bump product version to 4.2.0.1
[LibreOffice.git] / configure.ac
bloba1ec104e77a2c44685e191549dfdc07a3f3530be
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.0.1],[],[],[http://documentfoundation.org/])
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_neon=no
639     enable_mpl_subset=yes
640     enable_opengl=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-sandbox,
1221     AS_HELP_STRING([--enable-macosx-sandbox],
1222         [Make the app bundle run in a sandbox. Requires code signing.
1223          Is required by apps distributed in the Mac App Store, and implies
1224          adherence to App Store rules.]),
1227 AC_ARG_ENABLE(canonical-installation-tree-structure,
1228     AS_HELP_STRING([--enable-canonical-installation-tree-structure],
1229         [Make the installation tree structure be more canonical for
1230          the platform. Implemented only for OS X. Experimental and currently broken.]),
1234 AC_ARG_WITH(macosx-bundle-identifier,
1235     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1236         [Define the OS X bundle identifier. Default is the somewhat weird
1237          org.libreoffice.script ("script", huh?).]),
1238 ,with_macosx_bundle_identifier=org.libreoffice.script)
1240 AC_ARG_ENABLE(libc++,
1241     AS_HELP_STRING([--enable-libc++],
1242         [Use the libc++ C++ library instead of GNU libstdc++ on OS X. Only effective
1243          if --with-macosx-version-min-required is 10.7 or later. Experimental work in
1244          progress, very likely breaks something, don't use unless you plan to fix that.]),
1247 AC_ARG_ENABLE(ios-simulator,
1248     AS_HELP_STRING([--enable-ios-simulator],
1249         [Build for the iOS Simulator, not iOS device.]),
1252 AC_ARG_ENABLE(readonly-installset,
1253     AS_HELP_STRING([--enable-readonly-installset],
1254         [Prevents any attempts by LibreOffice to write into its installation. That means
1255          at least that no "system-wide" extensions can be added. Experimental work in
1256          progress.]),
1259 AC_ARG_ENABLE(postgresql-sdbc,
1260     AS_HELP_STRING([--disable-postgresql-sdbc],
1261         [Disable the build of the PostgreSQL-SDBC driver.])
1264 AC_ARG_ENABLE(lotuswordpro,
1265     AS_HELP_STRING([--disable-lotuswordpro],
1266         [Disable the build of the Lotus Word Pro filter.]),
1267 ,enable_lotuswordpro=yes)
1269 AC_ARG_ENABLE(firebird-sdbc,
1270     AS_HELP_STRING([--disable-firebird-sdbc],
1271         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1272 ,enable_firebird_sdbc=yes)
1274 AC_ARG_ENABLE(coretext,
1275     AS_HELP_STRING([--disable-coretext],
1276         [Don't use CoreText on Mac (but the obsolete ATSU instead).
1277          In a 64-bit LibreOffice CoreText is by necessity always used.]),
1280 AC_ARG_ENABLE(winegcc,
1281     AS_HELP_STRING([--enable-winegcc],
1282         [Enable use of winegcc during the build, in order to create msi* tools
1283          needed for MinGW cross-compilation.]),
1286 AC_ARG_ENABLE(liblangtag,
1287     AS_HELP_STRING([--disable-liblangtag],
1288         [Disable use of liblangtag, and instead use an own simple
1289          implementation.]),
1292 AC_ARG_ENABLE(bogus-pkg-config,
1293     AS_HELP_STRING([--enable-bogus-pkg-config],
1294         [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.]),
1297 AC_ARG_ENABLE(openssl,
1298     AS_HELP_STRING([--disable-openssl],
1299         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1300          components will either use GNUTLS or NSS. Work in progress,
1301          use only if you are hacking on it.]),
1302 ,enable_openssl=yes)
1304 AC_ARG_ENABLE(library-bin-tar,
1305     AS_HELP_STRING([--enable-library-bin-tar],
1306         [Enable the building and reused of tarball of binary build for some 'external' libraries
1307         Some libraries can save their build result in a tarball
1308         stored in TARFILE_LOCATION. that binary tarball is
1309         uniquely identified by the source tarbal,
1310         the content of the config_host.mk file and the content
1311         of the top-level directory in core for that library
1312         If this option is enabled, then if such a tarfile exist, it will be untarred
1313         isntead of the source tarfile, and the build step will be skipped for that
1314         library.
1315         If a proper tarfile does not exist, then the normal source-based
1316         build is done for taht library and a proper binary tarfile is created
1317         for the next time.]),
1320 AC_ARG_ENABLE(ia2,
1321     AS_HELP_STRING([--enable-ia2],
1322         [Enable the Windows IAccessibility2. Disables Java Accessibility Bridge.]),
1325 dnl ===================================================================
1326 dnl Optional Packages (--with/without-)
1327 dnl ===================================================================
1329 AC_ARG_WITH(gnu-patch,
1330     AS_HELP_STRING([--with-gnu-patch],
1331         [Specify location of GNU patch on Solaris or FreeBSD.]),
1334 AC_ARG_WITH(build-platform-configure-options,
1335         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1337 AC_ARG_WITH(gnu-cp,
1338     AS_HELP_STRING([--with-gnu-cp],
1339         [Specify location of GNU cp on Solaris or FreeBSD.]),
1342 AC_ARG_WITH(external-tar,
1343     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
1344         [Specify path to tarfiles manually.]),
1345     TARFILE_LOCATION=$withval ,
1348 AC_ARG_WITH(referenced-git,
1349     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1350         [Specify another checkout directory to reference. This makes use of
1351                  git submodule update --reference, and saves a lot of diskspace
1352                  when having multiple trees side-by-side.]),
1353     GIT_REFERENCE_SRC=$withval ,
1356 AC_ARG_WITH(linked-git,
1357     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1358         [Specify a directory where the repositories of submodules are located.
1359          This uses a method similar to git-new-workdir to get submodules.]),
1360     GIT_LINK_SRC=$withval ,
1363 AC_ARG_WITH(galleries,
1364     AS_HELP_STRING([--with-galleries],
1365         [Specify how galleries should be built. It is possible either to
1366          build these internally from source ("build"), or to (optionally
1367          download and) unpack them them from a package ("package"), or
1368          to disable them ("no")]),
1371 AC_ARG_WITH(theme,
1372     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1373         [Choose which themes to include. By default those themes with an '*' are included.
1374          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1377 AC_ARG_WITH(helppack-integration,
1379   --without-helppack-integration      It will not integrate the helppacks to the installer
1380                           of the product.
1381                           Please use this switch to use the online help or separate help packages.],
1384 AC_ARG_WITH(fonts,
1385     AS_HELP_STRING([--without-fonts],
1386         [LibreOffice includes some third-party fonts to provide a reliable basis for
1387          help content, templates, samples, etc. When these fonts are already
1388          known to be available on the system then you should use this option.]),
1391 AC_ARG_WITH(ppds,
1392     AS_HELP_STRING([--without-ppds],
1393         [Removes Postscript Printer definition files from LibreOffice
1394          installation set, for people building for specific distributions where
1395          PPDs are known to be already available (every recent distro with CUPS backend).]),
1398 AC_ARG_WITH(afms,
1399     AS_HELP_STRING([--without-afms],
1400         [Removes bitmap font files from LibreOffice installation set, for people
1401          building for specific distributions where AFM files or TrueType Fonts
1402          are known to be available.]),
1405 AC_ARG_WITH(epm,
1406     AS_HELP_STRING([--with-epm],
1407         [Decides which epm to use. Default is to use the one from the system if
1408          one is built. When either this is not there or you say =internal epm
1409          will be built.]),
1412 AC_ARG_WITH(package-format,
1413     AS_HELP_STRING([--with-package-format],
1414         [Specify package format(s) for LibreOffice installation sets. The
1415          implicit --without-package-format leads to no installation sets being
1416          generated. Possible values: aix, archive, bsd, deb, dmg, inst,
1417          installed, msi, native, osx, pkg, portable, rpm, setld, and tardist.
1418          Example: --with-package-format='deb rpm']),
1421 AC_ARG_WITH(tls,
1422     AS_HELP_STRING([--with-tls],
1423         [Decides which TLS/SSL and cryptographic implementations to use for
1424          LibreOffice's code. Notice that this doesn't apply for depending
1425          libraries like "neon", for example. Default is to use OpenSSL
1426          although NSS is also possible. Notice that selecting NSS restricts
1427          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1428          restrict by now the usage of NSS in LO's code. Possible values:
1429          openssl, nss. Example: --with-tls="nss"]),
1432 AC_ARG_WITH(system-libs,
1433     AS_HELP_STRING([--with-system-libs],
1434         [Use libraries already on system -- enables all --with-system-* flags.]),
1437 AC_ARG_WITH(system-headers,
1438     AS_HELP_STRING([--with-system-headers],
1439         [Use headers already on system -- enables all --with-system-* flags for
1440          external packages whose headers are the only entities used i.e.
1441          boost/vigra/odbc/sane-header(s).]),,
1442     [with_system_headers="$with_system_libs"])
1444 AC_ARG_WITH(system-jars,
1445     AS_HELP_STRING([--without-system-jars],
1446         [When building with --with-system-libs, also the needed jars are expected
1447          on the system. Use this to disable that]),,
1448     [with_system_jars="$with_system_libs"])
1450 AC_ARG_WITH(system-cairo,
1451     AS_HELP_STRING([--with-system-cairo],
1452         [Use cairo libraries already on system.  Happens automatically for
1453          (implicit) --enable-gtk and for --enable-gtk3.]))
1455 AC_ARG_WITH(myspell-dicts,
1456     AS_HELP_STRING([--with-myspell-dicts],
1457         [Adds myspell dictionaries to the LibreOffice installation set]),
1460 AC_ARG_WITH(system-dicts,
1461     AS_HELP_STRING([--without-system-dicts],
1462         [Do not use dictionaries from system paths.]),
1465 AC_ARG_WITH(external-dict-dir,
1466     AS_HELP_STRING([--with-external-dict-dir],
1467         [Specify external dictionary dir.]),
1470 AC_ARG_WITH(external-hyph-dir,
1471     AS_HELP_STRING([--with-external-hyph-dir],
1472         [Specify external hyphenation pattern dir.]),
1475 AC_ARG_WITH(external-thes-dir,
1476     AS_HELP_STRING([--with-external-thes-dir],
1477         [Specify external thesaurus dir.]),
1480 AC_ARG_WITH(system-zlib,
1481     AS_HELP_STRING([--with-system-zlib],
1482         [Use zlib already on system.]),,
1483     [with_system_zlib=auto])
1485 AC_ARG_WITH(system-jpeg,
1486     AS_HELP_STRING([--with-system-jpeg],
1487         [Use jpeg already on system.]),,
1488     [with_system_jpeg=auto])
1490 AC_ARG_WITH(system-clucene,
1491     AS_HELP_STRING([--with-system-clucene],
1492         [Use clucene already on system.]),,
1493     [with_system_clucene="$with_system_libs"])
1495 AC_ARG_WITH(system-expat,
1496     AS_HELP_STRING([--with-system-expat],
1497         [Use expat already on system.]),,
1498     [with_system_expat="$with_system_libs"])
1500 AC_ARG_WITH(system-libeot,
1501     AS_HELP_STRING([--with-system-libeot],
1502         [Use libeot already on system.]),,
1503     [with_system_libeot="$with_system_libs"])
1505 AC_ARG_WITH(system-libxml,
1506     AS_HELP_STRING([--with-system-libxml],
1507         [Use libxml/libxslt already on system.]),,
1508     [with_system_libxml=auto])
1510 AC_ARG_WITH(system-icu,
1511     AS_HELP_STRING([--with-system-icu],
1512         [Use icu already on system.]),,
1513     [with_system_icu="$with_system_libs"])
1515 AC_ARG_WITH(system-ucpp,
1516     AS_HELP_STRING([--with-system-ucpp],
1517         [Use ucpp already on system.]),,
1518     [])
1520 AC_ARG_WITH(system-openldap,
1521     AS_HELP_STRING([--with-system-openldap],
1522         [Use the OpenLDAP LDAP SDK already on system.]),,
1523     [with_system_openldap="$with_system_libs"])
1525 AC_ARG_WITH(system-poppler,
1526     AS_HELP_STRING([--with-system-poppler],
1527         [Use system poppler (only needed for PDF import).]),,
1528     [with_system_poppler="$with_system_libs"])
1530 AC_ARG_WITH(system-apache-commons,
1531     AS_HELP_STRING([--with-system-apache-commons],
1532         [Use Apache commons libraries already on system.]),,
1533     [with_system_apache_commons="$with_system_jars"])
1535 AC_ARG_WITH(system-mariadb,
1536     AS_HELP_STRING([--with-system-mariadb],
1537         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1538          extension.]),,
1539     [with_system_mariadb="$with_system_libs"])
1541 AC_ARG_ENABLE(bundle-mariadb,
1542     AS_HELP_STRING([--enable-bundle-mariadb],
1543         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1546 AC_ARG_WITH(system-mysql-cppconn,
1547     AS_HELP_STRING([--with-system-mysql-cppconn],
1548         [Use MySQL C++ Connector libraries already on system.]),,
1549     [with_system_mysql_cppconn="$with_system_libs"])
1551 AC_ARG_WITH(system-postgresql,
1552     AS_HELP_STRING([--with-system-postgresql],
1553         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1554          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1555     [with_system_postgresql="$with_system_libs"])
1557 AC_ARG_WITH(libpq-path,
1558     AS_HELP_STRING([--with-libpq-path],
1559         [Use this PostgreSQL C interface (libpq) installation for building
1560          the PostgreSQL-SDBC extension.])
1561     [
1562                           Usage:     --with-libpq-path=<absolute path to
1563                                                   your libpq installation>
1564     ],
1567 AC_ARG_WITH(system-firebird,
1568     AS_HELP_STRING([--with-system-firebird],
1569         [Use Firebird libraries already on system, for building the Firebird-SDBC
1570          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1571     [with_system_firebird="$with_system_libs"])
1573 AC_ARG_WITH(system-hsqldb,
1574     AS_HELP_STRING([--with-system-hsqldb],
1575         [Use hsqldb already on system.]))
1577 AC_ARG_WITH(hsqldb-jar,
1578     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1579         [Specify path to jarfile manually.]),
1580     HSQLDB_JAR=$withval)
1582 AC_ARG_ENABLE(scripting-beanshell,
1583     AS_HELP_STRING([--disable-scripting-beanshell],
1584         [Disable support for scripts in BeanShell.]),
1588 AC_ARG_WITH(system-beanshell,
1589     AS_HELP_STRING([--with-system-beanshell],
1590         [Use beanshell already on system.]),,
1591     [with_system_beanshell="$with_system_jars"])
1593 AC_ARG_WITH(beanshell-jar,
1594     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1595         [Specify path to jarfile manually.]),
1596     BSH_JAR=$withval)
1598 AC_ARG_ENABLE(scripting-javascript,
1599     AS_HELP_STRING([--disable-scripting-javascript],
1600         [Disable support for scripts in JavaScript.]),
1604 AC_ARG_WITH(system-rhino,
1605     AS_HELP_STRING([--with-system-rhino],
1606         [Use rhino already on system.]),,)
1607 #    [with_system_rhino="$with_system_jars"])
1608 # Above is not used as we have different debug interface
1609 # patched into internal rhino. This code needs to be fixed
1610 # before we can enable it by default.
1612 AC_ARG_WITH(rhino-jar,
1613     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1614         [Specify path to jarfile manually.]),
1615     RHINO_JAR=$withval)
1617 AC_ARG_WITH(commons-codec-jar,
1618     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1619         [Specify path to jarfile manually.]),
1620     COMMONS_CODEC_JAR=$withval)
1622 AC_ARG_WITH(commons-lang-jar,
1623     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1624         [Specify path to jarfile manually.]),
1625     COMMONS_LANG_JAR=$withval)
1627 AC_ARG_WITH(commons-httpclient-jar,
1628     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1629         [Specify path to jarfile manually.]),
1630     COMMONS_HTTPCLIENT_JAR=$withval)
1632 AC_ARG_WITH(commons-logging-jar,
1633     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1634         [Specify path to jarfile manually.]),
1635     COMMONS_LOGGING_JAR=$withval)
1637 AC_ARG_WITH(system-jfreereport,
1638     AS_HELP_STRING([--with-system-jfreereport],
1639         [Use JFreeReport already on system.]),,
1640     [with_system_jfreereport="$with_system_jars"])
1642 AC_ARG_WITH(sac-jar,
1643     AS_HELP_STRING([--with-sac-jar=JARFILE],
1644         [Specify path to jarfile manually.]),
1645     SAC_JAR=$withval)
1647 AC_ARG_WITH(libxml-jar,
1648     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1649         [Specify path to jarfile manually.]),
1650     LIBXML_JAR=$withval)
1652 AC_ARG_WITH(flute-jar,
1653     AS_HELP_STRING([--with-flute-jar=JARFILE],
1654         [Specify path to jarfile manually.]),
1655     FLUTE_JAR=$withval)
1657 AC_ARG_WITH(jfreereport-jar,
1658     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1659         [Specify path to jarfile manually.]),
1660     JFREEREPORT_JAR=$withval)
1662 AC_ARG_WITH(liblayout-jar,
1663     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1664         [Specify path to jarfile manually.]),
1665     LIBLAYOUT_JAR=$withval)
1667 AC_ARG_WITH(libloader-jar,
1668     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1669         [Specify path to jarfile manually.]),
1670     LIBLOADER_JAR=$withval)
1672 AC_ARG_WITH(libloader-jar,
1673     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1674         [Specify path to jarfile manually.]),
1675     LIBLOADER_JAR=$withval)
1677 AC_ARG_WITH(libformula-jar,
1678     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1679         [Specify path to jarfile manually.]),
1680     LIBFORMULA_JAR=$withval)
1682 AC_ARG_WITH(librepository-jar,
1683     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1684         [Specify path to jarfile manually.]),
1685     LIBREPOSITORY_JAR=$withval)
1687 AC_ARG_WITH(libfonts-jar,
1688     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1689         [Specify path to jarfile manually.]),
1690     LIBFONTS_JAR=$withval)
1692 AC_ARG_WITH(libserializer-jar,
1693     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1694         [Specify path to jarfile manually.]),
1695     LIBSERIALIZER_JAR=$withval)
1697 AC_ARG_WITH(libbase-jar,
1698     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1699         [Specify path to jarfile manually.]),
1700     LIBBASE_JAR=$withval)
1702 AC_ARG_WITH(system-odbc,
1703     AS_HELP_STRING([--with-system-odbc],
1704         [Use the odbc headers already on system.]),,
1705     [with_system_odbc="$with_system_headers"])
1707 AC_ARG_WITH(system-sane,
1708     AS_HELP_STRING([--with-system-sane],
1709         [Use sane.h already on system.]),,
1710     [with_system_sane="$with_system_headers"])
1712 AC_ARG_WITH(system-bluez,
1713     AS_HELP_STRING([--with-system-bluez],
1714         [Use bluetooth.h already on system.]),,
1715     [with_system_bluez="$with_system_headers"])
1717 AC_ARG_WITH(system-mesa-headers,
1718     AS_HELP_STRING([--with-system-mesa-headers],
1719         [Use Mesa headers already on system.]),,
1720     [with_system_mesa_headers="$with_system_headers"])
1722 AC_ARG_WITH(system-curl,
1723     AS_HELP_STRING([--with-system-curl],
1724         [Use curl already on system.]),,
1725     [with_system_curl=auto])
1727 AC_ARG_WITH(system-boost,
1728     AS_HELP_STRING([--with-system-boost],
1729         [Use boost already on system.]),,
1730     [with_system_boost="$with_system_headers"])
1732 AC_ARG_WITH(system-vigra,
1733     AS_HELP_STRING([--with-system-vigra],
1734         [Use vigra already on system.]),,
1735     [with_system_vigra="$with_system_headers"])
1737 AC_ARG_WITH(system-hunspell,
1738     AS_HELP_STRING([--with-system-hunspell],
1739         [Use libhunspell already on system.]),,
1740     [with_system_hunspell="$with_system_libs"])
1742 AC_ARG_WITH(system-mythes,
1743     AS_HELP_STRING([--with-system-mythes],
1744         [Use mythes already on system.]),,
1745     [with_system_mythes="$with_system_libs"])
1747 AC_ARG_WITH(system-altlinuxhyph,
1748     AS_HELP_STRING([--with-system-altlinuxhyph],
1749         [Use ALTLinuxhyph already on system.]),,
1750     [with_system_altlinuxhyph="$with_system_libs"])
1752 AC_ARG_WITH(system-lpsolve,
1753     AS_HELP_STRING([--with-system-lpsolve],
1754         [Use lpsolve already on system.]),,
1755     [with_system_lpsolve="$with_system_libs"])
1757 AC_ARG_WITH(system-liblangtag,
1758     AS_HELP_STRING([--with-system-liblangtag],
1759         [Use liblangtag library already on system.]),,
1760     [with_system_liblangtag="$with_system_libs"])
1762 AC_ARG_WITH(system-npapi-headers,
1763     AS_HELP_STRING([--with-system-npapi-headers],
1764         [Use NPAPI headers provided by system instead of bundled ones. Used in
1765          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=TRUE) and
1766          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1767     [with_system_npapi_headers="$with_system_headers"]
1770 AC_ARG_WITH(linker-hash-style,
1771     AS_HELP_STRING([--with-linker-hash-style],
1772         [Use linker with --hash-style=<style> when linking shared objects.
1773          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1774          if supported on the build system, and "sysv" otherwise.]))
1776 AC_ARG_WITH(jdk-home,
1777     AS_HELP_STRING([--with-jdk-home],
1778         [If you have installed JDK 1.3 or later on your system please supply the
1779          path here. Note that this is not the location of the java command but the
1780          location of the entire distribution.])
1781     [
1782                           Usage:     --with-jdk-home=<absolute path to JDK home>
1783     ],
1786 AC_ARG_WITH(help,
1787     AS_HELP_STRING([--with-help],
1788         [Enable the build of help. There is a special parameter "common" that
1789          can be used to bundle only the common part, .e.g help-specific icons.
1790          This is useful when you build the helpcontent separately.])
1791     [
1792                           Usage:     --with-help    build the entire local help
1793                                  --without-help     no local help (default)
1794                                  --with-help=common bundle common files for the local
1795                                                     help but do not build the whole help
1796     ],
1799 AC_ARG_WITH(java,
1800     AS_HELP_STRING([--with-java],
1801         [Specify the name of the Java interpreter command. Typically "java"
1802          which is the default.
1804          To build without support for Java components, applets, accessibility
1805          or the XML filters written in Java, use --without-java or --with-java=no.])
1806     [
1807                           Usage:     --with-java==<java command>
1808                                      --without-java
1809     ],
1810     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1811     [ with_java=java ]
1814 AC_ARG_WITH(jvm-path,
1815     AS_HELP_STRING([--with-jvm-path],
1816         [Use a specific JVM search path at runtime.])
1817     [
1818                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1820                           e. g.: --with-jvm-path=/usr/lib/
1821                                  to find JRE/JDK in /usr/lib/jvm/
1822     ],
1825 AC_ARG_WITH(ant-home,
1826     AS_HELP_STRING([--with-ant-home],
1827         [If you have installed Jakarta Ant on your system, please supply the path here.
1828          Note that this is not the location of the Ant binary but the location
1829          of the entire distribution.])
1830     [
1831                           Usage:     --with-ant-home=<absolute path to Ant home>
1832     ],
1835 AC_ARG_WITH(junit,
1836     AS_HELP_STRING([--with-junit],
1837         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1838          --without-junit disables those tests. Not relevant in the --without-java case.])
1839     [
1840                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1841     ],
1842 ,with_junit=yes)
1844 AC_ARG_WITH(perl-home,
1845     AS_HELP_STRING([--with-perl-home],
1846         [If you have installed Perl 5 Distribution, on your system, please
1847          supply the path here. Note that this is not the location of the Perl
1848          binary but the location of the entire distribution.])
1849     [
1850                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1851     ],
1854 AC_ARG_WITH(
1855     [doxygen],
1856     AS_HELP_STRING(
1857         [--with-doxygen],
1858         [Specifies the doxygen executable to use when generating ODK C/C++
1859          documentation. --without-doxygen disables generation of ODK C/C++
1860          documentation. Not relevant in the --disable-odk case.])
1861     [
1862                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1863     ],,
1864     [with_doxygen=yes])
1866 AC_ARG_WITH(visual-studio,
1867     AS_HELP_STRING([--with-visual-studio=<2012/2010/2013>],
1868         [Specify which Visual Studio version to use in case several are
1869          are installed. If not specified, the order of preference is
1870          2012, 2010, 2013 (including Express editions).])
1871     [
1872                           Usage:     --with-visual-studio=<2012/2010/2013>
1873     ],
1876 AC_ARG_WITH(windows-sdk,
1877     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1878         [Specify which Windows SDK, or "Windows Kit", version to use
1879          in case the one that came with the selected Visual Studio
1880          is not what you want for some reason. Note that not all compiler/SDK
1881          combinations are supported. The intent is that this option should not
1882          be needed.])
1883     [
1884                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1885     ],
1888 AC_ARG_WITH(lang,
1889     AS_HELP_STRING([--with-lang],
1890         [Use this option to build LibreOffice with additional language support.
1891          English (US) is always included by default.
1892          Separate multiple languages with space.
1893          For all languages, use --with-lang=ALL.])
1894     [
1895                           Usage:     --with-lang="es sw tu cs sk"
1896     ],
1899 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1900 AC_ARG_WITH(krb5,
1901     AS_HELP_STRING([--with-krb5],
1902         [Enable MIT Kerberos 5 support in modules that support it.
1903          By default automatically enabled on platforms
1904          where a good system Kerberos 5 is available.]),
1907 AC_ARG_WITH(gssapi,
1908     AS_HELP_STRING([--with-gssapi],
1909         [Enable GSSAPI support in modules that support it.
1910          By default automatically enabled on platforms
1911          where a good system GSSAPI is available.]),
1914 dnl ===================================================================
1915 dnl Branding
1916 dnl ===================================================================
1918 AC_ARG_WITH(branding,
1919     AS_HELP_STRING([--with-branding],
1920         [Use given path to retrieve branding images set.])
1921     [
1922                           Search for intro.png about.svg flat_logo.svg
1923                           backing_left.png backing_right.png
1924                           backing_rtl_left.png backing_rtl_right.png
1925                           backing_space.png. If any is missing, default
1926                           ones will be used instead.
1928                           Search also progress.conf for progress
1929                           settings on intro screen :
1931                           PROGRESSBARCOLOR="255,255,255" Set color of
1932                           progress bar. Comma separated RGB decimal values.
1933                           PROGRESSSIZE="407,6" Set size of progress bar.
1934                           Comma separated decimal values (width, height).
1935                           PROGRESSPOSITION="61,317" Set position of progress
1936                           bar from left,top. Comma separated decimal values.
1937                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
1938                           bar frame. Comma separated RGB decimal values.
1939                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
1940                           bar text. Comma separated RGB decimal values.
1941                           PROGRESSTEXTBASELINE="287" Set vertical position of
1942                           progress bar text from top. Decimal value.
1944                           Default values will be used if not found.
1946                           Usage:     --with-branding=/path/to/images
1947     ],
1951 AC_ARG_WITH(extra-buildid,
1952     AS_HELP_STRING([--with-extra-buildid],
1953         [Show addition build identification in about dialog.])
1954     [
1955                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
1956     ],
1960 AC_ARG_WITH(vendor,
1961     AS_HELP_STRING([--with-vendor],
1962         [Set vendor of the build.])
1963     [
1964                           Usage:     --with-vendor="John the Builder"
1965     ],
1968 AC_ARG_WITH(compat-oowrappers,
1969     AS_HELP_STRING([--with-compat-oowrappers],
1970         [Install oo* wrappers in parallel with
1971          lo* ones to keep backward compatibility.
1972          Has effect only with make distro-pack-install]),
1975 AC_ARG_WITH(os-version,
1976     AS_HELP_STRING([--with-os-version],
1977         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1978     [
1979                           Usage:     --with-os-version=<OSVERSION>
1980     ],
1983 AC_ARG_WITH(mingw-cross-compiler,
1984     AS_HELP_STRING([--with-mingw-cross-compiler],
1985         [Specify the MinGW cross-compiler to use.])
1986     [
1987                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1989                           When building on the ODK on Unix and building unowinreg.dll,
1990                           specify the MinGW C++ cross-compiler.
1991     ],
1994 AC_ARG_WITH(idlc-cpp,
1995     AS_HELP_STRING([--with-idlc-cpp],
1996         [Specify the C Preprocessor to use for idlc.])
1997     [
1998                           Usage:     --with-idlc-cpp=cpp
2000                           Default is ucpp.
2001     ]
2004 AC_ARG_WITH(build-version,
2005     AS_HELP_STRING([--with-build-version],
2006         [Allows the builder to add a custom version tag that will appear in the
2007          Help/About box for QA purposes.])
2008     [
2009                           Usage:     --with-build-version="Built by Jim"
2010     ],
2011     with_build_version=$withval ,
2014 AC_ARG_WITH(alloc,
2015     AS_HELP_STRING([--with-alloc],
2016         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2017          Note that on FreeBSD/NetBSD system==jemalloc]),
2020 AC_ARG_WITH(sun-templates,
2021     AS_HELP_STRING([--with-sun-templates],
2022         [Integrate Sun template packages.]),
2025 AC_ARG_WITH(parallelism,
2026     AS_HELP_STRING([--with-parallelism],
2027         [Number of jobs to run simultaneously during build. Parallel builds can
2028         save a lot of time on multi-cpu machines. Defaults to the number of
2029         CPUs on the machine, unless you configure --enable-icecream - then to
2030         10.]),
2033 AC_ARG_WITH(check-jobs,
2034     AS_HELP_STRING([--with-check-jobs],
2035         [Maximum number of jobs that will be issued at the same time during 'make subsequenttest'.
2036          Default value is the same as 'parallelism'. Useful because the subsequent tests are very lightweight.]),
2039 AC_ARG_WITH(all-tarballs,
2040     AS_HELP_STRING([--with-all-tarballs],
2041         [Download all external tarballs unconditionally]))
2043 AC_ARG_WITH(gdrive-client-id,
2044     AS_HELP_STRING([--with-gdrive-client-id],
2045         [Provides the client id of the application for OAuth2 authentication
2046         on Google Drive. If either this or --with-gdrive-client-secret is
2047         empty, the feature will be disabled]),
2050 AC_ARG_WITH(gdrive-client-secret,
2051     AS_HELP_STRING([--with-gdrive-client-secret],
2052         [Provides the client secret of the application for OAuth2
2053         authentication on Google Drive. If either this or
2054         --with-gdrive-client-id is empty, the feature will be disabled]),
2057 AC_ARG_WITH(alfresco-cloud-client-id,
2058     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2059         [Provides the client id of the application for OAuth2 authentication
2060         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2061         empty, the feature will be disabled]),
2064 AC_ARG_WITH(alfresco-cloud-client-secret,
2065     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2066         [Provides the client secret of the application for OAuth2
2067         authentication on Alfresco Cloud. If either this or
2068         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2071 dnl ===================================================================
2072 dnl Do we want to use pre-build binary tarball for recompile
2073 dnl ===================================================================
2075 if test "$enable_library_bin_tar" = "yes" ; then
2076    USE_LIBRARY_BIN_TAR=YES
2077 else
2078    USE_LIBRARY_BIN_TAR=NO
2080 AC_SUBST(USE_LIBRARY_BIN_TAR)
2082 dnl ===================================================================
2083 dnl Test whether build target is Release Build
2084 dnl ===================================================================
2085 AC_MSG_CHECKING([whether build target is Release Build])
2086 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2087     AC_MSG_RESULT([no])
2088     ENABLE_RELEASE_BUILD=
2089 else
2090     AC_MSG_RESULT([yes])
2091     ENABLE_RELEASE_BUILD=TRUE
2093 AC_SUBST(ENABLE_RELEASE_BUILD)
2095 dnl ===================================================================
2096 dnl Test whether to sign Windows Build
2097 dnl ===================================================================
2098 AC_MSG_CHECKING([whether to sign windows build])
2099 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2100     AC_MSG_RESULT([yes])
2101     WINDOWS_BUILD_SIGNING="TRUE"
2102 else
2103     AC_MSG_RESULT([no])
2104     WINDOWS_BUILD_SIGNING="FALSE"
2106 AC_SUBST(WINDOWS_BUILD_SIGNING)
2108 dnl ===================================================================
2109 dnl MacOSX build and runtime environment options
2110 dnl ===================================================================
2112 AC_ARG_WITH(macosx-sdk,
2113     AS_HELP_STRING([--with-macosx-sdk],
2114         [Use a specific SDK for building.])
2115     [
2116                           Usage:     --with-macosx-sdk=<version>
2118                           e. g.: --with-macosx-sdk=10.6
2120                           there are 3 options to control the MacOSX build:
2121                           --with-macosx-sdk (refered as 'sdk' below)
2122                           --with-macosx-version-min-required (refered as 'min' below)
2123                           --with-macosx-version-max-allowed (refered as 'max' below)
2125                           the connection between these value and the default they take is as follow:
2126                           ( ? means not specified on the command line, s means the SDK version found,
2127                           constraint: x <= y <= z)
2129                           ==========================================
2130                            command line      || config result
2131                           ==========================================
2132                           min  | max  | sdk  || min  | max  | sdk  |
2133                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
2134                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
2135                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
2136                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
2137                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2138                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2139                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2140                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2143                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2144                           for a detailled technical explanation of these variables
2146                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2148                           Note that even if in theory using a --with-macosx-version-max-allowed
2149                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2150                           should work, in practice Apple doesn't seem to test that, and at least
2151                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2152                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2153                           headers, but still.
2154     ],
2157 AC_ARG_WITH(macosx-version-min-required,
2158     AS_HELP_STRING([--with-macosx-version-min-required],
2159         [set the minimum OS version needed to run the built LibreOffice])
2160     [
2161                           Usage:     --with-macosx-version-min-required=<version>
2163                           e. g.: --with-macos-version-min-required=10.6
2164                           see --with-macosx-sdk for more info
2165     ],
2168 AC_ARG_WITH(macosx-version-max-allowed,
2169     AS_HELP_STRING([--with-macosx-version-max-allowed],
2170         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2171     [
2172                           Usage:     --with-macosx-version-max-allowed=<version>
2174                           e. g.: --with-macos-version-max-allowed=10.6
2175                           see --with-macosx-sdk for more info
2176     ],
2180 dnl ===================================================================
2181 dnl options for stuff used during cross-compilation build
2182 dnl These are superseded by --with-build-platform-configure-options.
2183 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2184 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2185 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2186 dnl ===================================================================
2188 AC_ARG_WITH(system-boost-for-build,
2189     AS_HELP_STRING([--with-system-boost-for-build],
2190         [Use boost already on system for build tools (cross-compilation only).]))
2192 AC_ARG_WITH(system-cppunit-for-build,
2193     AS_HELP_STRING([--with-system-cppunit-for-build],
2194         [Use cppunit already on system for build tools (cross-compilation only).]))
2196 AC_ARG_WITH(system-expat-for-build,
2197     AS_HELP_STRING([--with-system-expat-for-build],
2198         [Use expat already on system for build tools (cross-compilation only).]))
2200 AC_ARG_WITH(system-icu-for-build,
2201     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2202         [Use icu already on system for build tools (cross-compilation only).]))
2204 AC_ARG_WITH(system-libxml-for-build,
2205     AS_HELP_STRING([--with-system-libxml-for-build],
2206         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2209 dnl ===================================================================
2210 dnl check for required programs (grep, awk, sed, bash)
2211 dnl ===================================================================
2213 pathmunge ()
2215     if test -n "$1"; then
2216         if test "$build_os" = "cygwin"; then
2217             PathFormat "$1"
2218             new_path=`cygpath -u "$formatted_path"`
2219         else
2220             new_path="$1"
2221         fi
2222         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2223             if test "$2" = "after"; then
2224                 LO_PATH="$LO_PATH:$new_path"
2225             else
2226                 LO_PATH="$new_path:$LO_PATH"
2227             fi
2228         fi
2229         unset new_path
2230     fi
2233 AC_PROG_AWK
2234 AC_PATH_PROG( AWK, $AWK)
2235 if test -z "$AWK"; then
2236     AC_MSG_ERROR([install awk to run this script])
2239 AC_PATH_PROG(BASH, bash)
2240 if test -z "$BASH"; then
2241     AC_MSG_ERROR([bash not found in \$PATH])
2243 AC_SUBST(BASH)
2245 AC_MSG_CHECKING([for GNU or BSD tar])
2246 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2247     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2248     if test $? -eq 0;  then
2249         GNUTAR=$a
2250         break
2251     fi
2252 done
2253 AC_MSG_RESULT($GNUTAR)
2254 if test -z "$GNUTAR"; then
2255     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2257 AC_SUBST(GNUTAR)
2259 AC_MSG_CHECKING([for tar's option to strip components])
2260 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2261 if test $? -eq 0; then
2262     STRIP_COMPONENTS="--strip-components"
2263 else
2264     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2265     if test $? -eq 0; then
2266         STRIP_COMPONENTS="--strip-path"
2267     else
2268         STRIP_COMPONENTS="unsupported"
2269     fi
2271 AC_MSG_RESULT($STRIP_COMPONENTS)
2272 if test x$STRIP_COMPONENTS = xunsupported; then
2273     AC_MSG_ERROR([you need a tar that is able to strip components.])
2275 AC_SUBST(STRIP_COMPONENTS)
2277 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2278 dnl desktop OSes from "mobile" ones.
2280 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2281 dnl In other words, that when building for an OS that is not a
2282 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2284 dnl Note the direction of the implication; there is no assumption that
2285 dnl cross-compiling would imply a non-desktop OS.
2287 if test $_os != iOS -a $_os != Android; then
2288     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2289     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2290     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2293 DISABLE_EXPORT=''
2294 if test "$enable_export" != no; then
2295     BUILD_TYPE="$BUILD_TYPE EXPORT"
2296 else
2297     DISABLE_EXPORT='TRUE'
2298     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2300 AC_SUBST(DISABLE_EXPORT)
2302 dnl Decide whether to build database connectivity stuff (including
2303 dnl Base) or not. We probably don't want to on non-desktop OSes.
2305 if test -z "$enable_database_connectivity"; then
2306     # Do enable database connectivity for Android for now as otherwise
2307     # we presumably will get linking errors... We are not as far in
2308     # the work for iOS, so we might as well disable it for iOS already.
2310     # And actually, do enable it for iOS, too. Let's get back to
2311     # figuring out what to do with this later, if ever.
2313     # (Note that with "enable", I mean "enable building the related
2314     # code". Very likely little of it will make any sense at run-time
2315     # on Android or iOS and won't even be shipped with/linked into any
2316     # app.)
2318     #if test $_os != iOS; then
2319         enable_database_connectivity=yes
2320     #fi
2323 DISABLE_DBCONNECTIVITY=''
2324 if test "$enable_database_connectivity" = yes; then
2325     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2326 else
2327     DISABLE_DBCONNECTIVITY='TRUE'
2328     SCPDEFS="$SCPDEFS -DDISABLE_DBCONNECTIVITY"
2330 AC_SUBST(DISABLE_DBCONNECTIVITY)
2332 if test -z "$enable_extensions"; then
2333     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2334     if test $_os != iOS -a $_os != Android; then
2335         enable_extensions=yes
2336     fi
2339 if test "$enable_extensions" = yes; then
2340     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2341     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2344 if test -z "$enable_scripting"; then
2345     # Disable scripting for iOS unless specifically overridden
2346     # with --enable-scripting.
2347     if test $_os != iOS; then
2348         enable_scripting=yes
2349     fi
2352 DISABLE_SCRIPTING=''
2353 if test "$enable_scripting" = yes; then
2354     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2355 else
2356     DISABLE_SCRIPTING='TRUE'
2357     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2359 AC_SUBST(DISABLE_SCRIPTING)
2361 if test $_os = iOS -o $_os = Android; then
2362     # Disable dynamic_loading always for iOS and Android
2363     enable_dynamic_loading=no
2364 elif test -z "$enable_dynamic_loading"; then
2365     # Otherwise enable it unless speficically disabled
2366     enable_dynamic_loading=yes
2369 DISABLE_DYNLOADING=''
2370 if test "$enable_dynamic_loading" = yes; then
2371     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2372 else
2373     DISABLE_DYNLOADING='TRUE'
2374     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2376 AC_SUBST(DISABLE_DYNLOADING)
2378 # remenber SYSBASE value
2379 AC_SUBST(SYSBASE)
2381 dnl ===================================================================
2382 dnl  Sort out various gallery compilation options
2383 dnl ===================================================================
2384 AC_MSG_CHECKING([how to build and package galleries])
2385 if test -n "${with_galleries}"; then
2386     if test "$with_galleries" = "build"; then
2387         WITH_GALLERY_BUILD=YES
2388         AC_MSG_RESULT([build from source images internally])
2389     elif test "$with_galleries" = "package"; then
2390         WITH_GALLERY_BUILD=PACKAGE
2391         AC_MSG_ERROR([FIXME - implement build from pre-compiled package])
2392     elif test "$with_galleries" = "no"; then
2393         WITH_GALLERY_BUILD=
2394         AC_MSG_RESULT([disable non-internal gallery build])
2395     else
2396         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2397     fi
2398 else
2399     if test $_os != iOS -a $_os != Android; then
2400         WITH_GALLERY_BUILD=YES
2401         AC_MSG_RESULT([internal src images for desktop])
2402     else
2403         WITH_GALLERY_BUILD=
2404         AC_MSG_RESULT([disable src imgage build])
2405     fi
2407 AC_SUBST(WITH_GALLERY_BUILD)
2409 dnl ===================================================================
2410 dnl  Checks if ccache is available
2411 dnl ===================================================================
2412 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2413     case "%$CC%$CXX%" in
2414     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2415     # assume that's good then
2416     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2417         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2418         ;;
2419     *)
2420         AC_PATH_PROG([CCACHE],[ccache],[not found])
2421         if test "$CCACHE" = "not found"; then
2422             CCACHE=""
2423         else
2424             # Need to check for ccache version: otherwise prevents
2425             # caching of the results (like "-x objective-c++" for Mac)
2426             if test $_os = Darwin -o $_os = iOS; then
2427                 # Check ccache version
2428                 AC_MSG_CHECKING([whether version of ccache is suitable])
2429                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2430                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2431                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2432                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2433                 else
2434                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2435                     CCACHE=""
2436                 fi
2437             fi
2438         fi
2439         ;;
2440     esac
2441 else
2442     CCACHE=""
2445 if test "$CCACHE" != ""; then
2446     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2447     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2448     if test "$ccache_size" = ""; then
2449         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2450         if test "$ccache_size" = ""; then
2451             ccache_size=0
2452         fi
2453         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2454         if test $ccache_size -lt 1024; then
2455             CCACHE=""
2456             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
2457             add_warning "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled"
2458         else
2459             # warn that ccache may be too small for debug build
2460             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2461             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2462         fi
2463     else
2464         if test $ccache_size -lt 5; then
2465             #warn that ccache may be too small for debug build
2466             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2467             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2468         fi
2469     fi
2472 dnl ===================================================================
2473 dnl  Checks for C compiler,
2474 dnl  The check for the C++ compiler is later on.
2475 dnl ===================================================================
2476 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2477     GCC_HOME_SET="true"
2478     AC_MSG_CHECKING([gcc home])
2479     if test -z "$with_gcc_home"; then
2480         if test "$enable_icecream" = "yes"; then
2481             if test -d "/usr/lib/icecc/bin"; then
2482                 GCC_HOME="/usr/lib/icecc/"
2483             else
2484                 GCC_HOME="/opt/icecream/"
2485             fi
2486         else
2487             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2488             GCC_HOME_SET="false"
2489         fi
2490     else
2491         GCC_HOME="$with_gcc_home"
2492     fi
2493     AC_MSG_RESULT($GCC_HOME)
2494     AC_SUBST(GCC_HOME)
2496     if test "$GCC_HOME_SET" = "true"; then
2497         if test -z "$CC"; then
2498             CC="$GCC_HOME/bin/gcc"
2499         fi
2500         if test -z "$CXX"; then
2501             CXX="$GCC_HOME/bin/g++"
2502         fi
2503     fi
2506 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2507 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2508     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2509     save_CFLAGS=$CFLAGS
2510     AC_PROG_CC
2511     CFLAGS=$save_CFLAGS
2514 COMPATH=`dirname "$CC"`
2515 if test "$COMPATH" = "."; then
2516     AC_PATH_PROGS(COMPATH, $CC)
2517     dnl double square bracket to get single because of M4 quote...
2518     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2520 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2522 # Set the ENABLE_LTO variable
2523 # ===================================================================
2524 AC_MSG_CHECKING([whether to use link-time optimization])
2525 if test $_os = WINNT -a "$WITH_MINGW" != yes -a -z "$enable_lto" -a \
2526         \( -z "$enable_dbgutil" -o "$enable_dbgutil" = no \) -a \
2527         \( -z "$enable_debug" -o "$enable_debug" = no \); then
2528     # Turn on LTO for MSVC when optimising unless told not to
2529     enable_lto=yes
2531 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2532     ENABLE_LTO="TRUE"
2533     AC_MSG_RESULT([yes])
2534 else
2535     ENABLE_LTO=""
2536     AC_MSG_RESULT([no])
2538 AC_SUBST(ENABLE_LTO)
2540 dnl ===================================================================
2541 dnl Java support
2542 dnl ===================================================================
2543 AC_MSG_CHECKING([whether to build with Java support])
2544 if test "$with_java" != "no"; then
2545     if test "$DISABLE_SCRIPTING" = TRUE; then
2546         AC_MSG_RESULT([no, overridden by --disable-scripting])
2547         ENABLE_JAVA=""
2548         with_java=no
2549     else
2550         AC_MSG_RESULT([yes])
2551         ENABLE_JAVA="TRUE"
2552         AC_DEFINE(HAVE_FEATURE_JAVA)
2553     fi
2554 else
2555     AC_MSG_RESULT([no])
2556     ENABLE_JAVA=""
2559 AC_SUBST(ENABLE_JAVA)
2561 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2563 dnl ENABLE_JAVA="" indicate no Java support at all
2565 dnl ===================================================================
2566 dnl  Test the Solaris compiler version
2567 dnl ===================================================================
2568 if test "$_os" = "SunOS"; then
2569     if test "$CC" = "cc"; then
2570         AC_PATH_PROGS(_cc, cc)
2571         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2572         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2573         dnl cc -V outputs to standard error!!!!
2574         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2575         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2576         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2577         if test "$_sunstudio_major" != "5"; then
2578             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2579         else
2580             _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" }'`
2581             if test "$_sunstudio_minor" = "false"; then
2582                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2583             else
2584                 dnl compiler will do
2585                 AC_MSG_RESULT([checked])
2586             fi
2587         fi
2588     fi
2592 dnl ===================================================================
2593 dnl Check OS X SDK and compiler
2594 dnl ===================================================================
2596 if test $_os = Darwin; then
2598     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2599         bitness=-m32
2600     else
2601         bitness=-m64
2602         BITNESS_OVERRIDE=64
2603     fi
2605     # If no --with-macosx-sdk option is given, look for 10.6, 10.7,
2606     # 10.8 and 10.9 SDKs, in that order. If not found in some (old)
2607     # default locations, try the xcode-select tool.
2609     # The intent is that for "most" Mac-based developers, a suitable
2610     # SDK will be found automatically without any configure options.
2612     # For developers still using Xcode 3, in /Developer, either
2613     # because it is the only Xcode they have, or they have that in
2614     # addition to Xcode 4 in /Applications/Xcode.app, the 10.6 SDK
2615     # should be found.
2617     # For developers with a current Xcode, the lowest-numbered SDK
2618     # should be found.
2620     AC_MSG_CHECKING([what Mac OS X SDK to use])
2622     if test -z "$with_macosx_sdk"; then
2623         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2624             with_macosx_sdk=10.6
2625         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2626             with_macosx_sdk=10.6
2627         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2628             with_macosx_sdk=10.6
2629         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2630             with_macosx_sdk=10.7
2631         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2632             with_macosx_sdk=10.6
2633         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2634             with_macosx_sdk=10.7
2635         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2636             with_macosx_sdk=10.8
2637         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2638             with_macosx_sdk=10.9
2639         elif test -x /usr/bin/xcode-select; then
2640             xcodepath="`xcode-select -print-path`"
2641             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2642                 with_macosx_sdk=10.6
2643             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2644                 with_macosx_sdk=10.7
2645             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2646                 with_macosx_sdk=10.8
2647             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2648                 with_macosx_sdk=10.9
2649             fi
2650         fi
2651         if test -z "$with_macosx_sdk"; then
2652             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2653         fi
2654     fi
2656     case $with_macosx_sdk in
2657     10.6)
2658         MACOSX_SDK_VERSION=1060
2659         ;;
2660     10.7)
2661         MACOSX_SDK_VERSION=1070
2662         ;;
2663     10.8)
2664         MACOSX_SDK_VERSION=1080
2665         ;;
2666     10.9)
2667         MACOSX_SDK_VERSION=1090
2668         ;;
2669     *)
2670         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported value are 10.6--8])
2671         ;;
2672     esac
2674     # Next find it (again, if we deduced its version above by finding
2675     # it... but we need to look for it once more in case
2676     # --with-macosx-sdk was given so that the above search did not
2677     # happen).
2678     if test -z "$MACOSX_SDK_PATH"; then
2679         case $with_macosx_sdk in
2680         10.6)
2681             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2682                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2683             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2684                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2685             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2686                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2687             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2688                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2689             elif test -x /usr/bin/xcode-select; then
2690                 xcodepath="`xcode-select -print-path`"
2691                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2692                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2693                 fi
2694             fi
2695             ;;
2696         10.7)
2697             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2698                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2699             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2700                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2701             elif test -x /usr/bin/xcode-select; then
2702                 xcodepath="`xcode-select -print-path`"
2703                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2704                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2705                 fi
2706             fi
2707             ;;
2708         10.8|10.9)
2709             if test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2710                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2711             else
2712                 xcodepath="`xcode-select -print-path`"
2713                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2714                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2715                 fi
2716             fi
2717             ;;
2718         esac
2719         if test -z "$MACOSX_SDK_PATH"; then
2720             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2721         fi
2722     fi
2723     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2725     if test "$with_macosx_version_min_required" = ""; then
2726         with_macosx_version_min_required="10.6"
2727     fi
2729     if test "$with_macosx_version_max_allowed" = ""; then
2730         with_macosx_version_max_allowed="$with_macosx_sdk"
2731     fi
2733     # export this so that "xcrun" invocations later return matching values
2734     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2735     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2736     export DEVELOPER_DIR
2737     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2738     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2740     case "$with_macosx_version_min_required" in
2741     10.6)
2742         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2743         ;;
2744     10.7)
2745         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2746         ;;
2747     10.8)
2748         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2749         ;;
2750     10.9)
2751         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2752         ;;
2753     *)
2754         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.6--9])
2755         ;;
2756     esac
2758     if test "$BITNESS_OVERRIDE" = ""; then
2759         case "$with_macosx_version_min_required" in
2760         10.6)
2761             case "$with_macosx_sdk" in
2762             10.6)
2763                 ;;
2764             *)
2765                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2766                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2767                 ;;
2768             esac
2769             ;;
2770         *)
2771             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2772             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2773             ;;
2774         esac
2775     fi
2777     # If no CC and CXX environment vars, try to guess where the compiler is
2778     LIBTOOL=libtool
2779     if test -z "$save_CC"; then
2780         AC_MSG_CHECKING([what compiler to use])
2781         case $with_macosx_sdk in
2782         10.6)
2783             if test "$enable_libc__" = yes; then
2784                 AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2785             fi
2786             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2787             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2788                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2789                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2790             else
2791                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2792                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2793             fi
2794             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2795             LIBTOOL=libtool
2796             ;;
2797         10.7|10.8|10.9)
2798             if test "$enable_libc__" = yes; then
2799                 if test "$with_macosx_version_min_required" = 10.6; then
2800                     AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2801                 fi
2802                 # Use libc++ instead of libstdc++ when possible
2803                 stdlib=-stdlib=libc++
2804             fi
2805             if test "$ENABLE_LTO" = TRUE; then
2806                 lto=-flto
2807             fi
2808             CC="`xcrun -find clang` $bitness $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2809             CXX="`xcrun -find clang++` $bitness $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2810             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2811             AR=`xcrun -find ar`
2812             NM=`xcrun -find nm`
2813             STRIP=`xcrun -find strip`
2814             LIBTOOL=`xcrun -find libtool`
2815             RANLIB=`xcrun -find ranlib`
2816             ;;
2817         esac
2818         AC_MSG_RESULT([$CC and $CXX])
2819     fi
2821     case "$with_macosx_version_max_allowed" in
2822     10.6)
2823         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2824         ;;
2825     10.7)
2826         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2827         ;;
2828     10.8)
2829         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2830         ;;
2831     10.9)
2832         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2833         ;;
2834     *)
2835         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.6--8])
2836         ;;
2837     esac
2839     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2840     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2841         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2842     else
2843         AC_MSG_RESULT([ok])
2844     fi
2846     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2847     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2848         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2849     else
2850         AC_MSG_RESULT([ok])
2851     fi
2852     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2853     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2855     AC_MSG_CHECKING([whether to do code signing])
2857     if test "$enable_macosx_code_signing" = yes; then
2858         # By default use the first suitable certificate (?).
2860         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2861         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2862         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2863         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2864         # "Developer ID Application" one.
2866         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | awk '{print $2}' |head -1`
2867         if test -n "$identity"; then
2868             MACOSX_CODESIGNING_IDENTITY=$identity
2869             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2870             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2871         fi
2872     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2873         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2874         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2875         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2876     else
2877         AC_MSG_RESULT([no])
2878     fi
2880     AC_MSG_CHECKING([whether to sandbox the application])
2882     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2883         AC_MSG_ERROR([OS X sandboxing requires code signing])
2884     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2885         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2886     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2887         ENABLE_MACOSX_SANDBOX=TRUE
2888         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2889         AC_MSG_RESULT([yes])
2890     else
2891         AC_MSG_RESULT([no])
2892     fi
2894     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2896     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2898     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2900 AC_SUBST(MACOSX_SDK_PATH)
2901 AC_SUBST(MACOSX_SDK_VERSION)
2902 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2903 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2904 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2905 AC_SUBST(INSTALL_NAME_TOOL)
2906 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2907 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2908 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2909 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2911 dnl ===================================================================
2912 dnl Check iOS SDK and compiler
2913 dnl ===================================================================
2915 if test $_os = iOS; then
2917     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2918         :
2919     else
2920         BITNESS_OVERRIDE=64
2921     fi
2923     AC_MSG_CHECKING([what iOS SDK to use])
2925     if test "$enable_ios_simulator" = yes; then
2926         platform=iPhoneSimulator
2927     else
2928         platform=iPhoneOS
2929     fi
2931     xcode_developer=`xcode-select -print-path`
2933     pref_sdk_ver=7.0
2934     for sdkver in 7.0 6.1 6.0; do
2935         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2936         if test -d $t; then
2937             ios_sdk=$sdkver
2938             sysroot=$t
2939             break
2940         fi
2941     done
2943     if test -z "$sysroot"; then
2944         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
2945     fi
2947     AC_MSG_RESULT($sysroot)
2949     if test "$enable_ios_simulator" = yes; then
2950         if test "$BITNESS_OVERRIDE" = 64; then
2951             arch=x86_64
2952             versionmin=-mios-simulator-version-min=7.0
2953         else
2954             arch=i386
2955             case $sdkver in
2956             7.*)
2957                 versionmin=-mios-simulator-version-min=6.1
2958                 ;;
2959             *)
2960                 versionmin=-mmacosx-version-min=10.7
2961                 ;;
2962             esac
2963         fi
2964     else
2965         platform=iPhoneOS
2966         if test "$BITNESS_OVERRIDE" = 64; then
2967             arch=arm64
2968             versionmin=-miphoneos-version-min=7.0
2969         else
2970             arch=armv7
2971             versionmin=-miphoneos-version-min=6.1
2972         fi
2973     fi
2975     # LTO is not really recommended for iOS builds,
2976     # the link time will be astronomical
2977     if test "$ENABLE_LTO" = TRUE; then
2978         lto=-flto
2979     fi
2980     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
2981     # get compiled with it, to avoid ld warnings when linking all that together into one
2982     # executable.
2983     # Use libc++ if opted in only, and only when building against iOS 7 SDK or newer.
2985     XCODE_CLANG_CXX_LIBRARY=libstdc++
2986     case $ios_sdk in
2987     6.*)
2988         if test "$enable_libc__" = yes; then
2989             AC_MSG_ERROR([--enable-libc++ requires using Xcode 5 and iOS SDK 7 or newer it seems])
2990         fi
2991         ;;
2992     *)
2993         if test "$enable_libc__" = yes; then
2994             XCODE_CLANG_CXX_LIBRARY=libc++
2995         fi
2996         ;;
2997     esac
2999     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3001     CC="`xcrun -find clang` -arch $arch -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3002     CXX="`xcrun -find clang++` -arch $arch -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3004     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3005     AR=`xcrun -find ar`
3006     NM=`xcrun -find nm`
3007     STRIP=`xcrun -find strip`
3008     LIBTOOL=`xcrun -find libtool`
3009     RANLIB=`xcrun -find ranlib`
3012 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3014 AC_MSG_CHECKING([whether to treat the installation as read-only])
3016 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3017         "$enable_extensions" != yes; then
3018     enable_readonly_installset=yes
3020 if test "$enable_readonly_installset" = yes; then
3021     AC_MSG_RESULT([yes])
3022     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3023 else
3024     AC_MSG_RESULT([no])
3027 dnl ===================================================================
3028 dnl Structure of install set
3029 dnl ===================================================================
3031 if test $_os = Darwin -a "$enable_canonical_installation_tree_structure" = yes; then
3032     LIBO_BIN_FOLDER=MacOS
3033     LIBO_ETC_FOLDER=Resources
3034     LIBO_LIBEXEC_FOLDER=MacOS
3035     LIBO_LIB_FOLDER=Frameworks
3036     LIBO_SHARE_FOLDER=Resources
3037     LIBO_SHARE_HELP_FOLDER=Resources/help
3038     LIBO_SHARE_JAVA_FOLDER=Resources/java
3039     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3040     LIBO_LIB_PYUNO_FOLDER=Resources
3041     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3042     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3043     LIBO_URE_BIN_FOLDER=MacOS
3044     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3045     LIBO_URE_LIB_FOLDER=Frameworks
3046     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3047     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3048     ENABLE_MACOSX_MACLIKE_APP_STRUCTURE=TRUE
3049     AC_DEFINE(HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE)
3050 elif test $_os = Darwin; then
3051     LIBO_BIN_FOLDER=MacOS
3052     LIBO_ETC_FOLDER=MacOS
3053     LIBO_LIBEXEC_FOLDER=MacOS
3054     LIBO_LIB_FOLDER=MacOS
3055     LIBO_LIB_PYUNO_FOLDER=MacOS
3056     LIBO_SHARE_FOLDER=share
3057     LIBO_SHARE_HELP_FOLDER=help
3058     LIBO_SHARE_JAVA_FOLDER=MacOS/classes
3059     LIBO_SHARE_PRESETS_FOLDER=presets
3060     LIBO_SHARE_RESOURCE_FOLDER=MacOS/resource
3061     LIBO_SHARE_SHELL_FOLDER=MacOS/shell
3062     LIBO_URE_BIN_FOLDER=ure-link/bin
3063     LIBO_URE_ETC_FOLDER=ure-link/lib
3064     LIBO_URE_LIB_FOLDER=ure-link/lib
3065     LIBO_URE_SHARE_FOLDER=ure-link/share
3066     LIBO_URE_SHARE_JAVA_FOLDER=ure-link/share/java
3067 elif test $_os = WINNT; then
3068     LIBO_BIN_FOLDER=program
3069     LIBO_ETC_FOLDER=program
3070     LIBO_LIBEXEC_FOLDER=program
3071     LIBO_LIB_FOLDER=program
3072     LIBO_LIB_PYUNO_FOLDER=program
3073     LIBO_SHARE_FOLDER=share
3074     LIBO_SHARE_HELP_FOLDER=help
3075     LIBO_SHARE_JAVA_FOLDER=program/classes
3076     LIBO_SHARE_PRESETS_FOLDER=presets
3077     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3078     LIBO_SHARE_SHELL_FOLDER=program/shell
3079     LIBO_URE_BIN_FOLDER=URE/bin
3080     LIBO_URE_ETC_FOLDER=URE/bin
3081     LIBO_URE_LIB_FOLDER=URE/bin
3082     LIBO_URE_SHARE_FOLDER=URE
3083     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3084 else
3085     LIBO_BIN_FOLDER=program
3086     LIBO_ETC_FOLDER=program
3087     LIBO_LIBEXEC_FOLDER=program
3088     LIBO_LIB_FOLDER=program
3089     LIBO_LIB_PYUNO_FOLDER=program
3090     LIBO_SHARE_FOLDER=share
3091     LIBO_SHARE_HELP_FOLDER=help
3092     LIBO_SHARE_JAVA_FOLDER=program/classes
3093     LIBO_SHARE_PRESETS_FOLDER=presets
3094     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3095     LIBO_SHARE_SHELL_FOLDER=program/shell
3096     LIBO_URE_BIN_FOLDER=ure/bin
3097     LIBO_URE_ETC_FOLDER=ure/lib
3098     LIBO_URE_LIB_FOLDER=ure/lib
3099     LIBO_URE_SHARE_FOLDER=ure/share
3100     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3102 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3103 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3104 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3105 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3106 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3107 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3108 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3109 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3110 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3111 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3112 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3113 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3114 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3115 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3116 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3117 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3119 # Not all of them needed in config_host.mk, add more if need arises
3120 AC_SUBST(LIBO_BIN_FOLDER)
3121 AC_SUBST(LIBO_ETC_FOLDER)
3122 AC_SUBST(LIBO_LIB_FOLDER)
3123 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3124 AC_SUBST(LIBO_SHARE_FOLDER)
3125 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3126 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3127 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3128 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3129 AC_SUBST(LIBO_URE_BIN_FOLDER)
3130 AC_SUBST(LIBO_URE_ETC_FOLDER)
3131 AC_SUBST(LIBO_URE_LIB_FOLDER)
3132 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3133 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3134 AC_SUBST(ENABLE_MACOSX_MACLIKE_APP_STRUCTURE)
3136 dnl ===================================================================
3137 dnl Windows specific tests and stuff
3138 dnl ===================================================================
3140 # Get a value from the 32-bit side of the Registry
3141 reg_get_value_32()
3143     # Return value: $regvalue
3144     unset regvalue
3145     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3147     if test $? -eq 0; then
3148         regvalue=$_regvalue
3149     fi
3152 # Get a value from the 64-bit side of the Registry
3153 reg_get_value_64()
3155     # Return value: $regvalue
3156     unset regvalue
3157     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3159     if test $? -eq 0; then
3160         regvalue=$_regvalue
3161     fi
3164 if test "$_os" = "WINNT"; then
3165     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3166     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3167         AC_MSG_RESULT([no])
3168         WINDOWS_SDK_ARCH="x86"
3169     else
3170         AC_MSG_RESULT([yes])
3171         WINDOWS_SDK_ARCH="x64"
3172         BITNESS_OVERRIDE=64
3173     fi
3176 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3177     AC_MSG_CHECKING([whether to use DirectX])
3178     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3179         ENABLE_DIRECTX="TRUE"
3180         AC_MSG_RESULT([yes])
3181     else
3182         ENABLE_DIRECTX=""
3183         AC_MSG_RESULT([no])
3184     fi
3186     AC_MSG_CHECKING([whether to use ActiveX])
3187     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
3188         DISABLE_ACTIVEX=""
3189         AC_MSG_RESULT([yes])
3190     else
3191         DISABLE_ACTIVEX="TRUE"
3192         AC_MSG_RESULT([no])
3193     fi
3195     AC_MSG_CHECKING([whether to use ATL])
3196     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
3197         DISABLE_ATL=""
3198         AC_MSG_RESULT([yes])
3199     else
3200         DISABLE_ATL="TRUE"
3201         AC_MSG_RESULT([no])
3202     fi
3203 else
3204     ENABLE_DIRECTX=""
3205     DISABLE_ACTIVEX="TRUE"
3206     DISABLE_ATL="TRUE"
3209 AC_SUBST(ENABLE_DIRECTX)
3210 AC_SUBST(DISABLE_ACTIVEX)
3211 AC_SUBST(DISABLE_ATL)
3213 if test "$cross_compiling" = "yes"; then
3214     CROSS_COMPILING=YES
3215     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3216 else
3217     CROSS_COMPILING=
3218     BUILD_TYPE="$BUILD_TYPE NATIVE"
3220 AC_SUBST(CROSS_COMPILING)
3222 dnl ===================================================================
3223 dnl  Is GCC actually Clang?
3224 dnl ===================================================================
3226 COM_GCC_IS_CLANG=
3227 if test "$GCC" = "yes"; then
3228     AC_MSG_CHECKING([whether GCC is actually Clang])
3229     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3230         #ifndef __clang__
3231         you lose
3232         #endif
3233         int foo=42;
3234         ]])],
3235         [AC_MSG_RESULT([yes])
3236          COM_GCC_IS_CLANG=TRUE],
3237         [AC_MSG_RESULT([no])])
3239     if test "$COM_GCC_IS_CLANG" = TRUE; then
3240         AC_MSG_CHECKING([the Clang version])
3241         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3242         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3243         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3244         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3245         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3246     fi
3248 AC_SUBST(COM_GCC_IS_CLANG)
3250 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3251     if test -z "$CCACHE_CPP2"; then
3252             AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3253             add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3254     fi
3257 dnl ===================================================================
3258 dnl  Test the gcc version
3259 dnl ===================================================================
3260 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3261     AC_MSG_CHECKING([the GCC version])
3262     _gcc_version=`$CC -dumpversion`
3263     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3265     AC_MSG_RESULT([gcc $_gcc_version])
3266     if test "$GCC_VERSION" -lt 0401; then
3267         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.1.0])
3268     fi
3269 else
3270     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3271     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3272     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3273     # (which reports itself as GCC 4.2.1).
3274     GCC_VERSION=
3276 AC_SUBST(GCC_VERSION)
3278 # ===================================================================
3279 # check various GCC options that Clang does not support now but maybe
3280 # will somewhen in the future, check them even for GCC, so that the
3281 # flags are set
3282 # ===================================================================
3284 HAVE_GCC_GGDB2=
3285 HAVE_GCC_FINLINE_LIMIT=
3286 HAVE_GCC_FNO_INLINE=
3287 if test "$GCC" = "yes"; then
3288     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3289     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3290         # Option just ignored and silly warning that isn't a real
3291         # warning printed
3292         :
3293     else
3294         save_CFLAGS=$CFLAGS
3295         CFLAGS="$CFLAGS -Werror -ggdb2"
3296         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3297         CFLAGS=$save_CFLAGS
3298     fi
3299     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3300         AC_MSG_RESULT([yes])
3301     else
3302         AC_MSG_RESULT([no])
3303     fi
3305     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3306     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3307         # As above
3308         :
3309     else
3310         save_CFLAGS=$CFLAGS
3311         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3312         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3313         CFLAGS=$save_CFLAGS
3314     fi
3315     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3316         AC_MSG_RESULT([yes])
3317     else
3318         AC_MSG_RESULT([no])
3319     fi
3321     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3322     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3323         # Ditto
3324         :
3325     else
3326         save_CFLAGS=$CFLAGS
3327         CFLAGS="$CFLAGS -Werror -fno-inline"
3328         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3329         CFLAGS=$save_CFLAGS
3330     fi
3331     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3332         AC_MSG_RESULT([yes])
3333     else
3334         AC_MSG_RESULT([no])
3335     fi
3337 AC_SUBST(HAVE_GCC_GGDB2)
3338 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3339 AC_SUBST(HAVE_GCC_FNO_INLINE)
3341 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3342 if test "$GCC" = "yes"; then
3343     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3344     bsymbolic_functions_ldflags_save=$LDFLAGS
3345     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3346     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3347 #include <stdio.h>
3348         ],[
3349 printf ("hello world\n");
3350         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3351     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3352         AC_MSG_RESULT( found )
3353     else
3354         AC_MSG_RESULT( not found )
3355     fi
3356     LDFLAGS=$bsymbolic_functions_ldflags_save
3358 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3360 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3361 # NOTE: must _not_ be used for bundled external libraries!
3362 ISYSTEM=
3363 if test "$GCC" = "yes"; then
3364     AC_MSG_CHECKING( for -isystem )
3365     save_CFLAGS=$CFLAGS
3366     CFLAGS="$CFLAGS -Werror"
3367     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
3368     CFLAGS=$save_CFLAGS
3369     if test -n "$ISYSTEM"; then
3370         AC_MSG_RESULT(yes)
3371     else
3372         AC_MSG_RESULT(no)
3373     fi
3375 if test -z "$ISYSTEM"; then
3376     # fall back to using -I
3377     ISYSTEM=-I
3379 AC_SUBST(ISYSTEM)
3381 dnl ===================================================================
3382 dnl  Check which Visual Studio or MinGW compiler is used
3383 dnl ===================================================================
3385 map_vs_year_to_version()
3387     # Return value: $vsversion
3389     unset vsversion
3391     case $1 in
3392     2010)
3393         vsversion=10.0;;
3394     2012)
3395         vsversion=11.0;;
3396     2013)
3397         vsversion=12.0;;
3398     *)
3399         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3400     esac
3403 vs_versions_to_check()
3405     # Args: $1 (optional) : versions to check, in the order of preference
3406     # Return value: $vsversions
3408     unset vsversions
3410     if test -n "$1"; then
3411         map_vs_year_to_version "$1"
3412         vsversions=$vsversion
3413     else
3414         # By default we prefer 2012, then 2010, then 2013
3415         vsversions="11.0 10.0 12.0"
3416     fi
3419 find_msvs()
3421     # Find Visual Studio 2012/2010/2013
3422     # Args: $1 (optional) : versions to check, in the order of preference
3423     # Return value: $vstest
3425     unset vstest
3427     vs_versions_to_check "$1"
3429     for ver in $vsversions; do
3430         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3431         if test -n "$regvalue"; then
3432             vstest=$regvalue
3433             break
3434         fi
3435         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3436         if test -n "$regvalue"; then
3437             vstest=$regvalue
3438             break
3439         fi
3440     done
3443 find_msvc()
3445     # Find Visual C++ 2012/2010/2013
3446     # Args: $1 (optional) : The VS version year
3447     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3449     unset vctest vcnum vcnumwithdot
3451     vs_versions_to_check "$1"
3453     for ver in $vsversions; do
3454         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3455         if test -n "$regvalue"; then
3456             vctest=$regvalue
3457             break
3458         fi
3459         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3460         if test -n "$regvalue"; then
3461             vctest=$regvalue
3462             break
3463         fi
3464     done
3465     if test -n "$vctest"; then
3466         vcnumwithdot=$ver
3467         case "$vcnumwithdot" in
3468         10.0)
3469             vcyear=2010
3470             vcnum=100
3471             ;;
3472         11.0)
3473             vcyear=2012
3474             vcnum=110
3475             ;;
3476         12.0)
3477             vcyear=2013
3478             vcnum=120
3479             ;;
3480         esac
3481     fi
3484 SHOWINCLUDES_PREFIX=
3485 if test "$_os" = "WINNT"; then
3486     if test "$WITH_MINGW" != "yes"; then
3487         AC_MSG_CHECKING([Visual C++])
3489         find_msvc "$with_visual_studio"
3491         if test -z "$vctest"; then
3492             if test -n "$with_visual_studio"; then
3493                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3494             else
3495                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2013 installation found])
3496             fi
3497         fi
3499         if test "$BITNESS_OVERRIDE" = ""; then
3500             if test -f "$vctest/bin/cl.exe"; then
3501                 VC_PRODUCT_DIR=$vctest
3502             else
3503                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3504             fi
3505         else
3506             if test -f "$vctest/bin/amd64/cl.exe"; then
3507                 VC_PRODUCT_DIR=$vctest
3508             else
3509                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3510             fi
3511         fi
3513         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3514         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3515         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3517         dnl ===========================================================
3518         dnl  Check for the corresponding mspdb*.dll
3519         dnl ===========================================================
3521         MSPDB_PATH=
3523         if test "$BITNESS_OVERRIDE" = ""; then
3524                         if test "$vcnum" = "120"; then
3525                                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3526                         else
3527                                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3528                         fi
3529         else
3530             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3531         fi
3533         mspdbnum=$vcnum
3535         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3536             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3537         fi
3539         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3540         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3542         dnl The path needs to be added before cl is called
3543         PATH="$MSPDB_PATH:$PATH"
3545         AC_MSG_CHECKING([cl.exe])
3547         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3548         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3549         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3550         # is not enough?
3552         if test -z "$CC"; then
3553             if test "$BITNESS_OVERRIDE" = ""; then
3554                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3555                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3556                 fi
3557             else
3558                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3559                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3560                 fi
3561             fi
3563             # This gives us a posix path with 8.3 filename restrictions
3564             CC=`cygpath -d "$CC"`
3565             CC=`cygpath -u "$CC"`
3566         fi
3568         if test -n "$CC"; then
3569             # Remove /cl.exe from CC case insensitive
3570             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3571             if test "$BITNESS_OVERRIDE" = ""; then
3572                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3573             else
3574                 if test -n "$VC_PRODUCT_DIR"; then
3575                     # Huh, why not just an assignment?
3576                     COMPATH=`echo $VC_PRODUCT_DIR`
3577                 fi
3578             fi
3579             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3581             PathFormat "$COMPATH"
3582             COMPATH="$formatted_path"
3584             VCVER=$vcnum
3585             MSVSVER=$vcyear
3587             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3588             # are always "better", we list them in reverse chronological order.
3590             case $vcnum in
3591             100)
3592                 COMEX=13
3593                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3594                 ;;
3595             110)
3596                 COMEX=14
3597                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3598                 ;;
3599             120)
3600                 COMEX=15
3601                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3602                 ;;
3603             esac
3605             # The expectation is that --with-windows-sdk should not need to be used
3606             if test -n "$with_windows_sdk"; then
3607                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3608                 *" "$with_windows_sdk" "*)
3609                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3610                     ;;
3611                 *)
3612                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3613                     ;;
3614                 esac
3615             fi
3617             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3618             ac_objext=obj
3619             ac_exeext=exe
3621         else
3622             AC_MSG_ERROR([Visual C++ not found after all, huh])
3623         fi
3625         dnl We need to guess the prefix of the -showIncludes output, it can be
3626         dnl localized
3627         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3628         echo "#include <stdlib.h>" > conftest.c
3629         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3630             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3631         rm -f conftest.c conftest.obj
3632         if test -z "$SHOWINCLUDES_PREFIX"; then
3633             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3634         else
3635             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3636         fi
3638         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3639         # version of the Explorer extension (and maybe other small
3640         # bits, too) needed when installing a 32-bit LibreOffice on a
3641         # 64-bit OS. The 64-bit Explorer extension is a feature that
3642         # has been present since long in OOo. Don't confuse it with
3643         # building LibreOffice itself as 64-bit code, which is
3644         # unfinished work and highly experimental.
3646         BUILD_X64=
3647         CXX_X64_BINARY=
3648         LINK_X64_BINARY=
3650         if test "$BITNESS_OVERRIDE" = ""; then
3651             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3652             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3653                 # Prefer native x64 compiler to cross-compiler, in case we are running
3654                 # the build on a 64-bit OS.
3655                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3656                     BUILD_X64=TRUE
3657                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3658                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3659                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3660                     BUILD_X64=TRUE
3661                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3662                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3663                 fi
3664             fi
3665             if test "$BUILD_X64" = TRUE; then
3666                 AC_MSG_RESULT([found])
3667             else
3668                 AC_MSG_RESULT([not found])
3669                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3670             fi
3671         fi
3672         AC_SUBST(BUILD_X64)
3674         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3675         AC_SUBST(CXX_X64_BINARY)
3676         AC_SUBST(LINK_X64_BINARY)
3677     else
3678         AC_MSG_CHECKING([the compiler is MinGW])
3679         MACHINE_PREFIX=`$CC -dumpmachine`
3680         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3681             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3682             AC_MSG_RESULT([yes])
3683         else
3684             AC_MSG_ERROR([Compiler is not MinGW.])
3685         fi
3686     fi
3688 AC_SUBST(VCVER)
3689 PathFormat "$MSPDB_PATH"
3690 MSPDB_PATH="$formatted_path"
3691 AC_SUBST(SHOWINCLUDES_PREFIX)
3694 # dbghelp.dll
3696 if test "$_os" = "WINNT"; then
3697     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3701 # unowinreg.dll
3703 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3704 AC_SUBST(UNOWINREG_DLL)
3707 # prefix C with ccache if needed
3709 if test "$CCACHE" != ""; then
3710     AC_MSG_CHECKING([whether $CC is already ccached])
3712     AC_LANG_PUSH([C])
3713     save_CFLAGS=$CFLAGS
3714     CFLAGS="$CFLAGS --ccache-skip -O2"
3715     dnl an empty program will do, we're checking the compiler flags
3716     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3717                       [use_ccache=yes], [use_ccache=no])
3718     if test $use_ccache = yes; then
3719         AC_MSG_RESULT([yes])
3720     else
3721         CC="$CCACHE $CC"
3722         AC_MSG_RESULT([no])
3723     fi
3724     CFLAGS=$save_CFLAGS
3725     AC_LANG_POP([C])
3728 dnl Set the ENABLE_DBGUTIL variable
3729 dnl ===================================================================
3730 AC_MSG_CHECKING([whether to build with additional debug utilities])
3731 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3732     ENABLE_DBGUTIL="TRUE"
3733     # this is an extra var so it can have different default on different MSVC
3734     # versions (in case there are version specific problems with it)
3735     MSVC_USE_DEBUG_RUNTIME="TRUE"
3737     AC_MSG_RESULT([yes])
3738     # cppunit and graphite expose STL in public headers
3739     if test "$with_system_cppunit" = "yes"; then
3740         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3741     else
3742         with_system_cppunit=no
3743     fi
3744     if test "$with_system_graphite" = "yes"; then
3745         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3746     else
3747         with_system_graphite=no
3748     fi
3749     if test "$with_system_mysql_cppconn" = "yes"; then
3750         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3751     else
3752         with_system_mysql_cppconn=no
3753     fi
3754     if test "$with_system_orcus" = "yes"; then
3755         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3756     else
3757         with_system_orcus=no
3758     fi
3759     if test "$with_system_libcmis" = "yes"; then
3760         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3761     else
3762         with_system_libcmis=no
3763     fi
3764     if test "$enable_win_mozab_driver" = "yes"; then
3765         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3766     fi
3767 else
3768     ENABLE_DBGUTIL=""
3769     MSVC_USE_DEBUG_RUNTIME=""
3770     AC_MSG_RESULT([no])
3772 AC_SUBST(ENABLE_DBGUTIL)
3773 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3775 dnl Set the ENABLE_DEBUG variable.
3776 dnl ===================================================================
3777 AC_MSG_CHECKING([whether to do a debug build])
3778 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3779     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3781 if test -n "$ENABLE_DBGUTIL"; then
3782     if test "$enable_debug" = "no"; then
3783         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3784     fi
3785     ENABLE_DEBUG="TRUE"
3786     AC_MSG_RESULT([yes (dbgutil)])
3787 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3788     ENABLE_DEBUG="TRUE"
3789     AC_MSG_RESULT([yes])
3790 else
3791     ENABLE_DEBUG=""
3792     AC_MSG_RESULT([no])
3794 AC_SUBST(ENABLE_DEBUG)
3796 dnl Selective debuginfo
3797 ENABLE_DEBUGINFO_FOR=
3798 if test -n "$ENABLE_DEBUG"; then
3799     AC_MSG_CHECKING([whether to use selective debuginfo])
3800     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3801         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3802         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3803     else
3804         ENABLE_DEBUGINFO_FOR=all
3805         AC_MSG_RESULT([no, for all])
3806     fi
3808 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3810 dnl Check for enable symbols option
3811 dnl ===================================================================
3812 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3813 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3814     ENABLE_SYMBOLS="TRUE"
3815     if test -n "$ENABLE_DBGUTIL"; then
3816         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3817     elif test -n "$ENABLE_DEBUG"; then
3818         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3819     fi
3820     AC_MSG_RESULT([yes])
3821 else
3822     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3823         ENABLE_SYMBOLS="FALSE"
3824     else
3825         ENABLE_SYMBOLS=
3826     fi
3827     AC_MSG_RESULT([no])
3829 AC_SUBST(ENABLE_SYMBOLS)
3831 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3832 # By default use the ones specified by our build system,
3833 # but explicit override is possible.
3834 AC_MSG_CHECKING(for explicit AFLAGS)
3835 if test -n "$AFLAGS"; then
3836     AC_MSG_RESULT([$AFLAGS])
3837     x_AFLAGS=
3838 else
3839     AC_MSG_RESULT(no)
3840     x_AFLAGS=[\#]
3842 AC_MSG_CHECKING(for explicit CFLAGS)
3843 if test -n "$CFLAGS"; then
3844     AC_MSG_RESULT([$CFLAGS])
3845     x_CFLAGS=
3846 else
3847     AC_MSG_RESULT(no)
3848     x_CFLAGS=[\#]
3850 AC_MSG_CHECKING(for explicit CXXFLAGS)
3851 if test -n "$CXXFLAGS"; then
3852     AC_MSG_RESULT([$CXXFLAGS])
3853     x_CXXFLAGS=
3854 else
3855     AC_MSG_RESULT(no)
3856     x_CXXFLAGS=[\#]
3858 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3859 if test -n "$OBJCFLAGS"; then
3860     AC_MSG_RESULT([$OBJCFLAGS])
3861     x_OBJCFLAGS=
3862 else
3863     AC_MSG_RESULT(no)
3864     x_OBJCFLAGS=[\#]
3866 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3867 if test -n "$OBJCXXFLAGS"; then
3868     AC_MSG_RESULT([$OBJCXXFLAGS])
3869     x_OBJCXXFLAGS=
3870 else
3871     AC_MSG_RESULT(no)
3872     x_OBJCXXFLAGS=[\#]
3874 AC_MSG_CHECKING(for explicit LDFLAGS)
3875 if test -n "$LDFLAGS"; then
3876     AC_MSG_RESULT([$LDFLAGS])
3877     x_LDFLAGS=
3878 else
3879     AC_MSG_RESULT(no)
3880     x_LDFLAGS=[\#]
3882 AC_SUBST(AFLAGS)
3883 AC_SUBST(CFLAGS)
3884 AC_SUBST(CXXFLAGS)
3885 AC_SUBST(OBJCFLAGS)
3886 AC_SUBST(OBJCXXFLAGS)
3887 AC_SUBST(LDFLAGS)
3888 AC_SUBST(x_AFLAGS)
3889 AC_SUBST(x_CFLAGS)
3890 AC_SUBST(x_CXXFLAGS)
3891 AC_SUBST(x_OBJCFLAGS)
3892 AC_SUBST(x_OBJCXXFLAGS)
3893 AC_SUBST(x_LDFLAGS)
3896 # determine CPUNAME, GUIBASE, ...
3898 LIB64="lib"
3899 SOLARINC=
3901 case "$host_os" in
3903 aix*)
3904     COM=GCC
3905     CPUNAME=POWERPC
3906     GUIBASE=unx
3907     OS=AIX
3908     RTL_OS=AIX
3909     RTL_ARCH=PowerPC
3910     PLATFORMID=aix_powerpc
3911     OUTPATH=unxaigppc
3912     P_SEP=:
3913     ;;
3915 cygwin*)
3916     COM=MSC
3917     GUIBASE=not-used
3918     OS=WNT
3919     RTL_OS=Windows
3920     P_SEP=";"
3922     case "$host_cpu" in
3923     i*86|x86_64)
3924         if test "$BITNESS_OVERRIDE" = 64; then
3925             CPUNAME=X86_64
3926             RTL_ARCH=X86_64
3927             LIB64="lib/x64"
3928             PLATFORMID=windows_x86_64
3929             OUTPATH=wntmscx$COMEX
3930         else
3931             CPUNAME=INTEL
3932             RTL_ARCH=x86
3933             PLATFORMID=windows_x86
3934             OUTPATH=wntmsci$COMEX
3935         fi
3936         ;;
3937     *)
3938         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3939         ;;
3940     esac
3941     SCPDEFS="$SCPDEFS -D_MSC_VER"
3942     ;;
3944 darwin*)
3945     COM=GCC
3946     GUIBASE=not-used
3947     OS=MACOSX
3948     RTL_OS=MacOSX
3949     P_SEP=:
3951     case "$host_cpu" in
3952     arm*)
3953         CPUNAME=ARM
3954         RTL_ARCH=ARM_EABI
3955         PLATFORMID=ios_arm
3956         OUTPATH=unxiosr
3957         OS=IOS
3958         SDKDIR=sdk
3959         ;;
3960     i*86)
3961         if test "$BITNESS_OVERRIDE" = 64; then
3962             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3963         fi
3964         CPUNAME=INTEL
3965         RTL_ARCH=x86
3966         PLATFORMID=macosx_x86
3967         OUTPATH=unxmacxi
3968         ;;
3969     x86_64)
3970         if test "$BITNESS_OVERRIDE" = 64; then
3971             CPUNAME=X86_64
3972             RTL_ARCH=X86_64
3973             PLATFORMID=macosx_x86_64
3974             OUTPATH=unxmacxx
3975         else
3976             CPUNAME=INTEL
3977             RTL_ARCH=x86
3978             PLATFORMID=macosx_x86
3979             OUTPATH=unxmacxi
3980         fi
3981         ;;
3982     *)
3983         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3984         ;;
3985     esac
3986     ;;
3988 dragonfly*)
3989     COM=GCC
3990     GUIBASE=unx
3991     OS=DRAGONFLY
3992     RTL_OS=DragonFly
3993     OUTPATH=unxdfly
3994     P_SEP=:
3996     case "$host_cpu" in
3997     i*86)
3998         CPUNAME=INTEL
3999         RTL_ARCH=x86
4000         PLATFORMID=dragonfly_x86
4001         ;;
4002     x86_64)
4003         CPUNAME=X86_64
4004         RTL_ARCH=X86_64
4005         PLATFORMID=dragonfly_x86_64
4006         ;;
4007     *)
4008         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4009         ;;
4010     esac
4011     ;;
4013 freebsd*)
4014     COM=GCC
4015     GUIBASE=unx
4016     RTL_OS=FreeBSD
4017     OS=FREEBSD
4018     OUTPATH=unxfbsd
4019     P_SEP=:
4021     case "$host_cpu" in
4022     i*86)
4023         CPUNAME=INTEL
4024         RTL_ARCH=x86
4025         PLATFORMID=freebsd_x86
4026         OUTPATH=unxfbsdi
4027         ;;
4028     x86_64)
4029         CPUNAME=X86_64
4030         RTL_ARCH=X86_64
4031         PLATFORMID=freebsd_x86_64
4032         ;;
4033     *)
4034         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4035         ;;
4036     esac
4037     ;;
4039 kfreebsd*)
4040     COM=GCC
4041     GUIBASE=unx
4042     OS=LINUX
4043     RTL_OS=kFreeBSD
4044     P_SEP=:
4046     case "$host_cpu" in
4048     i*86)
4049         CPUNAME=INTEL
4050         RTL_ARCH=x86
4051         PLATFORMID=kfreebsd_x86
4052         OUTPATH=unxkfgi6
4053         ;;
4054     x86_64)
4055         CPUNAME=X86_64
4056         RTL_ARCH=X86_64
4057         LIB64="lib64"
4058         PLATFORMID=kfreebsd_x86_64
4059         OUTPATH=unxkfgx6
4060         ;;
4061     *)
4062         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4063         ;;
4064     esac
4065     ;;
4067 linux-gnu*)
4068     COM=GCC
4069     GUIBASE=unx
4070     OS=LINUX
4071     RTL_OS=Linux
4072     P_SEP=:
4074     case "$host_cpu" in
4076     alpha)
4077         CPUNAME=AXP
4078         RTL_ARCH=ALPHA
4079         PLATFORMID=linux_alpha
4080         OUTPATH=unxlngaxp
4081         ;;
4082     arm*)
4083         CPUNAME=ARM
4084         EPM_FLAGS="-a arm"
4085         OUTPATH=unxlngr
4086         RTL_ARCH=ARM_EABI
4087         PLATFORMID=linux_arm_eabi
4088         case "$host_cpu" in
4089         arm*-linux)
4090             RTL_ARCH=ARM_OABI
4091             PLATFORMID=linux_arm_oabi
4092             ;;
4093         esac
4094         ;;
4095     hppa)
4096         CPUNAME=HPPA
4097         RTL_ARCH=HPPA
4098         EPM_FLAGS="-a hppa"
4099         PLATFORMID=linux_hppa
4100         OUTPATH=unxlnghppa
4101         ;;
4102     i*86)
4103         CPUNAME=INTEL
4104         RTL_ARCH=x86
4105         PLATFORMID=linux_x86
4106         OUTPATH=unxlngi6
4107         ;;
4108     ia64)
4109         CPUNAME=IA64
4110         RTL_ARCH=IA64
4111         PLATFORMID=linux_ia64
4112         OUTPATH=unxlnga
4113         ;;
4114     mips)
4115         CPUNAME=GODSON
4116         RTL_ARCH=MIPS_EB
4117         EPM_FLAGS="-a mips"
4118         PLATFORMID=linux_mips_eb
4119         OUTPATH=unxlngmips
4120         ;;
4121     mips64)
4122         CPUNAME=GODSON
4123         RTL_ARCH=MIPS_EB
4124         EPM_FLAGS="-a mips64"
4125         PLATFORMID=linux_mips_eb
4126         OUTPATH=unxlngmips
4127         ;;
4128     mips64el)
4129         CPUNAME=GODSON
4130         RTL_ARCH=MIPS_EL
4131         EPM_FLAGS="-a mips64el"
4132         PLATFORMID=linux_mips_el
4133         OUTPATH=unxlngmips
4134         ;;
4135     mipsel)
4136         CPUNAME=GODSON
4137         RTL_ARCH=MIPS_EL
4138         EPM_FLAGS="-a mipsel"
4139         PLATFORMID=linux_mips_el
4140         OUTPATH=unxlngmips
4141         ;;
4142     m68k)
4143         CPUNAME=M68K
4144         RTL_ARCH=M68K
4145         PLATFORMID=linux_m68k
4146         OUTPATH=unxlngm68k
4147         ;;
4148     powerpc)
4149         CPUNAME=POWERPC
4150         RTL_ARCH=PowerPC
4151         PLATFORMID=linux_powerpc
4152         OUTPATH=unxlngppc
4153         ;;
4154     powerpc64)
4155         CPUNAME=POWERPC64
4156         RTL_ARCH=PowerPC_64
4157         LIB64="lib64"
4158         PLATFORMID=linux_powerpc_64
4159         OUTPATH=unxlngppc64
4160         ;;
4161     sparc)
4162         CPUNAME=SPARC
4163         RTL_ARCH=SPARC
4164         PLATFORMID=linux_sparc
4165         OUTPATH=unxlngs
4166         ;;
4167     s390)
4168         CPUNAME=S390
4169         RTL_ARCH=S390
4170         PLATFORMID=linux_s390
4171         OUTPATH=unxlngs390
4172         ;;
4173     s390x)
4174         CPUNAME=S390X
4175         RTL_ARCH=S390x
4176         LIB64="lib64"
4177         PLATFORMID=linux_s390x
4178         OUTPATH=unxlngs390x
4179         ;;
4180     x86_64)
4181         CPUNAME=X86_64
4182         RTL_ARCH=X86_64
4183         LIB64="lib64"
4184         PLATFORMID=linux_x86_64
4185         OUTPATH=unxlngx6
4186         ;;
4187     *)
4188         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4189         ;;
4190     esac
4191     ;;
4193 linux-android*)
4194     COM=GCC
4195     GUIBASE=not-used
4196     OS=ANDROID
4197     RTL_OS=Android
4198     P_SEP=:
4200     case "$host_cpu" in
4202     arm|armel)
4203         CPUNAME=ARM
4204         RTL_ARCH=ARM_EABI
4205         PLATFORMID=android_arm_eabi
4206         OUTPATH=unxandr
4207         ;;
4208     mips|mipsel)
4209         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4210         RTL_ARCH=MIPS_EL
4211         PLATFORMID=android_mips_el
4212         OUTPATH=unxandm
4213         ;;
4214     i*86)
4215         CPUNAME=INTEL
4216         RTL_ARCH=x86
4217         PLATFORMID=android_x86
4218         OUTPATH=unxandi
4219         ;;
4220     *)
4221         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4222         ;;
4223     esac
4224     ;;
4226 mingw*)
4227     COM=GCC
4228     GUIBASE=not-used
4229     OS=WNT
4230     RTL_OS=Windows
4231     P_SEP=:
4233     case "$host_cpu" in
4234     i*86|x86_64)
4235         if test "$BITNESS_OVERRIDE" = 64; then
4236             CPUNAME=X86_64
4237             RTL_ARCH=X86_84
4238             PLATFORMID=windows_x86_64
4239             OUTPATH=wntgccx$COMEX
4240             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4241         else
4242             CPUNAME=INTEL
4243             RTL_ARCH=x86
4244             PLATFORMID=windows_x86
4245             OUTPATH=wntgcci$COMEX
4246             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4247         fi
4248         ;;
4249     *)
4250         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4251         ;;
4252     esac
4254     ;;
4256 *netbsd*)
4258     COM=GCC
4259     GUIBASE=unx
4260     OS=NETBSD
4261     RTL_OS=NetBSD
4262     OUTPATH=unxnbsd
4263     P_SEP=:
4265     case "$host_cpu" in
4266     i*86)
4267         CPUNAME=INTEL
4268         RTL_ARCH=x86
4269         PLATFORMID=netbsd_x86
4270         ;;
4271     powerpc)
4272         CPUNAME=POWERPC
4273         RTL_ARCH=PowerPC
4274         PLATFORMID=netbsd_powerpc
4275         ;;
4276     sparc)
4277         CPUNAME=SPARC
4278         RTL_ARCH=SPARC
4279         PLATFORMID=netbsd_sparc
4280         ;;
4281     x86_64)
4282         CPUNAME=X86_64
4283         RTL_ARCH=X86_64
4284         PLATFORMID=netbsd_x86_64
4285         ;;
4286     *)
4287         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4288         ;;
4289     esac
4290     ;;
4292 openbsd*)
4293     COM=GCC
4294     GUIBASE=unx
4295     OS=OPENBSD
4296     RTL_OS=OpenBSD
4297     OUTPATH=unxobsd
4298     P_SEP=:
4300     case "$host_cpu" in
4301     i*86)
4302         CPUNAME=INTEL
4303         RTL_ARCH=x86
4304         PLATFORMID=openbsd_x86
4305         ;;
4306     x86_64)
4307         CPUNAME=X86_64
4308         RTL_ARCH=X86_64
4309         PLATFORMID=openbsd_x86_64
4310         ;;
4311     *)
4312         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4313         ;;
4314     esac
4315     SOLARINC="$SOLARINC -I/usr/local/include"
4316     SOLARLIB="$SOLARLIB -L/usr/local/lib"
4318     ;;
4320 solaris*)
4322     COM=GCC
4323     GUIBASE=unx
4324     OS=SOLARIS
4325     RTL_OS=Solaris
4326     P_SEP=:
4328     case "$host_cpu" in
4329     i*86)
4330         CPUNAME=INTEL
4331         RTL_ARCH=x86
4332         PLATFORMID=solaris_x86
4333         OUTPATH=unxsogi
4334         ;;
4335     sparc)
4336         CPUNAME=SPARC
4337         RTL_ARCH=SPARC
4338         PLATFORMID=solaris_sparc
4339         OUTPATH=unxsogs
4340         ;;
4341     sparc64)
4342         CPUNAME=SPARC64
4343         RTL_ARCH=SPARC64
4344         PLATFORMID=solaris_sparc64
4345         OUTPATH=unxsogu
4346         ;;
4347     *)
4348         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4349         ;;
4350     esac
4351     SOLARINC="$SOLARINC -I/usr/local/include"
4352     SOLARLIB="$SOLARLIB -L$COMPATH/lib"
4353     SOLARLIB="$SOLARLIB -L/usr/local/bin -L/usr/dt/lib -L/usr/openwin/lib"
4354     ;;
4357     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4358     ;;
4359 esac
4361 if test "$enable_headless" = "yes"; then
4362     if test "$GUIBASE" != "unx"; then
4363         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
4364     fi
4365     GUIBASE=not-used
4368 WORKDIR="${BUILDDIR}/workdir"
4369 INSTDIR="${BUILDDIR}/instdir"
4370 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4371 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4372 AC_SUBST(COM)
4373 AC_SUBST(CPUNAME)
4374 AC_SUBST(RTL_OS)
4375 AC_SUBST(RTL_ARCH)
4376 AC_SUBST(EPM_FLAGS)
4377 AC_SUBST(GUIBASE)
4378 AC_SUBST([INSTDIR])
4379 AC_SUBST([INSTROOT])
4380 AC_SUBST(OS)
4381 AC_SUBST(OUTPATH)
4382 AC_SUBST(P_SEP)
4383 AC_SUBST(WORKDIR)
4384 AC_SUBST(PLATFORMID)
4385 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4387 dnl ===================================================================
4388 dnl Test which package format to use
4389 dnl ===================================================================
4390 AC_MSG_CHECKING([which package format to use])
4391 if test -n "$with_package_format" -a "$with_package_format" != no; then
4392     for i in $with_package_format; do
4393         case "$i" in
4394         aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4395             ;;
4396         *)
4397             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4398 aix - AIX software distribution
4399 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4400 deb - Debian software distribution
4401 inst or tardist - IRIX software distribution
4402 osx - MacOS X software distribution
4403 pkg - Solaris software distribution
4404 rpm - RedHat software distribution
4405 setld - Tru64 (setld) software distribution
4406 native - "Native" software distribution for the platform
4407 portable - Portable software distribution
4409 LibreOffice additionally supports:
4410 archive - .tar.gz or .zip
4411 dmg - Mac OS X .dmg
4412 installed - installation tree
4413 msi - Windows .msi
4414         ])
4415             ;;
4416         esac
4417     done
4418     PKGFORMAT="$with_package_format"
4419     AC_MSG_RESULT([$PKGFORMAT])
4420 else
4421     PKGFORMAT=
4422     AC_MSG_RESULT([none])
4424 AC_SUBST(PKGFORMAT)
4426 dnl ===================================================================
4427 dnl Set up a different compiler to produce tools to run on the build
4428 dnl machine when doing cross-compilation
4429 dnl ===================================================================
4431 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4432 if test "$cross_compiling" = "yes"; then
4433     AC_MSG_CHECKING([for BUILD platform configuration])
4434     echo
4435     rm -rf CONF-FOR-BUILD config_build.mk
4436     mkdir CONF-FOR-BUILD
4437     # Here must be listed all files needed when running the configure script. In particular, also
4438     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4439     # keep them in the same order as there.
4440     (cd $SRC_ROOT && tar cf - \
4441         config.guess \
4442         bin/get_config_variables \
4443         solenv/bin/getcompver.awk \
4444         solenv/inc/langlist.mk \
4445         config_host.mk.in \
4446         Makefile.in \
4447         lo.xcent.in \
4448         instsetoo_native/util/openoffice.lst.in \
4449         config_host/*.in \
4450         sysui/desktop/macosx/Info.plist.in \
4451         ios/lo.xcconfig.in) \
4452     | (cd CONF-FOR-BUILD && tar xf -)
4453     cp configure CONF-FOR-BUILD
4454     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4455     (
4456     unset COM GUIBASE OS CPUNAME
4457     unset CC CXX SYSBASE CFLAGS
4458     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4459     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4460     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4461     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4462     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4463     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4464     cd CONF-FOR-BUILD
4465     sub_conf_opts=""
4466     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4467     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4468     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4469     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4470     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4471     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4472     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4473     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4474     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4475     # we need the msi build tools on mingw if we are creating the
4476     # installation set
4477     if test "$WITH_MINGW" = "yes"; then
4478         enable_winegcc_for_build=
4479         for pkgformat in $PKGFORMAT; do
4480             case "$pkgformat" in
4481             msi|native) enable_winegcc_for_build=yes ;;
4482             esac
4483         done
4484         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4485     fi
4486     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4487     # Don't bother having configure look for stuff not needed for the build platform anyway
4488     ./configure \
4489         --disable-graphite \
4490         --disable-pdfimport \
4491         --disable-postgresql-sdbc \
4492         --with-parallelism="$with_parallelism" \
4493         --without-doxygen \
4494         --without-java \
4495         $sub_conf_opts \
4496         --srcdir=$srcdir \
4497         2>&1 | sed -e 's/^/    /'
4498     test -f ./config_host.mk 2>/dev/null || exit
4499     cp config_host.mk ../config_build.mk
4500     mv config.log ../config.Build.log
4501     mkdir -p ../config_build
4502     mv config_host/*.h ../config_build
4503     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXSLT WORKDIR
4505     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXSLT; do
4506         VV='$'$V
4507         VV=`eval "echo $VV"`
4508         if test -n "$VV"; then
4509             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4510             echo "$line" >>build-config
4511         fi
4512     done
4514     for V in INSTDIR INSTROOT WORKDIR; do
4515         VV='$'$V
4516         VV=`eval "echo $VV"`
4517         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4518         if test -n "$VV"; then
4519             line="${V}_FOR_BUILD='$VV'"
4520             echo "$line" >>build-config
4521         fi
4522     done
4524     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4525     echo "$line" >>build-config
4527     )
4528     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4529     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])
4530     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4531              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4533     eval `cat CONF-FOR-BUILD/build-config`
4535     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4537     rm -rf CONF-FOR-BUILD
4538 else
4539     OS_FOR_BUILD="$OS"
4540     CC_FOR_BUILD="$CC"
4541     CXX_FOR_BUILD="$CXX"
4542     INSTDIR_FOR_BUILD="$INSTDIR"
4543     INSTROOT_FOR_BUILD="$INSTROOT"
4544     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4545     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4546     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4547     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4548     WORKDIR_FOR_BUILD="$WORKDIR"
4550 AC_SUBST(OS_FOR_BUILD)
4551 AC_SUBST(INSTDIR_FOR_BUILD)
4552 AC_SUBST(INSTROOT_FOR_BUILD)
4553 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4554 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4555 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4556 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4557 AC_SUBST(WORKDIR_FOR_BUILD)
4559 dnl ===================================================================
4560 dnl Check for syslog header
4561 dnl ===================================================================
4562 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4564 dnl ===================================================================
4565 dnl Set the ENABLE_CRASHDUMP variable.
4566 dnl ===================================================================
4567 AC_MSG_CHECKING([whether to enable crashdump feature])
4568 if test "$enable_crashdump" = "yes"; then
4569     ENABLE_CRASHDUMP="TRUE"
4570     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4571     AC_MSG_RESULT([yes])
4572 else
4573     ENABLE_CRASHDUMP=""
4574     AC_MSG_RESULT([no])
4576 AC_SUBST(ENABLE_CRASHDUMP)
4579 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4580 dnl ===================================================================
4581 AC_MSG_CHECKING([whether to turn warnings to errors])
4582 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4583     EXTERNAL_WARNINGS_NOT_ERRORS="FALSE"
4584     AC_MSG_RESULT([yes])
4585 else
4586     EXTERNAL_WARNINGS_NOT_ERRORS="TRUE"
4587     AC_MSG_RESULT([no])
4589 AC_SUBST(EXTERNAL_WARNINGS_NOT_ERRORS)
4591 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4592 dnl ===================================================================
4593 AC_MSG_CHECKING([whether to have assert to abort in release code])
4594 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4595     ASSERT_ALWAYS_ABORT="TRUE"
4596     AC_MSG_RESULT([yes])
4597 else
4598     ASSERT_ALWAYS_ABORT="FALSE"
4599     AC_MSG_RESULT([no])
4601 AC_SUBST(ASSERT_ALWAYS_ABORT)
4603 # Determine whether to use ooenv for the instdir installation
4604 # ===================================================================
4605 if test $_os != "WINNT" -a $_os != "Darwin"; then
4606     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4607     if test "$enable_ooenv" = "no"; then
4608         AC_MSG_RESULT([no])
4609     else
4610         ENABLE_OOENV="TRUE"
4611         AC_MSG_RESULT([yes])
4612     fi
4614 AC_SUBST(ENABLE_OOENV)
4616 if test "$enable_headless" = "yes"; then
4617     # be sure to do not mess with uneeded stuff
4618     test_randr=no
4619     test_xrender=no
4620     test_cups=no
4621     test_dbus=no
4622     test_fontconfig=yes
4623     test_gtk=no
4624     build_gstreamer=no
4625     build_gstreamer_0_10=no
4626     test_tde=no
4627     test_kde=no
4628     test_kde4=no
4629     enable_cairo_canvas=no
4630     enable_gnome_vfs=no
4633 dnl ===================================================================
4634 dnl check for cups support
4635 dnl ===================================================================
4636 ENABLE_CUPS=""
4638 if test "$enable_cups" = "no"; then
4639     test_cups=no
4642 AC_MSG_CHECKING([whether to enable CUPS support])
4643 if test "$test_cups" = "yes"; then
4644     ENABLE_CUPS="TRUE"
4645     AC_MSG_RESULT([yes])
4647     AC_MSG_CHECKING([whether cups support is present])
4648     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4649     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4650     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
4651         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4652     fi
4654 else
4655     AC_MSG_RESULT([no])
4658 AC_SUBST(ENABLE_CUPS)
4660 # fontconfig checks
4661 if test "$test_fontconfig" = "yes"; then
4662     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4663     SYSTEM_FONTCONFIG=YES
4665 AC_SUBST(FONTCONFIG_CFLAGS)
4666 AC_SUBST(FONTCONFIG_LIBS)
4667 AC_SUBST([SYSTEM_FONTCONFIG])
4669 dnl whether to find & fetch external tarballs?
4670 dnl ===================================================================
4671 if test -z "$TARFILE_LOCATION"; then
4672     TARFILE_LOCATION="$SRC_ROOT/src"
4674 AC_SUBST(TARFILE_LOCATION)
4676 AC_MSG_CHECKING([whether we want to fetch tarballs])
4677 if test "$enable_fetch_external" != "no"; then
4678     if test "$with_all_tarballs" = "yes"; then
4679         AC_MSG_RESULT(["yes, all of them"])
4680         DO_FETCH_TARBALLS="ALL"
4681     else
4682         AC_MSG_RESULT(["yes, if we use them"])
4683         DO_FETCH_TARBALLS="YES"
4684     fi
4685 else
4686     AC_MSG_RESULT([no])
4687     DO_FETCH_TARBALLS="NO"
4689 AC_SUBST(DO_FETCH_TARBALLS)
4691 AC_MSG_CHECKING([whether to build help])
4692 HELP_COMMON_ONLY=FALSE
4693 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4694     BUILD_TYPE="$BUILD_TYPE HELP"
4695     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4696     if test "$with_help" = "common" ; then
4697         HELP_COMMON_ONLY=TRUE
4698         AC_MSG_RESULT([common only])
4699     else
4700         SCPDEFS="$SCPDEFS -DWITH_HELP"
4701         AC_MSG_RESULT([yes])
4702     fi
4703 else
4704     AC_MSG_RESULT([no])
4706 AC_SUBST(HELP_COMMON_ONLY)
4708 dnl Test whether to include MySpell dictionaries
4709 dnl ===================================================================
4710 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4711 if test "$with_myspell_dicts" = "yes"; then
4712     AC_MSG_RESULT([yes])
4713     WITH_MYSPELL_DICTS=YES
4714     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4715     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4716 else
4717     AC_MSG_RESULT([no])
4718     WITH_MYSPELL_DICTS=NO
4720 AC_SUBST(WITH_MYSPELL_DICTS)
4722 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4723 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4724     if test "$with_system_dicts" = yes; then
4725         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4726     fi
4727     with_system_dicts=no
4730 AC_MSG_CHECKING([whether to use dicts from external paths])
4731 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4732     AC_MSG_RESULT([yes])
4733     SYSTEM_DICTS=YES
4734     AC_MSG_CHECKING([for spelling dictionary directory])
4735     if test -n "$with_external_dict_dir"; then
4736         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4737     else
4738         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4739         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4740             DICT_SYSTEM_DIR=file:///usr/share/myspell
4741         fi
4742     fi
4743     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4744     AC_MSG_CHECKING([for hyphenation patterns directory])
4745     if test -n "$with_external_hyph_dir"; then
4746         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4747     else
4748         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4749     fi
4750     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4751     AC_MSG_CHECKING([for thesaurus directory])
4752     if test -n "$with_external_thes_dir"; then
4753         THES_SYSTEM_DIR=file://$with_external_thes_dir
4754     else
4755         THES_SYSTEM_DIR=file:///usr/share/mythes
4756     fi
4757     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4758 else
4759     AC_MSG_RESULT([no])
4760     SYSTEM_DICTS=NO
4762 AC_SUBST(SYSTEM_DICTS)
4763 AC_SUBST(DICT_SYSTEM_DIR)
4764 AC_SUBST(HYPH_SYSTEM_DIR)
4765 AC_SUBST(THES_SYSTEM_DIR)
4767 dnl ===================================================================
4768 AC_MSG_CHECKING([whether to enable pch feature])
4769 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4770     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4771         ENABLE_PCH="TRUE"
4772         AC_MSG_RESULT([yes])
4773     elif test "$GCC" = "yes"; then
4774         ENABLE_PCH="TRUE"
4775         AC_MSG_RESULT([yes])
4776     else
4777         ENABLE_PCH=""
4778         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4779     fi
4780 else
4781     ENABLE_PCH=""
4782     AC_MSG_RESULT([no])
4784 AC_SUBST(ENABLE_PCH)
4786 dnl ===================================================================
4787 dnl Search all the common names for GNU make
4788 dnl ===================================================================
4789 AC_MSG_CHECKING([for GNU make])
4791 # try to use our own make if it is available and GNUMAKE was not already defined
4792 if test -z "$GNUMAKE"; then
4793     if test -x "/opt/lo/bin/make"; then
4794         GNUMAKE="/opt/lo/bin/make"
4795     fi
4798 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4799     if test -n "$a"; then
4800         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4801         if test $? -eq 0;  then
4802             GNUMAKE=`which $a`
4803             break
4804         fi
4805     fi
4806 done
4807 AC_MSG_RESULT($GNUMAKE)
4808 if test -z "$GNUMAKE"; then
4809     AC_MSG_ERROR([not found. install GNU make.])
4812 TAB=`printf '\t'`
4814 AC_MSG_CHECKING([the GNU make version])
4815 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4816 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4817 if test "$_make_longver" -ge "038200"; then
4818     AC_MSG_RESULT([$GNUMAKE $_make_version])
4820 elif test "$_make_longver" -ge "038100"; then
4821     if test "$build_os" = "cygwin"; then
4822         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4823     fi
4824     AC_MSG_RESULT([$GNUMAKE $_make_version])
4826     dnl ===================================================================
4827     dnl Search all the common names for sha1sum
4828     dnl ===================================================================
4829     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4830     if test -z "$SHA1SUM"; then
4831         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4832     elif test "$SHA1SUM" = "openssl"; then
4833         SHA1SUM="openssl sha1"
4834     fi
4835     AC_MSG_CHECKING([for GNU make bug 20033])
4836     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4837     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4838 A := \$(wildcard *.a)
4840 .PHONY: all
4841 all: \$(A:.a=.b)
4842 <TAB>@echo survived bug20033.
4844 .PHONY: setup
4845 setup:
4846 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4848 define d1
4849 @echo lala \$(1)
4850 @sleep 1
4851 endef
4853 define d2
4854 @echo tyty \$(1)
4855 @sleep 1
4856 endef
4858 %.b : %.a
4859 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4860 <TAB>\$(call d1,\$(CHECKSUM)),\
4861 <TAB>\$(call d2,\$(CHECKSUM)))
4863     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4864         no_parallelism_make="YES"
4865         AC_MSG_RESULT([yes, disable parallelism])
4866     else
4867         AC_MSG_RESULT([no, keep parallelism enabled])
4868     fi
4869     rm -rf $TESTGMAKEBUG20033
4870 else
4871     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4874 # find if gnumake support file function
4875 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
4876 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4877 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4878 \$(file >test.txt,Success )
4880 .PHONY: all
4881 all:
4882 <TAB>@cat test.txt
4885 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4886 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4887     HAVE_GNUMAKE_FILE_FUNC="YES"
4888     AC_MSG_RESULT([yes])
4889 else
4890     AC_MSG_RESULT([no])
4892 rm -rf $TESTGMAKEFILEFUNC
4893 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4894 AC_SUBST(GNUMAKE)
4896 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
4897 STALE_MAKE=
4898 make_warning=
4899 if test "$_make_ver_check" = ""; then
4900    STALE_MAKE=TRUE
4903 HAVE_LD_HASH_STYLE=FALSE
4904 WITH_LINKER_HASH_STYLE=
4905 AC_MSG_CHECKING( for --hash-style gcc linker support )
4906 if test "$GCC" = "yes"; then
4907     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4908         hash_styles="gnu sysv"
4909     elif test "$with_linker_hash_style" = "no"; then
4910         hash_styles=
4911     else
4912         hash_styles="$with_linker_hash_style"
4913     fi
4915     for hash_style in $hash_styles; do
4916         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4917         hash_style_ldflags_save=$LDFLAGS
4918         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4920         AC_LINK_IFELSE([AC_LANG_PROGRAM(
4921             [
4922 #include <stdio.h>
4923             ],[
4924 printf ("");
4925             ])],
4926             [ if ./conftest$EXEEXT; then
4927                   HAVE_LD_HASH_STYLE=TRUE
4928                   WITH_LINKER_HASH_STYLE=$hash_style
4929               fi],
4930             [HAVE_LD_HASH_STYLE=FALSE])
4931         LDFLAGS=$hash_style_ldflags_save
4932     done
4934     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4935         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4936     else
4937         AC_MSG_RESULT( no )
4938     fi
4939     LDFLAGS=$hash_style_ldflags_save
4940 else
4941     AC_MSG_RESULT( no )
4943 AC_SUBST(HAVE_LD_HASH_STYLE)
4944 AC_SUBST(WITH_LINKER_HASH_STYLE)
4946 dnl ===================================================================
4947 dnl Check whether there's a Perl version available.
4948 dnl ===================================================================
4949 if test -z "$with_perl_home"; then
4950     AC_PATH_PROG(PERL, perl)
4951 else
4952     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4953     _perl_path="$with_perl_home/bin/perl"
4954     if test -x "$_perl_path"; then
4955         PERL=$_perl_path
4956     else
4957         AC_MSG_ERROR([$_perl_path not found])
4958     fi
4961 dnl ===================================================================
4962 dnl Testing for Perl version 5 or greater.
4963 dnl $] is the Perl version variable, it is returned as an integer
4964 dnl ===================================================================
4965 if test "$PERL"; then
4966     AC_MSG_CHECKING([the Perl version])
4967     ${PERL} -e "exit($]);"
4968     _perl_version=$?
4969     if test "$_perl_version" -lt 5; then
4970         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4971     fi
4972     AC_MSG_RESULT([checked (perl $_perl_version)])
4973 else
4974     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4977 dnl ===================================================================
4978 dnl Testing for required Perl modules
4979 dnl ===================================================================
4981 AC_MSG_CHECKING([for required Perl modules])
4982 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4983     AC_MSG_RESULT([all modules found])
4984 else
4985     AC_MSG_RESULT([failed to find some modules])
4986     # Find out which modules are missing.
4987     missing_perl_modules=
4988     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
4989        missing_perl_modules=Archive::Zip
4990     fi
4991     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4992        missing_perl_modules="$missing_perl_modules Cwd"
4993     fi
4994     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4995        missing_perl_modules="$missing_perl_modules Digest::MD5"
4996     fi
4997        AC_MSG_ERROR([
4998     The missing Perl modules are: $missing_perl_modules
4999     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5002 dnl ===================================================================
5003 dnl Check for pkg-config
5004 dnl ===================================================================
5005 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5006     PKG_PROG_PKG_CONFIG
5009 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5011     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5012     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5013     # explicitly. Or put /path/to/compiler in PATH yourself.
5015     AC_CHECK_TOOL(AR,ar)
5016     AC_CHECK_TOOL(NM,nm)
5017     AC_CHECK_TOOL(OBJDUMP,objdump)
5018     AC_CHECK_TOOL(RANLIB,ranlib)
5019     AC_CHECK_TOOL(STRIP,strip)
5020     if test "$_os" = "WINNT"; then
5021         AC_CHECK_TOOL(DLLTOOL,dlltool)
5022         AC_CHECK_TOOL(WINDRES,windres)
5023     fi
5025 AC_SUBST(AR)
5026 AC_SUBST(DLLTOOL)
5027 AC_SUBST(NM)
5028 AC_SUBST(OBJDUMP)
5029 AC_SUBST(PKG_CONFIG)
5030 AC_SUBST(RANLIB)
5031 AC_SUBST(STRIP)
5032 AC_SUBST(WINDRES)
5034 dnl ===================================================================
5035 dnl pkg-config checks on Mac OS X
5036 dnl ===================================================================
5038 if test $_os = Darwin; then
5039     AC_MSG_CHECKING([for bogus pkg-config])
5040     if test -n "$PKG_CONFIG"; then
5041         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5042             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5043         else
5044             if test "$enable_bogus_pkg_config" = "yes"; then
5045                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5046             else
5047                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5048             fi
5049         fi
5050     else
5051         AC_MSG_RESULT([no, good])
5052     fi
5055 find_csc()
5057     # Return value: $csctest
5059     unset csctest
5061     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5062     if test -n "$regvalue"; then
5063         csctest=$regvalue
5064         return
5065     fi
5068 find_al()
5070     # Return value: $altest
5072     unset altest
5074     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5075         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5076         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5077             altest=$regvalue
5078             return
5079         fi
5080     done
5083 find_dotnetsdk()
5085     # Return value: $frametest (that's a silly name...)
5087     unset frametest
5089     for ver in 1.1 2.0; do
5090         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5091         if test -n "$regvalue"; then
5092             frametest=$regvalue
5093             return
5094         fi
5095     done
5098 find_winsdk_version()
5100     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5101     # Return value: $winsdktest
5103     unset winsdktest
5105     # Why we look for them in this particular order I don't know. But OTOH I
5106     case "$1" in
5107     6.0*|7.*)
5108         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5109         if test -n "$regvalue"; then
5110             winsdktest=$regvalue
5111             return
5112         fi
5113         ;;
5114     8.*)
5115         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5116         if test -n "$regvalue"; then
5117             winsdktest=$regvalue
5118             return
5119         fi
5120         ;;
5121     esac
5124 find_winsdk()
5126     # Args: $1 (optional) : list of acceptable SDK versions
5127     # Return value: $winsdktest
5129     unset winsdktest
5131     if test -n "$1"; then
5132         sdkversions=$1
5133     else
5134         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5135     fi
5137     for ver in $sdkversions; do
5138         find_winsdk_version $ver
5139         if test -n "$winsdktest"; then
5140             return
5141         fi
5142     done
5145 find_msms()
5147     for ver in 10.0 11.0; do
5148         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5149         if test -n "$regvalue"; then
5150             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5151                 msmdir=$regvalue
5152                 break
5153             fi
5154         fi
5155     done
5156     if test -z "$msmdir"; then
5157         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "$COMMONPROGRAMFILES\Merge Modules"])
5158         msmdir="$COMMONPROGRAMFILES\Merge Modules"
5159     fi
5160     msmdir=`cygpath -m "$msmdir"`
5161     if test -z "$msmdir"; then
5162         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5163             AC_MSG_ERROR([Merge modules not found in $msmdir])
5164         else
5165             AC_MSG_WARN([Merge modules not found in $msmdir])
5166             msmdir=""
5167         fi
5168     fi
5171 find_msvc_x64_dlls()
5173     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5174     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5175     for dll in $msvcdlls; do
5176         if ! test -f "$msvcdllpath/$dll"; then
5177             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5178         fi
5179     done
5182 if test "$build_os" = "cygwin"; then
5183     dnl Check midl.exe
5184     AC_MSG_CHECKING([for midl.exe])
5186     find_winsdk
5187     if test -f "$winsdktest/Bin/midl.exe"; then
5188         MIDL_PATH="$winsdktest/Bin"
5189     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5190         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5191     fi
5192     if test ! -f "$MIDL_PATH/midl.exe"; then
5193         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5194     else
5195         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5196     fi
5198     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5199     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
5200     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
5202     dnl Check csc.exe
5203     AC_MSG_CHECKING([for csc.exe])
5204     find_csc
5205     if test -f "$csctest/csc.exe"; then
5206         CSC_PATH="$csctest"
5207     fi
5208     if test ! -f "$CSC_PATH/csc.exe"; then
5209         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5210     else
5211         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5212     fi
5214     CSC_PATH=`cygpath -d "$CSC_PATH"`
5215     CSC_PATH=`cygpath -u "$CSC_PATH"`
5217     dnl Check al.exe
5218     AC_MSG_CHECKING([for al.exe])
5219     find_winsdk
5220     if test -f "$winsdktest/Bin/al.exe"; then
5221         AL_PATH="$winsdktest/Bin"
5222     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5223         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5224     fi
5226     if test -z "$AL_PATH"; then
5227         find_al
5228         if test -f "$altest/bin/al.exe"; then
5229             AL_PATH="$altest/bin"
5230         elif test -f "$altest/al.exe"; then
5231             AL_PATH="$altest"
5232         fi
5233     fi
5234     if test ! -f "$AL_PATH/al.exe"; then
5235         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5236     else
5237         AC_MSG_RESULT([$AL_PATH/al.exe])
5238     fi
5240     AL_PATH=`cygpath -d "$AL_PATH"`
5241     AL_PATH=`cygpath -u "$AL_PATH"`
5243     dnl Check mscoree.lib / .NET Framework dir
5244     AC_MSG_CHECKING(.NET Framework)
5245     find_dotnetsdk
5246     if test -f "$frametest/lib/mscoree.lib"; then
5247         DOTNET_FRAMEWORK_HOME="$frametest"
5248     else
5249         find_winsdk
5250         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5251             DOTNET_FRAMEWORK_HOME="$winsdktest"
5252         fi
5253     fi
5255     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5256         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5257     fi
5258     AC_MSG_RESULT(found)
5260     PathFormat "$MIDL_PATH"
5261     MIDL_PATH="$formatted_path"
5263     PathFormat "$AL_PATH"
5264     AL_PATH="$formatted_path"
5266     PathFormat "$DOTNET_FRAMEWORK_HOME"
5267     DOTNET_FRAMEWORK_HOME="$formatted_path"
5269     PathFormat "$CSC_PATH"
5270     CSC_PATH="$formatted_path"
5273 dnl ===================================================================
5274 dnl Check if stdc headers are available excluding MSVC.
5275 dnl ===================================================================
5276 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5277     AC_HEADER_STDC
5280 dnl ===================================================================
5281 dnl Testing for C++ compiler and version...
5282 dnl ===================================================================
5284 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5285     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5286     save_CXXFLAGS=$CXXFLAGS
5287     AC_PROG_CXX
5288     CXXFLAGS=$save_CXXFLAGS
5289 else
5290     if test -n "$CC" -a -z "$CXX"; then
5291         CXX="$CC"
5292     fi
5295 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
5296 if test "$GXX" = "yes"; then
5297     AC_MSG_CHECKING([the GNU C++ compiler version])
5299     _gpp_version=`$CXX -dumpversion`
5300     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5302     AC_MSG_RESULT([checked (g++ $_gpp_version)])
5304     if test "$_gpp_majmin" = "304"; then
5305         AC_MSG_CHECKING([whether $CXX has the enum bug])
5306         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5307             extern "C" void abort (void);
5308             extern "C" void exit (int status);
5310             enum E { E0, E1, E2, E3, E4, E5 };
5312             void test (enum E e)
5313             {
5314                 if (e == E2 || e == E3 || e == E1)
5315                     exit (1);
5316             }
5318             int main (void)
5319             {
5320                 test (E4);
5321                 test (E5);
5322                 test (E0);
5323                 return 0;
5324             }
5325             ]])],[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])],[])
5326     fi
5327     dnl see https://code.google.com/p/android/issues/detail?id=41770
5328     if test "$_gpp_majmin" -ge "407"; then
5329             glibcxx_threads=no
5330             AC_LANG_PUSH([C++])
5331             AC_REQUIRE_CPP
5332             AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5333             AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5334                 #include <bits/c++config.h>]],[[
5335                 #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5336                 && !defined(_GLIBCXX__PTHREADS) \
5337                 && !defined(_GLIBCXX_HAS_GTHREADS)
5338                 choke me
5339                 #endif
5340             ]])],[AC_MSG_RESULT([yes])
5341             glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5342             AC_LANG_POP([C++])
5343             if test $glibcxx_threads = yes; then
5344                   BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5345             fi
5346      fi
5348 AC_SUBST(BOOST_CXXFLAGS)
5351 # prefx CXX with ccache if needed
5353 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5354     if test "$CCACHE" != ""; then
5355         AC_MSG_CHECKING([whether $CXX is already ccached])
5356         AC_LANG_PUSH([C++])
5357         save_CXXFLAGS=$CXXFLAGS
5358         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5359         dnl an empty program will do, we're checking the compiler flags
5360         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5361                           [use_ccache=yes], [use_ccache=no])
5362         if test $use_ccache = yes; then
5363             AC_MSG_RESULT([yes])
5364         else
5365             CXX="$CCACHE $CXX"
5366             AC_MSG_RESULT([no])
5367         fi
5368         CXXFLAGS=$save_CXXFLAGS
5369         AC_LANG_POP([C++])
5370     fi
5373 dnl ===================================================================
5374 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5375 dnl ===================================================================
5377 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5378     AC_PROG_CXXCPP
5380     dnl Check whether there's a C pre-processor.
5381     dnl ===================================================================
5382     dnl When using SunStudio compiler, there is a bug with the cc
5383     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5384     dnl See Issuezilla #445.
5385     dnl ===================================================================
5386     if test "$_os" = "SunOS"; then
5387         CPP=$CXXCPP
5388     else
5389         AC_PROG_CPP
5390     fi
5394 dnl ===================================================================
5395 dnl Find integral type sizes and alignments
5396 dnl ===================================================================
5398 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5400     AC_CHECK_SIZEOF(long)
5401     AC_CHECK_SIZEOF(short)
5402     AC_CHECK_SIZEOF(int)
5403     AC_CHECK_SIZEOF(long long)
5404     AC_CHECK_SIZEOF(double)
5405     AC_CHECK_SIZEOF(void*)
5407     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5408     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5409     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5410     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5411     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5413     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5414     m4_pattern_allow([AC_CHECK_ALIGNOF])
5415     m4_ifdef([AC_CHECK_ALIGNOF],
5416         [
5417             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5418             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5419             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5420             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5421         ],
5422         [
5423             case "$_os-$host_cpu" in
5424             Linux-i686)
5425                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5426                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5427                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5428                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5429                 ;;
5430             Linux-x86_64)
5431                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5432                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5433                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5434                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5435                 ;;
5436             *)
5437                 if test -z "$ac_cv_alignof_short" -o \
5438                         -z "$ac_cv_alignof_int" -o \
5439                         -z "$ac_cv_alignof_long" -o \
5440                         -z "$ac_cv_alignof_double"; then
5441                    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.])
5442                 fi
5443                 ;;
5444             esac
5445         ])
5447     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5448     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5449     if test $ac_cv_sizeof_long -eq 8; then
5450         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5451     elif test $ac_cv_sizeof_double -eq 8; then
5452         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5453     else
5454         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5455     fi
5457     dnl Check for large file support
5458     AC_SYS_LARGEFILE
5459     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5460         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5461     fi
5462     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5463         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5464     fi
5465 else
5466     # Hardcode for MSVC
5467     SAL_TYPES_SIZEOFSHORT=2
5468     SAL_TYPES_SIZEOFINT=4
5469     SAL_TYPES_SIZEOFLONG=4
5470     SAL_TYPES_SIZEOFLONGLONG=8
5471     if test "$BITNESS_OVERRIDE" = ""; then
5472         SAL_TYPES_SIZEOFPOINTER=4
5473     else
5474         SAL_TYPES_SIZEOFPOINTER=8
5475     fi
5476     SAL_TYPES_ALIGNMENT2=2
5477     SAL_TYPES_ALIGNMENT4=4
5478     SAL_TYPES_ALIGNMENT8=8
5479     LFS_CFLAGS=''
5481 AC_SUBST(LFS_CFLAGS)
5483 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5484 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5485 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5486 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5487 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5488 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5489 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5490 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5492 dnl ===================================================================
5493 dnl Check if valgrind headers are available
5494 dnl ===================================================================
5495 ENABLE_VALGRIND=
5496 if test "$cross_compiling" != yes; then
5497     prev_cppflags=$CPPFLAGS
5498     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5499     # or where does it come from?
5500     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5501     AC_CHECK_HEADER([valgrind/valgrind.h],
5502         [ENABLE_VALGRIND=TRUE])
5503     CPPFLAGS=$prev_cppflags
5505 AC_SUBST([ENABLE_VALGRIND])
5506 if test -z "$ENABLE_VALGRIND"; then
5507     VALGRIND_CFLAGS=
5509 AC_SUBST([VALGRIND_CFLAGS])
5512 dnl ===================================================================
5513 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5514 dnl ===================================================================
5516 # We need at least the sys/sdt.h include header.
5517 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5518 if test "$SDT_H_FOUND" = "TRUE"; then
5519   # Found sys/sdt.h header, now make sure the c++ compiler works.
5520   # Old g++ versions had problems with probes in constructors/destructors.
5521   AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5522   AC_LANG_PUSH([C++])
5523   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5524     #include <sys/sdt.h>
5525     class ProbeClass
5526     {
5527     private:
5528       int& ref;
5529       const char *name;
5531     public:
5532       ProbeClass(int& v, const char *n) : ref(v), name(n)
5533       {
5534         DTRACE_PROBE2(_test_, cons, name, ref);
5535       }
5537       void method(int min)
5538       {
5539         DTRACE_PROBE3(_test_, meth, name, ref, min);
5540         ref -= min;
5541       }
5543       ~ProbeClass()
5544       {
5545         DTRACE_PROBE2(_test_, dest, name, ref);
5546       }
5547     };
5548   ]],[[
5549     int i = 64;
5550     DTRACE_PROBE1(_test_, call, i);
5551     ProbeClass inst = ProbeClass(i, "call");
5552     inst.method(24);
5553   ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5554         [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5555   AC_LANG_POP([C++])
5557 AC_CONFIG_HEADERS([config_host/config_probes.h])
5559 dnl ===================================================================
5560 dnl Compiler plugins
5561 dnl ===================================================================
5563 COMPILER_PLUGINS=
5564 # currently only Clang
5565 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
5566     if test -n "$enable_compiler_plugins"; then
5567         compiler_plugins="$enable_compiler_plugins"
5568     elif test -n "$ENABLE_DBGUTIL"; then
5569         compiler_plugins=test
5570     else
5571         compiler_plugins=no
5572     fi
5573     if test "$compiler_plugins" != "no"; then
5574         dnl The prefix where Clang resides, override to where Clang resides if
5575         dnl using a source build:
5576         if test -z "$CLANGDIR"; then
5577             CLANGDIR=/usr
5578         fi
5579         dnl The build directory (different from CLANGDIR if using a Clang out-
5580         dnl of-source build):
5581         if test -z "$CLANGBUILD"; then
5582             CLANGBUILD=/usr
5583         fi
5584         AC_LANG_PUSH([C++])
5585         save_CPPFLAGS=$CPPFLAGS
5586         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"
5587         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
5588             [COMPILER_PLUGINS=TRUE],
5589             [
5590             if test "$compiler_plugins" = "yes"; then
5591                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
5592             else
5593                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
5594                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
5595             fi
5596             ])
5597         CPPFLAGS=$save_CPPFLAGS
5598         AC_LANG_POP([C++])
5599     fi
5600 else
5601     if test "$enable_compiler_plugins" = "yes"; then
5602         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
5603     fi
5605 AC_SUBST(COMPILER_PLUGINS)
5606 AC_SUBST(CLANGDIR)
5607 AC_SUBST(CLANGBUILD)
5609 dnl ===================================================================
5610 dnl Set the MinGW sys-root
5611 dnl ===================================================================
5612 if test "$WITH_MINGW" = "yes"; then
5613     AC_MSG_CHECKING([for MinGW sysroot])
5614     sysroot=`$CC -print-sysroot`
5615     AS_IF([test -d "$sysroot"/mingw],
5616           [MINGW_SYSROOT="$sysroot"/mingw
5617            AC_MSG_RESULT([$MINGW_SYSROOT])],
5618           [AC_MSG_RESULT([not found])
5619            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5621 AC_SUBST([MINGW_DLLS])
5622 AC_SUBST([MINGW_SYSROOT])
5624 dnl ===================================================================
5625 dnl Set the MinGW include directories
5626 dnl ===================================================================
5627 if test "$WITH_MINGW" = "yes"; then
5628     AC_MSG_CHECKING([for MinGW include path])
5629     cat >conftest.$ac_ext <<_ACEOF
5630 #include <stddef.h>
5631 #include <bits/c++config.h>
5632 _ACEOF
5633     _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`
5634     rm conftest.$ac_ext
5635     if test -z "$_mingw_lib_include_path"; then
5636         _mingw_lib_include_path="NO_LIB_INCLUDE"
5637         AC_MSG_RESULT([no MinGW include path])
5638     else
5639         AC_MSG_RESULT([$_mingw_lib_include_path])
5640     fi
5641     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5642     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5644     AC_LANG_PUSH([C++])
5646     AC_MSG_CHECKING([for dynamic libgcc])
5647     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5648 #include <iostream>
5649 using namespace std;
5650 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5651             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5652             if test -n "$MINGW_GCCDLL"; then
5653                 MINGW_SHARED_GCCLIB=YES
5654                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5655             else
5656                 MINGW_SHARED_GCCLIB=NO
5657                 AC_MSG_RESULT([no])
5658             fi
5659        ],[ AC_MSG_RESULT([no])
5661     ])
5663     AC_MSG_CHECKING([for dynamic libstdc++])
5664     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5665 #include <iostream>
5666 using namespace std;
5667 ]], [[ cout << "Hello there." << endl; ]])],[
5668             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5669             if test -n "$MINGW_GXXDLL"; then
5670                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5671                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5672                 if test "$CROSS_COMPILING" = "YES"; then
5673                     dnl m4 escaping!
5674                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5675                 fi
5676                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5677                 MINGW_SHARED_GXXLIB=YES
5678                 AC_MSG_RESULT([$MINGW_GXXDLL])
5679             else
5680                 MINGW_SHARED_GXXLIB=NO
5681                 AC_MSG_RESULT([no])
5682             fi
5683        ],[ AC_MSG_RESULT([no])
5685     ])
5687     AC_LANG_POP([C++])
5689     AC_SUBST(MINGW_SHARED_GCCLIB)
5690     AC_SUBST(MINGW_SHARED_GXXLIB)
5691     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5692     AC_SUBST(MINGW_GCCDLL)
5693     AC_SUBST(MINGW_GXXDLL)
5696 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5697     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5700 if test "$WITH_MINGW" = "yes"; then
5701     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5702     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5703     [
5704     #include <usp10.h>
5705     ],
5706     [
5707     SCRIPT_CONTROL c;
5708     c.fMergeNeutralItems = 1;
5709     ])],
5710     [
5711     AC_MSG_RESULT(yes)
5712     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5713     ],
5714     [AC_MSG_RESULT(no)])
5717 dnl ===================================================================
5718 dnl Extra checking for the SunOS compiler
5719 dnl ===================================================================
5720 if test "$_os" = "SunOS"; then
5721     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5722     if test "$CC" = "cc"; then
5723     AC_MSG_CHECKING([SunStudio C++ Compiler])
5724         if test "$CXX" != "CC"; then
5725             AC_MSG_WARN([SunStudio C++ was not found])
5726             add_warning "SunStudio C++ was not found"
5727         else
5728             AC_MSG_RESULT([checked])
5729         fi
5730     fi
5733 dnl *************************************************************
5734 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5735 dnl *************************************************************
5736 if test "$WITH_MINGW" = "yes"; then
5737     AC_MSG_CHECKING([exception type])
5738     AC_LANG_PUSH([C++])
5739     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5741         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5743         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5744     ])
5745     AC_MSG_RESULT($exceptions_type)
5746     AC_LANG_POP([C++])
5749 EXCEPTIONS="$exceptions_type"
5750 AC_SUBST(EXCEPTIONS)
5752 dnl ===================================================================
5753 dnl thread-safe statics
5754 dnl ===================================================================
5755 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5756 unset HAVE_THREADSAFE_STATICS
5757 if test "$GCC" = "yes"; then
5758     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5759     dnl us.  However, some C++ runtimes use a single lock for all static
5760     dnl variables, which can cause deadlock in multi-threaded applications.
5761     dnl This is not easily tested here; for POSIX-based systems, if executing
5762     dnl the following C++ program does not terminate then the tool chain
5763     dnl apparently has this problem:
5764     dnl
5765     dnl   #include <pthread.h>
5766     dnl   int h() { return 0; }
5767     dnl   void * g(void * unused) {
5768     dnl     static int n = h();
5769     dnl     return &n;
5770     dnl   }
5771     dnl   int f() {
5772     dnl     pthread_t t;
5773     dnl     pthread_create(&t, 0, g, 0);
5774     dnl     pthread_join(t, 0);
5775     dnl     return 0;
5776     dnl   }
5777     dnl   int main() {
5778     dnl     static int n = f();
5779     dnl     return n;
5780     dnl   }
5781     dnl
5782     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5783     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5784     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5785     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5786     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5787     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5788     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5789     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5790     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5791     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5792     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5793     dnl "too old"):
5794     if test "$_os" != Darwin -a "$_os" != Android; then
5795         if test "$COM_GCC_IS_CLANG" = TRUE; then
5796             AC_LANG_PUSH([C++])
5797             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5798 #include <list>
5799 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5800 #error
5801 #endif
5802                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5803             AC_LANG_POP([C++])
5804         elif test "${GCC_VERSION?}" -ge 0403; then
5805             HAVE_THREADSAFE_STATICS=TRUE
5806         fi
5807     fi
5808     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5809         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5810         AC_MSG_RESULT([yes])
5811     else
5812         AC_MSG_RESULT([broken (i.e., no)])
5813     fi
5814 else
5815     AC_MSG_RESULT([unknown (assuming no)])
5817 AC_SUBST(HAVE_THREADSAFE_STATICS)
5819 dnl ===================================================================
5820 dnl visibility and other gcc features
5821 dnl ===================================================================
5822 if test "$GCC" = "yes"; then
5823     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5824     save_CFLAGS=$CFLAGS
5825     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5826     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5827     CFLAGS=$save_CFLAGS
5829     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5830         AC_MSG_RESULT([yes])
5831     else
5832         AC_MSG_RESULT([no])
5833     fi
5835     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5836     save_CFLAGS=$CFLAGS
5837     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5838     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5839     CFLAGS=$save_CFLAGS
5840     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5841         AC_MSG_RESULT([yes])
5842     else
5843         AC_MSG_RESULT([no])
5844     fi
5846     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5847     save_CFLAGS=$CFLAGS
5848     CFLAGS="$CFLAGS -Werror -mno-avx"
5849     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5850     CFLAGS=$save_CFLAGS
5851     if test "$HAVE_GCC_AVX" = "TRUE"; then
5852         AC_MSG_RESULT([yes])
5853     else
5854         AC_MSG_RESULT([no])
5855     fi
5857     AC_MSG_CHECKING([whether $CC supports atomic functions])
5858     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5859     int v = 0;
5860     if (__sync_add_and_fetch(&v, 1) != 1 ||
5861         __sync_sub_and_fetch(&v, 1) != 0)
5862         return 1;
5863     __sync_synchronize();
5864     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5865         v != 1)
5866         return 1;
5867     return 0;
5868 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5869     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5870         AC_MSG_RESULT([yes])
5871         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5872     else
5873         AC_MSG_RESULT([no])
5874     fi
5876     AC_MSG_CHECKING(
5877         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5878     save_CFLAGS=$CFLAGS
5879     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5880     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5881             #pragma GCC diagnostic ignored "-Wunused-parameter"
5882             void dummy(int n) {}
5883         ])], [
5884             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
5885             AC_MSG_RESULT([yes])
5886         ], [AC_MSG_RESULT([no])])
5887     CFLAGS=$save_CFLAGS
5889     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
5890     save_CFLAGS=$CFLAGS
5891     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5892     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5893             #pragma GCC diagnostic push
5894             #pragma GCC diagnostic ignored "-Wunused-parameter"
5895             void dummy(int n) {}
5896             #pragma GCC diagnostic pop
5897         ])], [
5898             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
5899             AC_MSG_RESULT([yes])
5900         ], [AC_MSG_RESULT([no])])
5901     CFLAGS=$save_CFLAGS
5903     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5904     save_CFLAGS=$CFLAGS
5905     CFLAGS="$CFLAGS -Werror"
5906     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5907             __attribute__((deprecated("test"))) void f();
5908         ])], [
5909             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5910             AC_MSG_RESULT([yes])
5911         ], [AC_MSG_RESULT([no])])
5912     CFLAGS=$save_CFLAGS
5914     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5915     AC_LANG_PUSH([C++])
5916     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5917             #include <cxxabi.h>
5918             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5919         ])], [
5920             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5921             AC_MSG_RESULT([yes])
5922         ], [AC_MSG_RESULT([no])])
5923     AC_LANG_POP([C++])
5925     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5926     AC_LANG_PUSH([C++])
5927     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5928             #include <cxxabi.h>
5929             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5930         ])], [
5931             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
5932             AC_MSG_RESULT([yes])
5933         ], [AC_MSG_RESULT([no])])
5934     AC_LANG_POP([C++])
5936     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5937     AC_LANG_PUSH([C++])
5938     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5939             #include <cxxabi.h>
5940             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5941         ])], [
5942             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
5943             AC_MSG_RESULT([yes])
5944         ], [AC_MSG_RESULT([no])])
5945     AC_LANG_POP([C++])
5947     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5948     AC_LANG_PUSH([C++])
5949     save_CXXFLAGS=$CXXFLAGS
5950     CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
5951     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5952             struct __attribute__((warn_unused)) dummy {};
5953         ])], [
5954             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5955             AC_MSG_RESULT([yes])
5956         ], [AC_MSG_RESULT([no])])
5957     CXXFLAGS=$save_CXXFLAGS
5958     AC_LANG_POP([C++])
5960     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
5961     AC_LANG_PUSH([C++])
5962     save_CXXFLAGS=$CXXFLAGS
5963     CXXFLAGS="$CFLAGS -Werror -Wunused"
5964     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5965             #include <string>
5966             void f() { std::string s; }
5967         ])], [
5968             AC_MSG_RESULT([no])
5969         ], [
5970             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
5971             AC_MSG_RESULT([yes])])
5972     CXXFLAGS=$save_CXXFLAGS
5973     AC_LANG_POP([C++])
5976 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
5977 AC_SUBST(HAVE_GCC_AVX)
5978 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5980 dnl ===================================================================
5981 dnl Identify the C++ library
5982 dnl ===================================================================
5984 AC_MSG_CHECKING([What the C++ library is])
5985 AC_LANG_PUSH([C++])
5986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5987 #include <utility>
5988 #ifndef __GLIBCXX__
5989 foo bar
5990 #endif
5991 ]])],
5992     [CPP_LIBRARY=GLIBCXX
5993      cpp_library_name="GNU libstdc++"
5994     ],
5995     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5996 #include <utility>
5997 #ifndef _LIBCPP_VERSION
5998 foo bar
5999 #endif
6000 ]])],
6001     [CPP_LIBRARY=LIBCPP
6002      cpp_library_name="LLVM libc++"
6003     ],
6004     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6005 #include <utility>
6006 #ifndef _MSC_VER
6007 foo bar
6008 #endif
6009 ]])],
6010     [CPP_LIBRARY=MSVCRT
6011      cpp_library_name="Microsoft"
6012     ],
6013     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6014 AC_MSG_RESULT([$cpp_library_name])
6015 AC_LANG_POP([C++])
6016 AC_SUBST(CPP_LIBRARY)
6018 dnl ===================================================================
6019 dnl C++11
6020 dnl ===================================================================
6022 CXXFLAGS_CXX11=
6023 HAVE_CXX11=
6024 if test "$COM" = MSC; then
6025     AC_MSG_CHECKING([whether $CXX supports C++11])
6026     AC_MSG_RESULT(yes)
6027     # MSVC supports (a subset of) CXX11 without any switch
6028     HAVE_CXX11=TRUE
6029     CXXFLAGS_CXX11=
6030 elif test "$GCC" = "yes"; then
6031     CXXFLAGS_CXX11=
6032     AC_MSG_CHECKING([whether $CXX supports C++11])
6033     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6034         save_CXXFLAGS=$CXXFLAGS
6035         CXXFLAGS="$CXXFLAGS $flag -Werror"
6036         AC_LANG_PUSH([C++])
6037         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6038         AC_LANG_POP([C++])
6039         CXXFLAGS=$save_CXXFLAGS
6040         if test -n "$CXXFLAGS_CXX11"; then
6041             HAVE_CXX11=TRUE
6042             break
6043         fi
6044     done
6045     if test "$HAVE_CXX11" = TRUE; then
6046         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6047     else
6048         AC_MSG_RESULT(no)
6049     fi
6052 if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then
6053     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6054     AC_LANG_PUSH([C++])
6055     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6056 #include <list>
6057 #if !defined(__GLIBCXX__)
6058 /* ok */
6059 #elif __GLIBCXX__ < 20111004
6060 /* before breakage */
6061 #elif __GLIBCXX__ > 20120703
6062 /* after breakage */
6063 #else
6064 abi broken
6065 #endif
6066         ]])], [AC_MSG_RESULT(no, ok)],
6067         [AC_MSG_RESULT(yes, disabling C++11)
6068          HAVE_CXX11=])
6069     AC_LANG_POP([C++])
6072 if test "$HAVE_CXX11" = TRUE; then
6073     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6074     save_CXXFLAGS=$CXXFLAGS
6075     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6076     AC_LANG_PUSH([C++])
6078     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6079 #include <stddef.h>
6081 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6083 namespace
6085         struct b
6086         {
6087                 int i;
6088                 int j;
6089         };
6091 ]], [[
6092 struct a
6094         int i;
6095         int j;
6097 a thinga[]={{0,0}, {1,1}};
6098 b thingb[]={{0,0}, {1,1}};
6099 size_t i = sizeof(sal_n_array_size(thinga));
6100 size_t j = sizeof(sal_n_array_size(thingb));
6101 return !(i != 0 && j != 0);
6103         ], [ AC_MSG_RESULT(yes) ],
6104         [ AC_MSG_RESULT(no)
6105           HAVE_CXX11=
6106         ])
6107     AC_LANG_POP([C++])
6108     CXXFLAGS=$save_CXXFLAGS
6111 if test "$HAVE_CXX11" = TRUE; then
6112     AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6113     save_CXXFLAGS=$CXXFLAGS
6114     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6115     AC_LANG_PUSH([C++])
6117     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6118 #include <vector>
6119     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6120     // (__float128)
6122     ],[ AC_MSG_RESULT(yes) ],
6123     [
6124         AC_MSG_RESULT(no)
6125         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6126         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6127         # __float128 is available during its build, but it's usually built using GCC,
6128         # and so c++config.h hardcodes __float128 being supported). As the only place
6129         # where __float128 is actually used is in a template specialization,
6130         # -D__float128=void will avoid the problem there while still causing a problem
6131         # if somebody actually uses the type.
6132         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6133         CXXFLAGS="$CXXFLAGS -D__float128=void"
6134         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6135 #include <vector>
6136     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6137     // (__float128)
6139         ],
6140         [
6141          AC_MSG_RESULT(yes)
6142          CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6143         ],
6144         [
6145          AC_MSG_RESULT(no)
6146          HAVE_CXX11=
6147         ])
6148     ])
6150     AC_LANG_POP([C++])
6151     CXXFLAGS=$save_CXXFLAGS
6154 if test "$HAVE_CXX11" = "TRUE"; then
6155     AC_DEFINE(HAVE_CXX11)
6156 elif test -n "$CXXFLAGS_CXX11"; then
6157     AC_MSG_NOTICE([Disabling C++11 support])
6158     CXXFLAGS_CXX11=
6159 elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
6160     AC_MSG_ERROR([Selected libc++ but C++11 support broken])
6163 AC_SUBST(CXXFLAGS_CXX11)
6164 AC_SUBST(HAVE_CXX11)
6166 dnl ==================================
6167 dnl Check for C++11 "= delete" support
6168 dnl ==================================
6170 if test "$HAVE_CXX11" = "TRUE"; then
6171     AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6172     save_CXXFLAGS=$CXXFLAGS
6173     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6174     AC_LANG_PUSH([C++])
6175     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6176 struct A
6177     {
6178     void test() = delete;
6179     };
6180 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6182     AC_LANG_POP([C++])
6183     CXXFLAGS=$save_CXXFLAGS
6184     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6185         AC_MSG_RESULT([yes])
6186         AC_DEFINE([HAVE_CXX11_DELETE])
6187     else
6188         AC_MSG_RESULT([no])
6189     fi
6192 dnl ==================================
6193 dnl Check for C++11 "override" support
6194 dnl ==================================
6196 if test "$HAVE_CXX11" = "TRUE"; then
6197     AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6198     save_CXXFLAGS=$CXXFLAGS
6199     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6200     AC_LANG_PUSH([C++])
6201     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6202 struct A
6204         virtual void test();
6207 struct B : A
6209         virtual void test() override;
6211 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6213     AC_LANG_POP([C++])
6214     CXXFLAGS=$save_CXXFLAGS
6215     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6216         AC_MSG_RESULT([yes])
6217         AC_DEFINE([HAVE_CXX11_OVERRIDE])
6218     else
6219         AC_MSG_RESULT([no])
6220     fi
6223 dnl ==================================
6224 dnl Check for C++11 "final" support
6225 dnl ==================================
6227 if test "$HAVE_CXX11" = "TRUE"; then
6228     AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6229     save_CXXFLAGS=$CXXFLAGS
6230     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6231     AC_LANG_PUSH([C++])
6232     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6233 // First check that this correct program that uses "final" compiles
6234 struct A final
6238 struct B
6240         virtual void test();
6243 struct C : B
6245         void test() final;
6247 ]])],[have_final=yes],[])
6249     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6250 // Then check that the "final" works as expected,
6251 // that this program fails to compile
6252 struct A final
6256 struct B : A
6259 ]])],[],[final_class_works=yes])
6261     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6262 // Also this should fail to compile
6263 struct B
6265         virtual void test();
6268 struct C : B
6270         void test() final;
6273 struct D : C
6275         void test();
6277 ]])],[],[final_method_works=yes])
6278     AC_LANG_POP([C++])
6280     CXXFLAGS=$save_CXXFLAGS
6282     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6283         AC_MSG_RESULT([yes])
6284         AC_DEFINE([HAVE_CXX11_FINAL])
6285     else
6286         AC_MSG_RESULT([no])
6287     fi
6290 dnl ===================================================================
6291 dnl Check for C++11 perfect forwarding support
6292 dnl ===================================================================
6293 if test "$HAVE_CXX11" = "TRUE"; then
6294     AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6295     save_CXXFLAGS=$CXXFLAGS
6296     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6297     AC_LANG_PUSH([C++])
6298     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6299         #include <utility>
6300         template<typename T, typename... Args> T * f(Args &&... v) {
6301             return new T(std::forward<Args>(v)...);
6302         }
6303         ]], [[
6304         f<int>(0);
6305         ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6306     AC_LANG_POP([C++])
6307     CXXFLAGS=$save_CXXFLAGS
6308     AC_MSG_RESULT([$perfect_forwarding])
6309     if test "$perfect_forwarding" = yes; then
6310         AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6311     fi
6314 HAVE_GCC_PRAGMA_OPERATOR=
6315 dnl _Pragma support (may require C++11)
6316 if test "$GCC" = "yes"; then
6317     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6318     AC_LANG_PUSH([C++])
6319     save_CXXFLAGS=$CXXFLAGS
6320     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6321     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6322             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6323         ])], [
6324             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6325             HAVE_GCC_PRAGMA_OPERATOR=1
6326             AC_MSG_RESULT([yes])
6327         ], [AC_MSG_RESULT([no])])
6328     AC_LANG_POP([C++])
6329     CXXFLAGS=$save_CXXFLAGS
6331 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6333 dnl ===================================================================
6334 dnl system stl sanity tests
6335 dnl ===================================================================
6336 HAVE_GCC_VISIBILITY_BROKEN=
6337 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6339     AC_LANG_PUSH([C++])
6341     save_CPPFLAGS="$CPPFLAGS"
6342     if test -n "$MACOSX_SDK_PATH"; then
6343         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6344     fi
6346     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6347     # only.
6348     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6349         dnl gcc#19664, gcc#22482, rhbz#162935
6350         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6351         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6352         AC_MSG_RESULT([$stlvisok])
6353         if test "$stlvisok" = "no"; then
6354             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6355             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6356             unset HAVE_GCC_VISIBILITY_FEATURE
6357         fi
6358     fi
6360     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6361         sharedlink_ldflags_save=$LDFLAGS
6362         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6364         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6365         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6366 #include <sstream>
6367 using namespace std;
6368             ]], [[
6369 istringstream strm( "test" ); return 0;
6370             ]])],
6371             # Ugh, surely bad to assume an error message will contain
6372             # the word "unresolvable", a problem with
6373             # -fvisibility-inlines-hidden and STL headers might cause
6374             # some more obscure message on some platform, and anway,
6375             # the error message could be localised.
6376             [$EGREP -q unresolvable conftest.err;
6377             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6378         ])
6379         AC_MSG_RESULT([$gccvisok])
6380         if test "$gccvisok" = "no"; then
6381             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6382             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6383             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6384         fi
6386         LDFLAGS=$sharedlink_ldflags_save
6387     fi
6389     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6390     # when we don't make any dynamic libraries?
6391     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6392         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6393         cat > conftestlib1.cc <<_ACEOF
6394 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6395 struct S2: S1<int> { virtual ~S2(); };
6396 S2::~S2() {}
6397 _ACEOF
6398         cat > conftestlib2.cc <<_ACEOF
6399 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6400 struct S2: S1<int> { virtual ~S2(); };
6401 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6402 _ACEOF
6403         gccvisinlineshiddenok=yes
6404         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6405             gccvisinlineshiddenok=no
6406         else
6407             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $LINKFLAGSNOUNDEFS -o libconftest2$DLLPOST >/dev/null 2>&5; then
6408                 gccvisinlineshiddenok=no
6409             fi
6410         fi
6412         rm -fr libconftest*
6413         AC_MSG_RESULT([$gccvisinlineshiddenok])
6414         if test "$gccvisinlineshiddenok" = "no"; then
6415             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6416             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6417             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6418         fi
6419     fi
6421     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6422         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6423         cat >visibility.cxx <<_ACEOF
6424 #pragma GCC visibility push(hidden)
6425 struct __attribute__ ((visibility ("default"))) TestStruct {
6426   static void Init();
6428 __attribute__ ((visibility ("default"))) void TestFunc() {
6429   TestStruct::Init();
6431 _ACEOF
6432         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6433             gccvisbroken=yes
6434         else
6435             case "$host_cpu" in
6436             i?86|x86_64)
6437                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6438                     gccvisbroken=no
6439                 else
6440                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6441                         gccvisbroken=no
6442                     else
6443                         gccvisbroken=yes
6444                     fi
6445                 fi
6446                 ;;
6447             *)
6448                 gccvisbroken=no
6449                 ;;
6450             esac
6451         fi
6452         rm -f visibility.s visibility.cxx
6454         AC_MSG_RESULT([$gccvisbroken])
6455         if test "$gccvisbroken" = "yes"; then
6456             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6457             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6458             unset HAVE_GCC_VISIBILITY_FEATURE
6459         fi
6460     fi
6462     CPPFLAGS="$save_CPPFLAGS"
6464     AC_LANG_POP([C++])
6467 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6468 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6470 dnl ===================================================================
6471 dnl  Clang++ tests
6472 dnl ===================================================================
6474 HAVE_GCC_FNO_DEFAULT_INLINE=
6475 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6476 if test "$GCC" = "yes"; then
6477     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6478     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6479         # Option just ignored and silly warning that isn't a real
6480         # warning printed
6481         :
6482     else
6483         AC_LANG_PUSH([C++])
6484         save_CXXFLAGS=$CXXFLAGS
6485         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6486         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6487         CXXFLAGS=$save_CXXFLAGS
6488         AC_LANG_POP([C++])
6489     fi
6490     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6491         AC_MSG_RESULT([yes])
6492     else
6493         AC_MSG_RESULT([no])
6494     fi
6496     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6497     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6498         # As above
6499         :
6500     else
6501         AC_LANG_PUSH([C++])
6502         save_CXXFLAGS=$CXXFLAGS
6503         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6504         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6505         CXXFLAGS=$save_CXXFLAGS
6506         AC_LANG_POP([C++])
6507     fi
6508     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6509         AC_MSG_RESULT([yes])
6510     else
6511         AC_MSG_RESULT([no])
6512     fi
6514 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6515 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6518 dnl ===================================================================
6519 dnl allocator
6520 dnl ===================================================================
6521 AC_MSG_CHECKING([which memory allocator to use])
6522 if test "$with_alloc" = "system"; then
6523     AC_MSG_RESULT([system])
6524     ALLOC="SYS_ALLOC"
6525     AC_CHECK_FUNCS([malloc realloc calloc free])
6527 if test "$with_alloc" = "tcmalloc"; then
6528     AC_MSG_RESULT(tcmalloc)
6529     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6530         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6531     fi
6532     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6533         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6534     ALLOC="TCMALLOC"
6536 if test "$with_alloc" = "jemalloc"; then
6537     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6538         AC_MSG_RESULT(jemalloc)
6539         save_CFLAGS=$CFLAGS
6540         CFLAGS="$CFLAGS -pthread"
6541         AC_CHECK_LIB([jemalloc], [malloc], [:],
6542             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6543         ALLOC="JEMALLOC"
6544         CFLAGS=$save_CFLAGS
6545     else
6546         AC_MSG_RESULT([system])
6547         ALLOC="SYS_ALLOC"
6548         AC_CHECK_FUNCS([malloc realloc calloc free])
6549     fi
6551 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6552     AC_MSG_RESULT([internal])
6554 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6555 AC_SUBST(HAVE_POSIX_FALLOCATE)
6556 AC_SUBST(ALLOC)
6558 dnl ===================================================================
6559 dnl Custom build version
6560 dnl ===================================================================
6562 AC_MSG_CHECKING([whether to add custom build version])
6563 if test "$with_build_version" != ""; then
6564     BUILD_VER_STRING=$with_build_version
6565     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6566 else
6567     BUILD_VER_STRING=
6568     AC_MSG_RESULT([no])
6570 AC_SUBST(BUILD_VER_STRING)
6572 JITC_PROCESSOR_TYPE=""
6573 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6574     # IBMs JDK needs this...
6575     JITC_PROCESSOR_TYPE=6
6576     export JITC_PROCESSOR_TYPE
6578 AC_SUBST([JITC_PROCESSOR_TYPE])
6580 # Misc Windows Stuff
6581 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6582     find_msvc_x64_dlls
6583     find_msms
6584     MSVC_DLL_PATH="$msvcdllpath"
6585     MSVC_DLLS="$msvcdlls"
6586     MSM_PATH="$msmdir"
6587     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6590 AC_SUBST(MSVC_DLL_PATH)
6591 AC_SUBST(MSVC_DLLS)
6592 AC_SUBST(MSM_PATH)
6594 dnl ===================================================================
6595 dnl Checks for Java
6596 dnl ===================================================================
6597 if test "$ENABLE_JAVA" != ""; then
6599     # Windows-specific tests
6600     if test "$build_os" = "cygwin"; then
6601         if test "$BITNESS_OVERRIDE" = 64; then
6602             bitness=64
6603         else
6604             bitness=32
6605         fi
6607         if test -z "$with_jdk_home"; then
6608             for ver in 1.7 1.6; do
6609                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6610                if test -n "$regvalue"; then
6611                    _jdk_home=$regvalue
6612                    break
6613                fi
6614             done
6615             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6616                 with_jdk_home="$_jdk_home"
6617                 howfound="found automatically"
6618             else
6619                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6620             fi
6621         else
6622             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6623             howfound="you passed"
6624         fi
6625     fi
6627     JAVA_HOME=; export JAVA_HOME
6628     if test -z "$with_jdk_home"; then
6629         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6630     else
6631         _java_path="$with_jdk_home/bin/$with_java"
6632         dnl Check if there is a Java interpreter at all.
6633         if test -x "$_java_path"; then
6634             JAVAINTERPRETER=$_java_path
6635         else
6636             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6637         fi
6638     fi
6640     if test "$build_os" = "cygwin"; then
6641         # Check that the JDK found is correct architecture
6642         # Why is this necessary, we don't link with any library from the JDK I think,
6644         shortjdkhome=`cygpath -d "$with_jdk_home"`
6645         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
6646             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6647             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6648         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
6649             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6650             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6651         fi
6653         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6654             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6655         fi
6656         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6657         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6658     elif test $_os = Darwin -a "$BITNESS_OVERRIDE" = ""; then
6659         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6660         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6661         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6662         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6663         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6664             AC_MSG_RESULT([yes])
6665             JAVAIFLAGS=-d32
6666         else
6667             AC_MSG_RESULT([no])
6668         fi
6669     fi
6672 dnl ===================================================================
6673 dnl Checks for JDK.
6674 dnl ===================================================================
6676 # Note that JAVA_HOME as for now always means the *build* platform's
6677 # JAVA_HOME. Whether all the complexity here actually is needed any
6678 # more or not, no idea.
6680 if test "$ENABLE_JAVA" != ""; then
6681     _gij_longver=0
6682     AC_MSG_CHECKING([the installed JDK])
6683     if test -n "$JAVAINTERPRETER"; then
6684         dnl java -version sends output to stderr!
6685         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6686             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6687         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6688             JDK=gcj
6689             AC_MSG_RESULT([checked (gcj)])
6690             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6691             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6693         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6694             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6695         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6696             JDK=ibm
6698             dnl IBM JDK specific tests
6699             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6700             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6702             if test "$_jdk_ver" -lt 10500; then
6703                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6704             fi
6706             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6708             if test "$with_jdk_home" = ""; then
6709                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6710 you must use the "--with-jdk-home" configure option explicitly])
6711             fi
6713            JAVA_HOME=$with_jdk_home
6715         else
6716             JDK=sun
6718             dnl Sun JDK specific tests
6719             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6720             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6722             if test "$_jdk_ver" -lt 10500; then
6723                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6724             fi
6725             if test "$_jdk_ver" -gt 10600; then
6726                 JAVA_CLASSPATH_NOT_SET="1"
6727             fi
6729             AC_MSG_RESULT([checked (JDK $_jdk)])
6730             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6731             if test "$_os" = "WINNT"; then
6732                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6733             fi
6734         fi
6735     else
6736         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6737     fi
6738 else
6739     dnl Java disabled
6740     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6743 dnl ===================================================================
6744 dnl Set target Java bytecode version
6745 dnl ===================================================================
6746 if test "$ENABLE_JAVA" != ""; then
6747     _java_target_ver="1.5"
6749     JAVA_SOURCE_VER="$_java_target_ver"
6750     JAVA_TARGET_VER="$_java_target_ver"
6753 dnl ===================================================================
6754 dnl Checks for javac
6755 dnl ===================================================================
6756 if test "$ENABLE_JAVA" != ""; then
6757     if test "$JDK" = "gcj"; then
6758         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6759     else
6760         javacompiler="javac"
6761     fi
6762     if test -z "$with_jdk_home"; then
6763         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6764     else
6765         _javac_path="$with_jdk_home/bin/$javacompiler"
6766         dnl Check if there is a Java compiler at all.
6767         if test -x "$_javac_path"; then
6768             JAVACOMPILER=$_javac_path
6769         fi
6770     fi
6771     if test -z "$JAVACOMPILER"; then
6772         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6773     fi
6774     if test "$build_os" = "cygwin"; then
6775         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6776             JAVACOMPILER="${JAVACOMPILER}.exe"
6777         fi
6778         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6779         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6780     fi
6782     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6783         AC_MSG_CHECKING([re-checking JDK])
6784         JDK=gcj
6785         AC_MSG_RESULT([checked (ecj)])
6786         _gij_longver="40200"
6787     fi
6790 JAVACISGCJ=""
6791 dnl ===================================================================
6792 dnl Checks that javac is gcj
6793 dnl ===================================================================
6794 if test "$ENABLE_JAVA" != ""; then
6795     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6796         JAVACISGCJ="yes"
6797     fi
6799 AC_SUBST(JAVACISGCJ)
6801 dnl ===================================================================
6802 dnl Checks for javadoc
6803 dnl ===================================================================
6804 if test "$ENABLE_JAVA" != ""; then
6805     if test -z "$with_jdk_home"; then
6806         AC_PATH_PROG(JAVADOC, javadoc)
6807     else
6808         _javadoc_path="$with_jdk_home/bin/javadoc"
6809         dnl Check if there is a javadoc at all.
6810         if test -x "$_javadoc_path"; then
6811             JAVADOC=$_javadoc_path
6812         else
6813             AC_PATH_PROG(JAVADOC, javadoc)
6814         fi
6815     fi
6816     if test -z "$JAVADOC"; then
6817         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6818     fi
6819     if test "$build_os" = "cygwin"; then
6820         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6821             JAVADOC="${JAVADOC}.exe"
6822         fi
6823         JAVADOC=`cygpath -d "$JAVADOC"`
6824         JAVADOC=`cygpath -u "$JAVADOC"`
6825     fi
6827     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6828     JAVADOCISGJDOC="yes"
6829     fi
6831 AC_SUBST(JAVADOCISGJDOC)
6833 if test "$ENABLE_JAVA" != ""; then
6834     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6835     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6836         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6837            # try to recover first by looking whether we have a alternatives
6838            # system as in Debian or newer SuSEs where following /usr/bin/javac
6839            # over /etc/alternatives/javac leads to the right bindir where we
6840            # just need to strip a bit away to get a valid JAVA_HOME
6841            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6842         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6843             # maybe only one level of symlink (e.g. on Mac)
6844             JAVA_HOME=$(readlink $JAVACOMPILER)
6845             if test "$(dirname $JAVA_HOME)" = "."; then
6846                 # we've got no path to trim back
6847                 JAVA_HOME=""
6848             fi
6849         else
6850             # else warn
6851             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6852             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6853             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6854             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6855         fi
6856         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6857         if test "$JAVA_HOME" != "/usr"; then
6858             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6859                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6860                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6861                 dnl Tiger already returns a JDK path..
6862                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6863             else
6864                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6865             fi
6866         fi
6867     fi
6868     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6870     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6871     if test -z "$JAVA_HOME"; then
6872         if test "x$with_jdk_home" = "x"; then
6873             cat > findhome.java <<_ACEOF
6874 [import java.io.File;
6876 class findhome
6878     public static void main(String args[])
6879     {
6880         String jrelocation = System.getProperty("java.home");
6881         File jre = new File(jrelocation);
6882         System.out.println(jre.getParent());
6883     }
6885 _ACEOF
6886             AC_MSG_CHECKING([if javac works])
6887             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6888             AC_TRY_EVAL(javac_cmd)
6889             if test $? = 0 -a -f ./findhome.class; then
6890                 AC_MSG_RESULT([javac works])
6891             else
6892                 echo "configure: javac test failed" >&5
6893                 cat findhome.java >&5
6894                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6895             fi
6896             AC_MSG_CHECKING([if gij knows its java.home])
6897             JAVA_HOME=`$JAVAINTERPRETER findhome`
6898             if test $? = 0 -a "$JAVA_HOME" != ""; then
6899                 AC_MSG_RESULT([$JAVA_HOME])
6900             else
6901                 echo "configure: java test failed" >&5
6902                 cat findhome.java >&5
6903                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6904             fi
6905             # clean-up after ourselves
6906             rm -f ./findhome.java ./findhome.class
6907         else
6908             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6909         fi
6910     fi
6912     dnl second sanity check JAVA_HOME if possible
6913     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6914         # now check if $JAVA_HOME is really valid
6915         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6916             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6917                 JAVA_HOME_OK="NO"
6918             fi
6919         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6920             JAVA_HOME_OK="NO"
6921         fi
6922         if test "$JAVA_HOME_OK" = "NO"; then
6923             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6924             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6925             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6926             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6927             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6928             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6929         fi
6930     fi
6931     PathFormat "$JAVA_HOME"
6932     JAVA_HOME="$formatted_path"
6935 AWTLIB=
6937 if test "$ENABLE_JAVA" != ""; then
6938     AC_MSG_CHECKING([for jawt lib name])
6939     if test "$JDK" = "gcj"; then
6940         save_CFLAGS=$CFLAGS
6941         save_LDFLAGS=$LDFLAGS
6942         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6943         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
6944         exec 6>/dev/null # no output
6945         AC_CHECK_HEADER(jni.h, [],
6946                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
6947         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
6948         exec 6>&1 # output on again
6949         CFLAGS=$save_CFLAGS
6950         LDFLAGS=$save_LDFLAGS
6951     fi
6952     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
6953     # A workaround is to link also against libpmawt.so
6954     if test "$JDK" = "ibm"; then
6955         save_CFLAGS=$CFLAGS
6956         save_LDFLAGS=$LDFLAGS
6957         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
6958         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6959         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
6960         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
6961         export LD_LIBRARY_PATH
6962         exec 6>/dev/null # no output
6963         AC_CHECK_HEADER(jni.h, [],
6964                     [AC_MSG_ERROR([jni.h could not be found.])], [])
6965         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
6966         if test -z "$AWTLIB"; then
6967             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
6968             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
6969         fi
6970         exec 6>&1 # output on again
6971         CFLAGS=$save_CFLAGS
6972         LDFLAGS=$save_LDFLAGS
6973         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
6974     fi
6975     if test -z "$AWTLIB"; then
6976         if test $_os = WINNT -a "$WITH_MINGW" != yes; then
6977             AWTLIB=jawt.lib
6978         else
6979             AWTLIB=-ljawt
6980         fi
6981     fi
6982     AC_MSG_RESULT([$AWTLIB])
6983     AC_SUBST(AWTLIB)
6987 if test -n "$ENABLE_JAVA" -a \( -z "$JAVALIB" -o -z "$JAVAINC" \); then
6989 # Determine JAVALIB
6990 # If your platform follow the common pattern
6991 # just define JAVA_ARCH and JAVA_TOOLKIT for it
6992 # if not, leave JAVA_ARCH empty and define JAVALIB manually
6993 # if you don't want JAVALIB to be exported at all
6994 # define x_JAVALIB=[\#]
6996     JAVA_ARCH=
6997     JAVA_TOOLKIT=
6998     x_JAVALIB=
6999     x_JDKLIB=[\#]
7001     case "$host_os" in
7003     aix*)
7004         JAVA_ARCH="ppc"
7005         JAVA_TOOLKIT="classic"
7006         JAVAINC="-I$JAVA_HOME/include"
7007         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7008         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7010         case "$JDK" in
7011         [Ii][Bb][Mm]*)
7012             JAVA_ARCH=
7013             JRE_BASE_DIR="$JAVA_HOME/jre/bin"
7014             JAVALIB="-L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic"
7015             ;;
7016         *)
7017             ;;
7018         esac
7020         ;;
7022     cygwin*)
7023         x_JDKLIB=
7024         JDKLIB="$JAVA_HOME/lib"
7025         JAVAINC="-I$JAVA_HOME/include/win32"
7026         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7027         ;;
7029     darwin*)
7030         x_JAVALIB=[\#]
7031         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
7032         ;;
7034     dragonfly*)
7035         case "$host_cpu" in
7036         i*86)
7037             JAVA_ARCH="i386"
7038             JAVA_TOOLKIT="client"
7039             ;;
7040         x86_64)
7041             JAVA_ARCH="amd64"
7042             JAVA_TOOLKIT="server"
7043             ;;
7044         esac
7045         JAVAINC="-I$JAVA_HOME/include"
7046         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7047         ;;
7049     freebsd*)
7050         case "$host_cpu" in
7051         i*86)
7052             JAVA_ARCH="i386"
7053             JAVA_TOOLKIT="client"
7054             ;;
7055         x86_64)
7056             if test "`echo $JAVA_HOME | sed -e 's,.*/,,'`" = "linux"; then
7057                 JAVA_ARCH="i386"
7058                 JAVA_TOOLKIT="client"
7059             else
7060                 JAVA_ARCH="amd64"
7061                 JAVA_TOOLKIT="server"
7062             fi
7063             ;;
7064         esac
7065         JAVAINC="-I$JAVA_HOME/include"
7066         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7067         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7068         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7069         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7070         ;;
7072     k*bsd*-gnu*)
7073         case "$host_cpu" in
7074         i*86)
7075             JAVA_ARCH="i386"
7076             JAVA_TOOLKIT="client"
7077             ;;
7078         x86_64)
7079             JAVA_ARCH="amd64"
7080             JAVA_TOOLKIT="server"
7081             ;;
7082         esac
7083         JAVAINC="-I$JAVA_HOME/include"
7084         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7085         ;;
7087     linux-gnu*)
7089         case "$host_cpu" in
7091         alpha)
7092             JAVA_ARCH="alpha"
7093             JAVA_TOOLKIT="server"
7094             ;;
7095         arm*)
7096             JAVA_ARCH="arm"
7097             JAVA_TOOLKIT="server"
7098             ;;
7099         hppa)
7100             JAVA_ARCH="hppa"
7101             JAVA_TOOLKIT="server"
7102             ;;
7103         i*86)
7104             JAVA_ARCH="i386"
7105             case "$JDK" in
7106             [Ii][Bb][Mm]*)
7107                 JAVA_ARCH=
7108                 JRE_BASE_DIR="$JAVA_HOME/jre/bin"
7109                 JAVALIB="-L$JAVA_HOME/$LIB64 -L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic -L$JRE_BASE_DIR/native_thread"
7110                 ;;
7111             [Bb][Ee][Aa]*)
7112                 JAVA_TOOLKIT="jrockit"
7113                 ;;
7114             *)
7115                 JAVA_TOOLKIT="client"
7116                 ;;
7117             esac
7118             ;;
7119         ia64)
7120             JAVA_ARCH="ia64"
7121             JAVA_TOOLKIT="server"
7122             ;;
7123         m68k)
7124             JAVA_ARCH="mk68"
7125             JAVA_TOOLKIT="server"
7126             ;;
7127         mips|mips64|mipsel|mips64el)
7128             JAVA_ARCH="$host_cpu"
7129             JAVA_TOOLKIT="server"
7130             ;;
7131         mips32)
7132             JAVA_ARCH="$host_cpu"
7133             JAVA_TOOLKIT="client"
7134             ;;
7135         powerpc)
7136             JAVA_ARCH="ppc"
7137             case "$JDK" in
7138             [Ii][Bb][Mm]*)
7139                 JAVA_TOOLKIT="classic"
7140                 ;;
7141             gcj)
7142                 JAVA_TOOLKIT="client"
7143                 ;;
7144             *)
7145                 JAVA_TOOLKIT="server"
7146                 ;;
7147             esac
7148             ;;
7149         powerpc64)
7150             JAVA_ARCH="ppc64"
7151             if test "$JDK" = "gcj"; then
7152                 JAVA_TOOLKIT="client"
7153             else
7154                 JAVA_TOOLKIT="server"
7155             fi
7156             ;;
7157         sparc)
7158             JAVA_ARCH="sparc"
7159             JAVA_TOOLKIT="server"
7160             ;;
7161         s390)
7162             JAVA_ARCH="s390"
7163             JAVA_TOOLKIT="server"
7164             ;;
7165         s390x)
7166             JAVA_ARCH="s390x"
7167             JAVA_TOOLKIT="server"
7168             ;;
7169         x86_64)
7170             JAVA_ARCH="amd64"
7171             JAVA_TOOLKIT="server"
7172             ;;
7173         *)
7174             AC_MSG_ERROR([No JAVALIB definition host_cpu $host_cpu for host_os $host_os])
7175             ;;
7176         esac
7177         JAVAINC="-I$JAVA_HOME/include"
7178         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7179         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7180         ;;
7182     linux-androideabi*)
7184         case "$host_cpu" in
7186         arm|armel)
7187             JAVA_ARCH="arm"
7188             JAVA_TOOLKIT="server"
7189             ;;
7190         esac
7191         ;;
7193     mingw*)
7194         x_JAVALIB=[\#]
7195         JAVAINC="-I$JAVA_HOME/include"
7196         ;;
7198     *netbsd*)
7200         case "$host_cpu" in
7201         i*86)
7202             JAVA_ARCH="i386"
7203             JAVA_TOOLKIT="client"
7204             ;;
7205         powerpc)
7206             JAVA_ARCH="pcc"
7207             JAVA_TOOLKIT="classic"
7208             ;;
7209         sparc)
7210             JAVA_ARCH="sparc"
7211             JAVA_TOOLKIT="client"
7212             ;;
7213         x86_64)
7214             JAVA_ARCH="amd64"
7215             JAVA_TOOLKIT="client"
7216             ;;
7217         esac
7218         JAVAINC="-I$JAVA_HOME/include"
7219         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7220         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7221        ;;
7223     openbsd*)
7224         case "$host_cpu" in
7225         i*86)
7226             JAVA_ARCH="i386"
7227             JAVA_TOOLKIT="client"
7228             ;;
7229         x86_64)
7230             JAVA_ARCH="amd64"
7231             JAVA_TOOLKIT="server"
7232             ;;
7233         esac
7234         JAVAINC="-I$JAVA_HOME/include"
7235         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7236         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7237         ;;
7239     solaris*)
7241         JAVA_TOOLKIT="xawt"
7242         case "$host_cpu" in
7243         i*86)
7244             JAVA_ARCH="i386"
7245             ;;
7246         sparc)
7247             JAVA_ARCH="sparc"
7248             ;;
7249         esac
7250         JAVAINC="-I$JAVA_HOME/include"
7251         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7252         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7253         ;;
7254     esac
7256     if test -n "$JAVA_ARCH"; then
7257         JRE_BASE_DIR="$JAVA_HOME/jre/lib/$JAVA_ARCH"
7258         JAVALIB="-L$JAVA_HOME/$LIB64"
7259         test -d "$JRE_BASE_DIR" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR"
7260         test -d "$JRE_BASE_DIR/$JAVA_TOOLKIT" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/$JAVA_TOOLKIT"
7261         test -d "$JRE_BASE_DIR/native_thread" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/native_thread"
7262     fi
7263 elif test -z "$ENABLE_JAVA"; then
7264     x_JAVALIB=[\#]
7265     x_JDKLIB=[\#]
7267 SOLARINC="$SOLARINC $JAVAINC"
7269 AC_SUBST(JAVALIB)
7270 AC_SUBST(JAVACOMPILER)
7271 AC_SUBST(JAVADOC)
7272 AC_SUBST(JAVAINTERPRETER)
7273 AC_SUBST(JAVAIFLAGS)
7274 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7275 AC_SUBST(JAVA_HOME)
7276 AC_SUBST(JAVA_SOURCE_VER)
7277 AC_SUBST(JAVA_TARGET_VER)
7278 AC_SUBST(JDK)
7279 AC_SUBST(JDKLIB)
7280 AC_SUBST(x_JAVALIB)
7281 AC_SUBST(x_JDKLIB)
7284 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7285 if test -n "$with_idlc_cpp"; then
7286     AC_MSG_RESULT([$with_idlc_cpp])
7287     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7288 else
7289     AC_MSG_RESULT([ucpp])
7290     AC_MSG_CHECKING([which ucpp tp use])
7291     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7292         AC_MSG_RESULT([external])
7293         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7294     else
7295         AC_MSG_RESULT([internal])
7296         BUILD_TYPE="$BUILD_TYPE UCPP"
7297     fi
7299 AC_SUBST(SYSTEM_UCPP)
7301 dnl ===================================================================
7302 dnl Check for epm (not needed for Windows)
7303 dnl ===================================================================
7304 AC_MSG_CHECKING([whether to enable EPM for packing])
7305 if test "$enable_epm" = "yes"; then
7306     AC_MSG_RESULT([yes])
7307     if test "$_os" != "WINNT"; then
7308         if test $_os = Darwin; then
7309             EPM=internal
7310         elif test -n "$with_epm"; then
7311             EPM=$with_epm
7312         else
7313             AC_PATH_PROG(EPM, epm, no)
7314         fi
7315         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7316             echo "EPM will be built."
7317             BUILD_TYPE="$BUILD_TYPE EPM"
7318             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7319         else
7320             # Gentoo has some epm which is something different...
7321             AC_MSG_CHECKING([whether the found epm is the right epm])
7322             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7323                 AC_MSG_RESULT([yes])
7324             else
7325                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7326             fi
7327             AC_MSG_CHECKING([epm version])
7328             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7329             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7330                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7331                 AC_MSG_RESULT([OK, >= 3.7])
7332             else
7333                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7334                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7335             fi
7336         fi
7337     fi
7339     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7340         AC_MSG_CHECKING([for rpm])
7341         for a in "$RPM" rpmbuild rpm; do
7342             $a --usage >/dev/null 2> /dev/null
7343             if test $? -eq 0; then
7344                 RPM=$a
7345                 break
7346             else
7347                 $a --version >/dev/null 2> /dev/null
7348                 if test $? -eq 0; then
7349                     RPM=$a
7350                     break
7351                 fi
7352             fi
7353         done
7354         if test -z "$RPM"; then
7355             AC_MSG_ERROR([not found])
7356         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7357             RPM_PATH=`which $RPM`
7358             AC_MSG_RESULT([$RPM_PATH])
7359             SCPDEFS="$SCPDEFS -DWITH_RPM"
7360         else
7361             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7362         fi
7363     fi
7364     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7365         AC_PATH_PROG(DPKG, dpkg, no)
7366         if test "$DPKG" = "no"; then
7367             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7368         fi
7369     fi
7370     if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
7371         if test "$_os" = "Darwin"; then
7372             AC_MSG_CHECKING([for PackageMaker availability])
7373             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
7374                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
7375             else
7376                 AC_MSG_RESULT([ok])
7377             fi
7378         else
7379             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
7380         fi
7381     fi
7382     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7383        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7384         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7385             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7386                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7387                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7388                     AC_MSG_RESULT([yes])
7389                 else
7390                     AC_MSG_RESULT([no])
7391                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7392                         _pt="rpm"
7393                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7394                         add_warning "the rpms will need to be installed with --nodeps"
7395                     else
7396                         _pt="pkg"
7397                     fi
7398                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7399                     add_warning "the ${_pt}s will not be relocateable"
7400                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7401                                  relocation will work, you need to patch your epm with the
7402                                  patch in epm/epm-3.7.patch or build with
7403                                  --with-epm=internal which will build a suitable epm])
7404                 fi
7405             fi
7406         fi
7407     fi
7408     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7409         AC_PATH_PROG(PKGMK, pkgmk, no)
7410         if test "$PKGMK" = "no"; then
7411             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7412         fi
7413     fi
7414     AC_SUBST(RPM)
7415     AC_SUBST(DPKG)
7416     AC_SUBST(PKGMK)
7417 else
7418     for i in $PKGFORMAT; do
7419         case "$i" in
7420         aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable)
7421             AC_MSG_ERROR(
7422                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7423             ;;
7424         esac
7425     done
7426     AC_MSG_RESULT([no])
7427     EPM=NO
7429 AC_SUBST(EPM)
7431 dnl ===================================================================
7432 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7433 dnl ===================================================================
7434 WINEGCC=
7435 if test "$enable_winegcc" = "yes"; then
7436     AC_PATH_PROG(WINEGCC, winegcc)
7437     if test "$WINEGCC" = ""; then
7438         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7439     fi
7440     CC_save="$CC"
7441     ac_exeext_save="$ac_exeext"
7442     CC="$WINEGCC -m32"
7443     ac_exeext=".exe"
7444     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7445 #include <stdio.h>
7446         ],[
7447 printf ("hello world\n");
7448         ])],,
7449         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7450     )
7451     CC="$CC_save"
7452     ac_exeext="$ac_exeext_save"
7454 AC_SUBST(WINEGCC)
7456 if test $_os = iOS; then
7457     enable_mpl_subset=yes
7458     enable_opengl=no
7459     enable_lotuswordpro=no
7460     enable_lpsolve=no
7461     enable_postgresql_sdbc=no
7462     enable_lotuswordpro=no
7463     enable_neon=no
7464     enable_extension_integration=no
7465     enable_report_builder=no
7466     with_theme="tango"
7467     with_ppds=no
7470 ENABLE_LWP=
7471 if test "$enable_lotuswordpro" = "yes"; then
7472     ENABLE_LWP="TRUE"
7473     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7475 AC_SUBST(ENABLE_LWP)
7477 dnl ===================================================================
7478 dnl Check for gperf
7479 dnl ===================================================================
7480 AC_PATH_PROG(GPERF, gperf)
7481 if test -z "$GPERF"; then
7482     AC_MSG_ERROR([gperf not found but needed. Install it.])
7484 AC_MSG_CHECKING([gperf version])
7485 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7486     AC_MSG_RESULT([OK])
7487 else
7488     AC_MSG_ERROR([too old, you need at least 3.0.0])
7490 AC_SUBST(GPERF)
7492 dnl ===================================================================
7493 dnl Check for building ODK
7494 dnl ===================================================================
7495 if test "$enable_odk" = no; then
7496     unset DOXYGEN
7497 else
7498     if test "$with_doxygen" = no; then
7499         AC_MSG_CHECKING([for doxygen])
7500         unset DOXYGEN
7501         AC_MSG_RESULT([no])
7502     else
7503         if test "$with_doxygen" = yes; then
7504             AC_PATH_PROG([DOXYGEN], [doxygen])
7505             if test -z "$DOXYGEN"; then
7506                 if test "$enable_odk" = "" ; then
7507                     enable_odk="no"
7508                 else
7509                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7510                 fi
7511             fi
7512         else
7513             AC_MSG_CHECKING([for doxygen])
7514             DOXYGEN=$with_doxygen
7515             AC_MSG_RESULT([$DOXYGEN])
7516         fi
7517         if test -n "$DOXYGEN"; then
7518            DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7519            DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7520            if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7521               AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7522            fi
7523         fi
7524     fi
7526 AC_SUBST([DOXYGEN])
7528 AC_MSG_CHECKING([whether to build the ODK])
7529 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7530     AC_MSG_RESULT([yes])
7532     if test "$with_java" != "no"; then
7533         AC_MSG_CHECKING([whether to build unowinreg.dll])
7534         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7535             # build on Win by default
7536             enable_build_unowinreg=yes
7537         fi
7538         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7539             AC_MSG_RESULT([no])
7540             BUILD_UNOWINREG=NO
7541         else
7542             AC_MSG_RESULT([yes])
7543             BUILD_UNOWINREG=YES
7544         fi
7545         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
7546             if test -z "$with_mingw_cross_compiler"; then
7547                 dnl Guess...
7548                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7549             elif test -x "$with_mingw_cross_compiler"; then
7550                  MINGWCXX="$with_mingw_cross_compiler"
7551             else
7552                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7553             fi
7555             if test "$MINGWCXX" = "false"; then
7556                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7557             fi
7559             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7560             if test -x "$mingwstrip_test"; then
7561                 MINGWSTRIP="$mingwstrip_test"
7562             else
7563                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7564             fi
7566             if test "$MINGWSTRIP" = "false"; then
7567                 AC_MSG_ERROR(MinGW32 binutils not found.)
7568             fi
7569         fi
7570     fi
7571     BUILD_TYPE="$BUILD_TYPE ODK"
7572 else
7573     AC_MSG_RESULT([no])
7574     BUILD_UNOWINREG=NO
7576 AC_SUBST(BUILD_UNOWINREG)
7577 AC_SUBST(MINGWCXX)
7578 AC_SUBST(MINGWSTRIP)
7580 dnl ===================================================================
7581 dnl Check for system zlib
7582 dnl ===================================================================
7583 if test "$with_system_zlib" = "auto"; then
7584     case "$_os" in
7585     WINNT)
7586         with_system_zlib="$with_system_libs"
7587         ;;
7588     *)
7589         with_system_zlib=yes
7590         ;;
7591     esac
7594 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7595 dnl and has no pkg-config for it at least on some tinderboxes,
7596 dnl so leaving that out for now
7597 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7598 AC_MSG_CHECKING([which zlib to use])
7599 if test "$with_system_zlib" = "yes"; then
7600     AC_MSG_RESULT([external])
7601     SYSTEM_ZLIB=YES
7602     AC_CHECK_HEADER(zlib.h, [],
7603         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7604     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7605         [AC_MSG_ERROR(zlib not found or functional)], [])
7606 else
7607     AC_MSG_RESULT([internal])
7608     SYSTEM_ZLIB=NO
7609     BUILD_TYPE="$BUILD_TYPE ZLIB"
7610     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7611     ZLIB_LIBS="-lzlib"
7613 AC_SUBST(ZLIB_CFLAGS)
7614 AC_SUBST(ZLIB_LIBS)
7615 AC_SUBST(SYSTEM_ZLIB)
7617 dnl ===================================================================
7618 dnl Check for system jpeg
7619 dnl ===================================================================
7620 AC_MSG_CHECKING([which jpeg to use])
7621 if test "$with_system_jpeg" = "auto"; then
7622     case "$_os" in
7623     WINNT|Darwin|iOS|Android)
7624         with_system_jpeg="$with_system_libs"
7625         ;;
7626     *)
7627         with_system_jpeg=yes
7628         ;;
7629     esac
7632 if test "$with_system_jpeg" = "yes"; then
7633     AC_MSG_RESULT([external])
7634     SYSTEM_JPEG=YES
7635     AC_CHECK_HEADER(jpeglib.h, [],
7636         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7637     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7638     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7639     libo_MINGW_CHECK_DLL([libjpeg])
7640 else
7641     AC_MSG_RESULT([internal])
7642     SYSTEM_JPEG=NO
7643     BUILD_TYPE="$BUILD_TYPE JPEG"
7645 AC_SUBST(SYSTEM_JPEG)
7648 dnl ===================================================================
7649 dnl Check for system clucene
7650 dnl ===================================================================
7651 dnl we should rather be using
7652 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7653 dnl but the contribs-lib check seems tricky
7654 AC_MSG_CHECKING([which clucene to use])
7655 if test "$with_system_clucene" = "yes"; then
7656     AC_MSG_RESULT([external])
7657     SYSTEM_CLUCENE=YES
7658     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7659     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7660     AC_LANG_PUSH([C++])
7661     save_CXXFLAGS=$CXXFLAGS
7662     save_CPPFLAGS=$CPPFLAGS
7663     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7664     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7665     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7666     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7667     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7668                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7669     CXXFLAGS=$save_CXXFLAGS
7670     CPPFLAGS=$save_CPPFLAGS
7671     AC_LANG_POP([C++])
7673     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7674 else
7675     AC_MSG_RESULT([internal])
7676     SYSTEM_CLUCENE=NO
7677     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7679 AC_SUBST(SYSTEM_CLUCENE)
7680 AC_SUBST(CLUCENE_CFLAGS)
7681 AC_SUBST(CLUCENE_LIBS)
7683 dnl ===================================================================
7684 dnl Check for system expat
7685 dnl ===================================================================
7686 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7687 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7688 AC_MSG_CHECKING([which expat to use])
7689 if test "$with_system_expat" = "yes"; then
7690     AC_MSG_RESULT([external])
7691     SYSTEM_EXPAT=YES
7692     AC_CHECK_HEADER(expat.h, [],
7693         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7694     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7695         [AC_MSG_RESULT(expat library not found or functional.)], [])
7696     libo_MINGW_CHECK_DLL([libexpat])
7697 else
7698     AC_MSG_RESULT([internal])
7699     SYSTEM_EXPAT=NO
7700     BUILD_TYPE="$BUILD_TYPE EXPAT"
7702 AC_SUBST(SYSTEM_EXPAT)
7704 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7705 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7706     ENABLE_EOT="TRUE"
7707     AC_DEFINE([ENABLE_EOT])
7708     AC_MSG_RESULT([yes])
7710     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7711 else
7712     ENABLE_EOT=
7713     AC_MSG_RESULT([no])
7715 AC_SUBST([ENABLE_EOT])
7717 dnl ===================================================================
7718 dnl Check for system libe-book
7719 dnl ===================================================================
7720 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"])
7722 dnl ===================================================================
7723 dnl Check for system libetonyek
7724 dnl ===================================================================
7725 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.0],["-I${WORKDIR}/UnpackedTarball/libetonyek/inc"],["-L${WORKDIR}/UnpackedTarball/libetonyek/src/lib/.libs -letonyek-0.0"])
7727 dnl ===================================================================
7728 dnl Check for system libfreehand
7729 dnl ===================================================================
7730 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.0],["-I${WORKDIR}/UnpackedTarball/libfreehand/inc"],["-L${WORKDIR}/UnpackedTarball/libfreehand/src/lib/.libs -lfreehand-0.0"])
7732 dnl ===================================================================
7733 dnl Check for system libodfgen
7734 dnl ===================================================================
7735 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0 >= 0.0.3])
7737 dnl ===================================================================
7738 dnl Check for system libcdr
7739 dnl ===================================================================
7740 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7742 dnl ===================================================================
7743 dnl Check for system libmspub
7744 dnl ===================================================================
7745 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7747 dnl ===================================================================
7748 dnl Check for system libmwaw
7749 dnl ===================================================================
7750 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.2])
7752 dnl ===================================================================
7753 dnl Check for system libvisio
7754 dnl ===================================================================
7755 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7757 dnl ===================================================================
7758 dnl Check for system libcmis
7759 dnl ===================================================================
7760 libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.4 >= 0.4.0])
7762 dnl ===================================================================
7763 dnl Check for system libwpd
7764 dnl ===================================================================
7765 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"])
7767 dnl ===================================================================
7768 dnl Check for system lcms2
7769 dnl ===================================================================
7770 if test "$with_system_lcms2" = "yes"; then
7771     libo_MINGW_CHECK_DLL([liblcms2])
7772 else
7773     SYSTEM_LCMS2=NO
7775 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7776 if test "$GCC" = "yes"; then
7777     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7779 if test "$COM" = "MSC"; then # override the above
7780     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7783 dnl ===================================================================
7784 dnl Check for system cppunit
7785 dnl ===================================================================
7786 if test "$cross_compiling" != "yes"; then
7787     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7790 dnl ===================================================================
7791 dnl Check whether freetype is available
7792 dnl ===================================================================
7793 if test  "$test_freetype" = "yes"; then
7794     AC_MSG_CHECKING([whether freetype is available])
7795     # FreeType has 3 different kinds of versions
7796     # * release, like 2.4.10
7797     # * libtool, like 13.0.7 (this what pkg-config returns)
7798     # * soname
7799     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7800     #
7801     # 9.9.3 is 2.2.0
7802     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7803     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7804     SYSTEM_FREETYPE=YES
7805     _save_libs="$LIBS"
7806     _save_cflags="$CFLAGS"
7807     LIBS="$LIBS $FREETYPE_LIBS"
7808     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7809     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7810     LIBS="$_save_libs"
7811     CFLAGS="$_save_cflags"
7813 AC_SUBST(FREETYPE_CFLAGS)
7814 AC_SUBST(FREETYPE_LIBS)
7815 AC_SUBST([SYSTEM_FREETYPE])
7817 dnl ===================================================================
7818 dnl Check for system libwps
7819 dnl ===================================================================
7820 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${WORKDIR}/UnpackedTarball/libwps/inc"],["-L${WORKDIR}/UnpackedTarball/libwps/src/lib/.libs -lwps-0.2"])
7822 dnl ===================================================================
7823 dnl Check for system libwpg
7824 dnl ===================================================================
7825 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${WORKDIR}/UnpackedTarball/libwpg/inc"],["-L${WORKDIR}/UnpackedTarball/libwpg/src/lib/.libs -lwpg-0.2"])
7827 # ===================================================================
7828 # Check for system libxslt
7829 # to prevent incompatibilities between internal libxml2 and external libxslt,
7830 # or vice versa, use with_system_libxml here
7831 # ===================================================================
7832 if test "$with_system_libxml" = "auto"; then
7833     case "$_os" in
7834     WINNT|iOS|Android)
7835         with_system_libxml="$with_system_libs"
7836         ;;
7837     *)
7838         with_system_libxml=yes
7839         ;;
7840     esac
7843 AC_MSG_CHECKING([which libxslt to use])
7844 if test "$with_system_libxml" = "yes"; then
7845     AC_MSG_RESULT([external])
7846     SYSTEM_LIBXSLT=YES
7847     if test "$_os" = "Darwin"; then
7848         dnl make sure to use SDK path
7849         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7850         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7851         dnl omit -L/usr/lib
7852         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7853         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7854     else
7855         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7856         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7857         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7858         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7859     fi
7861     dnl Check for xsltproc
7862     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7863     if test "$XSLTPROC" = "no"; then
7864         AC_MSG_ERROR([xsltproc is required])
7865     fi
7867     libo_MINGW_CHECK_DLL([libxslt])
7868     libo_MINGW_CHECK_DLL([libexslt])
7869     libo_MINGW_TRY_DLL([iconv])
7870 else
7871     AC_MSG_RESULT([internal])
7872     SYSTEM_LIBXSLT=NO
7873     LIBXSLT_MAJOR=1
7874     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7876     if test "$cross_compiling" = "yes"; then
7877         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7878         if test "$XSLTPROC" = "no"; then
7879             AC_MSG_ERROR([xsltproc is required])
7880         fi
7881     fi
7883 AC_SUBST(SYSTEM_LIBXSLT)
7884 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7885     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7887 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7889 AC_SUBST(LIBEXSLT_CFLAGS)
7890 AC_SUBST(LIBEXSLT_LIBS)
7891 AC_SUBST(LIBXSLT_CFLAGS)
7892 AC_SUBST(LIBXSLT_LIBS)
7893 AC_SUBST(LIBXSLT_MAJOR)
7894 AC_SUBST(XSLTPROC)
7896 # ===================================================================
7897 # Check for system libxml
7898 # ===================================================================
7899 AC_MSG_CHECKING([which libxml to use])
7900 if test "$with_system_libxml" = "yes"; then
7901     AC_MSG_RESULT([external])
7902     SYSTEM_LIBXML=YES
7903     if test "$_os" = "Darwin"; then
7904         dnl make sure to use SDK path
7905         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7906         dnl omit -L/usr/lib
7907         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7908     elif test $_os = iOS; then
7909         dnl make sure to use SDK path
7910         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7911         LIBXML_CFLAGS="-I$usr/include/libxml2"
7912         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7913     else
7914         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7915         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7916     fi
7918     dnl Check for xmllint
7919     AC_PATH_PROG(XMLLINT, xmllint, no)
7920     if test "$XMLLINT" = "no"; then
7921         AC_MSG_ERROR([xmllint is required])
7922     fi
7924     libo_MINGW_CHECK_DLL([libxml2])
7925     libo_MINGW_TRY_DLL([zlib1])
7926 else
7927     AC_MSG_RESULT([internal])
7928     SYSTEM_LIBXML=NO
7929     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7931 AC_SUBST(SYSTEM_LIBXML)
7932 AC_SUBST(LIBXML_CFLAGS)
7933 AC_SUBST(LIBXML_LIBS)
7934 AC_SUBST(XMLLINT)
7936 # =====================================================================
7937 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7938 # runtime requires Python 3 compatible version (>= 2.6)
7939 # Optionally user can pass an option to configure, i. e.
7940 # ./configure PYTHON=/usr/bin/python
7941 # =====================================================================
7942 if test "$build_os" != "cygwin"; then
7943     # This allows a lack of system python with no error, we use internal one in that case.
7944     AM_PATH_PYTHON([2.5],, [:])
7945     # Clean PYTHON_VERSION checked below if cross-compiling
7946     PYTHON_VERSION=""
7947     if test "$PYTHON" != ":"; then
7948         PYTHON_FOR_BUILD=$PYTHON
7949     fi
7951 AC_SUBST(PYTHON_FOR_BUILD)
7953 # Checks for Python to use for Pyuno
7954 AC_MSG_CHECKING([which Python to use for Pyuno])
7955 case "$enable_python" in
7956 no|disable)
7957     if test -z $PYTHON_FOR_BUILD; then
7958         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7959         # requirement from the choice whether to include Python stuff in the installer, but why
7960         # bother?
7961         AC_MSG_ERROR([Python is required at build time.])
7962     fi
7963     enable_python=no
7964     AC_MSG_RESULT([none])
7965     ;;
7966 ""|yes|auto)
7967     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7968         AC_MSG_RESULT([no, overridden by --disable-scripting])
7969         enable_python=no
7970     elif test $build_os = cygwin; then
7971         dnl When building on Windows we don't attempt to use any installed
7972         dnl "system"  Python.
7973         dnl
7974         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7975         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7976         dnl MinGW cross-compilation setups.)
7977         AC_MSG_RESULT([internal])
7978         enable_python=internal
7979     elif test "$cross_compiling" = yes; then
7980         AC_MSG_RESULT([system])
7981         enable_python=system
7982     else
7983         # Unset variables set by the above AM_PATH_PYTHON so that
7984         # we actually do check anew.
7985         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
7986         AM_PATH_PYTHON([3.3],, [:])
7987         if test "$PYTHON" = :; then
7988             AC_MSG_RESULT([internal])
7989             enable_python=internal
7990         else
7991             AC_MSG_RESULT([system])
7992             enable_python=system
7993         fi
7994     fi
7995     ;;
7996 internal)
7997     AC_MSG_RESULT([internal])
7998     ;;
7999 system)
8000     AC_MSG_RESULT([system])
8001     ;;
8003     AC_MSG_ERROR([Incorrect --enable-python option])
8004     ;;
8005 esac
8007 if test $enable_python != no; then
8008     BUILD_TYPE="$BUILD_TYPE PYUNO"
8011 if test $enable_python = system; then
8012     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8013         # We already have logic above to make sure the system Python
8014         # is used only when building against SDK 10.6 or newer.
8016         # Make sure we use the 2.6 Python when building against the
8017         # 10.6 SDK.
8018         case $with_macosx_sdk in
8019         10.6)
8020             python_version=2.6;;
8021         10.7|10.8)
8022             python_version=2.7;;
8023         *)
8024             # ???
8025             python_version=2.7;;
8026         esac
8027         PYTHON=python$python_version
8028         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
8029         PYTHON_LIBS="-framework Python"
8030     fi
8031     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8032         # Fallback: Accept these in the environment, or as set above
8033         # for MacOSX.
8034         :
8035     elif test "$cross_compiling" != yes; then
8036         # Unset variables set by the above AM_PATH_PYTHON so that
8037         # we actually do check anew.
8038         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
8039         # This causes an error if no python command is found
8040         AM_PATH_PYTHON([3.3])
8041         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8042         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8043         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8044         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8045         if test -z "$PKG_CONFIG"; then
8046             PYTHON_CFLAGS="-I$python_include"
8047             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8048         elif $PKG_CONFIG --exists python-$python_version; then
8049             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8050             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8051         else
8052             PYTHON_CFLAGS="-I$python_include"
8053             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8054         fi
8055     else
8056         dnl How to find out the cross-compilation Python installation path?
8057         dnl Let's hardocode what we know for different distributions for now...
8058         for python_version in 2.6; do
8059             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8060                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8061                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8062                 AC_MSG_CHECKING([for python.exe])
8063                 libo_MINGW_CHECK_DLL([libpython$python_version])
8064                 libo_MINGW_CHECK_DLL([libreadline6])
8065                 libo_MINGW_CHECK_DLL([libtermcap])
8066                 # could we somehow extract the really mingw python version from
8067                 # actual distro package?
8068                 # 2.6.2 currently on OpenSUSE 12.1?
8069                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8070                 PYTHON_VERSION=$python_version.2
8071                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8072                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8073                 break
8074             fi
8075         done
8076         AC_MSG_CHECKING([for python version])
8077         AS_IF([test -n "$PYTHON_VERSION"],
8078               [AC_MSG_RESULT([$PYTHON_VERSION])],
8079               [AC_MSG_RESULT([not found])
8080                AC_MSG_ERROR([no usable python found])])
8081         test -n "$PYTHON_CFLAGS" && break
8082     fi
8083     # let the PYTHON_FOR_BUILD match the same python installation that
8084     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8085     # better for PythonTests.
8086     PYTHON_FOR_BUILD=$PYTHON
8089 dnl By now enable_python should be "system", "internal" or "no"
8090 case $enable_python in
8091 system)
8092     SYSTEM_PYTHON=YES
8094     if test "$CROSS_COMPILING" != YES; then
8095         dnl Check if the headers really work
8096         save_CPPFLAGS="$CPPFLAGS"
8097         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8098         AC_CHECK_HEADER(Python.h, [],
8099            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8100            [])
8101         CPPFLAGS="$save_CPPFLAGS"
8103         AC_LANG_PUSH(C)
8104         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8105         AC_MSG_CHECKING([for correct python library version])
8106            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8107 #include <Python.h>
8109 int main(int argc, char **argv) {
8110        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8111            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8112        else return 1;
8114            ]])],[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])],[])
8115         CFLAGS=$save_CFLAGS
8116         AC_LANG_POP(C)
8118         dnl FIXME Check if the Python library can be linked with, too?
8119     fi
8120     ;;
8122 internal)
8123     SYSTEM_PYTHON=NO
8124     PYTHON_VERSION_MAJOR=3
8125     PYTHON_VERSION_MINOR=3
8126     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8127     BUILD_TYPE="$BUILD_TYPE PYTHON"
8128     # Embedded Python dies without Home set
8129     if test "$HOME" = ""; then
8130         export HOME=""
8131     fi
8132     # bz2 tarball and bzip2 is not standard
8133     if test -z "$BZIP2"; then
8134         AC_PATH_PROG( BZIP2, bzip2)
8135         if test -z "$BZIP2"; then
8136             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8137         fi
8138     fi
8139     ;;
8141     DISABLE_PYTHON=TRUE
8142     SYSTEM_PYTHON=NO
8143     ;;
8145     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8146     ;;
8147 esac
8149 AC_SUBST(DISABLE_PYTHON)
8150 AC_SUBST(SYSTEM_PYTHON)
8151 AC_SUBST(PYTHON_CFLAGS)
8152 AC_SUBST(PYTHON_LIBS)
8153 AC_SUBST(PYTHON_VERSION)
8154 AC_SUBST(PYTHON_VERSION_MAJOR)
8155 AC_SUBST(PYTHON_VERSION_MINOR)
8157 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8158 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8159     AC_MSG_RESULT([yes])
8160     ENABLE_MARIADBC=TRUE
8161     MARIADBC_MAJOR=1
8162     MARIADBC_MINOR=0
8163     MARIADBC_MICRO=2
8164     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8165 else
8166     AC_MSG_RESULT([no])
8167     ENABLE_MARIADBC=
8169 AC_SUBST(ENABLE_MARIADBC)
8170 AC_SUBST(MARIADBC_MAJOR)
8171 AC_SUBST(MARIADBC_MINOR)
8172 AC_SUBST(MARIADBC_MICRO)
8174 if test "$ENABLE_MARIADBC" = "TRUE"; then
8176     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8178     dnl ===================================================================
8179     dnl Check for system MariaDB
8180     dnl ===================================================================
8181     AC_MSG_CHECKING([which MariaDB to use])
8182     if test "$with_system_mariadb" = "yes"; then
8183         AC_MSG_RESULT([external])
8184         SYSTEM_MARIADB=YES
8185         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8186         if test -z "$MARIADBCONFIG"; then
8187             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8188             if test -z "$MARIADBCONFIG"; then
8189                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8190                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8191             fi
8192         fi
8193         AC_MSG_CHECKING([MariaDB version])
8194         MARIADB_VERSION=`$MARIADBCONFIG --version`
8195         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8196         if test "$MARIADB_MAJOR" -ge "5"; then
8197             AC_MSG_RESULT([OK])
8198         else
8199             AC_MSG_ERROR([too old, use 5.0.x or later])
8200         fi
8201         AC_MSG_CHECKING([for MariaDB Client library])
8202         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8203         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8204         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8205         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8206         if test "$enable_bundle_mariadb" = "yes"; then
8207             AC_MSG_RESULT([yes])
8208             BUNDLE_MARIADB=YES
8209             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8210             if test "$_os" = "Darwin"; then
8211                 LIBMARIADB=${LIBMARIADB}.dylib
8212             elif test "$_os" = "WINNT"; then
8213                 LIBMARIADB=${LIBMARIADB}.dll
8214             else
8215                 LIBMARIADB=${LIBMARIADB}.so
8216             fi
8217             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8218             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8219             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8220                 AC_MSG_RESULT([found.])
8221                 PathFormat "$LIBMARIADB_PATH"
8222                 LIBMARIADB_PATH="$formatted_path"
8223             else
8224                 AC_MSG_ERROR([not found.])
8225             fi
8226         else
8227             AC_MSG_RESULT([no])
8228             BUNDLE_MARIADB=NO
8229         fi
8230     else
8231         AC_MSG_RESULT([internal])
8232         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8233         SYSTEM_MARIADB=NO
8234         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8235         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8236         BUILD_TYPE="$BUILD_TYPE MARIADB"
8237     fi
8239     AC_SUBST(SYSTEM_MARIADB)
8240     AC_SUBST(MARIADB_CFLAGS)
8241     AC_SUBST(MARIADB_LIBS)
8242     AC_SUBST(LIBMARIADB)
8243     AC_SUBST(LIBMARIADB_PATH)
8244     AC_SUBST(BUNDLE_MARIADB)
8246     AC_LANG_PUSH([C++])
8247     dnl ===================================================================
8248     dnl Check for system MySQL C++ Connector
8249     dnl ===================================================================
8250     # FIXME!
8251     # who thought this too-generic cppconn dir was a good idea?
8252     AC_MSG_CHECKING([MySQL Connector/C++])
8253     if test "$with_system_mysql_cppconn" = "yes"; then
8254         AC_MSG_RESULT([external])
8255         SYSTEM_MYSQL_CPPCONN=YES
8256         AC_LANG_PUSH([C++])
8257         AC_CHECK_HEADER(mysql_driver.h, [],
8258                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8259         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8260                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8261         save_LIBS=$LIBS
8262         LIBS="$LIBS -lmysqlcppconn"
8263         AC_MSG_CHECKING([version])
8264         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8265 #include <mysql_driver.h>
8267 int main(int argc, char **argv) {
8268     sql::Driver *driver;
8269     driver = get_driver_instance();
8270     if (driver->getMajorVersion() > 1 || \
8271        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8272        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8273         return 0;
8274       else
8275         return 1;
8277       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8279         AC_LANG_POP([C++])
8280         LIBS=$save_LIBS
8281     else
8282         AC_MSG_RESULT([internal])
8283         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8284         SYSTEM_MYSQL_CPPCONN=NO
8285     fi
8286     AC_LANG_POP([C++])
8288 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8290 dnl ===================================================================
8291 dnl Check for system hsqldb
8292 dnl ===================================================================
8293 if test "$with_java" != "no"; then
8294 HSQLDB_USE_JDBC_4_1=
8295 AC_MSG_CHECKING([which hsqldb to use])
8296 if test "$with_system_hsqldb" = "yes"; then
8297     AC_MSG_RESULT([external])
8298     SYSTEM_HSQLDB=YES
8299     if test -z $HSQLDB_JAR; then
8300         HSQLDB_JAR=/usr/share/java/hsqldb.jar
8301     fi
8302     AC_CHECK_FILE($HSQLDB_JAR, [],
8303                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8304     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8305     export HSQLDB_JAR
8306     if $PERL -e 'use Archive::Zip;
8307             my $file = "$ENV{'HSQLDB_JAR'}";
8308             my $zip = Archive::Zip->new( $file );
8309             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8310             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
8311                push @l, split(/\n/, $mf);
8312                foreach my $line (@l) {
8313                   if ($line =~ m/Specification-Version:/) {
8314                       ($t, $version) = split (/:/,$line);
8315                       $version =~ s/^\s//;
8316                       ($a, $b, $c, $d) = split (/\./,$version);
8317                       if ($c == "0" && $d > "8")  {
8318                           exit 0;
8319                       } else {
8320                           exit 1;
8321                       }
8322                   }
8323                }
8324             } else {
8325                 exit 1;
8326             }'; then
8327         AC_MSG_RESULT([yes])
8328     else
8329         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8330     fi
8331 else
8332     AC_MSG_RESULT([internal])
8333     SYSTEM_HSQLDB=NO
8334     BUILD_TYPE="$BUILD_TYPE HSQLDB"
8335     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8336     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8337     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8338         AC_MSG_RESULT([yes])
8339         HSQLDB_USE_JDBC_4_1=YES
8340     else
8341         AC_MSG_RESULT([no])
8342     fi
8344 AC_SUBST(SYSTEM_HSQLDB)
8345 AC_SUBST(HSQLDB_JAR)
8346 AC_SUBST([HSQLDB_USE_JDBC_4_1])
8349 dnl ===================================================================
8350 dnl Check for PostgreSQL stuff
8351 dnl ===================================================================
8352 if test "x$enable_postgresql_sdbc" != "xno"; then
8353     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8355     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8356         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8357     fi
8358     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8359         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8360     fi
8362     AC_MSG_CHECKING([PostgreSQL C interface])
8363     if test "$with_system_postgresql" = "yes"; then
8364         AC_MSG_RESULT([external PostgreSQL])
8365         SYSTEM_POSTGRESQL=YES
8366         if test "$_os" = Darwin; then
8367             supp_path=''
8368             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8369                 pg_supp_path="$P_SEP$d$pg_supp_path"
8370             done
8371         fi
8372         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8373         if test -z "$PGCONFIG"; then
8374             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8375         fi
8376         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8377         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8378     else
8379         # if/when anything else than PostgreSQL uses Kerberos,
8380         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8381         WITH_KRB5=NO
8382         WITH_GSSAPI=no
8383         case "$_os" in
8384         Darwin)
8385             # MacOS X has system MIT Kerberos 5 since 10.4
8386             if test "$with_krb5" != "no"; then
8387                 WITH_KRB5=YES
8388                 save_LIBS=$LIBS
8389                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8390                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8391                 KRB5_LIBS=$LIBS
8392                 LIBS=$save_LIBS
8393                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8394                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8395                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8396                 LIBS=$save_LIBS
8397             fi
8398             if test "$with_gssapi" != "no"; then
8399               WITH_GSSAPI=YES
8400               save_LIBS=$LIBS
8401               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8402                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8403               GSSAPI_LIBS=$LIBS
8404               LIBS=$save_LIBS
8405             fi
8406             ;;
8407         WINNT)
8408             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8409                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8410             fi
8411             ;;
8412         Linux|GNU|*BSD|DragonFly)
8413             if test "$with_krb5" != "no"; then
8414                 WITH_KRB5=YES
8415                 save_LIBS=$LIBS
8416                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8417                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8418                 KRB5_LIBS=$LIBS
8419                 LIBS=$save_LIBS
8420                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8421                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8422                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8423                 LIBS=$save_LIBS
8424             fi
8425             if test "$with_gssapi" != "no"; then
8426                 WITH_GSSAPI=YES
8427                 save_LIBS=$LIBS
8428                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8429                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8430                 GSSAPI_LIBS=$LIBS
8431                 LIBS=$save_LIBS
8432             fi
8433             ;;
8434         *)
8435             if test "$with_krb5" = "yes"; then
8436                 WITH_KRB5=YES
8437                 save_LIBS=$LIBS
8438                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8439                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8440                 KRB5_LIBS=$LIBS
8441                 LIBS=$save_LIBS
8442                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8443                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8444                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8445                 LIBS=$save_LIBS
8446             fi
8447             if test "$with_gssapi" = "yes"; then
8448                 WITH_GSSAPI=YES
8449                 save_LIBS=$LIBS
8450                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8451                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8452                 LIBS=$save_LIBS
8453                 GSSAPI_LIBS=$LIBS
8454             fi
8455         esac
8457         if test -n "$with_libpq_path"; then
8458             SYSTEM_POSTGRESQL=YES
8459             AC_MSG_RESULT([external libpq])
8460             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8461             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8462         else
8463             SYSTEM_POSTGRESQL=NO
8464             AC_MSG_RESULT([internal])
8465             POSTGRESQL_LIB=""
8466             POSTGRESQL_INC="%OVERRIDE_ME%"
8467             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8468         fi
8469     fi
8470     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
8471         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8472         save_CFLAGS=$CFLAGS
8473         save_CPPFLAGS=$CPPFLAGS
8474         save_LIBS=$LIBS
8475         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8476         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8477         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8478         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8479             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8480         CFLAGS=$save_CFLAGS
8481         CPPFLAGS=$save_CPPFLAGS
8482         LIBS=$save_LIBS
8483     fi
8484     BUILD_POSTGRESQL_SDBC=YES
8486 AC_SUBST(WITH_KRB5)
8487 AC_SUBST(WITH_GSSAPI)
8488 AC_SUBST(GSSAPI_LIBS)
8489 AC_SUBST(KRB5_LIBS)
8490 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8491 AC_SUBST(SYSTEM_POSTGRESQL)
8492 AC_SUBST(POSTGRESQL_INC)
8493 AC_SUBST(POSTGRESQL_LIB)
8495 dnl ===================================================================
8496 dnl Check for Firebird stuff
8497 dnl ===================================================================
8498 ENABLE_FIREBIRD_SDBC=""
8499 if test "x$enable_firebird_sdbc" = "xyes"; then
8500     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8502     dnl ===================================================================
8503     dnl Check for system Firebird
8504     dnl ===================================================================
8505     AC_MSG_CHECKING([which Firebird to use])
8506     if test "$with_system_firebird" = "yes"; then
8507         AC_MSG_RESULT([external])
8508         SYSTEM_FIREBIRD=YES
8509         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8510         if test -z "$FIREBIRDCONFIG"; then
8511             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8512             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8513             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8514         else
8515             AC_MSG_NOTICE([fb_config found])
8516             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8517             AC_MSG_CHECKING([for Firebird Client library])
8518             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8519             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8520         fi
8521         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8522         AC_MSG_CHECKING([Firebird version])
8523         if test -n "${FIREBIRD_VERSION}"; then
8524             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8525             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8526             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8527                 AC_MSG_RESULT([OK])
8528             else
8529                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8530             fi
8531         else
8532             __save_CFLAGS="${CFLAGS}"
8533             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8534             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8535 #if defined(FB_API_VER) && FB_API_VER == 25
8536 #else
8537 #error "Wrong Firebird API version"
8538 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8539             CFLAGS="${__save_CFLAGS}"
8540         fi
8541         ENABLE_FIREBIRD_SDBC="TRUE"
8542     elif test "$enable_database_connectivity" != yes; then
8543         AC_MSG_RESULT([none])
8544     elif test "$cross_compiling" = "yes"; then
8545         AC_MSG_RESULT([none])
8546     else
8547         dnl We need libatomic-ops for any non X86/X64 system
8548         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8549             dnl ===================================================================
8550             dnl Check for system libatomic-ops
8551             dnl ===================================================================
8552             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8553             if test "$with_system_libatomic_ops" = "yes"; then
8554                 SYSTEM_LIBATOMIC_OPS=YES
8555                 AC_CHECK_HEADERS(atomic_ops.h, [],
8556                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8557             else
8558                 SYSTEM_LIBATOMIC_OPS=NO
8559                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8560                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8561                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8562             fi
8563         fi
8565         AC_MSG_RESULT([internal])
8566         SYSTEM_FIREBIRD=NO
8567         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8568         FIREBIRD_LIBS="-lfbembed"
8570         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8571         ENABLE_FIREBIRD_SDBC="TRUE"
8572     fi
8575 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8576 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8577 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8578 AC_SUBST(LIBATOMIC_OPS_LIBS)
8579 AC_SUBST(SYSTEM_FIREBIRD)
8580 AC_SUBST(FIREBIRD_CFLAGS)
8581 AC_SUBST(FIREBIRD_LIBS)
8582 dnl AC_SUBST([TOMMATH_CFLAGS])
8583 dnl AC_SUBST([TOMMATH_LIBS])
8585 dnl ===================================================================
8586 dnl Check for system curl
8587 dnl ===================================================================
8588 AC_MSG_CHECKING([which libcurl to use])
8589 if test "$with_system_curl" = "auto"; then
8590     case "$_os" in
8591     Darwin)
8592         with_system_curl=yes
8593         ;;
8594     *)
8595         with_system_curl="$with_system_libs"
8596         ;;
8597     esac
8600 if test "$with_system_curl" = "yes"; then
8601     AC_MSG_RESULT([external])
8602     SYSTEM_CURL=YES
8604     curl_version=""
8605     if test "$cross_compiling" = "yes"; then
8606         dnl At least the OBS mingw32-libcurl-devel package
8607         dnl comes with a proper .pc file
8608         PKG_CHECK_MODULES(CURL, libcurl,, [:])
8609         if test -n "$CURL_PKG_ERRORS"; then
8610             AC_MSG_RESULT([no])
8611         else
8612             curl_version=`$PKG_CONFIG --modversion libcurl`
8613         fi
8614     fi
8615     if test -z "$curl_version"; then
8616         AC_PATH_PROG(CURLCONFIG, curl-config)
8617         if test -z "$CURLCONFIG"; then
8618             AC_MSG_ERROR([install the libcurl development package])
8619         fi
8620         CURL_LIBS=`$CURLCONFIG --libs`
8621         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8622         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8623     fi
8625     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
8627     case $curl_version in
8628     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8629     dnl so they need to be doubled to end up in the configure script
8630     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8631         AC_MSG_RESULT([yes, you have $curl_version])
8632         ;;
8633     *)
8634         AC_MSG_ERROR([no, you have $curl_version])
8635         ;;
8636     esac
8638     libo_MINGW_CHECK_DLL([libcurl])
8639     libo_MINGW_TRY_DLL([libintl])
8640     libo_MINGW_TRY_DLL([libidn])
8641     libo_MINGW_TRY_DLL([libnspr4])
8642     libo_MINGW_TRY_DLL([nssutil3])
8643     libo_MINGW_TRY_DLL([libplc4])
8644     libo_MINGW_TRY_DLL([libplds4])
8645     libo_MINGW_TRY_DLL([nss3])
8646     libo_MINGW_TRY_DLL([ssl3])
8647     libo_MINGW_TRY_DLL([libgpg-error])
8648     libo_MINGW_TRY_DLL([libgcrypt])
8649     libo_MINGW_TRY_DLL([libssh2])
8650 else
8651     AC_MSG_RESULT([internal])
8652     SYSTEM_CURL=NO
8653     BUILD_TYPE="$BUILD_TYPE CURL"
8655 AC_SUBST(SYSTEM_CURL)
8656 AC_SUBST(CURL_CFLAGS)
8657 AC_SUBST(CURL_LIBS)
8659 dnl ===================================================================
8660 dnl Check for system boost
8661 dnl ===================================================================
8662 AC_MSG_CHECKING([which boost to use])
8663 if test "$with_system_boost" = "yes"; then
8664     AC_MSG_RESULT([external])
8665     SYSTEM_BOOST=YES
8666     AX_BOOST_BASE(1.47)
8667     AX_BOOST_DATE_TIME
8668     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8669     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8670     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8671         # if not found, try again with 'lib' prefix
8672         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8673     fi
8674     AC_LANG_PUSH([C++])
8675     save_CXXFLAGS=$CXXFLAGS
8676     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8677     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8678        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8679     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8680        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8681     AC_CHECK_HEADER(boost/function.hpp, [],
8682        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8683     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8684     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8685     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8686 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8687     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8688         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8689     else
8690         AC_MSG_RESULT([yes])
8691     fi
8692     CXXFLAGS=$save_CXXFLAGS
8693     AC_LANG_POP([C++])
8694 else
8695     AC_MSG_RESULT([internal])
8696     BUILD_TYPE="$BUILD_TYPE BOOST"
8697     SYSTEM_BOOST=NO
8699 AC_SUBST(SYSTEM_BOOST)
8701 dnl ===================================================================
8702 dnl Check for system mdds
8703 dnl ===================================================================
8704 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.9.1])
8706 dnl ===================================================================
8707 dnl Determine which hash container mdds shall use
8708 dnl ===================================================================
8709 AC_MSG_CHECKING([which hash container mdds shall use])
8710 if test "x$HAVE_CXX11" = "xTRUE" -a "x$SYSTEM_MDDS" = "xYES"; then
8711     MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8712     AC_MSG_RESULT([std::unordered_map])
8713 else
8714     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8715     AC_MSG_RESULT([boost::unordered_map])
8717 AC_SUBST([MDDS_CPPFLAGS])
8719 dnl ===================================================================
8720 dnl Check for system vigra
8721 dnl ===================================================================
8722 AC_MSG_CHECKING([which vigra to use])
8723 if test "$with_system_vigra" = "yes"; then
8724     AC_MSG_RESULT([external])
8725     SYSTEM_VIGRA=YES
8726     AC_LANG_PUSH([C++])
8727     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8728        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8729     AC_LANG_POP([C++])
8730 else
8731     AC_MSG_RESULT([internal])
8732     BUILD_TYPE="$BUILD_TYPE VIGRA"
8733     SYSTEM_VIGRA=NO
8735 AC_SUBST(SYSTEM_VIGRA)
8737 dnl ===================================================================
8738 dnl Check for system odbc
8739 dnl ===================================================================
8740 AC_MSG_CHECKING([which odbc headers to use])
8741 if test "$with_system_odbc" = "yes"; then
8742     AC_MSG_RESULT([external])
8743     SYSTEM_ODBC_HEADERS=YES
8745     AC_CHECK_HEADER(sqlext.h, [],
8746       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8747 elif test "$enable_database_connectivity" != yes; then
8748     AC_MSG_RESULT([none])
8749 else
8750     AC_MSG_RESULT([internal])
8751     SYSTEM_ODBC_HEADERS=NO
8753 AC_SUBST(SYSTEM_ODBC_HEADERS)
8756 dnl ===================================================================
8757 dnl Check for system openldap
8758 dnl ===================================================================
8760 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8761 AC_MSG_CHECKING([which openldap library to use])
8762 if test "$with_system_openldap" = "yes"; then
8763     AC_MSG_RESULT([external])
8764     SYSTEM_OPENLDAP=YES
8765     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8766     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8767     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8768 else
8769     AC_MSG_RESULT([internal])
8770     SYSTEM_OPENLDAP=NO
8771     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8774 AC_SUBST(SYSTEM_OPENLDAP)
8776 dnl ===================================================================
8777 dnl Check for mozilla ab connectivity for windows
8778 dnl ===================================================================
8780 if test "$_os" = "WINNT"; then
8781     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8782     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8783         WITH_MOZAB4WIN=YES
8784         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8785         BUILD_TYPE="$BUILD_TYPE MOZ"
8786         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8787         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8788         for dll in $MSVC80_DLLS; do
8789             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8790                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8791             fi
8792         done
8793     else
8794         AC_MSG_RESULT([no])
8795         WITH_MOZAB4WIN=NO
8796     fi
8798 AC_SUBST(WITH_MOZAB4WIN)
8799 AC_SUBST(MSVC80_DLLS)
8800 AC_SUBST(MSVC80_DLL_PATH)
8802 dnl ===================================================================
8803 dnl Check for TLS/SSL and cryptographic implementation to use
8804 dnl ===================================================================
8805 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8806 if test -n "$with_tls"; then
8807     case $with_tls in
8808     openssl)
8809         AC_DEFINE(USE_TLS_OPENSSL)
8810         TLS=OPENSSL
8812         if test "$enable_openssl" != "yes"; then
8813             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8814         fi
8816         # warn that OpenSSL has been selected but not all TLS code has this option
8817         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8818         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8819         ;;
8820     nss)
8821         AC_DEFINE(USE_TLS_NSS)
8822         TLS=NSS
8823         ;;
8824     *)
8825         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8826 openssl - OpenSSL
8827 nss - Mozilla's Network Security Services (NSS)
8828     ])
8829         ;;
8830     esac
8831 elif test $_os = iOS -o $_os = Android; then
8832     # We don't build NSS for iOS and Android
8833     AC_DEFINE(USE_TLS_OPENSSL)
8834     TLS=OPENSSL
8835 else
8836     # default to using NSS, it results in smaller oox lib
8837     AC_DEFINE(USE_TLS_NSS)
8838     TLS=NSS
8840 AC_MSG_RESULT([$TLS])
8841 AC_SUBST(TLS)
8843 dnl ===================================================================
8844 dnl Check for system NSS
8845 dnl ===================================================================
8846 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8847 if test "$with_system_nss" = "yes"; then
8848     libo_MINGW_CHECK_DLL([libnspr4])
8849     libo_MINGW_CHECK_DLL([libplc4])
8850     libo_MINGW_CHECK_DLL([libplds4])
8851     libo_MINGW_CHECK_DLL([nss3])
8852     libo_MINGW_CHECK_DLL([nssutil3])
8853     libo_MINGW_CHECK_DLL([smime3])
8854     libo_MINGW_CHECK_DLL([ssl3])
8857 dnl ===================================================================
8858 dnl Check for system mozilla headers
8859 dnl ===================================================================
8860 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8861 AC_MSG_CHECKING([which NPAPI headers to use])
8863 if test "$with_system_npapi_headers" = "yes"; then
8864     AC_MSG_RESULT([external])
8865     SYSTEM_NPAPI_HEADERS=YES
8866     # First try npapi-sdk:
8867     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8868     # Then go with libxul:
8869     if test "x$LOCATED" != "xyes"; then
8870         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8871     fi
8872     if test "x$LOCATED" != "xyes"; then
8873         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8874     fi
8875     # if still not found bail out
8876     if test "x$LOCATED" != "xyes"; then
8877         AC_MSG_ERROR([npapi.h header file not found])
8878     fi
8880     AC_LANG_PUSH([C])
8881     save_CFLAGS=$CFLAGS
8882     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8883     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8884     AC_COMPILE_IFELSE(
8885         [AC_LANG_SOURCE([[
8886             #define XP_UNIX
8887             #include <npapi.h>
8888             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8889             ]])],
8890         [AC_MSG_RESULT([const char*])],
8891         [
8892         AC_MSG_RESULT([char*])
8893         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8894         ])
8895     CFLAGS=$save_CFLAGS
8896     AC_LANG_POP([C])
8897     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8898 else
8899     AC_MSG_RESULT([internal])
8900         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8901         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
8902     SYSTEM_NPAPI_HEADERS=NO
8904 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8905 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8906 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8908 dnl ===================================================================
8909 dnl Check for system sane
8910 dnl ===================================================================
8911 AC_MSG_CHECKING([which sane header to use])
8912 if test "$with_system_sane" = "yes"; then
8913     AC_MSG_RESULT([external])
8914     AC_CHECK_HEADER(sane/sane.h, [],
8915       [AC_MSG_ERROR(sane not found. install sane)], [])
8916 else
8917     AC_MSG_RESULT([internal])
8918     BUILD_TYPE="$BUILD_TYPE SANE"
8921 dnl ===================================================================
8922 dnl Check for system icu
8923 dnl ===================================================================
8924 SYSTEM_GENBRK=
8925 SYSTEM_GENCCODE=
8926 SYSTEM_GENCMN=
8928 ICU_MAJOR=52
8929 ICU_MINOR=1
8930 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8931 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8932 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8933 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8934 AC_MSG_CHECKING([which icu to use])
8935 if test "$with_system_icu" = "yes"; then
8936     AC_MSG_RESULT([external])
8937     SYSTEM_ICU=YES
8938     AC_LANG_PUSH([C++])
8939     AC_MSG_CHECKING([for unicode/rbbi.h])
8940     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8941     AC_LANG_POP([C++])
8943     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8944         ICUPATH="$PATH"
8945         if test "$WITH_MINGW" = "yes"; then
8946             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8947         fi
8948         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8950         AC_MSG_CHECKING([ICU version])
8951         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8952         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8953         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8955         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8956             AC_MSG_RESULT([OK, $ICU_VERSION])
8957         else
8958             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8959         fi
8960     fi
8962     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8963         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8964         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8965         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8966         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8967         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8968         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8969             AC_MSG_RESULT([yes])
8970         else
8971             AC_MSG_RESULT([no])
8972             if test "$with_system_icu_for_build" != "force"; then
8973                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8974 You can use --with-system-icu-for-build=force to use it anyway.])
8975             fi
8976         fi
8977     fi
8979     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8980         # using the system icu tools can lead to version confusion, use the
8981         # ones from the build environment when cross-compiling
8982         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8983         if test -z "$SYSTEM_GENBRK"; then
8984             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8985         fi
8986         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8987         if test -z "$SYSTEM_GENCCODE"; then
8988             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8989         fi
8990         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8991         if test -z "$SYSTEM_GENCMN"; then
8992             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8993         fi
8994         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8995             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8996         else
8997             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
8998         fi
8999         if test "$ICU_MAJOR" -ge "49"; then
9000             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
9001             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
9002             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
9003         else
9004             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
9005             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
9006             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
9007         fi
9008     fi
9010     if test "$cross_compiling" = "yes"; then
9011        if test "$ICU_MAJOR" -ge "50"; then
9012             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9013             ICU_MINOR=""
9014        fi
9015     fi
9017     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9018     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9019     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9020 else
9021     AC_MSG_RESULT([internal])
9022     SYSTEM_ICU="NO"
9023     BUILD_TYPE="$BUILD_TYPE ICU"
9024     # surprisingly set these only for "internal" (to be used by various other
9025     # external libs): the system icu-config is quite unhelpful and spits out
9026     # dozens of weird flags and also default path -I/usr/include
9027     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9028     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9030 AC_SUBST(SYSTEM_ICU)
9031 AC_SUBST(SYSTEM_GENBRK)
9032 AC_SUBST(SYSTEM_GENCCODE)
9033 AC_SUBST(SYSTEM_GENCMN)
9034 AC_SUBST(ICU_MAJOR)
9035 AC_SUBST(ICU_MINOR)
9036 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9037 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9038 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9039 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9040 AC_SUBST(ICU_CFLAGS)
9041 AC_SUBST(ICU_LIBS)
9043 dnl ===================================================================
9044 dnl Graphite
9045 dnl ===================================================================
9047 AC_MSG_CHECKING([whether to enable graphite support])
9048 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9049     AC_MSG_RESULT([yes])
9050     ENABLE_GRAPHITE="TRUE"
9051     AC_DEFINE(ENABLE_GRAPHITE)
9052     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9053     if test "$with_system_graphite" = "yes"; then
9054         libo_MINGW_CHECK_DLL([libgraphite2])
9055     fi
9056 else
9057     AC_MSG_RESULT([no])
9059 AC_SUBST(ENABLE_GRAPHITE)
9061 dnl ===================================================================
9062 dnl Orcus
9063 dnl ===================================================================
9065 AC_MSG_CHECKING([whether to enable orcus])
9066 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9067     AC_MSG_RESULT([yes])
9068     ENABLE_ORCUS="TRUE"
9069     AC_DEFINE(ENABLE_ORCUS)
9071     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
9072     if test "$with_system_orcus" != "yes"; then
9073         if test "$SYSTEM_BOOST" = "YES"; then
9074             # ===========================================================
9075             # Determine if we are going to need to link with Boost.System
9076             # ===========================================================
9077             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9078             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9079             dnl in documentation has no effect.
9080             AC_MSG_CHECKING([if we need to link with Boost.System])
9081             AC_LANG_PUSH([C++])
9082             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9083                     @%:@include <boost/version.hpp>
9084                 ]],[[
9085                     #if BOOST_VERSION >= 105000
9086                     #   error yes, we need to link with Boost.System
9087                     #endif
9088                 ]])],[
9089                     AC_MSG_RESULT([no])
9090                 ],[
9091                     AC_MSG_RESULT([yes])
9092                     AX_BOOST_SYSTEM
9093             ])
9094             AC_LANG_POP([C++])
9095         fi
9096     fi
9097     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9098     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9099     AC_SUBST([BOOST_SYSTEM_LIB])
9100     AC_SUBST(SYSTEM_LIBORCUS)
9102 else
9103     AC_MSG_RESULT([no])
9105 AC_SUBST(ENABLE_ORCUS)
9107 dnl ===================================================================
9108 dnl HarfBuzz
9109 dnl ===================================================================
9110 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9111 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9112     AC_MSG_RESULT([yes])
9113     ENABLE_HARFBUZZ="TRUE"
9114     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9115         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"])
9116     else
9117         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9118     fi
9119 else
9120     AC_MSG_RESULT([no])
9122 AC_SUBST(ENABLE_HARFBUZZ)
9124 dnl ===================================================================
9125 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9126 dnl ===================================================================
9127 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9128 # Obviously no such thing on iOS or Android. Also not possible when building
9129 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9130 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9131         "$enable_headless" != yes
9132 then
9133     AC_MSG_RESULT([yes])
9134     ENABLE_NPAPI_FROM_BROWSER=TRUE
9135 else
9136     AC_MSG_RESULT([no])
9137     ENABLE_NPAPI_FROM_BROWSER=
9139 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9141 dnl ===================================================================
9142 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9143 dnl ===================================================================
9144 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9145 if test "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9146         "$enable_headless" != yes -a "$enable_gtk" != no
9147 then
9148     AC_MSG_RESULT([yes])
9149     ENABLE_NPAPI_INTO_BROWSER=TRUE
9150 else
9151     AC_MSG_RESULT([no])
9152     ENABLE_NPAPI_INTO_BROWSER=
9154 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9156 AC_MSG_CHECKING([whether to use X11])
9157 dnl ***************************************
9158 dnl testing for X libraries and includes...
9159 dnl ***************************************
9160 WANT_X11="no"
9161 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9162     WANT_X11="yes"
9163     AC_DEFINE(HAVE_FEATURE_X11)
9165 AC_MSG_RESULT([$WANT_X11])
9167 if test "$WANT_X11" = "yes"; then
9168     AC_PATH_X
9169     AC_PATH_XTRA
9170     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9172     if test -z "$x_includes"; then
9173         x_includes="default_x_includes"
9174     fi
9175     if test -z "$x_libraries"; then
9176         x_libraries="default_x_libraries"
9177     fi
9178     CFLAGS="$CFLAGS $X_CFLAGS"
9179     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9180     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9181 else
9182     x_includes="no_x_includes"
9183     x_libraries="no_x_libraries"
9186 if test "$WANT_X11" = "yes"; then
9187     dnl ===================================================================
9188     dnl Check for Composite.h for Mozilla plugin
9189     dnl ===================================================================
9190     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9191      [#include <X11/Intrinsic.h>])
9193     dnl ===================================================================
9194     dnl Check for extension headers
9195     dnl ===================================================================
9196     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9197      [#include <X11/extensions/shape.h>])
9200 dnl ===================================================================
9201 dnl Check for system Xrender
9202 dnl ===================================================================
9203 AC_MSG_CHECKING([whether to use Xrender])
9204 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9205     AC_MSG_RESULT([yes])
9206     PKG_CHECK_MODULES(XRENDER, xrender)
9207     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9208     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9209       [AC_MSG_ERROR(libXrender not found or functional)], [])
9210     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9211       [AC_MSG_ERROR(Xrender not found. install X)], [])
9212 else
9213     AC_MSG_RESULT([no])
9215 AC_SUBST(XRENDER_CFLAGS)
9216 AC_SUBST(XRENDER_LIBS)
9218 dnl ===================================================================
9219 dnl Check for XRandr
9220 dnl ===================================================================
9221 AC_MSG_CHECKING([whether to enable RandR support])
9222 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9223     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9224         XRANDR_DLOPEN="TRUE"
9225         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9226     else
9227         AC_MSG_RESULT([yes])
9228         XRANDR_DLOPEN="FALSE"
9229         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9230         if test "$ENABLE_RANDR" != "TRUE"; then
9231             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9232                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9233             XRANDR_CFLAGS=" "
9234             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9235               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9236             XRANDR_LIBS="-lXrandr "
9237             ENABLE_RANDR="TRUE"
9238         fi
9239         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9240     fi
9241 else
9242     ENABLE_RANDR=""
9243     AC_MSG_RESULT([no])
9245 AC_SUBST(XRANDR_DLOPEN)
9246 AC_SUBST(XRANDR_CFLAGS)
9247 AC_SUBST(XRANDR_LIBS)
9248 AC_SUBST(ENABLE_RANDR)
9250 dnl ===================================================================
9251 dnl Check for building neon
9252 dnl ===================================================================
9253 AC_MSG_CHECKING([whether to use neon])
9254 if test "$enable_neon" = "no"; then
9255     AC_MSG_RESULT([no])
9256     DISABLE_NEON=TRUE
9257     AC_SUBST(DISABLE_NEON)
9258 else
9259     AC_MSG_RESULT([yes])
9260 dnl ===================================================================
9261 dnl Check for system neon
9262 dnl ===================================================================
9263 libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9264 if test "$with_system_neon" = "yes"; then
9265     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9266     libo_MINGW_CHECK_DLL([libneon])
9267     libo_MINGW_TRY_DLL([libtasn1])
9268     libo_MINGW_TRY_DLL([libgnutls])
9269 else
9270     NEON_VERSION=0295
9272 AC_SUBST(NEON_VERSION)
9275 dnl ===================================================================
9276 dnl Check for disabling cve_tests
9277 dnl ===================================================================
9278 AC_MSG_CHECKING([whether to execute CVE tests])
9279 if test "$enable_cve_tests" = "no"; then
9280     AC_MSG_RESULT([no])
9281     DISABLE_CVE_TESTS=TRUE
9282     AC_SUBST(DISABLE_CVE_TESTS)
9283 else
9284     AC_MSG_RESULT([yes])
9287 dnl ===================================================================
9288 dnl Check for system openssl
9289 dnl ===================================================================
9290 DISABLE_OPENSSL=
9291 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9292 if test "$enable_openssl" = "yes"; then
9293     AC_MSG_RESULT([no])
9294     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9295         # OpenSSL is deprecated when building for 10.7 or later.
9296         #
9297         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9298         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9299         #
9300         # They apparently got fed up with the unstable ABI of
9301         # OpenSSL, or something, and recommend you either move to
9302         # their "Common Crypto Architecture", or, if you have to stay
9303         # with OpenSSL, just build it yourself statically and bundle
9304         # with your application.
9306         with_system_openssl=no
9307         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9308     elif test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
9309             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
9310         # Mac OS builds should get out without extra stuff is the Mac porters'
9311         # wish. And pkg-config is although Xcode ships a .pc for openssl
9312         with_system_openssl=yes
9313         SYSTEM_OPENSSL=YES
9314         OPENSSL_CFLAGS=
9315         OPENSSL_LIBS="-lssl -lcrypto"
9316     else
9317         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9318     fi
9319     if test "$with_system_openssl" = "yes"; then
9320         libo_MINGW_CHECK_DLL([libssl])
9321         libo_MINGW_CHECK_DLL([libcrypto])
9322         AC_MSG_CHECKING([whether openssl supports SHA512])
9323         AC_LANG_PUSH([C])
9324         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9325             SHA512_CTX context;
9326 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9327         AC_LANG_POP(C)
9328     fi
9329 else
9330     AC_MSG_RESULT([yes])
9331     DISABLE_OPENSSL=TRUE
9333     # warn that although OpenSSL is disabled, system libraries may be depending on it
9334     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9335     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9338 AC_SUBST([DISABLE_OPENSSL])
9340 dnl ===================================================================
9341 dnl Check for building gnutls
9342 dnl ===================================================================
9343 AC_MSG_CHECKING([whether to use gnutls])
9344 if test "$enable_neon" != "no" && test "$enable_openssl" = "no"; then
9345     AC_MSG_RESULT([yes])
9346     AM_PATH_LIBGCRYPT()
9347     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9348         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9349                       available in the system to use as replacement.]]))
9352 AC_SUBST([LIBGCRYPT_CFLAGS])
9353 AC_SUBST([LIBGCRYPT_LIBS])
9355 dnl ===================================================================
9356 dnl Check for system redland
9357 dnl ===================================================================
9358 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9359 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9360 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9361 if test "$with_system_redland" = "yes"; then
9362     libo_MINGW_CHECK_DLL([librdf])
9363     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9364             [AC_MSG_ERROR(librdf too old. Need >= 1.16)], [])
9365     libo_MINGW_TRY_DLL([libraptor])
9366     libo_MINGW_TRY_DLL([librasqal])
9367     libo_MINGW_TRY_DLL([libsqlite3])
9368 else
9369     RAPTOR_MAJOR="0"
9370     RASQAL_MAJOR="3"
9371     REDLAND_MAJOR="0"
9373 AC_SUBST(RAPTOR_MAJOR)
9374 AC_SUBST(RASQAL_MAJOR)
9375 AC_SUBST(REDLAND_MAJOR)
9377 dnl ===================================================================
9378 dnl Check for system hunspell
9379 dnl ===================================================================
9380 AC_MSG_CHECKING([which libhunspell to use])
9381 if test "$with_system_hunspell" = "yes"; then
9382     AC_MSG_RESULT([external])
9383     SYSTEM_HUNSPELL=YES
9384     AC_LANG_PUSH([C++])
9385     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9386     if test "$HUNSPELL_PC" != "TRUE"; then
9387         AC_CHECK_HEADER(hunspell.hxx, [],
9388             [
9389             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9390             [AC_MSG_ERROR(hunspell headers not found.)], [])
9391             ], [])
9392         AC_CHECK_LIB([hunspell], [main], [:],
9393            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9394         HUNSPELL_LIBS=-lhunspell
9395     fi
9396     AC_LANG_POP([C++])
9397     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9398     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9399 else
9400     AC_MSG_RESULT([internal])
9401     SYSTEM_HUNSPELL=NO
9402     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9403     if test "$COM" = "MSC"; then
9404         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9405     else
9406         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9407     fi
9408     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9410 AC_SUBST(SYSTEM_HUNSPELL)
9411 AC_SUBST(HUNSPELL_CFLAGS)
9412 AC_SUBST(HUNSPELL_LIBS)
9414 dnl ===================================================================
9415 dnl Checking for altlinuxhyph
9416 dnl ===================================================================
9417 AC_MSG_CHECKING([which altlinuxhyph to use])
9418 if test "$with_system_altlinuxhyph" = "yes"; then
9419     AC_MSG_RESULT([external])
9420     SYSTEM_HYPH=YES
9421     AC_CHECK_HEADER(hyphen.h, [],
9422        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9423     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9424        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9425        [#include <hyphen.h>])
9426     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9427         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9428     if test -z "$HYPHEN_LIB"; then
9429         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9430            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9431     fi
9432     if test -z "$HYPHEN_LIB"; then
9433         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9434            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9435     fi
9436     libo_MINGW_CHECK_DLL([libhyphen])
9437 else
9438     AC_MSG_RESULT([internal])
9439     SYSTEM_HYPH=NO
9440     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9441     if test "$COM" = "MSC"; then
9442         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9443     else
9444         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9445     fi
9447 AC_SUBST(SYSTEM_HYPH)
9448 AC_SUBST(HYPHEN_LIB)
9450 dnl ===================================================================
9451 dnl Checking for mythes
9452 dnl ===================================================================
9453 AC_MSG_CHECKING([which mythes to use])
9454 if test "$with_system_mythes" = "yes"; then
9455     AC_MSG_RESULT([external])
9456     SYSTEM_MYTHES=YES
9457     AC_LANG_PUSH([C++])
9458     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9459     if test "$MYTHES_PKGCONFIG" = "no"; then
9460         AC_CHECK_HEADER(mythes.hxx, [],
9461             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9462         AC_CHECK_LIB([mythes-1.2], [main], [:],
9463             [ MYTHES_FOUND=no], [])
9464     if test "$MYTHES_FOUND" = "no"; then
9465         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9466                 [ MYTHES_FOUND=no], [])
9467     fi
9468     if test "$MYTHES_FOUND" = "no"; then
9469         AC_MSG_ERROR([mythes library not found!.])
9470     fi
9471     fi
9472     AC_LANG_POP([C++])
9473     libo_MINGW_CHECK_DLL([libmythes-1.2])
9474     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9475 else
9476     AC_MSG_RESULT([internal])
9477     SYSTEM_MYTHES=NO
9478     BUILD_TYPE="$BUILD_TYPE MYTHES"
9479     if test "$COM" = "MSC"; then
9480         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9481     else
9482         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9483     fi
9485 AC_SUBST(SYSTEM_MYTHES)
9486 AC_SUBST(MYTHES_CFLAGS)
9487 AC_SUBST(MYTHES_LIBS)
9489 dnl ===================================================================
9490 dnl How should we build the linear programming solver ?
9491 dnl ===================================================================
9492 ENABLE_LPSOLVE=
9493 AC_MSG_CHECKING([whether to build with lpsolve])
9494 if test "$enable_lpsolve" != "no"; then
9495     ENABLE_LPSOLVE=TRUE
9496     AC_MSG_RESULT([yes])
9497 else
9498     AC_MSG_RESULT([no])
9500 AC_SUBST(ENABLE_LPSOLVE)
9502 AC_MSG_CHECKING([which lpsolve to use])
9503 if test "$with_system_lpsolve" = "yes"; then
9504     AC_MSG_RESULT([external])
9505     SYSTEM_LPSOLVE=YES
9506     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9507        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9508     save_LIBS=$LIBS
9509     # some systems need this. Like Ubuntu....
9510     AC_CHECK_LIB(m, floor)
9511     AC_CHECK_LIB(dl, dlopen)
9512     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9513         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9514     LIBS=$save_LIBS
9515     libo_MINGW_CHECK_DLL([lpsolve55])
9516 else
9517     AC_MSG_RESULT([internal])
9518     SYSTEM_LPSOLVE=NO
9519     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9521 AC_SUBST(SYSTEM_LPSOLVE)
9525 dnl ===================================================================
9526 dnl Checking for libexttextcat
9527 dnl ===================================================================
9528 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9529 if test "$with_system_libexttextcat" = "yes"; then
9530     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9532 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9534 dnl ***************************************
9535 dnl testing libc version for Linux...
9536 dnl ***************************************
9537 if test "$_os" = "Linux"; then
9538     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9539     exec 6>/dev/null # no output
9540     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9541     exec 6>&1 # output on again
9542     if test "$HAVE_LIBC"; then
9543         AC_MSG_RESULT([yes])
9544     else
9545         AC_MSG_ERROR([no, upgrade libc])
9546     fi
9549 dnl =========================================
9550 dnl Check for the Windows  SDK.
9551 dnl =========================================
9552 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9553 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9554 if test "$_os" = "WINNT"; then
9555     AC_MSG_CHECKING([for Windows SDK])
9556     if test "$build_os" = "cygwin"; then
9557         find_winsdk
9558         WINDOWS_SDK_HOME=$winsdktest
9560         # normalize if found
9561         if test -n "$WINDOWS_SDK_HOME"; then
9562             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9563             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9564         fi
9565     fi
9567     if test -n "$WINDOWS_SDK_HOME"; then
9568         # Remove a possible trailing backslash
9569         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9571         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9572              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9573              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9574             have_windows_sdk_headers=yes
9575         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9576              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9577              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9578             have_windows_sdk_headers=yes
9579         else
9580             have_windows_sdk_headers=no
9581         fi
9583         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9584             have_windows_sdk_libs=yes
9585         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9586             have_windows_sdk_libs=yes
9587         else
9588             have_windows_sdk_libs=no
9589         fi
9591         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9592             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9593 the  Windows SDK are installed.])
9594         fi
9596         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9597              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9598              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9599              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9600         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9601              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9602              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9603              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9604         else
9605             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9606         fi
9607     fi
9609     if test -z "$WINDOWS_SDK_HOME"; then
9610         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9611     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9612         WINDOWS_SDK_VERSION=60
9613         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9614     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9615         WINDOWS_SDK_VERSION=61
9616         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9617     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9618         WINDOWS_SDK_VERSION=70
9619         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9620     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9621         WINDOWS_SDK_VERSION=80
9622         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9623         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9624         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9625             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9626             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9627             add_warning "If a build created with VS 2012 should run on Windows XP,"
9628             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9629         fi
9630     else
9631         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9632     fi
9633     PathFormat "$WINDOWS_SDK_HOME"
9634     WINDOWS_SDK_HOME="$formatted_path"
9635     if test "$build_os" = "cygwin"; then
9636         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9637         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9638             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9639         fi
9640     fi
9642     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9643     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9644     dnl but not in v8.0), so allow this to be overriden with a
9645     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9646     dnl and configuration error if no WiLangId.vbs is found would arguably be
9647     dnl better, but I do not know under which conditions exactly it is needed by
9648     dnl msiglobal.pm:
9649     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9650         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9651         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9652             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9653         fi
9654         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9655             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9656         fi
9657         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9658             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9659             add_warning "WiLangId.vbs not found - building translated packages will fail"
9660         fi
9661     fi
9663 AC_SUBST(WINDOWS_SDK_HOME)
9664 AC_SUBST(WINDOWS_SDK_VERSION)
9665 AC_SUBST(WINDOWS_SDK_WILANGID)
9667 dnl =========================================
9668 dnl Check for uuidgen
9669 dnl =========================================
9670 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9671     if test "$WITH_MINGW" = "yes"; then
9672         AC_PATH_PROG([UUIDGEN], [uuid])
9673         if test -z "$UUIDGEN"; then
9674             AC_MSG_WARN([uuid is needed for dev-install])
9675         fi
9676     else
9677         # presence is already tested above in the WINDOWS_SDK_HOME check
9678         UUIDGEN=uuidgen.exe
9679         AC_SUBST(UUIDGEN)
9680     fi
9681 else
9682     AC_PATH_PROG([UUIDGEN], [uuidgen])
9683     if test -z "$UUIDGEN"; then
9684         AC_MSG_WARN([uuid is needed for dev-install])
9685     fi
9688 dnl =========================================
9689 dnl Check for the Microsoft DirectX SDK.
9690 dnl =========================================
9691 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9692     AC_MSG_CHECKING([for DirectX SDK])
9693     if test "$build_os" = "cygwin"; then
9694         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9695         if test -n "$DXSDK_DIR"; then
9696             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9697             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9698         fi
9699         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9700         # the "DirectX SDK not found" error later.
9701         # (Where?)
9703         # Remove a possible trailing backslash
9704         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9705     fi
9707     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9708         HAVE_DIRECTXSDK_H="yes"
9709     else
9710         HAVE_DIRECTXSDK_H="no"
9711     fi
9713     if test "$BITNESS_OVERRIDE" = 64; then
9714         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9715     else
9716         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9717     fi
9718     PathFormat "$DIRECTXSDK_LIB"
9719     DIRECTXSDK_LIB="$formatted_path"
9721     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9722         HAVE_DIRECTXSDK_LIB="yes"
9723     else
9724         HAVE_DIRECTXSDK_LIB="no"
9725     fi
9727     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9728         AC_MSG_RESULT([found])
9729     else
9730         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9731     fi
9732     if test -n "$DIRECTXSDK_HOME"; then
9733         PathFormat "$DIRECTXSDK_HOME"
9734         DIRECTXSDK_HOME="$formatted_path"
9735         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9736     fi
9738 AC_SUBST(DIRECTXSDK_HOME)
9740 dnl ***************************************
9741 dnl Checking for bison and flex
9742 dnl ***************************************
9743 AC_PATH_PROG(BISON, bison)
9744 if test -z "$BISON"; then
9745     AC_MSG_ERROR([no bison found in \$PATH, install it])
9746 else
9747     AC_MSG_CHECKING([the bison version])
9748     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9749     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9750     # Accept newer than 2.0
9751     if test "$_bison_longver" -lt 2000; then
9752         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9753     fi
9756 AC_PATH_PROG(FLEX, flex)
9757 if test -z "$FLEX"; then
9758     AC_MSG_ERROR([no flex found in \$PATH, install it])
9759 else
9760     AC_MSG_CHECKING([the flex version])
9761     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9762     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9763         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9764     fi
9766 AC_SUBST([FLEX])
9767 dnl ***************************************
9768 dnl Checking for patch
9769 dnl ***************************************
9770 AC_PATH_PROG(PATCH, patch)
9771 if test -z "$PATCH"; then
9772     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9775 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9776 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9777     if test -z "$with_gnu_patch"; then
9778         GNUPATCH=$PATCH
9779     else
9780         if test -x "$with_gnu_patch"; then
9781             GNUPATCH=$with_gnu_patch
9782         else
9783             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9784         fi
9785     fi
9787     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9788     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9789         AC_MSG_RESULT([yes])
9790     else
9791         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9792     fi
9793 else
9794     GNUPATCH=$PATCH
9797 dnl We also need to check for --with-gnu-cp
9799 if test -z "$with_gnu_cp"; then
9800     # check the place where the good stuff is hidden on Solaris...
9801     if test -x /usr/gnu/bin/cp; then
9802         GNUCP=/usr/gnu/bin/cp
9803     else
9804         AC_PATH_PROGS(GNUCP, gnucp cp)
9805     fi
9806     if test -z $GNUCP; then
9807         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9808     fi
9809 else
9810     if test -x "$with_gnu_cp"; then
9811         GNUCP=$with_gnu_cp
9812     else
9813         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9814     fi
9817 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9818 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9819     AC_MSG_RESULT([yes])
9820 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9821     AC_MSG_RESULT([yes])
9822 else
9823     case "$build_os" in
9824     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9825         x_GNUCP=[\#]
9826         GNUCP=''
9827         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9828         ;;
9829     *)
9830         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9831         ;;
9832     esac
9835 AC_SUBST(GNUPATCH)
9836 AC_SUBST(GNUCP)
9837 AC_SUBST(x_GNUCP)
9839 dnl ***************************************
9840 dnl testing assembler path
9841 dnl ***************************************
9842 ML_EXE=""
9843 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9844     if test "$BITNESS_OVERRIDE" = ""; then
9845         assembler=ml.exe
9846         assembler_bin=bin
9847     else
9848         assembler=ml64.exe
9849         assembler_bin=bin/amd64
9850     fi
9852     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9853     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9854         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9855         AC_MSG_RESULT([found])
9856         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9857     else
9858         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9859     fi
9861     PathFormat "$ASM_HOME"
9862     ASM_HOME="$formatted_path"
9863 else
9864     ASM_HOME=""
9867 AC_SUBST(ML_EXE)
9869 dnl ===================================================================
9870 dnl We need zip and unzip
9871 dnl ===================================================================
9872 AC_PATH_PROG(ZIP, zip)
9873 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9874 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9875     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],,)
9878 AC_PATH_PROG(UNZIP, unzip)
9879 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9881 dnl ===================================================================
9882 dnl Zip must be a specific type for different build types.
9883 dnl ===================================================================
9884 if test $build_os = cygwin; then
9885     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9886         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9887     fi
9890 dnl ===================================================================
9891 dnl Test which vclplugs have to be built.
9892 dnl ===================================================================
9893 R=""
9894 GTK3_CFLAGS=""
9895 GTK3_LIBS=""
9896 ENABLE_GTK3=""
9897 if test "x$enable_gtk3" = "xyes"; then
9898     if test "$with_system_cairo" = no; then
9899         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9900     fi
9901     : ${with_system_cairo:=yes}
9902     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="")
9903     if test "x$ENABLE_GTK3" = "xTRUE"; then
9904         R="gtk3"
9905     else
9906         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9907     fi
9908     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9910 AC_SUBST(GTK3_LIBS)
9911 AC_SUBST(GTK3_CFLAGS)
9912 AC_SUBST(ENABLE_GTK3)
9914 AC_MSG_CHECKING([which VCLplugs shall be built])
9915 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9916     enable_gtk=no
9918 ENABLE_GTK=""
9919 if test "x$enable_gtk" = "xyes"; then
9920     if test "$with_system_cairo" = no; then
9921         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9922     fi
9923     : ${with_system_cairo:=yes}
9924     ENABLE_GTK="TRUE"
9925     AC_DEFINE(ENABLE_GTK)
9926     R="gtk $R"
9928 AC_SUBST(ENABLE_GTK)
9930 ENABLE_TDE=""
9931 if test "x$enable_tde" = "xyes"; then
9932     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9933     # are built from the same sources. So we only allow one of them.
9934     if test "x$enable_kde" = "xyes"; then
9935         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9936     fi
9937     ENABLE_TDE="TRUE"
9938     AC_DEFINE(ENABLE_TDE)
9939     R="$R tde"
9941 AC_SUBST(ENABLE_TDE)
9943 ENABLE_KDE=""
9944 if test "x$enable_kde" = "xyes"; then
9945     ENABLE_KDE="TRUE"
9946     AC_DEFINE(ENABLE_KDE)
9947     R="$R kde"
9949 AC_SUBST(ENABLE_KDE)
9951 ENABLE_KDE4=""
9952 if test "x$enable_kde4" = "xyes"; then
9953     ENABLE_KDE4="TRUE"
9954     AC_DEFINE(ENABLE_KDE4)
9955     R="$R kde4"
9957 AC_SUBST(ENABLE_KDE4)
9959 ENABLE_HEADLESS=""
9960 if test "x$enable_headless" = "xyes"; then
9961     ENABLE_HEADLESS="TRUE"
9962     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9963     R="headless"
9965 AC_SUBST(ENABLE_HEADLESS)
9967 if test -z "$R"; then
9968     AC_MSG_RESULT([none])
9969 else
9970     AC_MSG_RESULT([$R])
9973 dnl ===================================================================
9974 dnl GCONF check
9975 dnl ===================================================================
9977 ENABLE_GCONF=
9978 AC_MSG_CHECKING([whether to enable GConf support])
9979 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9980     ENABLE_GCONF="TRUE"
9981     AC_MSG_RESULT([yes])
9982     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9983     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9984 else
9985     AC_MSG_RESULT([no])
9987 AC_SUBST(GCONF_LIBS)
9988 AC_SUBST(GCONF_CFLAGS)
9989 AC_SUBST(ENABLE_GCONF)
9991 dnl ===================================================================
9992 dnl Gnome VFS check
9993 dnl ===================================================================
9995 ENABLE_GNOMEVFS=""
9996 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9997 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9998     ENABLE_GNOMEVFS="TRUE"
9999     AC_MSG_RESULT([yes])
10000     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10001     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10002     AC_DEFINE(ENABLE_GNOME_VFS)
10003 else
10004     AC_MSG_RESULT([no])
10006 AC_SUBST(GNOMEVFS_LIBS)
10007 AC_SUBST(GNOMEVFS_CFLAGS)
10008 AC_SUBST(ENABLE_GNOMEVFS)
10010 dnl ===================================================================
10011 dnl check for dbus support
10012 dnl ===================================================================
10013 ENABLE_DBUS=""
10014 DBUS_CFLAGS=""
10015 DBUS_LIBS=""
10017 if test "$enable_dbus" = "no"; then
10018     test_dbus=no
10021 AC_MSG_CHECKING([whether to enable DBUS support])
10022 if test "$test_dbus" = "yes"; then
10023     ENABLE_DBUS="TRUE"
10024     AC_MSG_RESULT([yes])
10025     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10026     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10027 else
10028     AC_MSG_RESULT([no])
10031 AC_SUBST(ENABLE_DBUS)
10032 AC_SUBST(DBUS_CFLAGS)
10033 AC_SUBST(DBUS_LIBS)
10035 AC_MSG_CHECKING([whether to enable font install via packagekit])
10036 if test "$ENABLE_DBUS" = "TRUE"; then
10037     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10038         ENABLE_PACKAGEKIT=TRUE
10039         AC_MSG_RESULT([yes])
10040     else
10041         ENABLE_PACKAGEKIT=
10042         AC_MSG_RESULT([no])
10043     fi
10044 else
10045     AC_MSG_RESULT([no, dbus disabled.])
10047 AC_SUBST(ENABLE_PACKAGEKIT)
10049 AC_MSG_CHECKING([whether to enable Impress remote control])
10050 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10051     AC_MSG_RESULT([yes])
10052     ENABLE_SDREMOTE=TRUE
10053     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10055     # If not explicitly enabled or disabled, default
10056     if test -z "$enable_sdremote_bluetooth"; then
10057         case "$OS" in
10058         LINUX|MACOSX|WNT)
10059             # Default to yes for these
10060             enable_sdremote_bluetooth=yes
10061             ;;
10062         *)
10063             # otherwise no
10064             enable_sdremote_bluetooth=no
10065             ;;
10066         esac
10067     fi
10068     # $enable_sdremote_bluetooth is guaranteed non-empty now
10070     if test "$enable_sdremote_bluetooth" != "no"; then
10071         if test "$OS" = "LINUX"; then
10072             if test "$ENABLE_DBUS" = "TRUE"; then
10073                 AC_MSG_RESULT([yes])
10074                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10075                 dnl ===================================================================
10076                 dnl Check for system bluez
10077                 dnl ===================================================================
10078                 AC_MSG_CHECKING([which Bluetooth header to use])
10079                 if test "$with_system_bluez" = "yes"; then
10080                     AC_MSG_RESULT([external])
10081                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10082                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10083                     SYSTEM_BLUEZ=YES
10084                 else
10085                     AC_MSG_RESULT([internal])
10086                     SYSTEM_BLUEZ=NO
10087                 fi
10088             else
10089                 AC_MSG_RESULT([no, dbus disabled])
10090                 ENABLE_SDREMOTE_BLUETOOTH=
10091                 SYSTEM_BLUEZ=NO 
10092             fi
10093         else
10094             AC_MSG_RESULT([yes])
10095             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10096             SYSTEM_BLUEZ=NO
10097         fi
10098     else
10099         AC_MSG_RESULT([no])
10100         ENABLE_SDREMOTE_BLUETOOTH=
10101         SYSTEM_BLUEZ=NO
10102     fi
10103 else
10104     ENABLE_SDREMOTE=
10105     SYSTEM_BLUEZ=NO
10106     AC_MSG_RESULT([no])
10108 AC_SUBST(ENABLE_SDREMOTE)
10109 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10110 AC_SUBST(SYSTEM_BLUEZ)
10112 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10113 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10114     AC_MSG_RESULT([yes])
10115     ENABLE_SDREMOTE_ANDROID=TRUE
10116 else
10117     AC_MSG_RESULT([no])
10118     ENABLE_SDREMOTE_ANDROID=
10120 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10122 dnl ===================================================================
10123 dnl Check whether the gtk 2.0 libraries are available.
10124 dnl ===================================================================
10126 GTK_CFLAGS=""
10127 GTK_LIBS=""
10128 ENABLE_SYSTRAY_GTK=""
10129 if test  "$test_gtk" = "yes"; then
10131     if test "$ENABLE_GTK" = "TRUE"; then
10132         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]))
10133         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10134         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]))
10135         BUILD_TYPE="$BUILD_TYPE GTK"
10136         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10138     AC_MSG_CHECKING([whether to enable the systray quickstarter])
10139         if test "x$enable_systray" = "xyes"; then
10140             AC_MSG_RESULT([yes])
10141             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10142                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10143                             [ ENABLE_SYSTRAY_GTK="" ])
10144         else
10145             AC_MSG_RESULT([no])
10146         fi
10148         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10149         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10150                           [ENABLE_GTK_PRINT="TRUE"],
10151                           [ENABLE_GTK_PRINT=""])
10152         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10154         AC_MSG_CHECKING([whether to enable GIO support])
10155         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10156             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10157                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10158             fi
10159             dnl Need at least 2.26 for the dbus support.
10160             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10161                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10162             if test "$ENABLE_GIO" = "TRUE"; then
10163                 AC_DEFINE(ENABLE_GIO)
10164                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10165             fi
10166         else
10167             AC_MSG_RESULT([no])
10168         fi
10169     fi
10171 AC_SUBST(ENABLE_GIO)
10172 AC_SUBST(GIO_CFLAGS)
10173 AC_SUBST(GIO_LIBS)
10174 AC_SUBST(ENABLE_SYSTRAY_GTK)
10175 AC_SUBST(GTK_CFLAGS)
10176 AC_SUBST(GTK_LIBS)
10177 AC_SUBST(GTHREAD_CFLAGS)
10178 AC_SUBST(GTHREAD_LIBS)
10179 AC_SUBST([ENABLE_GTK_PRINT])
10180 AC_SUBST([GTK_PRINT_CFLAGS])
10181 AC_SUBST([GTK_PRINT_LIBS])
10184 dnl ===================================================================
10185 dnl Check whether the Telepathy libraries are available.
10186 dnl ===================================================================
10188 ENABLE_TELEPATHY=""
10189 TELEPATHY_CFLAGS=""
10190 TELEPATHY_LIBS=""
10192 AC_MSG_CHECKING([whether to enable Telepathy support])
10193 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10194     ENABLE_TELEPATHY="TRUE"
10195     AC_DEFINE(ENABLE_TELEPATHY)
10196     AC_MSG_RESULT([yes])
10197     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 )
10198     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10199 else
10200     AC_MSG_RESULT([no])
10203 AC_SUBST(ENABLE_TELEPATHY)
10204 AC_SUBST(TELEPATHY_CFLAGS)
10205 AC_SUBST(TELEPATHY_LIBS)
10208 dnl ===================================================================
10210 SPLIT_APP_MODULES=""
10211 if test "$enable_split_app_modules" = "yes"; then
10212     SPLIT_APP_MODULES="YES"
10214 AC_SUBST(SPLIT_APP_MODULES)
10216 SPLIT_OPT_FEATURES=""
10217 if test "$enable_split_opt_features" = "yes"; then
10218     SPLIT_OPT_FEATURES="YES"
10220 AC_SUBST(SPLIT_OPT_FEATURES)
10222 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10223     if test "$enable_cairo_canvas" = yes; then
10224         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10225     fi
10226     enable_cairo_canvas=no
10227 elif test -z "$enable_cairo_canvas"; then
10228     enable_cairo_canvas=yes
10231 ENABLE_CAIRO_CANVAS=""
10232 if test "$enable_cairo_canvas" = "yes"; then
10233     test_cairo=yes
10234     ENABLE_CAIRO_CANVAS="TRUE"
10236 AC_SUBST(ENABLE_CAIRO_CANVAS)
10238 dnl ===================================================================
10239 dnl Check whether the GStreamer libraries are available.
10240 dnl ===================================================================
10242 ENABLE_GSTREAMER=""
10244 if test "$build_gstreamer" = "yes"; then
10246     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10247     if test "x$enable_gstreamer" != "xno"; then
10248         ENABLE_GSTREAMER="TRUE"
10249         AC_MSG_RESULT([yes])
10250         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10251         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10252     else
10253         AC_MSG_RESULT([no])
10254     fi
10256 AC_SUBST(GSTREAMER_CFLAGS)
10257 AC_SUBST(GSTREAMER_LIBS)
10258 AC_SUBST(ENABLE_GSTREAMER)
10261 ENABLE_GSTREAMER_0_10=""
10262 if test "$build_gstreamer_0_10" = "yes"; then
10264     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10265     if test "x$enable_gstreamer_0_10" != "xno"; then
10266         ENABLE_GSTREAMER_0_10="TRUE"
10267         AC_MSG_RESULT([yes])
10268         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10269             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10270         ])
10271         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10272     else
10273         AC_MSG_RESULT([no])
10274     fi
10277 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10278 AC_SUBST(GSTREAMER_0_10_LIBS)
10279 AC_SUBST(ENABLE_GSTREAMER_0_10)
10281 dnl ===================================================================
10282 dnl Check whether to build the VLC avmedia backend
10283 dnl ===================================================================
10285 ENABLE_VLC=""
10287 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10288 if test $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10289     ENABLE_VLC="TRUE"
10290     AC_MSG_RESULT([yes])
10291 else
10292     AC_MSG_RESULT([no])
10294 AC_SUBST(ENABLE_VLC)
10296 dnl ===================================================================
10297 dnl Check whether the OpenGL libraries are available
10298 dnl ===================================================================
10300 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10301 ENABLE_OPENGL=
10303 if test -z "$enable_opengl"; then
10304     if test $_os = WINNT; then
10305         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10306         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10307         # code for Windows.
10308         enable_opengl=no
10309     elif test $_os = iOS; then
10310         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10311         # build fine for iOS, too, but let's leave that for later
10312         enable_opengl=no
10313     elif test "$enable_headless" = "yes"; then
10314         enable_opengl=no
10315     else
10316         enable_opengl=yes
10317     fi
10320 if test "x$enable_opengl" = "xno"; then
10321     AC_MSG_RESULT([no])
10322 elif test "$_os" = "Darwin"; then
10323     # We use frameworks on Mac OS X, no need for detail checks
10324     ENABLE_OPENGL=TRUE
10325     ENABLE_OPENGL_CANVAS=
10326     add_warning "openGL canvas not adapted for Mac yet - disabling"
10327     SYSTEM_MESA_HEADERS=YES
10328     AC_MSG_RESULT([yes])
10329 elif test $_os = WINNT; then
10330     # Experimental: try to use OpenGL on Windows
10331     ENABLE_OPENGL=TRUE
10332     ENABLE_OPENGL_CANVAS=TRUE
10333     # We need the internal "Mesa" headers.
10334     SYSTEM_MESA_HEADERS=NO
10335     BUILD_TYPE="$BUILD_TYPE MESA"
10336     AC_MSG_RESULT([yes])
10337 else
10338     save_LDFLAGS=$LDFLAGS
10339     LDFLAGS="$LDFLAGS -lm"
10340     AC_MSG_RESULT([yes])
10341     AC_CHECK_LIB([GL], [main],
10342         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10343             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10344              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10345              ENABLE_OPENGL_CANVAS=], [])],
10346         [AC_MSG_ERROR(libGL not installed or functional)], [])
10347     LDFLAGS="$LDFLAGS -lGL"
10348     AC_CHECK_LIB([GLU], [main], [:],
10349               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10350     ENABLE_OPENGL=TRUE
10351     LDFLAGS=$save_LDFLAGS
10353     dnl ===================================================================
10354     dnl Check for system Mesa
10355     dnl ===================================================================
10356     AC_MSG_CHECKING([which Mesa headers to use])
10357     if test "$with_system_mesa_headers" = "yes"; then
10358         AC_MSG_RESULT([external])
10359         SYSTEM_MESA_HEADERS=YES
10360         AC_LANG_PUSH(C)
10361         AC_CHECK_HEADER(GL/glxext.h, [],
10362            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10363         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10364         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10365         AC_LANG_POP(C)
10366     else
10367         AC_MSG_RESULT([internal])
10368         SYSTEM_MESA_HEADERS=NO
10369         BUILD_TYPE="$BUILD_TYPE MESA"
10370     fi
10373 AC_SUBST(SYSTEM_MESA_HEADERS)
10374 AC_SUBST(ENABLE_OPENGL)
10375 AC_SUBST(ENABLE_OPENGL_CANVAS)
10377 dnl =================================================
10378 dnl Check whether to build with OpenCL support.
10379 dnl =================================================
10381 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10382 ENABLE_OPENCL=
10384 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10385     AC_MSG_RESULT([yes])
10386     enable_opencl=yes
10387     ENABLE_OPENCL=TRUE
10388     AC_DEFINE(HAVE_FEATURE_OPENCL)
10389 else
10390     AC_MSG_RESULT([no])
10391     enable_opencl=no
10394 AC_SUBST(ENABLE_OPENCL)
10396 # pdf import?
10397 AC_MSG_CHECKING([whether to build the PDF import feature])
10398 ENABLE_PDFIMPORT=
10399 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10400     AC_MSG_RESULT([yes])
10401     ENABLE_PDFIMPORT=TRUE
10403     dnl ===================================================================
10404     dnl Check for system poppler
10405     dnl ===================================================================
10406     AC_MSG_CHECKING([which PDF import backend to use])
10407     if test "$with_system_poppler" = "yes"; then
10408         AC_MSG_RESULT([external])
10409         SYSTEM_POPPLER=YES
10410         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10411         AC_LANG_PUSH([C++])
10412         save_CXXFLAGS=$CXXFLAGS
10413         save_CPPFLAGS=$CPPFLAGS
10414         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10415         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10416         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10417                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10418         CXXFLAGS=$save_CXXFLAGS
10419         CPPFLAGS=$save_CPPFLAGS
10420         AC_LANG_POP([C++])
10421         libo_MINGW_CHECK_DLL([libpoppler])
10422         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10423     else
10424         AC_MSG_RESULT([internal])
10425         SYSTEM_POPPLER=NO
10426         BUILD_TYPE="$BUILD_TYPE POPPLER"
10427     fi
10428 else
10429     AC_MSG_RESULT([no])
10431 AC_SUBST(ENABLE_PDFIMPORT)
10432 AC_SUBST(SYSTEM_POPPLER)
10433 AC_SUBST(POPPLER_CFLAGS)
10434 AC_SUBST(POPPLER_LIBS)
10436 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10437 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10438     AC_MSG_RESULT([yes])
10439     ENABLE_MEDIAWIKI=TRUE
10440     BUILD_TYPE="$BUILD_TYPE XSLTML"
10441     if test  "x$with_java" = "xno"; then
10442         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10443     fi
10444 else
10445     AC_MSG_RESULT([no])
10446     ENABLE_MEDIAWIKI=
10447     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10449 AC_SUBST(ENABLE_MEDIAWIKI)
10451 AC_MSG_CHECKING([whether to build the Report Builder])
10452 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10453     AC_MSG_RESULT([yes])
10454     ENABLE_REPORTBUILDER=TRUE
10455     AC_MSG_CHECKING([which jfreereport libs to use])
10456     if test "$with_system_jfreereport" = "yes"; then
10457         SYSTEM_JFREEREPORT=YES
10458         AC_MSG_RESULT([external])
10459         if test -z $SAC_JAR; then
10460             SAC_JAR=/usr/share/java/sac.jar
10461         fi
10462         AC_CHECK_FILE($SAC_JAR, [],
10463              [AC_MSG_ERROR(sac.jar not found.)], [])
10465         if test -z $LIBXML_JAR; then
10466             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10467                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10468                 [
10469                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10470                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10471                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10472                     )
10473                 ]
10474             )
10475         else
10476             AC_CHECK_FILE($LIBXML_JAR, [],
10477                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10478         fi
10480         if test -z $FLUTE_JAR; then
10481             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10482                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10483                 [
10484                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10485                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10486                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10487                     )
10488                 ]
10489             )
10490         else
10491             AC_CHECK_FILE($FLUTE_JAR, [],
10492                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10493         fi
10495         if test -z $JFREEREPORT_JAR; then
10496             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10497                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10498                 [
10499                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10500                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10501                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10502                     )
10503                 ]
10504             )
10505         else
10506             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10507                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10508         fi
10510         if test -z $LIBLAYOUT_JAR; then
10511             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10512                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10513                 [
10514                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10515                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10516                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10517                     )
10518                 ]
10519             )
10520         else
10521             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10522                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10523         fi
10525         if test -z $LIBLOADER_JAR; then
10526             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10527                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10528                 [
10529                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10530                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10531                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10532                     )
10533                 ]
10534             )
10535         else
10536             AC_CHECK_FILE($LIBLOADER_JAR, [],
10537                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10538         fi
10540         if test -z $LIBFORMULA_JAR; then
10541             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10542                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10543                  [
10544                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10545                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10546                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10547                      )
10548                  ]
10549             )
10550         else
10551             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10552                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10553         fi
10555         if test -z $LIBREPOSITORY_JAR; then
10556             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10557                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10558                 [
10559                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10560                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10561                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10562                     )
10563                 ]
10564             )
10565         else
10566             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10567                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10568         fi
10570         if test -z $LIBFONTS_JAR; then
10571             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10572                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10573                 [
10574                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10575                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10576                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10577                     )
10578                 ]
10579             )
10580         else
10581             AC_CHECK_FILE($LIBFONTS_JAR, [],
10582                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10583         fi
10585         if test -z $LIBSERIALIZER_JAR; then
10586             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10587                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10588                 [
10589                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10590                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10591                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10592                     )
10593                 ]
10594             )
10595         else
10596             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10597                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10598         fi
10600         if test -z $LIBBASE_JAR; then
10601             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10602                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10603                 [
10604                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10605                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10606                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10607                     )
10608                 ]
10609             )
10610         else
10611             AC_CHECK_FILE($LIBBASE_JAR, [],
10612                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10613         fi
10615     else
10616         AC_MSG_RESULT([internal])
10617         SYSTEM_JFREEREPORT=NO
10618         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10619     fi
10620 else
10621     AC_MSG_RESULT([no])
10622     ENABLE_REPORTBUILDER=
10623     SYSTEM_JFREEREPORT=NO
10625 AC_SUBST(ENABLE_REPORTBUILDER)
10626 AC_SUBST(SYSTEM_JFREEREPORT)
10627 AC_SUBST(SAC_JAR)
10628 AC_SUBST(LIBXML_JAR)
10629 AC_SUBST(FLUTE_JAR)
10630 AC_SUBST(JFREEREPORT_JAR)
10631 AC_SUBST(LIBBASE_JAR)
10632 AC_SUBST(LIBLAYOUT_JAR)
10633 AC_SUBST(LIBLOADER_JAR)
10634 AC_SUBST(LIBFORMULA_JAR)
10635 AC_SUBST(LIBREPOSITORY_JAR)
10636 AC_SUBST(LIBFONTS_JAR)
10637 AC_SUBST(LIBSERIALIZER_JAR)
10639 # this has to be here because both the Wiki Publisher and the SRB use
10640 # commons-logging
10641 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10642     AC_MSG_CHECKING([which Apache commons-* libs to use])
10643     if test "$with_system_apache_commons" = "yes"; then
10644         SYSTEM_APACHE_COMMONS=YES
10645         AC_MSG_RESULT([external])
10646         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10647             if test -z $COMMONS_CODEC_JAR; then
10648                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
10649                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
10650                     [
10651                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10652                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10653                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10654                         )
10655                     ]
10656                 )
10657             else
10658                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10659                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10660             fi
10662             if test -z $COMMONS_LANG_JAR; then
10663                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
10664                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
10665                     [
10666                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10667                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10668                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10669                             )
10670                     ]
10671                 )
10672             else
10673                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10674                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10675             fi
10677             if test -z $COMMONS_HTTPCLIENT_JAR; then
10678                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10679                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10680                     [
10681                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10682                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10683                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10684                         )
10685                     ]
10686                 )
10687             else
10688                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10689                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10690             fi
10691         fi
10692         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10693             if test -z $COMMONS_LOGGING_JAR; then
10694                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
10695                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
10696                    [
10697                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10698                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10699                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10700                         )
10701                     ]
10702                 )
10703             else
10704                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10705                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10706             fi
10707         fi
10708     else
10709         AC_MSG_RESULT([internal])
10710         SYSTEM_APACHE_COMMONS=NO
10711         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10712     fi
10714 AC_SUBST(SYSTEM_APACHE_COMMONS)
10715 AC_SUBST(COMMONS_CODEC_JAR)
10716 AC_SUBST(COMMONS_LANG_JAR)
10717 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10718 AC_SUBST(COMMONS_LOGGING_JAR)
10720 # scripting provider for BeanShell?
10721 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10722 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10723     AC_MSG_RESULT([yes])
10724     ENABLE_SCRIPTING_BEANSHELL=TRUE
10726     dnl ===================================================================
10727     dnl Check for system beanshell
10728     dnl ===================================================================
10729     AC_MSG_CHECKING([which beanshell to use])
10730     if test "$with_system_beanshell" = "yes"; then
10731         AC_MSG_RESULT([external])
10732         SYSTEM_BSH=YES
10733         if test -z $BSH_JAR; then
10734             BSH_JAR=/usr/share/java/bsh.jar
10735         fi
10736         AC_CHECK_FILE($BSH_JAR, [],
10737                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10738     else
10739         AC_MSG_RESULT([internal])
10740         SYSTEM_BSH=NO
10741         BUILD_TYPE="$BUILD_TYPE BSH"
10742     fi
10743 else
10744     AC_MSG_RESULT([no])
10745     ENABLE_SCRIPTING_BEANSHELL=
10746     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10748 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10749 AC_SUBST(SYSTEM_BSH)
10750 AC_SUBST(BSH_JAR)
10752 # scripting provider for JavaScript?
10753 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10754 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10755     AC_MSG_RESULT([yes])
10756     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10758     dnl ===================================================================
10759     dnl Check for system rhino
10760     dnl ===================================================================
10761     AC_MSG_CHECKING([which rhino to use])
10762     if test "$with_system_rhino" = "yes"; then
10763         AC_MSG_RESULT([external])
10764         SYSTEM_RHINO=YES
10765         if test -z $RHINO_JAR; then
10766             RHINO_JAR=/usr/share/java/js.jar
10767         fi
10768         AC_CHECK_FILE($RHINO_JAR, [],
10769                    [AC_MSG_ERROR(js.jar not found.)], [])
10770     else
10771         AC_MSG_RESULT([internal])
10772         SYSTEM_RHINO=NO
10773         BUILD_TYPE="$BUILD_TYPE RHINO"
10774     fi
10775 else
10776     AC_MSG_RESULT([no])
10777     ENABLE_SCRIPTING_JAVASCRIPT=
10778     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10780 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10781 AC_SUBST(SYSTEM_RHINO)
10782 AC_SUBST(RHINO_JAR)
10784 supports_multilib=
10785 case "$host_cpu" in
10786 x86_64 | powerpc64 | s390x)
10787     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10788         supports_multilib="yes"
10789     fi
10790     ;;
10792     ;;
10793 esac
10795 dnl ===================================================================
10796 dnl Check whether the TQt and TDE libraries are available.
10797 dnl ===================================================================
10799 TDE_CFLAGS=""
10800 TDE_LIBS=""
10801 if test "$_os" != "OpenBSD"; then
10802     MOC="moc"
10804 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10805     dnl Search paths for TQt and TDE
10806     if test -z "$supports_multilib"; then
10807         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"
10808         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"
10809     else
10810         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"
10811         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"
10812     fi
10813     if test -n "$TQTDIR"; then
10814         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10815         if test -z "$supports_multilib"; then
10816             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10817         else
10818             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10819         fi
10820     fi
10821     if test -z "$supports_multilib"; then
10822         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"
10823         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"
10824     else
10825         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"
10826         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"
10827     fi
10828     if test -n "$TDEDIR"; then
10829         tde_incdirs="$TDEDIR/include $tde_incdirs"
10830         if test -z "$supports_multilib"; then
10831             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10832         else
10833             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10834         fi
10835     fi
10837     dnl What to test
10838     tqt_test_include="ntqstyle.h"
10839     tde_test_include="kapp.h"
10841     if test "$_os" != "OpenBSD"; then
10842         tqt_test_library="libtqt-mt.so"
10843         tde_test_library="libDCOP.so"
10844     else
10845         tqt_test_library="libtqt-mt.so*"
10846         tde_test_library="libDCOP.so*"
10847     fi
10849     dnl Check for TQt headers
10850     AC_MSG_CHECKING([for TQt headers])
10851     tqt_incdir="no"
10852     for tde_check in $tqt_incdirs; do
10853         if test -r "$tde_check/$tqt_test_include"; then
10854             tqt_incdir="$tde_check"
10855             break
10856         fi
10857     done
10858     AC_MSG_RESULT([$tqt_incdir])
10859     if test "x$tqt_incdir" = "xno"; then
10860         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10861 your TQt installation by exporting TQTDIR before running "configure".])
10862     fi
10864     dnl Check for TQt libraries
10865     AC_MSG_CHECKING([for TQt libraries])
10866     tqt_libdir="no"
10867     for tqt_check in $tqt_libdirs; do
10868         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10869             tqt_libdir="$tqt_check"
10870             break
10871         fi
10872     done
10873     AC_MSG_RESULT([$tqt_libdir])
10874     if test "x$tqt_libdir" = "xno"; then
10875         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10876 your TQt installation by exporting TQTDIR before running "configure".])
10877     fi
10879     dnl Check for Meta Object Compiler
10880     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10881     if test "$MOC" = "no"; then
10882         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10883 the root of your TQt installation by exporting TQTDIR before running "configure".])
10884     fi
10886     dnl Check for TDE headers
10887     AC_MSG_CHECKING([for TDE headers])
10888     tde_incdir="no"
10889     for tde_check in $tde_incdirs; do
10890         if test -r "$tde_check/$tde_test_include"; then
10891             tde_incdir="$tde_check"
10892             break
10893         fi
10894     done
10895     AC_MSG_RESULT([$tde_incdir])
10896     if test "x$tde_incdir" = "xno"; then
10897         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10898 your TDE installation by exporting TDEDIR before running "configure".])
10899     fi
10901     dnl Check for TDE libraries
10902     AC_MSG_CHECKING([for TDE libraries])
10903     tde_libdir="no"
10904     for tde_check in $tde_libdirs; do
10905         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10906             tde_libdir="$tde_check"
10907             break
10908         fi
10909     done
10910     AC_MSG_RESULT([$tde_libdir])
10911     if test "x$tde_libdir" = "xno"; then
10912         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10913 your TDE installation by exporting TDEDIR before running "configure".])
10914     fi
10916     dnl Set the variables
10917     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10918     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10920 AC_SUBST(TDE_CFLAGS)
10921 AC_SUBST(TDE_LIBS)
10922 AC_SUBST(MOC)
10924 dnl ===================================================================
10925 dnl Check whether the Qt3 and KDE3 libraries are available.
10926 dnl ===================================================================
10928 KDE_CFLAGS=""
10929 KDE_LIBS=""
10930 if test "$_os" != "OpenBSD"; then
10931     MOC="moc"
10933 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10934     dnl Search paths for Qt3 and KDE3
10935     if test -z "$supports_multilib"; then
10936         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"
10937         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"
10938     else
10939         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"
10940         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"
10941     fi
10942     if test -n "$QTDIR"; then
10943         qt_incdirs="$QTDIR/include $qt_incdirs"
10944         if test -z "$supports_multilib"; then
10945             qt_libdirs="$QTDIR/lib $qt_libdirs"
10946         else
10947             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10948         fi
10949     fi
10950     if test -z "$supports_multilib"; then
10951         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"
10952         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"
10953     else
10954         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"
10955         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"
10956     fi
10957     if test -n "$KDEDIR"; then
10958         kde_incdirs="$KDEDIR/include $kde_incdirs"
10959         if test -z "$supports_multilib"; then
10960             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10961         else
10962             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10963         fi
10964     fi
10966     dnl What to test
10967     qt_test_include="qstyle.h"
10968     kde_test_include="kapp.h"
10970     if test "$_os" != "OpenBSD"; then
10971         qt_test_library="libqt-mt.so"
10972         kde_test_library="libDCOP.so"
10973     else
10974         qt_test_library="libqt-mt.so*"
10975         kde_test_library="libDCOP.so*"
10976     fi
10978     dnl Check for Qt3 headers
10979     AC_MSG_CHECKING([for Qt3 headers])
10980     qt_incdir="no"
10981     for kde_check in $qt_incdirs; do
10982         if test -r "$kde_check/$qt_test_include"; then
10983             qt_incdir="$kde_check"
10984             break
10985         fi
10986     done
10987     AC_MSG_RESULT([$qt_incdir])
10988     if test "x$qt_incdir" = "xno"; then
10989         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10990 your Qt3 installation by exporting QTDIR before running "configure".])
10991     fi
10993     dnl Check for Qt3 libraries
10994     AC_MSG_CHECKING([for Qt3 libraries])
10995     qt_libdir="no"
10996     for qt_check in $qt_libdirs; do
10997         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10998             qt_libdir="$qt_check"
10999             break
11000         fi
11001     done
11002     AC_MSG_RESULT([$qt_libdir])
11003     if test "x$qt_libdir" = "xno"; then
11004         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11005 your Qt3 installation by exporting QTDIR before running "configure".])
11006     fi
11008     dnl Check for Meta Object Compiler
11009     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11010     if test "$MOC" = "no"; then
11011         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11012 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11013     fi
11015     dnl Check for KDE3 headers
11016     AC_MSG_CHECKING([for KDE3 headers])
11017     kde_incdir="no"
11018     for kde_check in $kde_incdirs; do
11019         if test -r "$kde_check/$kde_test_include"; then
11020             kde_incdir="$kde_check"
11021             break
11022         fi
11023     done
11024     AC_MSG_RESULT([$kde_incdir])
11025     if test "x$kde_incdir" = "xno"; then
11026         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11027 your KDE3 installation by exporting KDEDIR before running "configure".])
11028     fi
11030     dnl Check for KDE3 libraries
11031     AC_MSG_CHECKING([for KDE3 libraries])
11032     kde_libdir="no"
11033     for kde_check in $kde_libdirs; do
11034         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11035             kde_libdir="$kde_check"
11036             break
11037         fi
11038     done
11039     AC_MSG_RESULT([$kde_libdir])
11040     if test "x$kde_libdir" = "xno"; then
11041         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11042 your KDE3 installation by exporting KDEDIR before running "configure".])
11043     fi
11045     dnl Set the variables
11046     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11047     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11048     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11050 AC_SUBST(KDE_CFLAGS)
11051 AC_SUBST(KDE_LIBS)
11052 AC_SUBST(MOC)
11054 dnl ===================================================================
11055 dnl KDE4 Integration
11056 dnl ===================================================================
11058 KDE4_CFLAGS=""
11059 KDE4_LIBS=""
11060 QMAKE4="qmake"
11061 MOC4="moc"
11062 KDE_GLIB_CFLAGS=""
11063 KDE_GLIB_LIBS=""
11064 KDE_HAVE_GLIB=""
11065 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11066     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11067     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11069     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11070     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11072     if test -n "$supports_multilib"; then
11073         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11074         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11075     fi
11077     if test -n "$QTDIR"; then
11078         qt_incdirs="$QTDIR/include $qt_incdirs"
11079         if test -z "$supports_multilib"; then
11080             qt_libdirs="$QTDIR/lib $qt_libdirs"
11081         else
11082             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11083         fi
11084     fi
11085     if test -n "$QT4DIR"; then
11086         qt_incdirs="$QT4DIR/include $qt_incdirs"
11087         if test -z "$supports_multilib"; then
11088             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11089         else
11090             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11091         fi
11092     fi
11094     if test -n "$KDEDIR"; then
11095         kde_incdirs="$KDEDIR/include $kde_incdirs"
11096         if test -z "$supports_multilib"; then
11097             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11098         else
11099             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11100         fi
11101     fi
11102     if test -n "$KDE4DIR"; then
11103         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11104         if test -z "$supports_multilib"; then
11105             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11106         else
11107             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11108         fi
11109     fi
11111     qt_test_include="Qt/qobject.h"
11112     qt_test_library="libQtCore.so"
11113     kde_test_include="kwindowsystem.h"
11114     kde_test_library="libsolid.so"
11116     AC_MSG_CHECKING([for Qt4 headers])
11117     qt_header_dir="no"
11118     for inc_dir in $qt_incdirs; do
11119         if test -r "$inc_dir/$qt_test_include"; then
11120             qt_header_dir="$inc_dir"
11121             break
11122         fi
11123     done
11125     AC_MSG_RESULT([$qt_header_dir])
11126     if test "x$qt_header_dir" = "xno"; then
11127         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11128     fi
11130     dnl Check for qmake
11131     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11132     QMAKE4="$QMAKEQT4"
11133     if test "$QMAKE4" = "no"; then
11134         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11135         if test "$QMAKE4" = "no"; then
11136             AC_MSG_ERROR([Qmake not found.  Please specify
11137 the root of your Qt installation by exporting QT4DIR before running "configure".])
11138         fi
11139     fi
11141     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11142     AC_MSG_CHECKING([for Qt4 libraries])
11143     qt_lib_dir="no"
11144     for lib_dir in $qt_libdirs; do
11145         if test -r "$lib_dir/$qt_test_library"; then
11146             qt_lib_dir="$lib_dir"
11147             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11148             break
11149         fi
11150     done
11152     AC_MSG_RESULT([$qt_lib_dir])
11154     if test "x$qt_lib_dir" = "xno"; then
11155         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11156     fi
11158     dnl Check for Meta Object Compiler
11160     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11161     MOC4="$MOCQT4"
11162     if test "$MOC4" = "no"; then
11163         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11164         if test "$MOC4" = "no"; then
11165             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11166 the root of your Qt installation by exporting QT4DIR before running "configure".])
11167         fi
11168     fi
11170     dnl Check for KDE4 headers
11171     AC_MSG_CHECKING([for KDE4 headers])
11172     kde_incdir="no"
11173     for kde_check in $kde_incdirs; do
11174         if test -r "$kde_check/$kde_test_include"; then
11175             kde_incdir="$kde_check"
11176             break
11177         fi
11178     done
11179     AC_MSG_RESULT([$kde_incdir])
11180     if test "x$kde_incdir" = "xno"; then
11181         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11182     fi
11184     dnl Check for KDE4 libraries
11185     AC_MSG_CHECKING([for KDE4 libraries])
11186     kde_libdir="no"
11187     for kde_check in $kde_libdirs; do
11188         if test -r "$kde_check/$kde_test_library"; then
11189             kde_libdir="$kde_check"
11190             break
11191         fi
11192     done
11194     AC_MSG_RESULT([$kde_libdir])
11195     if test "x$kde_libdir" = "xno"; then
11196         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11197     fi
11199     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11200     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkio -lkfile -lkdeui -lkdecore -lQtCore -lQtGui"
11201     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11203     AC_LANG_PUSH([C++])
11204     save_CXXFLAGS=$CXXFLAGS
11205     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11206     AC_MSG_CHECKING([whether KDE is >= 4.2])
11207        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11208 #include <kdeversion.h>
11210 int main(int argc, char **argv) {
11211        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11212        else return 1;
11214        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11215     CXXFLAGS=$save_CXXFLAGS
11216     AC_LANG_POP([C++])
11218     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11219     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11220     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11221         [
11222         KDE_HAVE_GLIB=1
11223         AC_DEFINE(KDE_HAVE_GLIB,1)
11224         KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11225         ],
11226         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
11228 AC_SUBST(KDE4_CFLAGS)
11229 AC_SUBST(KDE4_LIBS)
11230 AC_SUBST(MOC4)
11231 AC_SUBST(KDE_GLIB_CFLAGS)
11232 AC_SUBST(KDE_GLIB_LIBS)
11233 AC_SUBST(KDE_HAVE_GLIB)
11235 dnl ===================================================================
11236 dnl Test for the enabling the lockdown pieces
11237 dnl ===================================================================
11238 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11239 ENABLE_LOCKDOWN=
11240 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11241     ENABLE_LOCKDOWN=TRUE
11242     AC_MSG_RESULT([yes])
11243 else
11244     AC_MSG_RESULT([no])
11246 AC_SUBST(ENABLE_LOCKDOWN)
11248 dnl ===================================================================
11249 dnl Test whether to include Evolution 2 support
11250 dnl ===================================================================
11251 AC_MSG_CHECKING([whether to enable evolution 2 support])
11252 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11253     AC_MSG_RESULT([yes])
11254     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11255     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11256     ENABLE_EVOAB2="TRUE"
11257 else
11258     ENABLE_EVOAB2=""
11259     AC_MSG_RESULT([no])
11261 AC_SUBST(ENABLE_EVOAB2)
11262 AC_SUBST(GOBJECT_CFLAGS)
11263 AC_SUBST(GOBJECT_LIBS)
11265 dnl ===================================================================
11266 dnl Test whether to include TDE AB support
11267 dnl ===================================================================
11268 AC_MSG_CHECKING([whether to enable TDE address book support])
11269 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11270     AC_MSG_RESULT([yes])
11271     AC_LANG_PUSH([C++])
11272     save_CXXFLAGS=$CXXFLAGS
11273     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11274     AC_MSG_CHECKING([whether TDE is at least R14.0])
11275        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11276 #include <tdeversion.h>
11278 int main(int argc, char **argv) {
11279        if (TDE_VERSION_MAJOR >= 14) return 0;
11280        else return 1;
11282        ]])],[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])],[])
11283     CXXFLAGS=$save_CXXFLAGS
11284     AC_LANG_POP([C++])
11285     ENABLE_TDEAB=TRUE
11286 else
11287     AC_MSG_RESULT([no])
11288     ENABLE_TDEAB=
11290 AC_SUBST(ENABLE_TDEAB)
11292 dnl ===================================================================
11293 dnl Test whether to include KDE AB support
11294 dnl ===================================================================
11295 AC_MSG_CHECKING([whether to enable KDE address book support])
11296 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11297     AC_MSG_RESULT([yes])
11298     AC_LANG_PUSH([C++])
11299     save_CXXFLAGS=$CXXFLAGS
11300     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11301     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11302        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11303 #include <kdeversion.h>
11305 int main(int argc, char **argv) {
11306        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11307        else return 1;
11309        ]])],[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])],[])
11310     CXXFLAGS=$save_CXXFLAGS
11311     AC_LANG_POP([C++])
11312     ENABLE_KAB=TRUE
11313 else
11314     AC_MSG_RESULT([no])
11315     ENABLE_KAB=
11317 AC_SUBST(ENABLE_KAB)
11319 dnl ===================================================================
11320 dnl Test which themes to include
11321 dnl ===================================================================
11322 AC_MSG_CHECKING([which themes to include])
11323 # if none given use default subset of available themes
11324 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11325     with_theme="crystal default hicontrast oxygen tango sifr"
11326     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11329 WITH_THEMES=""
11330 if test "x$with_theme" != "xno"; then
11331     for theme in $with_theme; do
11332         case $theme in
11333         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11334         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11335         esac
11336         WITH_THEMES="$WITH_THEMES $theme"
11337     done
11339 AC_MSG_RESULT([$WITH_THEMES])
11340 AC_SUBST([WITH_THEMES])
11342 dnl ===================================================================
11343 dnl Test whether to integrate helppacks into the product's installer
11344 dnl ===================================================================
11345 AC_MSG_CHECKING([for helppack integration])
11346 if test "$with_helppack_integration" = "no"; then
11347     WITH_HELPPACK_INTEGRATION=NO
11348     AC_MSG_RESULT([no integration])
11349 else
11350     WITH_HELPPACK_INTEGRATION=YES
11351     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11352     AC_MSG_RESULT([integration])
11354 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11356 dnl ===================================================================
11357 dnl Test whether to use CoreText framework
11358 dnl ===================================================================
11359 ENABLE_CORETEXT=
11360 if test "$_os" = "Darwin"; then
11361     AC_MSG_CHECKING([whether to use CoreText framework])
11362     if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
11363         AC_MSG_RESULT([yes])
11364         ENABLE_CORETEXT=TRUE
11365     else
11366         AC_MSG_RESULT([no])
11367     fi
11369 AC_SUBST(ENABLE_CORETEXT)
11371 ###############################################################################
11372 # Extensions checking
11373 ###############################################################################
11374 AC_MSG_CHECKING([for extensions integration])
11375 if test "x$enable_extension_integration" != "xno"; then
11376     WITH_EXTENSION_INTEGRATION=YES
11377     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11378     AC_MSG_RESULT([yes, use integration])
11379 else
11380     WITH_EXTENSION_INTEGRATION=NO
11381     AC_MSG_RESULT([no, do not integrate])
11383 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11385 dnl Should any extra extensions be included?
11386 dnl There are standalone tests for each of these below.
11387 WITH_EXTRA_EXTENSIONS=
11388 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11390 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11391 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11392 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11393 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11394 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11395 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11396 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11397 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11398 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11399 if test "x$with_java" != "xno"; then
11400     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11401     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11404 dnl ===================================================================
11405 dnl Test whether to include Sun Professional Template Pack
11406 dnl ===================================================================
11407 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11408 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11409     AC_MSG_RESULT([no integration])
11410 else
11411     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11412     sun_supported_langs="en-US de it fr es hu"
11413     if test "$with_sun_templates" = "yes"; then
11414         wanted_sun_templates="$sun_supported_langs"
11415     else
11416         # check whether the langs are supported by Sun
11417         wanted_sun_templates=
11418         for lang in $with_sun_templates; do
11419             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11420                 wanted_sun_templates="$wanted_sun_templates $lang"
11421             fi
11422         done
11423     fi
11424     SUNTEMPLATES_LANG=
11425     SUNTEMPLATES_DE_PACK=
11426     SUNTEMPLATES_EN_US_PACK=
11427     SUNTEMPLATES_ES_PACK=
11428     SUNTEMPLATES_FR_PACK=
11429     SUNTEMPLATES_HU_PACK=
11430     SUNTEMPLATES_IT_PACK=
11431     # check whether the langs are requested at all
11432     for lang in $wanted_sun_templates; do
11433     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11434         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11435         case $lang in
11436         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11437         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11438         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11439         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11440         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11441         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11442         esac
11443     fi
11444     done
11445     WITH_EXTRA_EXTENSIONS=YES
11446     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11448 AC_SUBST(SUNTEMPLATES_DE_PACK)
11449 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11450 AC_SUBST(SUNTEMPLATES_ES_PACK)
11451 AC_SUBST(SUNTEMPLATES_FR_PACK)
11452 AC_SUBST(SUNTEMPLATES_HU_PACK)
11453 AC_SUBST(SUNTEMPLATES_IT_PACK)
11455 dnl ===================================================================
11456 dnl Test whether to include fonts
11457 dnl ===================================================================
11458 AC_MSG_CHECKING([whether to include third-party fonts])
11459 if test "$with_fonts" != "no"; then
11460     AC_MSG_RESULT([yes])
11461     WITH_FONTS=YES
11462     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11463 else
11464     AC_MSG_RESULT([no])
11465     WITH_FONTS=NO
11466     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11468 AC_SUBST(WITH_FONTS)
11470 dnl ===================================================================
11471 dnl Test whether to include ppds
11472 dnl ===================================================================
11473 AC_MSG_CHECKING([whether to include PPDs])
11474 if test "$with_ppds" != "no"; then
11475     AC_MSG_RESULT([yes])
11476 else
11477     AC_MSG_RESULT([no])
11478     WITHOUT_PPDS=YES
11479     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11481 AC_SUBST(WITHOUT_PPDS)
11483 dnl ===================================================================
11484 dnl Test whether to include afms
11485 dnl ===================================================================
11486 AC_MSG_CHECKING([whether to include AFMs])
11487 if test "$with_afms" != "no"; then
11488     AC_MSG_RESULT([yes])
11489     BUILD_TYPE="$BUILD_TYPE AFMS"
11490 else
11491     AC_MSG_RESULT([no])
11492     WITHOUT_AFMS=YES
11493     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
11495 AC_SUBST(WITHOUT_AFMS)
11497 dnl ===================================================================
11498 dnl Test whether to include extra galleries
11499 dnl ===================================================================
11500 AC_MSG_CHECKING([whether to include extra galleries])
11501 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11502     AC_MSG_RESULT([no])
11503     WITH_EXTRA_GALLERY=NO
11504     OOOP_GALLERY_PACK=""
11505 else
11506     AC_MSG_RESULT([yes])
11507     WITH_EXTRA_GALLERY=YES
11508     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11509     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11510     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11512 AC_SUBST(WITH_EXTRA_GALLERY)
11513 AC_SUBST(OOOP_GALLERY_PACK)
11515 dnl ===================================================================
11516 dnl Test whether to include extra templates
11517 dnl ===================================================================
11518 AC_MSG_CHECKING([whether to include extra templates])
11519 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11520     AC_MSG_RESULT([no])
11521     WITH_EXTRA_TEMPLATE=NO
11522     OOOP_TEMPLATES_PACK=""
11523 else
11524     AC_MSG_RESULT([yes])
11525     WITH_EXTRA_TEMPLATE=YES
11526     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11527     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11528     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11530 AC_SUBST(WITH_EXTRA_TEMPLATE)
11531 AC_SUBST(OOOP_TEMPLATES_PACK)
11533 dnl ===================================================================
11534 dnl Test whether to include extra samples
11535 dnl ===================================================================
11536 AC_MSG_CHECKING([whether to include extra samples])
11537 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11538     AC_MSG_RESULT([no])
11539     WITH_EXTRA_SAMPLE=NO
11540     OOOP_SAMPLES_PACK=""
11541 else
11542     AC_MSG_RESULT([yes])
11543     WITH_EXTRA_SAMPLE=YES
11544     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11545     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11546     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11548 AC_SUBST(WITH_EXTRA_SAMPLE)
11549 AC_SUBST(OOOP_SAMPLES_PACK)
11551 dnl ===================================================================
11552 dnl Test whether to include extra fonts
11553 dnl ===================================================================
11554 AC_MSG_CHECKING([whether to include extra fonts])
11555 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11556     AC_MSG_RESULT([no])
11557     WITH_EXTRA_FONT=NO
11558     OOOP_FONTS_PACK=""
11559 else
11560     AC_MSG_RESULT([yes])
11561     WITH_EXTRA_FONT=YES
11562     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11563     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11564     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11566 AC_SUBST(WITH_EXTRA_FONT)
11567 AC_SUBST(OOOP_FONTS_PACK)
11569 dnl ===================================================================
11570 dnl Test whether to enable online update service
11571 dnl ===================================================================
11572 AC_MSG_CHECKING([whether to enable online update])
11573 ENABLE_ONLINE_UPDATE=
11574 if test "$enable_online_update" = ""; then
11575     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11576         AC_MSG_RESULT([yes])
11577         ENABLE_ONLINE_UPDATE="TRUE"
11578     else
11579         AC_MSG_RESULT([no])
11580     fi
11581 else
11582     if test "$enable_online_update" = "yes"; then
11583         AC_MSG_RESULT([yes])
11584         ENABLE_ONLINE_UPDATE="TRUE"
11585     else
11586         AC_MSG_RESULT([no])
11587     fi
11589 AC_SUBST(ENABLE_ONLINE_UPDATE)
11591 dnl ===================================================================
11592 dnl Test whether to enable ia2
11593 dnl ===================================================================
11594 AC_MSG_CHECKING([whether to enable IA2])
11595 ENABLE_IA2=
11596 if test "$enable_ia2" = "yes"; then
11597     if test "$_os" = "WINNT"; then
11598         AC_MSG_RESULT([yes])
11599         ENABLE_IA2="TRUE"
11600     else
11601         AC_MSG_RESULT([no])
11602     fi
11604 AC_SUBST(ENABLE_IA2)
11606 dnl ===================================================================
11607 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11608 dnl ===================================================================
11609 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11610 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11611     AC_MSG_RESULT([no])
11612     ENABLE_SILENT_MSI=
11613 else
11614     AC_MSG_RESULT([yes])
11615     ENABLE_SILENT_MSI=TRUE
11616     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11618 AC_SUBST(ENABLE_SILENT_MSI)
11620 AC_MSG_CHECKING([whether and how to use Xinerama])
11621 if test "$_os" = "Darwin"; then
11622     USE_XINERAMA=YES
11623     XINERAMA_LINK=dynamic
11624     AC_MSG_RESULT([yes])
11625 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11626     if test "$x_libraries" = "default_x_libraries"; then
11627         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11628         if test "x$XINERAMALIB" = x; then
11629            XINERAMALIB="/usr/lib"
11630         fi
11631     else
11632         XINERAMALIB="$x_libraries"
11633     fi
11634     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11635         # we have both versions, let the user decide but use the dynamic one
11636         # per default
11637         USE_XINERAMA=YES
11638         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11639             XINERAMA_LINK=dynamic
11640         else
11641             XINERAMA_LINK=static
11642         fi
11643     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11644         # we have only the dynamic version
11645         USE_XINERAMA=YES
11646         XINERAMA_LINK=dynamic
11647     elif test -e "$XINERAMALIB/libXinerama.a"; then
11648         # static version
11649         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11650             USE_XINERAMA=YES
11651             XINERAMA_LINK=static
11652         else
11653             USE_XINERAMA=NO
11654             XINERAMA_LINK=none
11655         fi
11656     else
11657         # no Xinerama
11658         USE_XINERAMA=NO
11659         XINERAMA_LINK=none
11660     fi
11661     if test "$USE_XINERAMA" = "YES"; then
11662         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11663         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11664             [AC_MSG_ERROR(Xinerama header not found.)], [])
11665         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11666         if test "x$XEXTLIB" = x; then
11667            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11668         fi
11669         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11670         if test "$_os" = "FreeBSD"; then
11671             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11672         fi
11673         if test "$_os" = "Linux"; then
11674             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11675         fi
11676         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11677             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11678     else
11679         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11680     fi
11681 else
11682     USE_XINERAMA=NO
11683     XINERAMA_LINK=none
11684     AC_MSG_RESULT([no])
11686 AC_SUBST(USE_XINERAMA)
11687 AC_SUBST(XINERAMA_LINK)
11689 dnl ===================================================================
11690 dnl Test whether to build cairo or rely on the system version
11691 dnl ===================================================================
11693 if test "$GUIBASE" = "unx"; then
11694     # Used in vcl/Library_vclplug_gen.mk
11695     test_cairo=yes
11698 if test "$test_cairo" = "yes"; then
11699     AC_MSG_CHECKING([whether to use the system cairo])
11701     : ${with_system_cairo:=$with_system_libs}
11702     if test "$with_system_cairo" = "yes"; then
11703         SYSTEM_CAIRO=YES
11704         AC_MSG_RESULT([yes])
11706         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11707         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11709         if test "$test_xrender" = "yes"; then
11710             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11711             AC_LANG_PUSH([C])
11712             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11713 #ifdef PictStandardA8
11714 #else
11715       return fail;
11716 #endif
11717 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11719             AC_LANG_POP([C])
11720         fi
11721         libo_MINGW_CHECK_DLL([libcairo])
11722         libo_MINGW_TRY_DLL([libfontconfig])
11723         libo_MINGW_TRY_DLL([libfreetype])
11724         libo_MINGW_TRY_DLL([libpixman])
11725         libo_MINGW_TRY_DLL([libpng15])
11726     else
11727         SYSTEM_CAIRO=NO
11728         AC_MSG_RESULT([no])
11730         BUILD_TYPE="$BUILD_TYPE CAIRO"
11731         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11732     fi
11735 AC_SUBST(SYSTEM_CAIRO)
11736 AC_SUBST(CAIRO_CFLAGS)
11737 AC_SUBST(CAIRO_LIBS)
11739 dnl ===================================================================
11740 dnl Test whether to use avahi
11741 dnl ===================================================================
11742 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11743     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11744                       [ENABLE_AVAHI="TRUE"])
11745     AC_DEFINE(HAVE_FEATURE_AVAHI)
11746     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11749 AC_SUBST(ENABLE_AVAHI)
11750 AC_SUBST(AVAHI_CFLAGS)
11751 AC_SUBST(AVAHI_LIBS)
11753 dnl ===================================================================
11754 dnl Test whether to use liblangtag
11755 dnl ===================================================================
11756 ENABLE_LIBLANGTAG=
11757 SYSTEM_LIBLANGTAG=
11758 AC_MSG_CHECKING([whether to use liblangtag])
11759 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11760     ENABLE_LIBLANGTAG=TRUE
11761     AC_MSG_RESULT([yes])
11762     AC_MSG_CHECKING([whether to use system liblangtag])
11763     if test "$with_system_liblangtag" = yes; then
11764         SYSTEM_LIBLANGTAG=YES
11765         AC_MSG_RESULT([yes])
11766         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11767         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11768         libo_MINGW_CHECK_DLL([liblangtag])
11769     else
11770         SYSTEM_LIBLANGTAG=NO
11771         AC_MSG_RESULT([no])
11772         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11773         if test "$COM" = "MSC"; then
11774             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11775         else
11776             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11777         fi
11778     fi
11779 else
11780     AC_MSG_RESULT([no])
11782 AC_SUBST(ENABLE_LIBLANGTAG)
11783 AC_SUBST(SYSTEM_LIBLANGTAG)
11784 AC_SUBST(LIBLANGTAG_CFLAGS)
11785 AC_SUBST(LIBLANGTAG_LIBS)
11787 dnl ===================================================================
11788 dnl Test whether to build libpng or rely on the system version
11789 dnl ===================================================================
11791 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11793 dnl ===================================================================
11794 dnl Check for runtime JVM search path
11795 dnl ===================================================================
11796 if test "$ENABLE_JAVA" != ""; then
11797     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11798     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11799         AC_MSG_RESULT([yes])
11800         if ! test -d "$with_jvm_path"; then
11801             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11802         fi
11803         if ! test -d "$with_jvm_path"jvm; then
11804             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11805         fi
11806         JVM_ONE_PATH_CHECK="$with_jvm_path"
11807         AC_SUBST(JVM_ONE_PATH_CHECK)
11808     else
11809         AC_MSG_RESULT([no])
11810     fi
11813 dnl ===================================================================
11814 dnl Test for the presence of Ant and that it works
11815 dnl ===================================================================
11817 if test "$ENABLE_JAVA" != ""; then
11818     ANT_HOME=; export ANT_HOME
11819     WITH_ANT_HOME=; export WITH_ANT_HOME
11820     if test -z "$with_ant_home"; then
11821         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11822     else
11823         if test "$_os" = "WINNT"; then
11824             with_ant_home=`cygpath -u "$with_ant_home"`
11825         fi
11826         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11827         WITH_ANT_HOME=$with_ant_home
11828         ANT_HOME=$with_ant_home
11829     fi
11831     if test -z "$ANT"; then
11832         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11833     else
11834         # resolve relative or absolute symlink
11835         while test -h "$ANT"; do
11836             a_cwd=`pwd`
11837             a_basename=`basename "$ANT"`
11838             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11839             cd "`dirname "$ANT"`"
11840             cd "`dirname "$a_script"`"
11841             ANT="`pwd`"/"`basename "$a_script"`"
11842             cd "$a_cwd"
11843         done
11845         AC_MSG_CHECKING([if $ANT works])
11846         cat > conftest.java << EOF
11847         public class conftest {
11848             int testmethod(int a, int b) {
11849                     return a + b;
11850             }
11851         }
11854         cat > conftest.xml << EOF
11855         <project name="conftest" default="conftest">
11856         <target name="conftest">
11857             <javac srcdir="." includes="conftest.java">
11858             </javac>
11859         </target>
11860         </project>
11863         oldJAVA_HOME=$JAVA_HOME
11864         if test "$JAVACISGCJ" = "yes"; then
11865             JAVA_HOME=; export JAVA_HOME
11866             ant_gcj="-Dbuild.compiler=gcj"
11867         fi
11868         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11869         if test $? = 0 -a -f ./conftest.class; then
11870             AC_MSG_RESULT([Ant works])
11871             if test -z "$WITH_ANT_HOME"; then
11872                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11873                 if test -z "$ANT_HOME"; then
11874                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11875                 fi
11876             else
11877                 ANT_HOME="$WITH_ANT_HOME"
11878             fi
11879         else
11880             echo "configure: Ant test failed" >&5
11881             cat conftest.java >&5
11882             cat conftest.xml >&5
11883             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11884             ANT_HOME=""
11885             add_warning "Ant does not work - Some Java projects will not build!"
11886         fi
11887         JAVA_HOME=$oldJAVA_HOME
11888         rm -f conftest* core core.* *.core
11889     fi
11890     if test -z "$ANT_HOME"; then
11891         ANT_HOME="NO_ANT_HOME"
11892     else
11893         PathFormat "$ANT_HOME"
11894         ANT_HOME="$formatted_path"
11895         PathFormat "$ANT"
11896         ANT="$ANT"
11897     fi
11898     AC_SUBST(ANT_HOME)
11899     AC_SUBST(ANT)
11901     dnl Checking for ant.jar
11902     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11903         AC_MSG_CHECKING([Ant lib directory])
11904         if test -f $ANT_HOME/lib/ant.jar; then
11905             ANT_LIB="$ANT_HOME/lib"
11906         else
11907             if test -f $ANT_HOME/ant.jar; then
11908                 ANT_LIB="$ANT_HOME"
11909             else
11910                 if test -f /usr/share/java/ant.jar; then
11911                     ANT_LIB=/usr/share/java
11912                 else
11913                     if test -f /usr/share/ant-core/lib/ant.jar; then
11914                         ANT_LIB=/usr/share/ant-core/lib
11915                     else
11916                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11917                             ANT_LIB="$ANT_HOME/lib/ant"
11918                         else
11919                             if test -f /usr/share/lib/ant/ant.jar; then
11920                                 ANT_LIB=/usr/share/lib/ant
11921                             else
11922                                 AC_MSG_ERROR([Ant libraries not found!])
11923                             fi
11924                         fi
11925                     fi
11926                 fi
11927             fi
11928         fi
11929         PathFormat "$ANT_LIB"
11930         ANT_LIB="$formatted_path"
11931         AC_MSG_RESULT([Ant lib directory found.])
11932     fi
11933     AC_SUBST(ANT_LIB)
11935     ant_minver=1.6.0
11936     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11938     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11939     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11940     ant_version_major=`echo $ant_version | cut -d. -f1`
11941     ant_version_minor=`echo $ant_version | cut -d. -f2`
11942     echo "configure: ant_version $ant_version " >&5
11943     echo "configure: ant_version_major $ant_version_major " >&5
11944     echo "configure: ant_version_minor $ant_version_minor " >&5
11945     if test "$ant_version_major" -ge "2"; then
11946         AC_MSG_RESULT([yes, $ant_version])
11947     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11948         AC_MSG_RESULT([yes, $ant_version])
11949     else
11950         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11951     fi
11953     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
11954         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
11955         rm -rf confdir
11956         mkdir confdir
11957         cat > conftest.java << EOF
11958             public class conftest {
11959                 int testmethod(int a, int b) {
11960                     return a + b;
11961                 }
11962             }
11965         cat > conftest.xml << EOF
11966             <project name="conftest" default="conftest">
11967             <target name="conftest" depends="copytest">
11968                 <javac srcdir="." includes="conftest.java">
11969                 </javac>
11970             </target>
11971             <target name="copytest">
11972                  <copy todir="confdir">
11973                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
11974                  <filterset/>
11975                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
11976                  </copy>
11977             </target>
11978             </project>
11981         if test "$JAVACISGCJ" = "yes"; then
11982             JAVA_HOME=; export JAVA_HOME
11983             ant_gcj="-Dbuild.compiler=gcj"
11984         fi
11985         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11986         if test $? = 0 -a -f ./conftest.class; then
11987             AC_MSG_RESULT([yes])
11988             rm -rf confdir
11989         else
11990             echo "configure: Ant test failed" >&5
11991             cat conftest.java >&5
11992             cat conftest.xml >&5
11993             rm -rf confdir
11994             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
11995         fi
11996     fi
11997     rm -f conftest* core core.* *.core
12000 OOO_JUNIT_JAR=
12001 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12002     AC_MSG_CHECKING([for JUnit 4])
12003     if test "$with_junit" = "yes"; then
12004         if test -e /usr/share/java/junit4.jar; then
12005             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12006         else
12007            if test -e /usr/share/lib/java/junit.jar; then
12008               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12009            else
12010               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12011            fi
12012         fi
12013     else
12014         OOO_JUNIT_JAR=$with_junit
12015     fi
12016     if test "$_os" = "WINNT"; then
12017         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12018     fi
12019     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
12020         grep org/junit/Before.class > /dev/null 2>&5
12021     if test $? -eq 0; then
12022         # check if either class-path entry is available for hamcrest or
12023         # it's bundled
12024         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
12025             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
12026             AC_MSG_RESULT([$OOO_JUNIT_JAR])
12027         else
12028             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
12029 provide a full junit jar or use --without-junit])
12030         fi
12031     else
12032         AC_MSG_RESULT([no])
12033         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
12034 location (/usr/share/java), specify its pathname via
12035 --with-junit=..., or disable it via --without-junit])
12036     fi
12037     if test $OOO_JUNIT_JAR != ""; then
12038     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12039     fi
12041 AC_SUBST(OOO_JUNIT_JAR)
12044 AC_SUBST(SCPDEFS)
12047 # check for wget and curl
12049 WGET=
12050 CURL=
12052 if test "$enable_fetch_external" != "no"; then
12054 CURL=`which curl 2>/dev/null`
12056 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12057     eval "$i --version" > /dev/null 2>&1
12058     ret=$?
12059     if test $ret -eq 0; then
12060         WGET=$i
12061         break
12062     fi
12063 done
12065 if test -z "$WGET" -a -z "$CURL"; then
12066     AC_MSG_ERROR([neither wget nor curl found!])
12071 AC_SUBST(WGET)
12072 AC_SUBST(CURL)
12075 # check for md5sum
12077 MD5SUM=
12079 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12080     if test "$i" = "md5"; then
12081         eval "$i -x" > /dev/null 2>&1
12082     else
12083         eval "$i --version" > /dev/null 2>&1
12084     fi
12085     ret=$?
12086     if test $ret -eq 0; then
12087         MD5SUM=$i
12088         break
12089     fi
12090 done
12092 if test "$MD5SUM" = "md5"; then
12093     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12094         MD5SUM="$MD5SUM -r"
12095     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12096         MD5SUM="$MD5SUM -n"
12097     fi
12100 if test -z "$MD5SUM"; then
12101     AC_MSG_ERROR([no md5sum: found!])
12104 AC_SUBST(MD5SUM)
12106 dnl ===================================================================
12107 dnl Dealing with l10n options
12108 dnl ===================================================================
12109 AC_MSG_CHECKING([which languages to be built])
12110 # get list of all languages
12111 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12112 # the sed command does the following:
12113 #   + if a line ends with a backslash, append the next line to it
12114 #   + adds " on the beginning of the value (after =)
12115 #   + adds " at the end of the value
12116 #   + removes en-US; we want to put it on the beginning
12117 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12118 [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)]
12119 ALL_LANGS="en-US $completelangiso"
12120 # check the configured localizations
12121 WITH_LANG="$with_lang"
12122 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12123     AC_MSG_RESULT([en-US])
12124 else
12125     AC_MSG_RESULT([$WITH_LANG])
12126     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12128 # check that the list is valid
12129 for lang in $WITH_LANG; do
12130     test "$lang" = "ALL" && continue
12131     # need to check for the exact string, so add space before and after the list of all languages
12132     for vl in $ALL_LANGS; do
12133         if test "$vl" = "$lang"; then
12134            break
12135         fi
12136     done
12137     if test "$vl" != "$lang"; then
12138         # if you're reading this - you prolly quoted your languages remove the quotes ...
12139         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12140     fi
12141 done
12142 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12143     echo $WITH_LANG | grep -q en-US
12144     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12146 # list with substituted ALL
12147 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12148 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12149 test "$WITH_LANG" = "en-US" && WITH_LANG=
12150 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12151     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12152     ALL_LANGS=`echo $ALL_LANGS qtz`
12154 AC_SUBST(ALL_LANGS)
12155 AC_SUBST(WITH_LANG)
12156 AC_SUBST(WITH_LANG_LIST)
12157 AC_SUBST(GIT_NEEDED_SUBMODULES)
12159 WITH_POOR_HELP_LOCALIZATIONS=
12160 if test -d "$SRC_ROOT/translations/source"; then
12161     for l in `ls -1 $SRC_ROOT/translations/source`; do
12162         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12163             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12164         fi
12165     done
12167 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12169 dnl git submodule update --reference
12170 dnl ===================================================================
12171 if test -n "${GIT_REFERENCE_SRC}"; then
12172     for repo in ${GIT_NEEDED_SUBMODULES}; do
12173         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12174             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12175         fi
12176     done
12178 AC_SUBST(GIT_REFERENCE_SRC)
12180 dnl git submodules linked dirs
12181 dnl ===================================================================
12182 if test -n "${GIT_LINK_SRC}"; then
12183     for repo in ${GIT_NEEDED_SUBMODULES}; do
12184         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12185             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12186         fi
12187     done
12189 AC_SUBST(GIT_LINK_SRC)
12191 dnl branding
12192 dnl ===================================================================
12193 AC_MSG_CHECKING([for alternative branding images directory])
12194 # initialize mapped arrays
12195 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12196 brand_files="$BRAND_INTRO_IMAGES about.svg \
12197     backing_left.png backing_right.png \
12198     backing_rtl_left.png backing_rtl_right.png \
12199     backing_space.png"
12201 if test -z "$with_branding" -o "$with_branding" = "no"; then
12202     AC_MSG_RESULT([none])
12203     DEFAULT_BRAND_IMAGES="$brand_files"
12204 else
12205     if ! test -d $with_branding ; then
12206         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12207     else
12208         AC_MSG_RESULT([$with_branding])
12209         CUSTOM_BRAND_DIR="$with_branding"
12210         for lfile in $brand_files
12211         do
12212             if ! test -f $with_branding/$lfile ; then
12213                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12214                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12215             else
12216                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12217             fi
12218         done
12219         check_for_progress="yes"
12220     fi
12222 AC_SUBST([BRAND_INTRO_IMAGES])
12223 AC_SUBST([CUSTOM_BRAND_DIR])
12224 AC_SUBST([CUSTOM_BRAND_IMAGES])
12225 AC_SUBST([DEFAULT_BRAND_IMAGES])
12228 AC_MSG_CHECKING([for 'intro' progress settings])
12229 PROGRESSBARCOLOR=
12230 PROGRESSSIZE=
12231 PROGRESSPOSITION=
12232 PROGRESSFRAMECOLOR=
12233 PROGRESSTEXTCOLOR=
12234 PROGRESSTEXTBASELINE=
12236 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12237     source "$with_branding/progress.conf"
12238     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12239 else
12240     AC_MSG_RESULT([none])
12243 AC_SUBST(PROGRESSBARCOLOR)
12244 AC_SUBST(PROGRESSSIZE)
12245 AC_SUBST(PROGRESSPOSITION)
12246 AC_SUBST(PROGRESSFRAMECOLOR)
12247 AC_SUBST(PROGRESSTEXTCOLOR)
12248 AC_SUBST(PROGRESSTEXTBASELINE)
12251 AC_MSG_CHECKING([for extra build ID])
12252 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12253     EXTRA_BUILDID="$with_extra_buildid"
12255 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12256 if test -n "$EXTRA_BUILDID" ; then
12257     AC_MSG_RESULT([$EXTRA_BUILDID])
12258 else
12259     AC_MSG_RESULT([not set])
12261 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12263 OOO_VENDOR=
12264 AC_MSG_CHECKING([for vendor])
12265 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12266     OOO_VENDOR="$USERNAME"
12268     if test -z "$OOO_VENDOR"; then
12269         OOO_VENDOR="$USER"
12270     fi
12272     if test -z "$OOO_VENDOR"; then
12273         OOO_VENDOR="`id -u -n`"
12274     fi
12276     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12277 else
12278     OOO_VENDOR="$with_vendor"
12279     AC_MSG_RESULT([$OOO_VENDOR])
12281 AC_SUBST(OOO_VENDOR)
12283 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12284 if test "$with_compat_oowrappers" = "yes"; then
12285     WITH_COMPAT_OOWRAPPERS=YES
12286     AC_MSG_RESULT(yes)
12287 else
12288     WITH_COMPAT_OOWRAPPERS=
12289     AC_MSG_RESULT(no)
12291 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12293 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
12294 AC_MSG_CHECKING([for install dirname])
12295 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12296     INSTALLDIRNAME="$with_install_dirname"
12298 AC_MSG_RESULT([$INSTALLDIRNAME])
12299 AC_SUBST(INSTALLDIRNAME)
12301 AC_MSG_CHECKING([for prefix])
12302 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12303 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12304 PREFIXDIR="$prefix"
12305 AC_MSG_RESULT([$PREFIXDIR])
12306 AC_SUBST(PREFIXDIR)
12308 LIBDIR=[$(eval echo $(eval echo $libdir))]
12309 AC_SUBST(LIBDIR)
12311 DATADIR=[$(eval echo $(eval echo $datadir))]
12312 AC_SUBST(DATADIR)
12314 MANDIR=[$(eval echo $(eval echo $mandir))]
12315 AC_SUBST(MANDIR)
12317 DOCDIR=[$(eval echo $(eval echo $docdir))]
12318 AC_SUBST(DOCDIR)
12320 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12321 AC_SUBST(INSTALLDIR)
12323 TESTINSTALLDIR="${BUILDDIR}/test-install"
12324 AC_SUBST(TESTINSTALLDIR)
12327 # ===================================================================
12328 # OAuth2 id and secrets
12329 # ===================================================================
12331 AC_MSG_CHECKING([for Google Drive client id and secret])
12332 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12333 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12334 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12335     GDRIVE_CLIENT_ID="\"\""
12338 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12339     GDRIVE_CLIENT_SECRET="\"\""
12342 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12343     AC_MSG_RESULT([not set])
12344 else
12345     AC_MSG_RESULT([set])
12348 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12349 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12351 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12352 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12353 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12354 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12355     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12358 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12359     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12362 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12363     AC_MSG_RESULT([not set])
12364 else
12365     AC_MSG_RESULT([set])
12367 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12368 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12370 # ===================================================================
12371 # De- or increase default verbosity of build process
12372 # ===================================================================
12373 AC_MSG_CHECKING([build verbosity])
12374 if test -n "$enable_verbose"; then
12375     if test "$enable_verbose" = "yes"; then
12376         VERBOSE="TRUE"
12377         AC_MSG_RESULT([high])
12378     fi
12379     if test "$enable_verbose" = "no"; then
12380         VERBOSE="FALSE"
12381         AC_MSG_RESULT([low])
12382     fi
12383 else
12384     AC_MSG_RESULT([not set])
12386 AC_SUBST(VERBOSE)
12388 dnl ===================================================================
12389 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12390 dnl --enable-dependency-tracking configure option
12391 dnl ===================================================================
12392 AC_MSG_CHECKING([whether to enable dependency tracking])
12393 if test "$enable_dependency_tracking" = "no"; then
12394     nodep=TRUE
12395     AC_MSG_RESULT([no])
12396 else
12397     AC_MSG_RESULT([yes])
12399 AC_SUBST(nodep)
12401 dnl ===================================================================
12402 dnl Number of CPUs to use during the build
12403 dnl ===================================================================
12404 AC_MSG_CHECKING([for number of processors to use])
12405 # plain --with-parallelism is just the default
12406 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12407     if test "$with_parallelism" = "no"; then
12408         PARALLELISM=1
12409     else
12410         PARALLELISM=$with_parallelism
12411     fi
12412 else
12413     if test "$enable_icecream" = "yes"; then
12414         PARALLELISM="10"
12415     else
12416         case `uname -s` in
12418         Darwin|FreeBSD|NetBSD|OpenBSD)
12419             PARALLELISM=`sysctl -n hw.ncpu`
12420             ;;
12422         Linux)
12423             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12424         ;;
12425         # what else than above does profit here *and* has /proc?
12426         *)
12427             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12428             ;;
12429         esac
12431         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12432         # unexpected format, 'wc -l' will have returned 0.
12433         if test "$PARALLELISM" -eq 0; then
12434             PARALLELISM=1
12435         fi
12436     fi
12439 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12440     if test -z "$with_parallelism"; then
12441             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12442             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12443             PARALLELISM="1"
12444     else
12445         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."
12446     fi
12449 AC_MSG_RESULT([$PARALLELISM])
12450 AC_SUBST(PARALLELISM)
12453 # Set up ILIB for MSVC build
12455 if test "$build_os" = "cygwin"; then
12456     ILIB="."
12457     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12458         ILIB="$ILIB;$JAVA_HOME/lib"
12459     fi
12460     if test "$BITNESS_OVERRIDE" = 64; then
12461         ILIB="$ILIB;$COMPATH/lib/amd64"
12462         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12463         if test "$WINDOWS_SDK_VERSION" = "80"; then
12464             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12465         fi
12466     else
12467         ILIB="$ILIB;$COMPATH/lib"
12468         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12469         if test "$WINDOWS_SDK_VERSION" = "80"; then
12470             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12471         fi
12472     fi
12473     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12475     if test "$ENABLE_DIRECTX" = "TRUE"; then
12476         ILIB="$ILIB;$DIRECTXSDK_LIB"
12477     fi
12478     AC_SUBST(ILIB)
12482 # ===================================================================
12483 # Creating bigger shared library to link against
12484 # ===================================================================
12485 AC_MSG_CHECKING([whether to create huge library])
12486 MERGELIBS=
12488 if test $_os = iOS -o $_os = Android; then
12489     # Never any point in mergelibs for these as we build just static
12490     # libraries anyway...
12491     enable_mergelibs=no
12494 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12495     if test $_os != Linux -a $_os != WINNT; then
12496         add_warning "--enable-mergelibs is not tested for this platform"
12497     fi
12498     if test "$enable_mergelibs" = "all"; then
12499         MERGELIBS="ALL"
12500         URELIBS="TRUE"
12501     else
12502         MERGELIBS="CORE"
12503     fi
12504     AC_MSG_RESULT([yes])
12505 else
12506     AC_MSG_RESULT([no])
12508 AC_SUBST([MERGELIBS])
12509 AC_SUBST([URELIBS])
12511 # ===================================================================
12512 # Create hardlinks on deliver instead of copying for smaller size and speed up
12513 # ===================================================================
12514 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12515 HARDLINKDELIVER=
12516 if test "$enable_hardlink_deliver" = "yes"; then
12517     HARDLINKDELIVER="TRUE"
12518     AC_MSG_RESULT([yes])
12519 else
12520     AC_MSG_RESULT([no])
12522 AC_SUBST(HARDLINKDELIVER)
12524 dnl ===================================================================
12525 dnl icerun is a wrapper that stops us spawning tens of processes
12526 dnl locally - for tools that can't be executed on the compile cluster
12527 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12528 dnl ===================================================================
12529 AC_MSG_CHECKING([whether to use icerun wrapper])
12530 ICECREAM_RUN=
12531 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12532     ICECREAM_RUN=icerun
12533     AC_MSG_RESULT([yes])
12534 else
12535     AC_MSG_RESULT([no])
12537 AC_SUBST(ICECREAM_RUN)
12539 dnl ===================================================================
12541 AC_MSG_CHECKING([MPL subset])
12542 MPL_SUBSET=
12544 if test "$enable_mpl_subset" = "yes"; then
12545     warn_report=false
12546     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12547         warn_report=true
12548     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12549         warn_report=true
12550     fi
12551     if test "$warn_report" = "true"; then
12552         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12553     fi
12554     if test "x$enable_postgresql_sdbc" != "xno"; then
12555         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12556     fi
12557     if test "$enable_lotuswordpro" = "yes"; then
12558         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12559     fi
12560     if test "$enable_neon" != "no" -o "x$DISABLE_NEON" != "xTRUE"; then
12561         AC_MSG_ERROR([need to --disable-neon - webdav support.])
12562     fi
12563     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12564         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12565     fi
12566     if test -n "$ENABLE_PDFIMPORT"; then
12567         if test "x$SYSTEM_POPPLER" != "xNO"; then
12568             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12569         fi
12570     fi
12571     # cf. m4/libo_check_extension.m4
12572     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12573         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12574     fi
12575     for theme in $WITH_THEMES; do
12576         case $theme in
12577         crystal|default|hicontrast|human|oxygen|sifr)
12578             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12579         *) : ;;
12580         esac
12581     done
12582     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12583         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12584     fi
12585     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12586         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12587     fi
12589     MPL_SUBSET="TRUE"
12590     AC_DEFINE(MPL_HAVE_SUBSET)
12591     AC_MSG_RESULT([only])
12592 else
12593     AC_MSG_RESULT([no restrictions])
12595 AC_SUBST(MPL_SUBSET)
12598 dnl ===================================================================
12599 dnl Setting up the environment.
12600 dnl ===================================================================
12601 echo "setting up the build environment variables..."
12603 AC_SUBST(COMPATH)
12605 if test "$build_os" = "cygwin"; then
12606     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12607         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12608         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12609     else
12610         ATL_LIB="$COMPATH/atlmfc/lib"
12611         ATL_INCLUDE="$COMPATH/atlmfc/include"
12612     fi
12613     if test "$BITNESS_OVERRIDE" = 64; then
12614         ATL_LIB="$ATL_LIB/amd64"
12615     fi
12616     PathFormat "/usr/bin/grep.exe"
12617     WIN_GREP="$formatted_path"
12618     PathFormat "/usr/bin/find.exe"
12619     WIN_FIND="$formatted_path"
12620     PathFormat "/usr/bin/ls.exe"
12621     WIN_LS="$formatted_path"
12622     PathFormat "/usr/bin/touch.exe"
12623     WIN_TOUCH="$formatted_path"
12626 AC_SUBST(ATL_INCLUDE)
12627 AC_SUBST(ATL_LIB)
12628 AC_SUBST(WIN_FIND)
12629 AC_SUBST(WIN_GREP)
12630 AC_SUBST(WIN_LS)
12631 AC_SUBST(WIN_TOUCH)
12633 AC_SUBST(BUILD_TYPE)
12635 AC_SUBST(SOLARINC)
12636 AC_SUBST(SOLARLIB)
12638 PathFormat "$PERL"
12639 PERL="$formatted_path"
12640 AC_SUBST(PERL)
12642 if test -n "$TMPDIR"; then
12643     TEMP_DIRECTORY="$TMPDIR"
12644 else
12645     TEMP_DIRECTORY="/tmp"
12647 if test "$build_os" = "cygwin"; then
12648     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12650 AC_SUBST(TEMP_DIRECTORY)
12652 # setup the PATH for the environment
12653 if test -n "$LO_PATH_FOR_BUILD"; then
12654     LO_PATH="$LO_PATH_FOR_BUILD"
12655 else
12656     LO_PATH="$PATH"
12658     case "$host_os" in
12660     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12661         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12662             pathmunge "$JAVA_HOME/bin" "after"
12663         fi
12664         ;;
12666     cygwin*)
12667         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12668         pathmunge "$ASM_HOME" "before"
12669         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12670         pathmunge "$CSC_PATH" "before"
12671         pathmunge "$MIDL_PATH" "before"
12672         pathmunge "$AL_PATH" "before"
12673         pathmunge "$MSPDB_PATH" "before"
12674         if test "$BITNESS_OVERRIDE" = 64; then
12675             pathmunge "$COMPATH/bin/amd64" "before"
12676             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12677         else
12678             pathmunge "$COMPATH/bin" "before"
12679             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12680         fi
12681         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12682             if test -d "$JAVA_HOME/jre/bin/client"; then
12683                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12684             fi
12685             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12686                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12687             fi
12688             pathmunge "$JAVA_HOME/bin" "before"
12689         fi
12690         ;;
12692     solaris*)
12693         pathmunge "/usr/css/bin" "before"
12694         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12695             pathmunge "$JAVA_HOME/bin" "after"
12696         fi
12697         ;;
12698     esac
12700     pathmunge "$SRC_ROOT/solenv/bin" "before"
12701     pathmunge "." "before"
12704 AC_SUBST(LO_PATH)
12706 # Generate a configuration md5 we can use for deps
12707 if test -f config_host.mk; then
12708     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12711 AC_CONFIG_FILES([config_host.mk
12712                  Makefile
12713                  lo.xcent
12714                  instsetoo_native/util/openoffice.lst
12715                  sysui/desktop/macosx/Info.plist
12716                  ios/lo.xcconfig])
12717 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12718 AC_CONFIG_HEADERS([config_host/config_clang.h])
12719 AC_CONFIG_HEADERS([config_host/config_eot.h])
12720 AC_CONFIG_HEADERS([config_host/config_features.h])
12721 AC_CONFIG_HEADERS([config_host/config_folders.h])
12722 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12723 AC_CONFIG_HEADERS([config_host/config_global.h])
12724 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12725 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12726 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12727 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12728 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12729 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12730 AC_CONFIG_HEADERS([config_host/config_oox.h])
12731 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12732 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12733 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12734 AC_CONFIG_HEADERS([config_host/config_version.h])
12735 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12736 AC_OUTPUT
12738 if test "$CROSS_COMPILING" = YES; then
12739     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12742 # touch the config timestamp file
12743 if test ! -f config_host.mk.stamp; then
12744     echo > config_host.mk.stamp
12745 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12746     echo "Configuration unchanged - avoiding scp2 stamp update"
12747 else
12748     echo > config_host.mk.stamp
12752 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12753 cat << _EOS
12754 ****************************************************************************
12755 WARNING:
12756 Your make version is known to be horribly slow, and hard to debug
12757 problems with. To get a reasonably functional make please do:
12759 to install a pre-compiled binary make for cygwin
12761 mkdir -p /opt/lo/bin
12762 cd /opt/lo/bin
12763 wget http://dev-www.libreoffice.org/bin/cygwin/make
12764 chmod +x make
12766 to install from source:
12767 place yourself in a working directory of you choice.
12769 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
12770 cd dev-tools/make-3.82-gbuild
12771 ./configure --prefix=/opt/lo
12772 make
12773 make install
12775 Then re-run autogen.sh
12777 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12778 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12780 _EOS
12783 cat << _EOF
12784 ****************************************************************************
12786 To build, issue:
12787 $GNUMAKE
12789 For details, run:
12790 $GNUMAKE help
12792 _EOF
12794 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
12795     cat << _EOF
12796 After the build has finished, your can immediately run it using:
12797 instdir/program/soffice
12799 If you want to run the smoketest, issue:
12800 $GNUMAKE check
12802 _EOF
12805 if test -f warn; then
12806     cat warn
12807     rm warn
12810 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: