Stop leaking all ScPostIt instances.
[LibreOffice.git] / configure.ac
blobdb579c2578a3374df5f2efd2aa04dcb4bed58bde
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.3.0+],[],[],[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 libabw
7819 dnl ===================================================================
7820 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.0],["-I${WORKDIR}/UnpackedTarball/libabw/inc"],["-L${WORKDIR}/UnpackedTarball/libabw/src/lib/.libs -labw-0.0"])
7822 dnl ===================================================================
7823 dnl Check for system libwps
7824 dnl ===================================================================
7825 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${WORKDIR}/UnpackedTarball/libwps/inc"],["-L${WORKDIR}/UnpackedTarball/libwps/src/lib/.libs -lwps-0.2"])
7827 dnl ===================================================================
7828 dnl Check for system libwpg
7829 dnl ===================================================================
7830 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${WORKDIR}/UnpackedTarball/libwpg/inc"],["-L${WORKDIR}/UnpackedTarball/libwpg/src/lib/.libs -lwpg-0.2"])
7832 # ===================================================================
7833 # Check for system libxslt
7834 # to prevent incompatibilities between internal libxml2 and external libxslt,
7835 # or vice versa, use with_system_libxml here
7836 # ===================================================================
7837 if test "$with_system_libxml" = "auto"; then
7838     case "$_os" in
7839     WINNT|iOS|Android)
7840         with_system_libxml="$with_system_libs"
7841         ;;
7842     *)
7843         with_system_libxml=yes
7844         ;;
7845     esac
7848 AC_MSG_CHECKING([which libxslt to use])
7849 if test "$with_system_libxml" = "yes"; then
7850     AC_MSG_RESULT([external])
7851     SYSTEM_LIBXSLT=YES
7852     if test "$_os" = "Darwin"; then
7853         dnl make sure to use SDK path
7854         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7855         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7856         dnl omit -L/usr/lib
7857         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7858         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7859     else
7860         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7861         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7862         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7863         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7864     fi
7866     dnl Check for xsltproc
7867     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7868     if test "$XSLTPROC" = "no"; then
7869         AC_MSG_ERROR([xsltproc is required])
7870     fi
7872     libo_MINGW_CHECK_DLL([libxslt])
7873     libo_MINGW_CHECK_DLL([libexslt])
7874     libo_MINGW_TRY_DLL([iconv])
7875 else
7876     AC_MSG_RESULT([internal])
7877     SYSTEM_LIBXSLT=NO
7878     LIBXSLT_MAJOR=1
7879     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7881     if test "$cross_compiling" = "yes"; then
7882         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7883         if test "$XSLTPROC" = "no"; then
7884             AC_MSG_ERROR([xsltproc is required])
7885         fi
7886     fi
7888 AC_SUBST(SYSTEM_LIBXSLT)
7889 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7890     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7892 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7894 AC_SUBST(LIBEXSLT_CFLAGS)
7895 AC_SUBST(LIBEXSLT_LIBS)
7896 AC_SUBST(LIBXSLT_CFLAGS)
7897 AC_SUBST(LIBXSLT_LIBS)
7898 AC_SUBST(LIBXSLT_MAJOR)
7899 AC_SUBST(XSLTPROC)
7901 # ===================================================================
7902 # Check for system libxml
7903 # ===================================================================
7904 AC_MSG_CHECKING([which libxml to use])
7905 if test "$with_system_libxml" = "yes"; then
7906     AC_MSG_RESULT([external])
7907     SYSTEM_LIBXML=YES
7908     if test "$_os" = "Darwin"; then
7909         dnl make sure to use SDK path
7910         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7911         dnl omit -L/usr/lib
7912         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7913     elif test $_os = iOS; then
7914         dnl make sure to use SDK path
7915         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7916         LIBXML_CFLAGS="-I$usr/include/libxml2"
7917         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7918     else
7919         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7920         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7921     fi
7923     dnl Check for xmllint
7924     AC_PATH_PROG(XMLLINT, xmllint, no)
7925     if test "$XMLLINT" = "no"; then
7926         AC_MSG_ERROR([xmllint is required])
7927     fi
7929     libo_MINGW_CHECK_DLL([libxml2])
7930     libo_MINGW_TRY_DLL([zlib1])
7931 else
7932     AC_MSG_RESULT([internal])
7933     SYSTEM_LIBXML=NO
7934     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7936 AC_SUBST(SYSTEM_LIBXML)
7937 AC_SUBST(LIBXML_CFLAGS)
7938 AC_SUBST(LIBXML_LIBS)
7939 AC_SUBST(XMLLINT)
7941 # =====================================================================
7942 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7943 # runtime requires Python 3 compatible version (>= 2.6)
7944 # Optionally user can pass an option to configure, i. e.
7945 # ./configure PYTHON=/usr/bin/python
7946 # =====================================================================
7947 if test "$build_os" != "cygwin"; then
7948     # This allows a lack of system python with no error, we use internal one in that case.
7949     AM_PATH_PYTHON([2.5],, [:])
7950     # Clean PYTHON_VERSION checked below if cross-compiling
7951     PYTHON_VERSION=""
7952     if test "$PYTHON" != ":"; then
7953         PYTHON_FOR_BUILD=$PYTHON
7954     fi
7956 AC_SUBST(PYTHON_FOR_BUILD)
7958 # Checks for Python to use for Pyuno
7959 AC_MSG_CHECKING([which Python to use for Pyuno])
7960 case "$enable_python" in
7961 no|disable)
7962     if test -z $PYTHON_FOR_BUILD; then
7963         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7964         # requirement from the choice whether to include Python stuff in the installer, but why
7965         # bother?
7966         AC_MSG_ERROR([Python is required at build time.])
7967     fi
7968     enable_python=no
7969     AC_MSG_RESULT([none])
7970     ;;
7971 ""|yes|auto)
7972     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7973         AC_MSG_RESULT([no, overridden by --disable-scripting])
7974         enable_python=no
7975     elif test $build_os = cygwin; then
7976         dnl When building on Windows we don't attempt to use any installed
7977         dnl "system"  Python.
7978         dnl
7979         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7980         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7981         dnl MinGW cross-compilation setups.)
7982         AC_MSG_RESULT([internal])
7983         enable_python=internal
7984     elif test "$cross_compiling" = yes; then
7985         AC_MSG_RESULT([system])
7986         enable_python=system
7987     else
7988         # Unset variables set by the above AM_PATH_PYTHON so that
7989         # we actually do check anew.
7990         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
7991         AM_PATH_PYTHON([3.3],, [:])
7992         if test "$PYTHON" = :; then
7993             AC_MSG_RESULT([internal])
7994             enable_python=internal
7995         else
7996             AC_MSG_RESULT([system])
7997             enable_python=system
7998         fi
7999     fi
8000     ;;
8001 internal)
8002     AC_MSG_RESULT([internal])
8003     ;;
8004 system)
8005     AC_MSG_RESULT([system])
8006     ;;
8008     AC_MSG_ERROR([Incorrect --enable-python option])
8009     ;;
8010 esac
8012 if test $enable_python != no; then
8013     BUILD_TYPE="$BUILD_TYPE PYUNO"
8016 if test $enable_python = system; then
8017     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8018         # We already have logic above to make sure the system Python
8019         # is used only when building against SDK 10.6 or newer.
8021         # Make sure we use the 2.6 Python when building against the
8022         # 10.6 SDK.
8023         case $with_macosx_sdk in
8024         10.6)
8025             python_version=2.6;;
8026         10.7|10.8)
8027             python_version=2.7;;
8028         *)
8029             # ???
8030             python_version=2.7;;
8031         esac
8032         PYTHON=python$python_version
8033         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
8034         PYTHON_LIBS="-framework Python"
8035     fi
8036     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8037         # Fallback: Accept these in the environment, or as set above
8038         # for MacOSX.
8039         :
8040     elif test "$cross_compiling" != yes; then
8041         # Unset variables set by the above AM_PATH_PYTHON so that
8042         # we actually do check anew.
8043         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
8044         # This causes an error if no python command is found
8045         AM_PATH_PYTHON([3.3])
8046         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8047         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8048         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8049         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8050         if test -z "$PKG_CONFIG"; then
8051             PYTHON_CFLAGS="-I$python_include"
8052             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8053         elif $PKG_CONFIG --exists python-$python_version; then
8054             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8055             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8056         else
8057             PYTHON_CFLAGS="-I$python_include"
8058             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8059         fi
8060     else
8061         dnl How to find out the cross-compilation Python installation path?
8062         dnl Let's hardocode what we know for different distributions for now...
8063         for python_version in 2.6; do
8064             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8065                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8066                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8067                 AC_MSG_CHECKING([for python.exe])
8068                 libo_MINGW_CHECK_DLL([libpython$python_version])
8069                 libo_MINGW_CHECK_DLL([libreadline6])
8070                 libo_MINGW_CHECK_DLL([libtermcap])
8071                 # could we somehow extract the really mingw python version from
8072                 # actual distro package?
8073                 # 2.6.2 currently on OpenSUSE 12.1?
8074                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8075                 PYTHON_VERSION=$python_version.2
8076                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8077                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8078                 break
8079             fi
8080         done
8081         AC_MSG_CHECKING([for python version])
8082         AS_IF([test -n "$PYTHON_VERSION"],
8083               [AC_MSG_RESULT([$PYTHON_VERSION])],
8084               [AC_MSG_RESULT([not found])
8085                AC_MSG_ERROR([no usable python found])])
8086         test -n "$PYTHON_CFLAGS" && break
8087     fi
8088     # let the PYTHON_FOR_BUILD match the same python installation that
8089     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8090     # better for PythonTests.
8091     PYTHON_FOR_BUILD=$PYTHON
8094 dnl By now enable_python should be "system", "internal" or "no"
8095 case $enable_python in
8096 system)
8097     SYSTEM_PYTHON=YES
8099     if test "$CROSS_COMPILING" != YES; then
8100         dnl Check if the headers really work
8101         save_CPPFLAGS="$CPPFLAGS"
8102         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8103         AC_CHECK_HEADER(Python.h, [],
8104            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8105            [])
8106         CPPFLAGS="$save_CPPFLAGS"
8108         AC_LANG_PUSH(C)
8109         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8110         AC_MSG_CHECKING([for correct python library version])
8111            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8112 #include <Python.h>
8114 int main(int argc, char **argv) {
8115        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8116            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8117        else return 1;
8119            ]])],[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])],[])
8120         CFLAGS=$save_CFLAGS
8121         AC_LANG_POP(C)
8123         dnl FIXME Check if the Python library can be linked with, too?
8124     fi
8125     ;;
8127 internal)
8128     SYSTEM_PYTHON=NO
8129     PYTHON_VERSION_MAJOR=3
8130     PYTHON_VERSION_MINOR=3
8131     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8132     BUILD_TYPE="$BUILD_TYPE PYTHON"
8133     # Embedded Python dies without Home set
8134     if test "$HOME" = ""; then
8135         export HOME=""
8136     fi
8137     # bz2 tarball and bzip2 is not standard
8138     if test -z "$BZIP2"; then
8139         AC_PATH_PROG( BZIP2, bzip2)
8140         if test -z "$BZIP2"; then
8141             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8142         fi
8143     fi
8144     ;;
8146     DISABLE_PYTHON=TRUE
8147     SYSTEM_PYTHON=NO
8148     ;;
8150     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8151     ;;
8152 esac
8154 AC_SUBST(DISABLE_PYTHON)
8155 AC_SUBST(SYSTEM_PYTHON)
8156 AC_SUBST(PYTHON_CFLAGS)
8157 AC_SUBST(PYTHON_LIBS)
8158 AC_SUBST(PYTHON_VERSION)
8159 AC_SUBST(PYTHON_VERSION_MAJOR)
8160 AC_SUBST(PYTHON_VERSION_MINOR)
8162 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8163 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8164     AC_MSG_RESULT([yes])
8165     ENABLE_MARIADBC=TRUE
8166     MARIADBC_MAJOR=1
8167     MARIADBC_MINOR=0
8168     MARIADBC_MICRO=2
8169     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8170 else
8171     AC_MSG_RESULT([no])
8172     ENABLE_MARIADBC=
8174 AC_SUBST(ENABLE_MARIADBC)
8175 AC_SUBST(MARIADBC_MAJOR)
8176 AC_SUBST(MARIADBC_MINOR)
8177 AC_SUBST(MARIADBC_MICRO)
8179 if test "$ENABLE_MARIADBC" = "TRUE"; then
8181     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8183     dnl ===================================================================
8184     dnl Check for system MariaDB
8185     dnl ===================================================================
8186     AC_MSG_CHECKING([which MariaDB to use])
8187     if test "$with_system_mariadb" = "yes"; then
8188         AC_MSG_RESULT([external])
8189         SYSTEM_MARIADB=YES
8190         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8191         if test -z "$MARIADBCONFIG"; then
8192             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8193             if test -z "$MARIADBCONFIG"; then
8194                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8195                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8196             fi
8197         fi
8198         AC_MSG_CHECKING([MariaDB version])
8199         MARIADB_VERSION=`$MARIADBCONFIG --version`
8200         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8201         if test "$MARIADB_MAJOR" -ge "5"; then
8202             AC_MSG_RESULT([OK])
8203         else
8204             AC_MSG_ERROR([too old, use 5.0.x or later])
8205         fi
8206         AC_MSG_CHECKING([for MariaDB Client library])
8207         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8208         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8209         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8210         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8211         if test "$enable_bundle_mariadb" = "yes"; then
8212             AC_MSG_RESULT([yes])
8213             BUNDLE_MARIADB=YES
8214             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8215             if test "$_os" = "Darwin"; then
8216                 LIBMARIADB=${LIBMARIADB}.dylib
8217             elif test "$_os" = "WINNT"; then
8218                 LIBMARIADB=${LIBMARIADB}.dll
8219             else
8220                 LIBMARIADB=${LIBMARIADB}.so
8221             fi
8222             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8223             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8224             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8225                 AC_MSG_RESULT([found.])
8226                 PathFormat "$LIBMARIADB_PATH"
8227                 LIBMARIADB_PATH="$formatted_path"
8228             else
8229                 AC_MSG_ERROR([not found.])
8230             fi
8231         else
8232             AC_MSG_RESULT([no])
8233             BUNDLE_MARIADB=NO
8234         fi
8235     else
8236         AC_MSG_RESULT([internal])
8237         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8238         SYSTEM_MARIADB=NO
8239         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8240         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8241         BUILD_TYPE="$BUILD_TYPE MARIADB"
8242     fi
8244     AC_SUBST(SYSTEM_MARIADB)
8245     AC_SUBST(MARIADB_CFLAGS)
8246     AC_SUBST(MARIADB_LIBS)
8247     AC_SUBST(LIBMARIADB)
8248     AC_SUBST(LIBMARIADB_PATH)
8249     AC_SUBST(BUNDLE_MARIADB)
8251     AC_LANG_PUSH([C++])
8252     dnl ===================================================================
8253     dnl Check for system MySQL C++ Connector
8254     dnl ===================================================================
8255     # FIXME!
8256     # who thought this too-generic cppconn dir was a good idea?
8257     AC_MSG_CHECKING([MySQL Connector/C++])
8258     if test "$with_system_mysql_cppconn" = "yes"; then
8259         AC_MSG_RESULT([external])
8260         SYSTEM_MYSQL_CPPCONN=YES
8261         AC_LANG_PUSH([C++])
8262         AC_CHECK_HEADER(mysql_driver.h, [],
8263                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8264         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8265                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8266         save_LIBS=$LIBS
8267         LIBS="$LIBS -lmysqlcppconn"
8268         AC_MSG_CHECKING([version])
8269         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8270 #include <mysql_driver.h>
8272 int main(int argc, char **argv) {
8273     sql::Driver *driver;
8274     driver = get_driver_instance();
8275     if (driver->getMajorVersion() > 1 || \
8276        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8277        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8278         return 0;
8279       else
8280         return 1;
8282       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8284         AC_LANG_POP([C++])
8285         LIBS=$save_LIBS
8286     else
8287         AC_MSG_RESULT([internal])
8288         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8289         SYSTEM_MYSQL_CPPCONN=NO
8290     fi
8291     AC_LANG_POP([C++])
8293 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8295 dnl ===================================================================
8296 dnl Check for system hsqldb
8297 dnl ===================================================================
8298 if test "$with_java" != "no"; then
8299 HSQLDB_USE_JDBC_4_1=
8300 AC_MSG_CHECKING([which hsqldb to use])
8301 if test "$with_system_hsqldb" = "yes"; then
8302     AC_MSG_RESULT([external])
8303     SYSTEM_HSQLDB=YES
8304     if test -z $HSQLDB_JAR; then
8305         HSQLDB_JAR=/usr/share/java/hsqldb.jar
8306     fi
8307     AC_CHECK_FILE($HSQLDB_JAR, [],
8308                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8309     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8310     export HSQLDB_JAR
8311     if $PERL -e 'use Archive::Zip;
8312             my $file = "$ENV{'HSQLDB_JAR'}";
8313             my $zip = Archive::Zip->new( $file );
8314             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8315             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
8316                push @l, split(/\n/, $mf);
8317                foreach my $line (@l) {
8318                   if ($line =~ m/Specification-Version:/) {
8319                       ($t, $version) = split (/:/,$line);
8320                       $version =~ s/^\s//;
8321                       ($a, $b, $c, $d) = split (/\./,$version);
8322                       if ($c == "0" && $d > "8")  {
8323                           exit 0;
8324                       } else {
8325                           exit 1;
8326                       }
8327                   }
8328                }
8329             } else {
8330                 exit 1;
8331             }'; then
8332         AC_MSG_RESULT([yes])
8333     else
8334         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8335     fi
8336 else
8337     AC_MSG_RESULT([internal])
8338     SYSTEM_HSQLDB=NO
8339     BUILD_TYPE="$BUILD_TYPE HSQLDB"
8340     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8341     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8342     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8343         AC_MSG_RESULT([yes])
8344         HSQLDB_USE_JDBC_4_1=YES
8345     else
8346         AC_MSG_RESULT([no])
8347     fi
8349 AC_SUBST(SYSTEM_HSQLDB)
8350 AC_SUBST(HSQLDB_JAR)
8351 AC_SUBST([HSQLDB_USE_JDBC_4_1])
8354 dnl ===================================================================
8355 dnl Check for PostgreSQL stuff
8356 dnl ===================================================================
8357 if test "x$enable_postgresql_sdbc" != "xno"; then
8358     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8360     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8361         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8362     fi
8363     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8364         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8365     fi
8367     AC_MSG_CHECKING([PostgreSQL C interface])
8368     if test "$with_system_postgresql" = "yes"; then
8369         AC_MSG_RESULT([external PostgreSQL])
8370         SYSTEM_POSTGRESQL=YES
8371         if test "$_os" = Darwin; then
8372             supp_path=''
8373             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8374                 pg_supp_path="$P_SEP$d$pg_supp_path"
8375             done
8376         fi
8377         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8378         if test -z "$PGCONFIG"; then
8379             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8380         fi
8381         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8382         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8383     else
8384         # if/when anything else than PostgreSQL uses Kerberos,
8385         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8386         WITH_KRB5=NO
8387         WITH_GSSAPI=no
8388         case "$_os" in
8389         Darwin)
8390             # MacOS X has system MIT Kerberos 5 since 10.4
8391             if test "$with_krb5" != "no"; then
8392                 WITH_KRB5=YES
8393                 save_LIBS=$LIBS
8394                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8395                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8396                 KRB5_LIBS=$LIBS
8397                 LIBS=$save_LIBS
8398                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8399                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8400                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8401                 LIBS=$save_LIBS
8402             fi
8403             if test "$with_gssapi" != "no"; then
8404               WITH_GSSAPI=YES
8405               save_LIBS=$LIBS
8406               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8407                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8408               GSSAPI_LIBS=$LIBS
8409               LIBS=$save_LIBS
8410             fi
8411             ;;
8412         WINNT)
8413             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8414                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8415             fi
8416             ;;
8417         Linux|GNU|*BSD|DragonFly)
8418             if test "$with_krb5" != "no"; then
8419                 WITH_KRB5=YES
8420                 save_LIBS=$LIBS
8421                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8422                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8423                 KRB5_LIBS=$LIBS
8424                 LIBS=$save_LIBS
8425                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8426                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8427                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8428                 LIBS=$save_LIBS
8429             fi
8430             if test "$with_gssapi" != "no"; then
8431                 WITH_GSSAPI=YES
8432                 save_LIBS=$LIBS
8433                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8434                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8435                 GSSAPI_LIBS=$LIBS
8436                 LIBS=$save_LIBS
8437             fi
8438             ;;
8439         *)
8440             if test "$with_krb5" = "yes"; then
8441                 WITH_KRB5=YES
8442                 save_LIBS=$LIBS
8443                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8444                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8445                 KRB5_LIBS=$LIBS
8446                 LIBS=$save_LIBS
8447                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8448                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8449                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8450                 LIBS=$save_LIBS
8451             fi
8452             if test "$with_gssapi" = "yes"; then
8453                 WITH_GSSAPI=YES
8454                 save_LIBS=$LIBS
8455                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8456                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8457                 LIBS=$save_LIBS
8458                 GSSAPI_LIBS=$LIBS
8459             fi
8460         esac
8462         if test -n "$with_libpq_path"; then
8463             SYSTEM_POSTGRESQL=YES
8464             AC_MSG_RESULT([external libpq])
8465             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8466             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8467         else
8468             SYSTEM_POSTGRESQL=NO
8469             AC_MSG_RESULT([internal])
8470             POSTGRESQL_LIB=""
8471             POSTGRESQL_INC="%OVERRIDE_ME%"
8472             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8473         fi
8474     fi
8475     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
8476         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8477         save_CFLAGS=$CFLAGS
8478         save_CPPFLAGS=$CPPFLAGS
8479         save_LIBS=$LIBS
8480         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8481         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8482         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8483         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8484             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8485         CFLAGS=$save_CFLAGS
8486         CPPFLAGS=$save_CPPFLAGS
8487         LIBS=$save_LIBS
8488     fi
8489     BUILD_POSTGRESQL_SDBC=YES
8491 AC_SUBST(WITH_KRB5)
8492 AC_SUBST(WITH_GSSAPI)
8493 AC_SUBST(GSSAPI_LIBS)
8494 AC_SUBST(KRB5_LIBS)
8495 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8496 AC_SUBST(SYSTEM_POSTGRESQL)
8497 AC_SUBST(POSTGRESQL_INC)
8498 AC_SUBST(POSTGRESQL_LIB)
8500 dnl ===================================================================
8501 dnl Check for Firebird stuff
8502 dnl ===================================================================
8503 ENABLE_FIREBIRD_SDBC=""
8504 if test "x$enable_firebird_sdbc" = "xyes"; then
8505     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8507     dnl ===================================================================
8508     dnl Check for system Firebird
8509     dnl ===================================================================
8510     AC_MSG_CHECKING([which Firebird to use])
8511     if test "$with_system_firebird" = "yes"; then
8512         AC_MSG_RESULT([external])
8513         SYSTEM_FIREBIRD=YES
8514         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8515         if test -z "$FIREBIRDCONFIG"; then
8516             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8517             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8518             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8519         else
8520             AC_MSG_NOTICE([fb_config found])
8521             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8522             AC_MSG_CHECKING([for Firebird Client library])
8523             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8524             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8525         fi
8526         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8527         AC_MSG_CHECKING([Firebird version])
8528         if test -n "${FIREBIRD_VERSION}"; then
8529             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8530             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8531             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8532                 AC_MSG_RESULT([OK])
8533             else
8534                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8535             fi
8536         else
8537             __save_CFLAGS="${CFLAGS}"
8538             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8539             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8540 #if defined(FB_API_VER) && FB_API_VER == 25
8541 #else
8542 #error "Wrong Firebird API version"
8543 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8544             CFLAGS="${__save_CFLAGS}"
8545         fi
8546         ENABLE_FIREBIRD_SDBC="TRUE"
8547     elif test "$enable_database_connectivity" != yes; then
8548         AC_MSG_RESULT([none])
8549     elif test "$cross_compiling" = "yes"; then
8550         AC_MSG_RESULT([none])
8551     else
8552         dnl We need libatomic-ops for any non X86/X64 system
8553         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8554             dnl ===================================================================
8555             dnl Check for system libatomic-ops
8556             dnl ===================================================================
8557             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8558             if test "$with_system_libatomic_ops" = "yes"; then
8559                 SYSTEM_LIBATOMIC_OPS=YES
8560                 AC_CHECK_HEADERS(atomic_ops.h, [],
8561                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8562             else
8563                 SYSTEM_LIBATOMIC_OPS=NO
8564                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8565                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8566                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8567             fi
8568         fi
8570         AC_MSG_RESULT([internal])
8571         SYSTEM_FIREBIRD=NO
8572         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8573         FIREBIRD_LIBS="-lfbembed"
8575         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8576         ENABLE_FIREBIRD_SDBC="TRUE"
8577     fi
8580 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8581 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8582 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8583 AC_SUBST(LIBATOMIC_OPS_LIBS)
8584 AC_SUBST(SYSTEM_FIREBIRD)
8585 AC_SUBST(FIREBIRD_CFLAGS)
8586 AC_SUBST(FIREBIRD_LIBS)
8587 dnl AC_SUBST([TOMMATH_CFLAGS])
8588 dnl AC_SUBST([TOMMATH_LIBS])
8590 dnl ===================================================================
8591 dnl Check for system curl
8592 dnl ===================================================================
8593 AC_MSG_CHECKING([which libcurl to use])
8594 if test "$with_system_curl" = "auto"; then
8595     case "$_os" in
8596     Darwin)
8597         with_system_curl=yes
8598         ;;
8599     *)
8600         with_system_curl="$with_system_libs"
8601         ;;
8602     esac
8605 if test "$with_system_curl" = "yes"; then
8606     AC_MSG_RESULT([external])
8607     SYSTEM_CURL=YES
8609     curl_version=""
8610     if test "$cross_compiling" = "yes"; then
8611         dnl At least the OBS mingw32-libcurl-devel package
8612         dnl comes with a proper .pc file
8613         PKG_CHECK_MODULES(CURL, libcurl,, [:])
8614         if test -n "$CURL_PKG_ERRORS"; then
8615             AC_MSG_RESULT([no])
8616         else
8617             curl_version=`$PKG_CONFIG --modversion libcurl`
8618         fi
8619     fi
8620     if test -z "$curl_version"; then
8621         AC_PATH_PROG(CURLCONFIG, curl-config)
8622         if test -z "$CURLCONFIG"; then
8623             AC_MSG_ERROR([install the libcurl development package])
8624         fi
8625         CURL_LIBS=`$CURLCONFIG --libs`
8626         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8627         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8628     fi
8630     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
8632     case $curl_version in
8633     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8634     dnl so they need to be doubled to end up in the configure script
8635     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8636         AC_MSG_RESULT([yes, you have $curl_version])
8637         ;;
8638     *)
8639         AC_MSG_ERROR([no, you have $curl_version])
8640         ;;
8641     esac
8643     libo_MINGW_CHECK_DLL([libcurl])
8644     libo_MINGW_TRY_DLL([libintl])
8645     libo_MINGW_TRY_DLL([libidn])
8646     libo_MINGW_TRY_DLL([libnspr4])
8647     libo_MINGW_TRY_DLL([nssutil3])
8648     libo_MINGW_TRY_DLL([libplc4])
8649     libo_MINGW_TRY_DLL([libplds4])
8650     libo_MINGW_TRY_DLL([nss3])
8651     libo_MINGW_TRY_DLL([ssl3])
8652     libo_MINGW_TRY_DLL([libgpg-error])
8653     libo_MINGW_TRY_DLL([libgcrypt])
8654     libo_MINGW_TRY_DLL([libssh2])
8655 else
8656     AC_MSG_RESULT([internal])
8657     SYSTEM_CURL=NO
8658     BUILD_TYPE="$BUILD_TYPE CURL"
8660 AC_SUBST(SYSTEM_CURL)
8661 AC_SUBST(CURL_CFLAGS)
8662 AC_SUBST(CURL_LIBS)
8664 dnl ===================================================================
8665 dnl Check for system boost
8666 dnl ===================================================================
8667 AC_MSG_CHECKING([which boost to use])
8668 if test "$with_system_boost" = "yes"; then
8669     AC_MSG_RESULT([external])
8670     SYSTEM_BOOST=YES
8671     AX_BOOST_BASE(1.47)
8672     AX_BOOST_DATE_TIME
8673     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8674     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8675     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8676         # if not found, try again with 'lib' prefix
8677         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8678     fi
8679     AC_LANG_PUSH([C++])
8680     save_CXXFLAGS=$CXXFLAGS
8681     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8682     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8683        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8684     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8685        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8686     AC_CHECK_HEADER(boost/function.hpp, [],
8687        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8688     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8689     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8690     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8691 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8692     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8693         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8694     else
8695         AC_MSG_RESULT([yes])
8696     fi
8697     CXXFLAGS=$save_CXXFLAGS
8698     AC_LANG_POP([C++])
8699 else
8700     AC_MSG_RESULT([internal])
8701     BUILD_TYPE="$BUILD_TYPE BOOST"
8702     SYSTEM_BOOST=NO
8704 AC_SUBST(SYSTEM_BOOST)
8706 dnl ===================================================================
8707 dnl Check for system mdds
8708 dnl ===================================================================
8709 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.10.1])
8711 dnl ===================================================================
8712 dnl Determine which hash container mdds shall use
8713 dnl ===================================================================
8714 AC_MSG_CHECKING([which hash container mdds shall use])
8715 if test "x$HAVE_CXX11" = "xTRUE" -a "x$SYSTEM_MDDS" = "xYES"; then
8716     MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8717     AC_MSG_RESULT([std::unordered_map])
8718 else
8719     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8720     AC_MSG_RESULT([boost::unordered_map])
8722 AC_SUBST([MDDS_CPPFLAGS])
8724 dnl ===================================================================
8725 dnl Check for system vigra
8726 dnl ===================================================================
8727 AC_MSG_CHECKING([which vigra to use])
8728 if test "$with_system_vigra" = "yes"; then
8729     AC_MSG_RESULT([external])
8730     SYSTEM_VIGRA=YES
8731     AC_LANG_PUSH([C++])
8732     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8733        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8734     AC_LANG_POP([C++])
8735 else
8736     AC_MSG_RESULT([internal])
8737     BUILD_TYPE="$BUILD_TYPE VIGRA"
8738     SYSTEM_VIGRA=NO
8740 AC_SUBST(SYSTEM_VIGRA)
8742 dnl ===================================================================
8743 dnl Check for system odbc
8744 dnl ===================================================================
8745 AC_MSG_CHECKING([which odbc headers to use])
8746 if test "$with_system_odbc" = "yes"; then
8747     AC_MSG_RESULT([external])
8748     SYSTEM_ODBC_HEADERS=YES
8750     AC_CHECK_HEADER(sqlext.h, [],
8751       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8752 elif test "$enable_database_connectivity" != yes; then
8753     AC_MSG_RESULT([none])
8754 else
8755     AC_MSG_RESULT([internal])
8756     SYSTEM_ODBC_HEADERS=NO
8758 AC_SUBST(SYSTEM_ODBC_HEADERS)
8761 dnl ===================================================================
8762 dnl Check for system openldap
8763 dnl ===================================================================
8765 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8766 AC_MSG_CHECKING([which openldap library to use])
8767 if test "$with_system_openldap" = "yes"; then
8768     AC_MSG_RESULT([external])
8769     SYSTEM_OPENLDAP=YES
8770     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8771     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8772     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8773 else
8774     AC_MSG_RESULT([internal])
8775     SYSTEM_OPENLDAP=NO
8776     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8779 AC_SUBST(SYSTEM_OPENLDAP)
8781 dnl ===================================================================
8782 dnl Check for mozilla ab connectivity for windows
8783 dnl ===================================================================
8785 if test "$_os" = "WINNT"; then
8786     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8787     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8788         WITH_MOZAB4WIN=YES
8789         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8790         BUILD_TYPE="$BUILD_TYPE MOZ"
8791         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8792         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8793         for dll in $MSVC80_DLLS; do
8794             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8795                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8796             fi
8797         done
8798     else
8799         AC_MSG_RESULT([no])
8800         WITH_MOZAB4WIN=NO
8801     fi
8803 AC_SUBST(WITH_MOZAB4WIN)
8804 AC_SUBST(MSVC80_DLLS)
8805 AC_SUBST(MSVC80_DLL_PATH)
8807 dnl ===================================================================
8808 dnl Check for TLS/SSL and cryptographic implementation to use
8809 dnl ===================================================================
8810 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8811 if test -n "$with_tls"; then
8812     case $with_tls in
8813     openssl)
8814         AC_DEFINE(USE_TLS_OPENSSL)
8815         TLS=OPENSSL
8817         if test "$enable_openssl" != "yes"; then
8818             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8819         fi
8821         # warn that OpenSSL has been selected but not all TLS code has this option
8822         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8823         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8824         ;;
8825     nss)
8826         AC_DEFINE(USE_TLS_NSS)
8827         TLS=NSS
8828         ;;
8829     *)
8830         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8831 openssl - OpenSSL
8832 nss - Mozilla's Network Security Services (NSS)
8833     ])
8834         ;;
8835     esac
8836 elif test $_os = iOS -o $_os = Android; then
8837     # We don't build NSS for iOS and Android
8838     AC_DEFINE(USE_TLS_OPENSSL)
8839     TLS=OPENSSL
8840 else
8841     # default to using NSS, it results in smaller oox lib
8842     AC_DEFINE(USE_TLS_NSS)
8843     TLS=NSS
8845 AC_MSG_RESULT([$TLS])
8846 AC_SUBST(TLS)
8848 dnl ===================================================================
8849 dnl Check for system NSS
8850 dnl ===================================================================
8851 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8852 if test "$with_system_nss" = "yes"; then
8853     libo_MINGW_CHECK_DLL([libnspr4])
8854     libo_MINGW_CHECK_DLL([libplc4])
8855     libo_MINGW_CHECK_DLL([libplds4])
8856     libo_MINGW_CHECK_DLL([nss3])
8857     libo_MINGW_CHECK_DLL([nssutil3])
8858     libo_MINGW_CHECK_DLL([smime3])
8859     libo_MINGW_CHECK_DLL([ssl3])
8862 dnl ===================================================================
8863 dnl Check for system mozilla headers
8864 dnl ===================================================================
8865 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8866 AC_MSG_CHECKING([which NPAPI headers to use])
8868 if test "$with_system_npapi_headers" = "yes"; then
8869     AC_MSG_RESULT([external])
8870     SYSTEM_NPAPI_HEADERS=YES
8871     # First try npapi-sdk:
8872     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8873     # Then go with libxul:
8874     if test "x$LOCATED" != "xyes"; then
8875         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8876     fi
8877     if test "x$LOCATED" != "xyes"; then
8878         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8879     fi
8880     # if still not found bail out
8881     if test "x$LOCATED" != "xyes"; then
8882         AC_MSG_ERROR([npapi.h header file not found])
8883     fi
8885     AC_LANG_PUSH([C])
8886     save_CFLAGS=$CFLAGS
8887     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8888     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8889     AC_COMPILE_IFELSE(
8890         [AC_LANG_SOURCE([[
8891             #define XP_UNIX
8892             #include <npapi.h>
8893             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8894             ]])],
8895         [AC_MSG_RESULT([const char*])],
8896         [
8897         AC_MSG_RESULT([char*])
8898         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8899         ])
8900     CFLAGS=$save_CFLAGS
8901     AC_LANG_POP([C])
8902     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8903 else
8904     AC_MSG_RESULT([internal])
8905         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8906         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
8907     SYSTEM_NPAPI_HEADERS=NO
8909 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8910 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8911 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8913 dnl ===================================================================
8914 dnl Check for system sane
8915 dnl ===================================================================
8916 AC_MSG_CHECKING([which sane header to use])
8917 if test "$with_system_sane" = "yes"; then
8918     AC_MSG_RESULT([external])
8919     AC_CHECK_HEADER(sane/sane.h, [],
8920       [AC_MSG_ERROR(sane not found. install sane)], [])
8921 else
8922     AC_MSG_RESULT([internal])
8923     BUILD_TYPE="$BUILD_TYPE SANE"
8926 dnl ===================================================================
8927 dnl Check for system icu
8928 dnl ===================================================================
8929 SYSTEM_GENBRK=
8930 SYSTEM_GENCCODE=
8931 SYSTEM_GENCMN=
8933 ICU_MAJOR=52
8934 ICU_MINOR=1
8935 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8936 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8937 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8938 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8939 AC_MSG_CHECKING([which icu to use])
8940 if test "$with_system_icu" = "yes"; then
8941     AC_MSG_RESULT([external])
8942     SYSTEM_ICU=YES
8943     AC_LANG_PUSH([C++])
8944     AC_MSG_CHECKING([for unicode/rbbi.h])
8945     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8946     AC_LANG_POP([C++])
8948     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8949         ICUPATH="$PATH"
8950         if test "$WITH_MINGW" = "yes"; then
8951             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8952         fi
8953         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8955         AC_MSG_CHECKING([ICU version])
8956         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8957         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8958         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8960         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8961             AC_MSG_RESULT([OK, $ICU_VERSION])
8962         else
8963             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8964         fi
8965     fi
8967     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8968         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8969         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8970         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8971         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8972         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8973         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8974             AC_MSG_RESULT([yes])
8975         else
8976             AC_MSG_RESULT([no])
8977             if test "$with_system_icu_for_build" != "force"; then
8978                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8979 You can use --with-system-icu-for-build=force to use it anyway.])
8980             fi
8981         fi
8982     fi
8984     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8985         # using the system icu tools can lead to version confusion, use the
8986         # ones from the build environment when cross-compiling
8987         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8988         if test -z "$SYSTEM_GENBRK"; then
8989             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8990         fi
8991         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8992         if test -z "$SYSTEM_GENCCODE"; then
8993             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8994         fi
8995         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8996         if test -z "$SYSTEM_GENCMN"; then
8997             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8998         fi
8999         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
9000             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
9001         else
9002             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
9003         fi
9004         if test "$ICU_MAJOR" -ge "49"; then
9005             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
9006             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
9007             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
9008         else
9009             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
9010             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
9011             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
9012         fi
9013     fi
9015     if test "$cross_compiling" = "yes"; then
9016        if test "$ICU_MAJOR" -ge "50"; then
9017             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9018             ICU_MINOR=""
9019        fi
9020     fi
9022     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9023     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9024     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9025 else
9026     AC_MSG_RESULT([internal])
9027     SYSTEM_ICU="NO"
9028     BUILD_TYPE="$BUILD_TYPE ICU"
9029     # surprisingly set these only for "internal" (to be used by various other
9030     # external libs): the system icu-config is quite unhelpful and spits out
9031     # dozens of weird flags and also default path -I/usr/include
9032     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9033     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9035 AC_SUBST(SYSTEM_ICU)
9036 AC_SUBST(SYSTEM_GENBRK)
9037 AC_SUBST(SYSTEM_GENCCODE)
9038 AC_SUBST(SYSTEM_GENCMN)
9039 AC_SUBST(ICU_MAJOR)
9040 AC_SUBST(ICU_MINOR)
9041 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9042 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9043 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9044 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9045 AC_SUBST(ICU_CFLAGS)
9046 AC_SUBST(ICU_LIBS)
9048 dnl ===================================================================
9049 dnl Graphite
9050 dnl ===================================================================
9052 AC_MSG_CHECKING([whether to enable graphite support])
9053 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9054     AC_MSG_RESULT([yes])
9055     ENABLE_GRAPHITE="TRUE"
9056     AC_DEFINE(ENABLE_GRAPHITE)
9057     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9058     if test "$with_system_graphite" = "yes"; then
9059         libo_MINGW_CHECK_DLL([libgraphite2])
9060     fi
9061 else
9062     AC_MSG_RESULT([no])
9064 AC_SUBST(ENABLE_GRAPHITE)
9066 dnl ===================================================================
9067 dnl Orcus
9068 dnl ===================================================================
9070 AC_MSG_CHECKING([whether to enable orcus])
9071 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9072     AC_MSG_RESULT([yes])
9073     ENABLE_ORCUS="TRUE"
9074     AC_DEFINE(ENABLE_ORCUS)
9076     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
9077     if test "$with_system_orcus" != "yes"; then
9078         if test "$SYSTEM_BOOST" = "YES"; then
9079             # ===========================================================
9080             # Determine if we are going to need to link with Boost.System
9081             # ===========================================================
9082             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9083             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9084             dnl in documentation has no effect.
9085             AC_MSG_CHECKING([if we need to link with Boost.System])
9086             AC_LANG_PUSH([C++])
9087             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9088                     @%:@include <boost/version.hpp>
9089                 ]],[[
9090                     #if BOOST_VERSION >= 105000
9091                     #   error yes, we need to link with Boost.System
9092                     #endif
9093                 ]])],[
9094                     AC_MSG_RESULT([no])
9095                 ],[
9096                     AC_MSG_RESULT([yes])
9097                     AX_BOOST_SYSTEM
9098             ])
9099             AC_LANG_POP([C++])
9100         fi
9101     fi
9102     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9103     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9104     AC_SUBST([BOOST_SYSTEM_LIB])
9105     AC_SUBST(SYSTEM_LIBORCUS)
9107 else
9108     AC_MSG_RESULT([no])
9110 AC_SUBST(ENABLE_ORCUS)
9112 dnl ===================================================================
9113 dnl HarfBuzz
9114 dnl ===================================================================
9115 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9116 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9117     AC_MSG_RESULT([yes])
9118     ENABLE_HARFBUZZ="TRUE"
9119     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9120         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"])
9121     else
9122         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9123     fi
9124 else
9125     AC_MSG_RESULT([no])
9127 AC_SUBST(ENABLE_HARFBUZZ)
9129 dnl ===================================================================
9130 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9131 dnl ===================================================================
9132 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9133 # Obviously no such thing on iOS or Android. Also not possible when building
9134 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9135 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9136         "$enable_headless" != yes -a "$enable_mpl_subset" != yes
9137 then
9138     AC_MSG_RESULT([yes])
9139     ENABLE_NPAPI_FROM_BROWSER=TRUE
9140 else
9141     AC_MSG_RESULT([no])
9142     ENABLE_NPAPI_FROM_BROWSER=
9144 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9146 dnl ===================================================================
9147 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9148 dnl ===================================================================
9149 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9150 if test "$enable_mpl_subset" != yes -a \( "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9151         "$enable_headless" != yes -a "$enable_gtk" != no \)
9152 then
9153     AC_MSG_RESULT([yes])
9154     ENABLE_NPAPI_INTO_BROWSER=TRUE
9155 else
9156     AC_MSG_RESULT([no])
9157     ENABLE_NPAPI_INTO_BROWSER=
9159 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9161 AC_MSG_CHECKING([whether to use X11])
9162 dnl ***************************************
9163 dnl testing for X libraries and includes...
9164 dnl ***************************************
9165 WANT_X11="no"
9166 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9167     WANT_X11="yes"
9168     AC_DEFINE(HAVE_FEATURE_X11)
9170 AC_MSG_RESULT([$WANT_X11])
9172 if test "$WANT_X11" = "yes"; then
9173     AC_PATH_X
9174     AC_PATH_XTRA
9175     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9177     if test -z "$x_includes"; then
9178         x_includes="default_x_includes"
9179     fi
9180     if test -z "$x_libraries"; then
9181         x_libraries="default_x_libraries"
9182     fi
9183     CFLAGS="$CFLAGS $X_CFLAGS"
9184     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9185     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9186 else
9187     x_includes="no_x_includes"
9188     x_libraries="no_x_libraries"
9191 if test "$WANT_X11" = "yes"; then
9192     dnl ===================================================================
9193     dnl Check for Composite.h for Mozilla plugin
9194     dnl ===================================================================
9195     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9196      [#include <X11/Intrinsic.h>])
9198     dnl ===================================================================
9199     dnl Check for extension headers
9200     dnl ===================================================================
9201     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9202      [#include <X11/extensions/shape.h>])
9205 dnl ===================================================================
9206 dnl Check for system Xrender
9207 dnl ===================================================================
9208 AC_MSG_CHECKING([whether to use Xrender])
9209 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9210     AC_MSG_RESULT([yes])
9211     PKG_CHECK_MODULES(XRENDER, xrender)
9212     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9213     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9214       [AC_MSG_ERROR(libXrender not found or functional)], [])
9215     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9216       [AC_MSG_ERROR(Xrender not found. install X)], [])
9217 else
9218     AC_MSG_RESULT([no])
9220 AC_SUBST(XRENDER_CFLAGS)
9221 AC_SUBST(XRENDER_LIBS)
9223 dnl ===================================================================
9224 dnl Check for XRandr
9225 dnl ===================================================================
9226 AC_MSG_CHECKING([whether to enable RandR support])
9227 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9228     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9229         XRANDR_DLOPEN="TRUE"
9230         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9231     else
9232         AC_MSG_RESULT([yes])
9233         XRANDR_DLOPEN="FALSE"
9234         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9235         if test "$ENABLE_RANDR" != "TRUE"; then
9236             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9237                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9238             XRANDR_CFLAGS=" "
9239             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9240               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9241             XRANDR_LIBS="-lXrandr "
9242             ENABLE_RANDR="TRUE"
9243         fi
9244         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9245     fi
9246 else
9247     ENABLE_RANDR=""
9248     AC_MSG_RESULT([no])
9250 AC_SUBST(XRANDR_DLOPEN)
9251 AC_SUBST(XRANDR_CFLAGS)
9252 AC_SUBST(XRANDR_LIBS)
9253 AC_SUBST(ENABLE_RANDR)
9255 dnl ===================================================================
9256 dnl Check for building neon
9257 dnl ===================================================================
9258 AC_MSG_CHECKING([whether to use neon])
9259 if test "$enable_neon" = "no"; then
9260     AC_MSG_RESULT([no])
9261     DISABLE_NEON=TRUE
9262     AC_SUBST(DISABLE_NEON)
9263 else
9264     AC_MSG_RESULT([yes])
9265 dnl ===================================================================
9266 dnl Check for system neon
9267 dnl ===================================================================
9268 libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9269 if test "$with_system_neon" = "yes"; then
9270     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9271     libo_MINGW_CHECK_DLL([libneon])
9272     libo_MINGW_TRY_DLL([libtasn1])
9273     libo_MINGW_TRY_DLL([libgnutls])
9274 else
9275     NEON_VERSION=0295
9277 AC_SUBST(NEON_VERSION)
9280 dnl ===================================================================
9281 dnl Check for disabling cve_tests
9282 dnl ===================================================================
9283 AC_MSG_CHECKING([whether to execute CVE tests])
9284 if test "$enable_cve_tests" = "no"; then
9285     AC_MSG_RESULT([no])
9286     DISABLE_CVE_TESTS=TRUE
9287     AC_SUBST(DISABLE_CVE_TESTS)
9288 else
9289     AC_MSG_RESULT([yes])
9292 dnl ===================================================================
9293 dnl Check for system openssl
9294 dnl ===================================================================
9295 DISABLE_OPENSSL=
9296 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9297 if test "$enable_openssl" = "yes"; then
9298     AC_MSG_RESULT([no])
9299     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9300         # OpenSSL is deprecated when building for 10.7 or later.
9301         #
9302         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9303         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9304         #
9305         # They apparently got fed up with the unstable ABI of
9306         # OpenSSL, or something, and recommend you either move to
9307         # their "Common Crypto Architecture", or, if you have to stay
9308         # with OpenSSL, just build it yourself statically and bundle
9309         # with your application.
9311         with_system_openssl=no
9312         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9313     elif test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
9314             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
9315         # Mac OS builds should get out without extra stuff is the Mac porters'
9316         # wish. And pkg-config is although Xcode ships a .pc for openssl
9317         with_system_openssl=yes
9318         SYSTEM_OPENSSL=YES
9319         OPENSSL_CFLAGS=
9320         OPENSSL_LIBS="-lssl -lcrypto"
9321     else
9322         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9323     fi
9324     if test "$with_system_openssl" = "yes"; then
9325         libo_MINGW_CHECK_DLL([libssl])
9326         libo_MINGW_CHECK_DLL([libcrypto])
9327         AC_MSG_CHECKING([whether openssl supports SHA512])
9328         AC_LANG_PUSH([C])
9329         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9330             SHA512_CTX context;
9331 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9332         AC_LANG_POP(C)
9333     fi
9334 else
9335     AC_MSG_RESULT([yes])
9336     DISABLE_OPENSSL=TRUE
9338     # warn that although OpenSSL is disabled, system libraries may be depending on it
9339     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9340     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9343 AC_SUBST([DISABLE_OPENSSL])
9345 dnl ===================================================================
9346 dnl Check for building gnutls
9347 dnl ===================================================================
9348 AC_MSG_CHECKING([whether to use gnutls])
9349 if test "$enable_neon" != "no" && test "$enable_openssl" = "no"; then
9350     AC_MSG_RESULT([yes])
9351     AM_PATH_LIBGCRYPT()
9352     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9353         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9354                       available in the system to use as replacement.]]))
9357 AC_SUBST([LIBGCRYPT_CFLAGS])
9358 AC_SUBST([LIBGCRYPT_LIBS])
9360 dnl ===================================================================
9361 dnl Check for system redland
9362 dnl ===================================================================
9363 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9364 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9365 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9366 if test "$with_system_redland" = "yes"; then
9367     libo_MINGW_CHECK_DLL([librdf])
9368     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9369             [AC_MSG_ERROR(librdf too old. Need >= 1.16)], [])
9370     libo_MINGW_TRY_DLL([libraptor])
9371     libo_MINGW_TRY_DLL([librasqal])
9372     libo_MINGW_TRY_DLL([libsqlite3])
9373 else
9374     RAPTOR_MAJOR="0"
9375     RASQAL_MAJOR="3"
9376     REDLAND_MAJOR="0"
9378 AC_SUBST(RAPTOR_MAJOR)
9379 AC_SUBST(RASQAL_MAJOR)
9380 AC_SUBST(REDLAND_MAJOR)
9382 dnl ===================================================================
9383 dnl Check for system hunspell
9384 dnl ===================================================================
9385 AC_MSG_CHECKING([which libhunspell to use])
9386 if test "$with_system_hunspell" = "yes"; then
9387     AC_MSG_RESULT([external])
9388     SYSTEM_HUNSPELL=YES
9389     AC_LANG_PUSH([C++])
9390     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9391     if test "$HUNSPELL_PC" != "TRUE"; then
9392         AC_CHECK_HEADER(hunspell.hxx, [],
9393             [
9394             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9395             [AC_MSG_ERROR(hunspell headers not found.)], [])
9396             ], [])
9397         AC_CHECK_LIB([hunspell], [main], [:],
9398            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9399         HUNSPELL_LIBS=-lhunspell
9400     fi
9401     AC_LANG_POP([C++])
9402     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9403     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9404 else
9405     AC_MSG_RESULT([internal])
9406     SYSTEM_HUNSPELL=NO
9407     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9408     if test "$COM" = "MSC"; then
9409         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9410     else
9411         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9412     fi
9413     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9415 AC_SUBST(SYSTEM_HUNSPELL)
9416 AC_SUBST(HUNSPELL_CFLAGS)
9417 AC_SUBST(HUNSPELL_LIBS)
9419 dnl ===================================================================
9420 dnl Checking for altlinuxhyph
9421 dnl ===================================================================
9422 AC_MSG_CHECKING([which altlinuxhyph to use])
9423 if test "$with_system_altlinuxhyph" = "yes"; then
9424     AC_MSG_RESULT([external])
9425     SYSTEM_HYPH=YES
9426     AC_CHECK_HEADER(hyphen.h, [],
9427        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9428     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9429        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9430        [#include <hyphen.h>])
9431     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9432         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9433     if test -z "$HYPHEN_LIB"; then
9434         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9435            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9436     fi
9437     if test -z "$HYPHEN_LIB"; then
9438         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9439            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9440     fi
9441     libo_MINGW_CHECK_DLL([libhyphen])
9442 else
9443     AC_MSG_RESULT([internal])
9444     SYSTEM_HYPH=NO
9445     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9446     if test "$COM" = "MSC"; then
9447         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9448     else
9449         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9450     fi
9452 AC_SUBST(SYSTEM_HYPH)
9453 AC_SUBST(HYPHEN_LIB)
9455 dnl ===================================================================
9456 dnl Checking for mythes
9457 dnl ===================================================================
9458 AC_MSG_CHECKING([which mythes to use])
9459 if test "$with_system_mythes" = "yes"; then
9460     AC_MSG_RESULT([external])
9461     SYSTEM_MYTHES=YES
9462     AC_LANG_PUSH([C++])
9463     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9464     if test "$MYTHES_PKGCONFIG" = "no"; then
9465         AC_CHECK_HEADER(mythes.hxx, [],
9466             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9467         AC_CHECK_LIB([mythes-1.2], [main], [:],
9468             [ MYTHES_FOUND=no], [])
9469     if test "$MYTHES_FOUND" = "no"; then
9470         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9471                 [ MYTHES_FOUND=no], [])
9472     fi
9473     if test "$MYTHES_FOUND" = "no"; then
9474         AC_MSG_ERROR([mythes library not found!.])
9475     fi
9476     fi
9477     AC_LANG_POP([C++])
9478     libo_MINGW_CHECK_DLL([libmythes-1.2])
9479     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9480 else
9481     AC_MSG_RESULT([internal])
9482     SYSTEM_MYTHES=NO
9483     BUILD_TYPE="$BUILD_TYPE MYTHES"
9484     if test "$COM" = "MSC"; then
9485         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9486     else
9487         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9488     fi
9490 AC_SUBST(SYSTEM_MYTHES)
9491 AC_SUBST(MYTHES_CFLAGS)
9492 AC_SUBST(MYTHES_LIBS)
9494 dnl ===================================================================
9495 dnl How should we build the linear programming solver ?
9496 dnl ===================================================================
9497 ENABLE_LPSOLVE=
9498 AC_MSG_CHECKING([whether to build with lpsolve])
9499 if test "$enable_lpsolve" != "no"; then
9500     ENABLE_LPSOLVE=TRUE
9501     AC_MSG_RESULT([yes])
9502 else
9503     AC_MSG_RESULT([no])
9505 AC_SUBST(ENABLE_LPSOLVE)
9507 AC_MSG_CHECKING([which lpsolve to use])
9508 if test "$with_system_lpsolve" = "yes"; then
9509     AC_MSG_RESULT([external])
9510     SYSTEM_LPSOLVE=YES
9511     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9512        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9513     save_LIBS=$LIBS
9514     # some systems need this. Like Ubuntu....
9515     AC_CHECK_LIB(m, floor)
9516     AC_CHECK_LIB(dl, dlopen)
9517     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9518         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9519     LIBS=$save_LIBS
9520     libo_MINGW_CHECK_DLL([lpsolve55])
9521 else
9522     AC_MSG_RESULT([internal])
9523     SYSTEM_LPSOLVE=NO
9524     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9526 AC_SUBST(SYSTEM_LPSOLVE)
9530 dnl ===================================================================
9531 dnl Checking for libexttextcat
9532 dnl ===================================================================
9533 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9534 if test "$with_system_libexttextcat" = "yes"; then
9535     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9537 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9539 dnl ***************************************
9540 dnl testing libc version for Linux...
9541 dnl ***************************************
9542 if test "$_os" = "Linux"; then
9543     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9544     exec 6>/dev/null # no output
9545     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9546     exec 6>&1 # output on again
9547     if test "$HAVE_LIBC"; then
9548         AC_MSG_RESULT([yes])
9549     else
9550         AC_MSG_ERROR([no, upgrade libc])
9551     fi
9554 dnl =========================================
9555 dnl Check for the Windows  SDK.
9556 dnl =========================================
9557 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9558 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9559 if test "$_os" = "WINNT"; then
9560     AC_MSG_CHECKING([for Windows SDK])
9561     if test "$build_os" = "cygwin"; then
9562         find_winsdk
9563         WINDOWS_SDK_HOME=$winsdktest
9565         # normalize if found
9566         if test -n "$WINDOWS_SDK_HOME"; then
9567             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9568             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9569         fi
9570     fi
9572     if test -n "$WINDOWS_SDK_HOME"; then
9573         # Remove a possible trailing backslash
9574         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9576         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9577              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9578              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9579             have_windows_sdk_headers=yes
9580         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9581              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9582              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9583             have_windows_sdk_headers=yes
9584         else
9585             have_windows_sdk_headers=no
9586         fi
9588         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9589             have_windows_sdk_libs=yes
9590         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9591             have_windows_sdk_libs=yes
9592         else
9593             have_windows_sdk_libs=no
9594         fi
9596         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9597             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9598 the  Windows SDK are installed.])
9599         fi
9601         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9602              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9603              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9604              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9605         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9606              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9607              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9608              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9609         else
9610             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9611         fi
9612     fi
9614     if test -z "$WINDOWS_SDK_HOME"; then
9615         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9616     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9617         WINDOWS_SDK_VERSION=60
9618         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9619     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9620         WINDOWS_SDK_VERSION=61
9621         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9622     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9623         WINDOWS_SDK_VERSION=70
9624         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9625     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9626         WINDOWS_SDK_VERSION=80
9627         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9628         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9629         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9630             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9631             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9632             add_warning "If a build created with VS 2012 should run on Windows XP,"
9633             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9634         fi
9635     else
9636         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9637     fi
9638     PathFormat "$WINDOWS_SDK_HOME"
9639     WINDOWS_SDK_HOME="$formatted_path"
9640     if test "$build_os" = "cygwin"; then
9641         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9642         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9643             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9644         fi
9645     fi
9647     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9648     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9649     dnl but not in v8.0), so allow this to be overriden with a
9650     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9651     dnl and configuration error if no WiLangId.vbs is found would arguably be
9652     dnl better, but I do not know under which conditions exactly it is needed by
9653     dnl msiglobal.pm:
9654     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9655         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9656         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9657             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9658         fi
9659         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9660             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9661         fi
9662         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9663             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9664             add_warning "WiLangId.vbs not found - building translated packages will fail"
9665         fi
9666     fi
9668 AC_SUBST(WINDOWS_SDK_HOME)
9669 AC_SUBST(WINDOWS_SDK_VERSION)
9670 AC_SUBST(WINDOWS_SDK_WILANGID)
9672 dnl =========================================
9673 dnl Check for uuidgen
9674 dnl =========================================
9675 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9676     if test "$WITH_MINGW" = "yes"; then
9677         AC_PATH_PROG([UUIDGEN], [uuid])
9678         if test -z "$UUIDGEN"; then
9679             AC_MSG_WARN([uuid is needed for dev-install])
9680         fi
9681     else
9682         # presence is already tested above in the WINDOWS_SDK_HOME check
9683         UUIDGEN=uuidgen.exe
9684         AC_SUBST(UUIDGEN)
9685     fi
9686 else
9687     AC_PATH_PROG([UUIDGEN], [uuidgen])
9688     if test -z "$UUIDGEN"; then
9689         AC_MSG_WARN([uuid is needed for dev-install])
9690     fi
9693 dnl =========================================
9694 dnl Check for the Microsoft DirectX SDK.
9695 dnl =========================================
9696 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9697     AC_MSG_CHECKING([for DirectX SDK])
9698     if test "$build_os" = "cygwin"; then
9699         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9700         if test -n "$DXSDK_DIR"; then
9701             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9702             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9703         fi
9704         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9705         # the "DirectX SDK not found" error later.
9706         # (Where?)
9708         # Remove a possible trailing backslash
9709         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9710     fi
9712     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9713         HAVE_DIRECTXSDK_H="yes"
9714     else
9715         HAVE_DIRECTXSDK_H="no"
9716     fi
9718     if test "$BITNESS_OVERRIDE" = 64; then
9719         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9720     else
9721         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9722     fi
9723     PathFormat "$DIRECTXSDK_LIB"
9724     DIRECTXSDK_LIB="$formatted_path"
9726     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9727         HAVE_DIRECTXSDK_LIB="yes"
9728     else
9729         HAVE_DIRECTXSDK_LIB="no"
9730     fi
9732     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9733         AC_MSG_RESULT([found])
9734     else
9735         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9736     fi
9737     if test -n "$DIRECTXSDK_HOME"; then
9738         PathFormat "$DIRECTXSDK_HOME"
9739         DIRECTXSDK_HOME="$formatted_path"
9740         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9741     fi
9743 AC_SUBST(DIRECTXSDK_HOME)
9745 dnl ***************************************
9746 dnl Checking for bison and flex
9747 dnl ***************************************
9748 AC_PATH_PROG(BISON, bison)
9749 if test -z "$BISON"; then
9750     AC_MSG_ERROR([no bison found in \$PATH, install it])
9751 else
9752     AC_MSG_CHECKING([the bison version])
9753     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9754     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9755     # Accept newer than 2.0
9756     if test "$_bison_longver" -lt 2000; then
9757         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9758     fi
9761 AC_PATH_PROG(FLEX, flex)
9762 if test -z "$FLEX"; then
9763     AC_MSG_ERROR([no flex found in \$PATH, install it])
9764 else
9765     AC_MSG_CHECKING([the flex version])
9766     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9767     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9768         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9769     fi
9771 AC_SUBST([FLEX])
9772 dnl ***************************************
9773 dnl Checking for patch
9774 dnl ***************************************
9775 AC_PATH_PROG(PATCH, patch)
9776 if test -z "$PATCH"; then
9777     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9780 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9781 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9782     if test -z "$with_gnu_patch"; then
9783         GNUPATCH=$PATCH
9784     else
9785         if test -x "$with_gnu_patch"; then
9786             GNUPATCH=$with_gnu_patch
9787         else
9788             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9789         fi
9790     fi
9792     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9793     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9794         AC_MSG_RESULT([yes])
9795     else
9796         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9797     fi
9798 else
9799     GNUPATCH=$PATCH
9802 dnl We also need to check for --with-gnu-cp
9804 if test -z "$with_gnu_cp"; then
9805     # check the place where the good stuff is hidden on Solaris...
9806     if test -x /usr/gnu/bin/cp; then
9807         GNUCP=/usr/gnu/bin/cp
9808     else
9809         AC_PATH_PROGS(GNUCP, gnucp cp)
9810     fi
9811     if test -z $GNUCP; then
9812         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9813     fi
9814 else
9815     if test -x "$with_gnu_cp"; then
9816         GNUCP=$with_gnu_cp
9817     else
9818         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9819     fi
9822 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9823 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9824     AC_MSG_RESULT([yes])
9825 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9826     AC_MSG_RESULT([yes])
9827 else
9828     case "$build_os" in
9829     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9830         x_GNUCP=[\#]
9831         GNUCP=''
9832         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9833         ;;
9834     *)
9835         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9836         ;;
9837     esac
9840 AC_SUBST(GNUPATCH)
9841 AC_SUBST(GNUCP)
9842 AC_SUBST(x_GNUCP)
9844 dnl ***************************************
9845 dnl testing assembler path
9846 dnl ***************************************
9847 ML_EXE=""
9848 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9849     if test "$BITNESS_OVERRIDE" = ""; then
9850         assembler=ml.exe
9851         assembler_bin=bin
9852     else
9853         assembler=ml64.exe
9854         assembler_bin=bin/amd64
9855     fi
9857     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9858     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9859         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9860         AC_MSG_RESULT([found])
9861         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9862     else
9863         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9864     fi
9866     PathFormat "$ASM_HOME"
9867     ASM_HOME="$formatted_path"
9868 else
9869     ASM_HOME=""
9872 AC_SUBST(ML_EXE)
9874 dnl ===================================================================
9875 dnl We need zip and unzip
9876 dnl ===================================================================
9877 AC_PATH_PROG(ZIP, zip)
9878 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9879 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9880     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],,)
9883 AC_PATH_PROG(UNZIP, unzip)
9884 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9886 dnl ===================================================================
9887 dnl Zip must be a specific type for different build types.
9888 dnl ===================================================================
9889 if test $build_os = cygwin; then
9890     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9891         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9892     fi
9895 dnl ===================================================================
9896 dnl Test which vclplugs have to be built.
9897 dnl ===================================================================
9898 R=""
9899 GTK3_CFLAGS=""
9900 GTK3_LIBS=""
9901 ENABLE_GTK3=""
9902 if test "x$enable_gtk3" = "xyes"; then
9903     if test "$with_system_cairo" = no; then
9904         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9905     fi
9906     : ${with_system_cairo:=yes}
9907     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="")
9908     if test "x$ENABLE_GTK3" = "xTRUE"; then
9909         R="gtk3"
9910     else
9911         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9912     fi
9913     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9915 AC_SUBST(GTK3_LIBS)
9916 AC_SUBST(GTK3_CFLAGS)
9917 AC_SUBST(ENABLE_GTK3)
9919 AC_MSG_CHECKING([which VCLplugs shall be built])
9920 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9921     enable_gtk=no
9923 ENABLE_GTK=""
9924 if test "x$enable_gtk" = "xyes"; then
9925     if test "$with_system_cairo" = no; then
9926         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9927     fi
9928     : ${with_system_cairo:=yes}
9929     ENABLE_GTK="TRUE"
9930     AC_DEFINE(ENABLE_GTK)
9931     R="gtk $R"
9933 AC_SUBST(ENABLE_GTK)
9935 ENABLE_TDE=""
9936 if test "x$enable_tde" = "xyes"; then
9937     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9938     # are built from the same sources. So we only allow one of them.
9939     if test "x$enable_kde" = "xyes"; then
9940         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9941     fi
9942     ENABLE_TDE="TRUE"
9943     AC_DEFINE(ENABLE_TDE)
9944     R="$R tde"
9946 AC_SUBST(ENABLE_TDE)
9948 ENABLE_KDE=""
9949 if test "x$enable_kde" = "xyes"; then
9950     ENABLE_KDE="TRUE"
9951     AC_DEFINE(ENABLE_KDE)
9952     R="$R kde"
9954 AC_SUBST(ENABLE_KDE)
9956 ENABLE_KDE4=""
9957 if test "x$enable_kde4" = "xyes"; then
9958     ENABLE_KDE4="TRUE"
9959     AC_DEFINE(ENABLE_KDE4)
9960     R="$R kde4"
9962 AC_SUBST(ENABLE_KDE4)
9964 ENABLE_HEADLESS=""
9965 if test "x$enable_headless" = "xyes"; then
9966     ENABLE_HEADLESS="TRUE"
9967     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9968     R="headless"
9970 AC_SUBST(ENABLE_HEADLESS)
9972 if test -z "$R"; then
9973     AC_MSG_RESULT([none])
9974 else
9975     AC_MSG_RESULT([$R])
9978 dnl ===================================================================
9979 dnl GCONF check
9980 dnl ===================================================================
9982 ENABLE_GCONF=
9983 AC_MSG_CHECKING([whether to enable GConf support])
9984 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9985     ENABLE_GCONF="TRUE"
9986     AC_MSG_RESULT([yes])
9987     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9988     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9989 else
9990     AC_MSG_RESULT([no])
9992 AC_SUBST(GCONF_LIBS)
9993 AC_SUBST(GCONF_CFLAGS)
9994 AC_SUBST(ENABLE_GCONF)
9996 dnl ===================================================================
9997 dnl Gnome VFS check
9998 dnl ===================================================================
10000 ENABLE_GNOMEVFS=""
10001 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10002 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10003     ENABLE_GNOMEVFS="TRUE"
10004     AC_MSG_RESULT([yes])
10005     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10006     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10007     AC_DEFINE(ENABLE_GNOME_VFS)
10008 else
10009     AC_MSG_RESULT([no])
10011 AC_SUBST(GNOMEVFS_LIBS)
10012 AC_SUBST(GNOMEVFS_CFLAGS)
10013 AC_SUBST(ENABLE_GNOMEVFS)
10015 dnl ===================================================================
10016 dnl check for dbus support
10017 dnl ===================================================================
10018 ENABLE_DBUS=""
10019 DBUS_CFLAGS=""
10020 DBUS_LIBS=""
10022 if test "$enable_dbus" = "no"; then
10023     test_dbus=no
10026 AC_MSG_CHECKING([whether to enable DBUS support])
10027 if test "$test_dbus" = "yes"; then
10028     ENABLE_DBUS="TRUE"
10029     AC_MSG_RESULT([yes])
10030     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10031     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10032 else
10033     AC_MSG_RESULT([no])
10036 AC_SUBST(ENABLE_DBUS)
10037 AC_SUBST(DBUS_CFLAGS)
10038 AC_SUBST(DBUS_LIBS)
10040 AC_MSG_CHECKING([whether to enable font install via packagekit])
10041 if test "$ENABLE_DBUS" = "TRUE"; then
10042     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10043         ENABLE_PACKAGEKIT=TRUE
10044         AC_MSG_RESULT([yes])
10045     else
10046         ENABLE_PACKAGEKIT=
10047         AC_MSG_RESULT([no])
10048     fi
10049 else
10050     AC_MSG_RESULT([no, dbus disabled.])
10052 AC_SUBST(ENABLE_PACKAGEKIT)
10054 AC_MSG_CHECKING([whether to enable Impress remote control])
10055 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10056     AC_MSG_RESULT([yes])
10057     ENABLE_SDREMOTE=TRUE
10058     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10060     # If not explicitly enabled or disabled, default
10061     if test -z "$enable_sdremote_bluetooth"; then
10062         case "$OS" in
10063         LINUX|MACOSX|WNT)
10064             # Default to yes for these
10065             enable_sdremote_bluetooth=yes
10066             ;;
10067         *)
10068             # otherwise no
10069             enable_sdremote_bluetooth=no
10070             ;;
10071         esac
10072     fi
10073     # $enable_sdremote_bluetooth is guaranteed non-empty now
10075     if test "$enable_sdremote_bluetooth" != "no"; then
10076         if test "$OS" = "LINUX"; then
10077             if test "$ENABLE_DBUS" = "TRUE"; then
10078                 AC_MSG_RESULT([yes])
10079                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10080                 dnl ===================================================================
10081                 dnl Check for system bluez
10082                 dnl ===================================================================
10083                 AC_MSG_CHECKING([which Bluetooth header to use])
10084                 if test "$with_system_bluez" = "yes"; then
10085                     AC_MSG_RESULT([external])
10086                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10087                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10088                     SYSTEM_BLUEZ=YES
10089                 else
10090                     AC_MSG_RESULT([internal])
10091                     SYSTEM_BLUEZ=NO
10092                 fi
10093             else
10094                 AC_MSG_RESULT([no, dbus disabled])
10095                 ENABLE_SDREMOTE_BLUETOOTH=
10096                 SYSTEM_BLUEZ=NO 
10097             fi
10098         else
10099             AC_MSG_RESULT([yes])
10100             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10101             SYSTEM_BLUEZ=NO
10102         fi
10103     else
10104         AC_MSG_RESULT([no])
10105         ENABLE_SDREMOTE_BLUETOOTH=
10106         SYSTEM_BLUEZ=NO
10107     fi
10108 else
10109     ENABLE_SDREMOTE=
10110     SYSTEM_BLUEZ=NO
10111     AC_MSG_RESULT([no])
10113 AC_SUBST(ENABLE_SDREMOTE)
10114 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10115 AC_SUBST(SYSTEM_BLUEZ)
10117 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10118 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10119     AC_MSG_RESULT([yes])
10120     ENABLE_SDREMOTE_ANDROID=TRUE
10121 else
10122     AC_MSG_RESULT([no])
10123     ENABLE_SDREMOTE_ANDROID=
10125 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10127 dnl ===================================================================
10128 dnl Check whether the gtk 2.0 libraries are available.
10129 dnl ===================================================================
10131 GTK_CFLAGS=""
10132 GTK_LIBS=""
10133 ENABLE_SYSTRAY_GTK=""
10134 if test  "$test_gtk" = "yes"; then
10136     if test "$ENABLE_GTK" = "TRUE"; then
10137         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]))
10138         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10139         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]))
10140         BUILD_TYPE="$BUILD_TYPE GTK"
10141         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10143     AC_MSG_CHECKING([whether to enable the systray quickstarter])
10144         if test "x$enable_systray" = "xyes"; then
10145             AC_MSG_RESULT([yes])
10146             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10147                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10148                             [ ENABLE_SYSTRAY_GTK="" ])
10149         else
10150             AC_MSG_RESULT([no])
10151         fi
10153         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10154         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10155                           [ENABLE_GTK_PRINT="TRUE"],
10156                           [ENABLE_GTK_PRINT=""])
10157         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10159         AC_MSG_CHECKING([whether to enable GIO support])
10160         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10161             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10162                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10163             fi
10164             dnl Need at least 2.26 for the dbus support.
10165             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10166                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10167             if test "$ENABLE_GIO" = "TRUE"; then
10168                 AC_DEFINE(ENABLE_GIO)
10169                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10170             fi
10171         else
10172             AC_MSG_RESULT([no])
10173         fi
10174     fi
10176 AC_SUBST(ENABLE_GIO)
10177 AC_SUBST(GIO_CFLAGS)
10178 AC_SUBST(GIO_LIBS)
10179 AC_SUBST(ENABLE_SYSTRAY_GTK)
10180 AC_SUBST(GTK_CFLAGS)
10181 AC_SUBST(GTK_LIBS)
10182 AC_SUBST(GTHREAD_CFLAGS)
10183 AC_SUBST(GTHREAD_LIBS)
10184 AC_SUBST([ENABLE_GTK_PRINT])
10185 AC_SUBST([GTK_PRINT_CFLAGS])
10186 AC_SUBST([GTK_PRINT_LIBS])
10189 dnl ===================================================================
10190 dnl Check whether the Telepathy libraries are available.
10191 dnl ===================================================================
10193 ENABLE_TELEPATHY=""
10194 TELEPATHY_CFLAGS=""
10195 TELEPATHY_LIBS=""
10197 AC_MSG_CHECKING([whether to enable Telepathy support])
10198 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10199     ENABLE_TELEPATHY="TRUE"
10200     AC_DEFINE(ENABLE_TELEPATHY)
10201     AC_MSG_RESULT([yes])
10202     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 )
10203     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10204 else
10205     AC_MSG_RESULT([no])
10208 AC_SUBST(ENABLE_TELEPATHY)
10209 AC_SUBST(TELEPATHY_CFLAGS)
10210 AC_SUBST(TELEPATHY_LIBS)
10213 dnl ===================================================================
10215 SPLIT_APP_MODULES=""
10216 if test "$enable_split_app_modules" = "yes"; then
10217     SPLIT_APP_MODULES="YES"
10219 AC_SUBST(SPLIT_APP_MODULES)
10221 SPLIT_OPT_FEATURES=""
10222 if test "$enable_split_opt_features" = "yes"; then
10223     SPLIT_OPT_FEATURES="YES"
10225 AC_SUBST(SPLIT_OPT_FEATURES)
10227 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10228     if test "$enable_cairo_canvas" = yes; then
10229         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10230     fi
10231     enable_cairo_canvas=no
10232 elif test -z "$enable_cairo_canvas"; then
10233     enable_cairo_canvas=yes
10236 ENABLE_CAIRO_CANVAS=""
10237 if test "$enable_cairo_canvas" = "yes"; then
10238     test_cairo=yes
10239     ENABLE_CAIRO_CANVAS="TRUE"
10241 AC_SUBST(ENABLE_CAIRO_CANVAS)
10243 dnl ===================================================================
10244 dnl Check whether the GStreamer libraries are available.
10245 dnl ===================================================================
10247 ENABLE_GSTREAMER=""
10249 if test "$build_gstreamer" = "yes"; then
10251     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10252     if test "x$enable_gstreamer" != "xno"; then
10253         ENABLE_GSTREAMER="TRUE"
10254         AC_MSG_RESULT([yes])
10255         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10256         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10257     else
10258         AC_MSG_RESULT([no])
10259     fi
10261 AC_SUBST(GSTREAMER_CFLAGS)
10262 AC_SUBST(GSTREAMER_LIBS)
10263 AC_SUBST(ENABLE_GSTREAMER)
10266 ENABLE_GSTREAMER_0_10=""
10267 if test "$build_gstreamer_0_10" = "yes"; then
10269     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10270     if test "x$enable_gstreamer_0_10" != "xno"; then
10271         ENABLE_GSTREAMER_0_10="TRUE"
10272         AC_MSG_RESULT([yes])
10273         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10274             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10275         ])
10276         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10277     else
10278         AC_MSG_RESULT([no])
10279     fi
10282 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10283 AC_SUBST(GSTREAMER_0_10_LIBS)
10284 AC_SUBST(ENABLE_GSTREAMER_0_10)
10286 dnl ===================================================================
10287 dnl Check whether to build the VLC avmedia backend
10288 dnl ===================================================================
10290 ENABLE_VLC=""
10292 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10293 if test $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10294     ENABLE_VLC="TRUE"
10295     AC_MSG_RESULT([yes])
10296 else
10297     AC_MSG_RESULT([no])
10299 AC_SUBST(ENABLE_VLC)
10301 dnl ===================================================================
10302 dnl Check whether the OpenGL libraries are available
10303 dnl ===================================================================
10305 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10306 ENABLE_OPENGL=
10308 if test -z "$enable_opengl"; then
10309     if test $_os = WINNT; then
10310         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10311         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10312         # code for Windows.
10313         enable_opengl=no
10314     elif test $_os = iOS; then
10315         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10316         # build fine for iOS, too, but let's leave that for later
10317         enable_opengl=no
10318     elif test "$enable_headless" = "yes"; then
10319         enable_opengl=no
10320     else
10321         enable_opengl=yes
10322     fi
10325 if test "x$enable_opengl" = "xno"; then
10326     AC_MSG_RESULT([no])
10327 elif test "$_os" = "Darwin"; then
10328     # We use frameworks on Mac OS X, no need for detail checks
10329     ENABLE_OPENGL=TRUE
10330     ENABLE_OPENGL_CANVAS=
10331     add_warning "openGL canvas not adapted for Mac yet - disabling"
10332     SYSTEM_MESA_HEADERS=YES
10333     AC_MSG_RESULT([yes])
10334 elif test $_os = WINNT; then
10335     # Experimental: try to use OpenGL on Windows
10336     ENABLE_OPENGL=TRUE
10337     ENABLE_OPENGL_CANVAS=TRUE
10338     # We need the internal "Mesa" headers.
10339     SYSTEM_MESA_HEADERS=NO
10340     BUILD_TYPE="$BUILD_TYPE MESA"
10341     AC_MSG_RESULT([yes])
10342 else
10343     save_LDFLAGS=$LDFLAGS
10344     LDFLAGS="$LDFLAGS -lm"
10345     AC_MSG_RESULT([yes])
10346     AC_CHECK_LIB([GL], [main],
10347         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10348             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10349              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10350              ENABLE_OPENGL_CANVAS=], [])],
10351         [AC_MSG_ERROR(libGL not installed or functional)], [])
10352     LDFLAGS="$LDFLAGS -lGL"
10353     AC_CHECK_LIB([GLU], [main], [:],
10354               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10355     ENABLE_OPENGL=TRUE
10356     LDFLAGS=$save_LDFLAGS
10358     dnl ===================================================================
10359     dnl Check for system Mesa
10360     dnl ===================================================================
10361     AC_MSG_CHECKING([which Mesa headers to use])
10362     if test "$with_system_mesa_headers" = "yes"; then
10363         AC_MSG_RESULT([external])
10364         SYSTEM_MESA_HEADERS=YES
10365         AC_LANG_PUSH(C)
10366         AC_CHECK_HEADER(GL/glxext.h, [],
10367            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10368         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10369         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10370         AC_LANG_POP(C)
10371     else
10372         AC_MSG_RESULT([internal])
10373         SYSTEM_MESA_HEADERS=NO
10374         BUILD_TYPE="$BUILD_TYPE MESA"
10375     fi
10378 AC_SUBST(SYSTEM_MESA_HEADERS)
10379 AC_SUBST(ENABLE_OPENGL)
10380 AC_SUBST(ENABLE_OPENGL_CANVAS)
10382 dnl =================================================
10383 dnl Check whether to build with OpenCL support.
10384 dnl =================================================
10386 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10387 ENABLE_OPENCL=
10389 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10390     AC_MSG_RESULT([yes])
10391     enable_opencl=yes
10392     ENABLE_OPENCL=TRUE
10393     AC_DEFINE(HAVE_FEATURE_OPENCL)
10394 else
10395     AC_MSG_RESULT([no])
10396     enable_opencl=no
10399 AC_SUBST(ENABLE_OPENCL)
10401 # pdf import?
10402 AC_MSG_CHECKING([whether to build the PDF import feature])
10403 ENABLE_PDFIMPORT=
10404 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10405     AC_MSG_RESULT([yes])
10406     ENABLE_PDFIMPORT=TRUE
10408     dnl ===================================================================
10409     dnl Check for system poppler
10410     dnl ===================================================================
10411     AC_MSG_CHECKING([which PDF import backend to use])
10412     if test "$with_system_poppler" = "yes"; then
10413         AC_MSG_RESULT([external])
10414         SYSTEM_POPPLER=YES
10415         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10416         AC_LANG_PUSH([C++])
10417         save_CXXFLAGS=$CXXFLAGS
10418         save_CPPFLAGS=$CPPFLAGS
10419         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10420         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10421         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10422                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10423         CXXFLAGS=$save_CXXFLAGS
10424         CPPFLAGS=$save_CPPFLAGS
10425         AC_LANG_POP([C++])
10426         libo_MINGW_CHECK_DLL([libpoppler])
10427         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10428     else
10429         AC_MSG_RESULT([internal])
10430         SYSTEM_POPPLER=NO
10431         BUILD_TYPE="$BUILD_TYPE POPPLER"
10432     fi
10433 else
10434     AC_MSG_RESULT([no])
10436 AC_SUBST(ENABLE_PDFIMPORT)
10437 AC_SUBST(SYSTEM_POPPLER)
10438 AC_SUBST(POPPLER_CFLAGS)
10439 AC_SUBST(POPPLER_LIBS)
10441 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10442 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10443     AC_MSG_RESULT([yes])
10444     ENABLE_MEDIAWIKI=TRUE
10445     BUILD_TYPE="$BUILD_TYPE XSLTML"
10446     if test  "x$with_java" = "xno"; then
10447         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10448     fi
10449 else
10450     AC_MSG_RESULT([no])
10451     ENABLE_MEDIAWIKI=
10452     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10454 AC_SUBST(ENABLE_MEDIAWIKI)
10456 AC_MSG_CHECKING([whether to build the Report Builder])
10457 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10458     AC_MSG_RESULT([yes])
10459     ENABLE_REPORTBUILDER=TRUE
10460     AC_MSG_CHECKING([which jfreereport libs to use])
10461     if test "$with_system_jfreereport" = "yes"; then
10462         SYSTEM_JFREEREPORT=YES
10463         AC_MSG_RESULT([external])
10464         if test -z $SAC_JAR; then
10465             SAC_JAR=/usr/share/java/sac.jar
10466         fi
10467         AC_CHECK_FILE($SAC_JAR, [],
10468              [AC_MSG_ERROR(sac.jar not found.)], [])
10470         if test -z $LIBXML_JAR; then
10471             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10472                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10473                 [
10474                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10475                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10476                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10477                     )
10478                 ]
10479             )
10480         else
10481             AC_CHECK_FILE($LIBXML_JAR, [],
10482                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10483         fi
10485         if test -z $FLUTE_JAR; then
10486             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10487                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10488                 [
10489                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10490                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10491                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10492                     )
10493                 ]
10494             )
10495         else
10496             AC_CHECK_FILE($FLUTE_JAR, [],
10497                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10498         fi
10500         if test -z $JFREEREPORT_JAR; then
10501             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10502                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10503                 [
10504                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10505                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10506                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10507                     )
10508                 ]
10509             )
10510         else
10511             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10512                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10513         fi
10515         if test -z $LIBLAYOUT_JAR; then
10516             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10517                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10518                 [
10519                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10520                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10521                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10522                     )
10523                 ]
10524             )
10525         else
10526             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10527                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10528         fi
10530         if test -z $LIBLOADER_JAR; then
10531             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10532                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10533                 [
10534                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10535                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10536                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10537                     )
10538                 ]
10539             )
10540         else
10541             AC_CHECK_FILE($LIBLOADER_JAR, [],
10542                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10543         fi
10545         if test -z $LIBFORMULA_JAR; then
10546             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10547                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10548                  [
10549                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10550                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10551                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10552                      )
10553                  ]
10554             )
10555         else
10556             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10557                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10558         fi
10560         if test -z $LIBREPOSITORY_JAR; then
10561             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10562                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10563                 [
10564                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10565                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10566                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10567                     )
10568                 ]
10569             )
10570         else
10571             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10572                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10573         fi
10575         if test -z $LIBFONTS_JAR; then
10576             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10577                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10578                 [
10579                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10580                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10581                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10582                     )
10583                 ]
10584             )
10585         else
10586             AC_CHECK_FILE($LIBFONTS_JAR, [],
10587                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10588         fi
10590         if test -z $LIBSERIALIZER_JAR; then
10591             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10592                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10593                 [
10594                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10595                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10596                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10597                     )
10598                 ]
10599             )
10600         else
10601             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10602                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10603         fi
10605         if test -z $LIBBASE_JAR; then
10606             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10607                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10608                 [
10609                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10610                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10611                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10612                     )
10613                 ]
10614             )
10615         else
10616             AC_CHECK_FILE($LIBBASE_JAR, [],
10617                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10618         fi
10620     else
10621         AC_MSG_RESULT([internal])
10622         SYSTEM_JFREEREPORT=NO
10623         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10624     fi
10625 else
10626     AC_MSG_RESULT([no])
10627     ENABLE_REPORTBUILDER=
10628     SYSTEM_JFREEREPORT=NO
10630 AC_SUBST(ENABLE_REPORTBUILDER)
10631 AC_SUBST(SYSTEM_JFREEREPORT)
10632 AC_SUBST(SAC_JAR)
10633 AC_SUBST(LIBXML_JAR)
10634 AC_SUBST(FLUTE_JAR)
10635 AC_SUBST(JFREEREPORT_JAR)
10636 AC_SUBST(LIBBASE_JAR)
10637 AC_SUBST(LIBLAYOUT_JAR)
10638 AC_SUBST(LIBLOADER_JAR)
10639 AC_SUBST(LIBFORMULA_JAR)
10640 AC_SUBST(LIBREPOSITORY_JAR)
10641 AC_SUBST(LIBFONTS_JAR)
10642 AC_SUBST(LIBSERIALIZER_JAR)
10644 # this has to be here because both the Wiki Publisher and the SRB use
10645 # commons-logging
10646 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10647     AC_MSG_CHECKING([which Apache commons-* libs to use])
10648     if test "$with_system_apache_commons" = "yes"; then
10649         SYSTEM_APACHE_COMMONS=YES
10650         AC_MSG_RESULT([external])
10651         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10652             if test -z $COMMONS_CODEC_JAR; then
10653                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
10654                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
10655                     [
10656                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10657                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10658                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10659                         )
10660                     ]
10661                 )
10662             else
10663                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10664                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10665             fi
10667             if test -z $COMMONS_LANG_JAR; then
10668                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
10669                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
10670                     [
10671                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10672                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10673                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10674                             )
10675                     ]
10676                 )
10677             else
10678                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10679                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10680             fi
10682             if test -z $COMMONS_HTTPCLIENT_JAR; then
10683                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10684                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10685                     [
10686                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10687                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10688                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10689                         )
10690                     ]
10691                 )
10692             else
10693                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10694                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10695             fi
10696         fi
10697         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10698             if test -z $COMMONS_LOGGING_JAR; then
10699                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
10700                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
10701                    [
10702                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10703                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10704                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10705                         )
10706                     ]
10707                 )
10708             else
10709                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10710                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10711             fi
10712         fi
10713     else
10714         AC_MSG_RESULT([internal])
10715         SYSTEM_APACHE_COMMONS=NO
10716         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10717     fi
10719 AC_SUBST(SYSTEM_APACHE_COMMONS)
10720 AC_SUBST(COMMONS_CODEC_JAR)
10721 AC_SUBST(COMMONS_LANG_JAR)
10722 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10723 AC_SUBST(COMMONS_LOGGING_JAR)
10725 # scripting provider for BeanShell?
10726 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10727 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10728     AC_MSG_RESULT([yes])
10729     ENABLE_SCRIPTING_BEANSHELL=TRUE
10731     dnl ===================================================================
10732     dnl Check for system beanshell
10733     dnl ===================================================================
10734     AC_MSG_CHECKING([which beanshell to use])
10735     if test "$with_system_beanshell" = "yes"; then
10736         AC_MSG_RESULT([external])
10737         SYSTEM_BSH=YES
10738         if test -z $BSH_JAR; then
10739             BSH_JAR=/usr/share/java/bsh.jar
10740         fi
10741         AC_CHECK_FILE($BSH_JAR, [],
10742                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10743     else
10744         AC_MSG_RESULT([internal])
10745         SYSTEM_BSH=NO
10746         BUILD_TYPE="$BUILD_TYPE BSH"
10747     fi
10748 else
10749     AC_MSG_RESULT([no])
10750     ENABLE_SCRIPTING_BEANSHELL=
10751     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10753 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10754 AC_SUBST(SYSTEM_BSH)
10755 AC_SUBST(BSH_JAR)
10757 # scripting provider for JavaScript?
10758 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10759 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10760     AC_MSG_RESULT([yes])
10761     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10763     dnl ===================================================================
10764     dnl Check for system rhino
10765     dnl ===================================================================
10766     AC_MSG_CHECKING([which rhino to use])
10767     if test "$with_system_rhino" = "yes"; then
10768         AC_MSG_RESULT([external])
10769         SYSTEM_RHINO=YES
10770         if test -z $RHINO_JAR; then
10771             RHINO_JAR=/usr/share/java/js.jar
10772         fi
10773         AC_CHECK_FILE($RHINO_JAR, [],
10774                    [AC_MSG_ERROR(js.jar not found.)], [])
10775     else
10776         AC_MSG_RESULT([internal])
10777         SYSTEM_RHINO=NO
10778         BUILD_TYPE="$BUILD_TYPE RHINO"
10779     fi
10780 else
10781     AC_MSG_RESULT([no])
10782     ENABLE_SCRIPTING_JAVASCRIPT=
10783     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10785 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10786 AC_SUBST(SYSTEM_RHINO)
10787 AC_SUBST(RHINO_JAR)
10789 supports_multilib=
10790 case "$host_cpu" in
10791 x86_64 | powerpc64 | s390x)
10792     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10793         supports_multilib="yes"
10794     fi
10795     ;;
10797     ;;
10798 esac
10800 dnl ===================================================================
10801 dnl Check whether the TQt and TDE libraries are available.
10802 dnl ===================================================================
10804 TDE_CFLAGS=""
10805 TDE_LIBS=""
10806 if test "$_os" != "OpenBSD"; then
10807     MOC="moc"
10809 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10810     dnl Search paths for TQt and TDE
10811     if test -z "$supports_multilib"; then
10812         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"
10813         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"
10814     else
10815         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"
10816         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"
10817     fi
10818     if test -n "$TQTDIR"; then
10819         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10820         if test -z "$supports_multilib"; then
10821             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10822         else
10823             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10824         fi
10825     fi
10826     if test -z "$supports_multilib"; then
10827         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"
10828         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"
10829     else
10830         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"
10831         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"
10832     fi
10833     if test -n "$TDEDIR"; then
10834         tde_incdirs="$TDEDIR/include $tde_incdirs"
10835         if test -z "$supports_multilib"; then
10836             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10837         else
10838             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10839         fi
10840     fi
10842     dnl What to test
10843     tqt_test_include="ntqstyle.h"
10844     tde_test_include="kapp.h"
10846     if test "$_os" != "OpenBSD"; then
10847         tqt_test_library="libtqt-mt.so"
10848         tde_test_library="libDCOP.so"
10849     else
10850         tqt_test_library="libtqt-mt.so*"
10851         tde_test_library="libDCOP.so*"
10852     fi
10854     dnl Check for TQt headers
10855     AC_MSG_CHECKING([for TQt headers])
10856     tqt_incdir="no"
10857     for tde_check in $tqt_incdirs; do
10858         if test -r "$tde_check/$tqt_test_include"; then
10859             tqt_incdir="$tde_check"
10860             break
10861         fi
10862     done
10863     AC_MSG_RESULT([$tqt_incdir])
10864     if test "x$tqt_incdir" = "xno"; then
10865         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10866 your TQt installation by exporting TQTDIR before running "configure".])
10867     fi
10869     dnl Check for TQt libraries
10870     AC_MSG_CHECKING([for TQt libraries])
10871     tqt_libdir="no"
10872     for tqt_check in $tqt_libdirs; do
10873         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10874             tqt_libdir="$tqt_check"
10875             break
10876         fi
10877     done
10878     AC_MSG_RESULT([$tqt_libdir])
10879     if test "x$tqt_libdir" = "xno"; then
10880         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10881 your TQt installation by exporting TQTDIR before running "configure".])
10882     fi
10884     dnl Check for Meta Object Compiler
10885     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10886     if test "$MOC" = "no"; then
10887         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10888 the root of your TQt installation by exporting TQTDIR before running "configure".])
10889     fi
10891     dnl Check for TDE headers
10892     AC_MSG_CHECKING([for TDE headers])
10893     tde_incdir="no"
10894     for tde_check in $tde_incdirs; do
10895         if test -r "$tde_check/$tde_test_include"; then
10896             tde_incdir="$tde_check"
10897             break
10898         fi
10899     done
10900     AC_MSG_RESULT([$tde_incdir])
10901     if test "x$tde_incdir" = "xno"; then
10902         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10903 your TDE installation by exporting TDEDIR before running "configure".])
10904     fi
10906     dnl Check for TDE libraries
10907     AC_MSG_CHECKING([for TDE libraries])
10908     tde_libdir="no"
10909     for tde_check in $tde_libdirs; do
10910         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10911             tde_libdir="$tde_check"
10912             break
10913         fi
10914     done
10915     AC_MSG_RESULT([$tde_libdir])
10916     if test "x$tde_libdir" = "xno"; then
10917         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10918 your TDE installation by exporting TDEDIR before running "configure".])
10919     fi
10921     dnl Set the variables
10922     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10923     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10925 AC_SUBST(TDE_CFLAGS)
10926 AC_SUBST(TDE_LIBS)
10927 AC_SUBST(MOC)
10929 dnl ===================================================================
10930 dnl Check whether the Qt3 and KDE3 libraries are available.
10931 dnl ===================================================================
10933 KDE_CFLAGS=""
10934 KDE_LIBS=""
10935 if test "$_os" != "OpenBSD"; then
10936     MOC="moc"
10938 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10939     dnl Search paths for Qt3 and KDE3
10940     if test -z "$supports_multilib"; then
10941         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"
10942         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"
10943     else
10944         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"
10945         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"
10946     fi
10947     if test -n "$QTDIR"; then
10948         qt_incdirs="$QTDIR/include $qt_incdirs"
10949         if test -z "$supports_multilib"; then
10950             qt_libdirs="$QTDIR/lib $qt_libdirs"
10951         else
10952             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10953         fi
10954     fi
10955     if test -z "$supports_multilib"; then
10956         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"
10957         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"
10958     else
10959         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"
10960         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"
10961     fi
10962     if test -n "$KDEDIR"; then
10963         kde_incdirs="$KDEDIR/include $kde_incdirs"
10964         if test -z "$supports_multilib"; then
10965             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10966         else
10967             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10968         fi
10969     fi
10971     dnl What to test
10972     qt_test_include="qstyle.h"
10973     kde_test_include="kapp.h"
10975     if test "$_os" != "OpenBSD"; then
10976         qt_test_library="libqt-mt.so"
10977         kde_test_library="libDCOP.so"
10978     else
10979         qt_test_library="libqt-mt.so*"
10980         kde_test_library="libDCOP.so*"
10981     fi
10983     dnl Check for Qt3 headers
10984     AC_MSG_CHECKING([for Qt3 headers])
10985     qt_incdir="no"
10986     for kde_check in $qt_incdirs; do
10987         if test -r "$kde_check/$qt_test_include"; then
10988             qt_incdir="$kde_check"
10989             break
10990         fi
10991     done
10992     AC_MSG_RESULT([$qt_incdir])
10993     if test "x$qt_incdir" = "xno"; then
10994         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10995 your Qt3 installation by exporting QTDIR before running "configure".])
10996     fi
10998     dnl Check for Qt3 libraries
10999     AC_MSG_CHECKING([for Qt3 libraries])
11000     qt_libdir="no"
11001     for qt_check in $qt_libdirs; do
11002         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11003             qt_libdir="$qt_check"
11004             break
11005         fi
11006     done
11007     AC_MSG_RESULT([$qt_libdir])
11008     if test "x$qt_libdir" = "xno"; then
11009         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11010 your Qt3 installation by exporting QTDIR before running "configure".])
11011     fi
11013     dnl Check for Meta Object Compiler
11014     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11015     if test "$MOC" = "no"; then
11016         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11017 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11018     fi
11020     dnl Check for KDE3 headers
11021     AC_MSG_CHECKING([for KDE3 headers])
11022     kde_incdir="no"
11023     for kde_check in $kde_incdirs; do
11024         if test -r "$kde_check/$kde_test_include"; then
11025             kde_incdir="$kde_check"
11026             break
11027         fi
11028     done
11029     AC_MSG_RESULT([$kde_incdir])
11030     if test "x$kde_incdir" = "xno"; then
11031         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11032 your KDE3 installation by exporting KDEDIR before running "configure".])
11033     fi
11035     dnl Check for KDE3 libraries
11036     AC_MSG_CHECKING([for KDE3 libraries])
11037     kde_libdir="no"
11038     for kde_check in $kde_libdirs; do
11039         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11040             kde_libdir="$kde_check"
11041             break
11042         fi
11043     done
11044     AC_MSG_RESULT([$kde_libdir])
11045     if test "x$kde_libdir" = "xno"; then
11046         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11047 your KDE3 installation by exporting KDEDIR before running "configure".])
11048     fi
11050     dnl Set the variables
11051     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11052     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11053     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11055 AC_SUBST(KDE_CFLAGS)
11056 AC_SUBST(KDE_LIBS)
11057 AC_SUBST(MOC)
11059 dnl ===================================================================
11060 dnl KDE4 Integration
11061 dnl ===================================================================
11063 KDE4_CFLAGS=""
11064 KDE4_LIBS=""
11065 QMAKE4="qmake"
11066 MOC4="moc"
11067 KDE_GLIB_CFLAGS=""
11068 KDE_GLIB_LIBS=""
11069 KDE_HAVE_GLIB=""
11070 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11071     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11072     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11074     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11075     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11077     if test -n "$supports_multilib"; then
11078         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11079         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11080     fi
11082     if test -n "$QTDIR"; then
11083         qt_incdirs="$QTDIR/include $qt_incdirs"
11084         if test -z "$supports_multilib"; then
11085             qt_libdirs="$QTDIR/lib $qt_libdirs"
11086         else
11087             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11088         fi
11089     fi
11090     if test -n "$QT4DIR"; then
11091         qt_incdirs="$QT4DIR/include $qt_incdirs"
11092         if test -z "$supports_multilib"; then
11093             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11094         else
11095             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11096         fi
11097     fi
11099     if test -n "$KDEDIR"; then
11100         kde_incdirs="$KDEDIR/include $kde_incdirs"
11101         if test -z "$supports_multilib"; then
11102             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11103         else
11104             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11105         fi
11106     fi
11107     if test -n "$KDE4DIR"; then
11108         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11109         if test -z "$supports_multilib"; then
11110             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11111         else
11112             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11113         fi
11114     fi
11116     qt_test_include="Qt/qobject.h"
11117     qt_test_library="libQtCore.so"
11118     kde_test_include="kwindowsystem.h"
11119     kde_test_library="libsolid.so"
11121     AC_MSG_CHECKING([for Qt4 headers])
11122     qt_header_dir="no"
11123     for inc_dir in $qt_incdirs; do
11124         if test -r "$inc_dir/$qt_test_include"; then
11125             qt_header_dir="$inc_dir"
11126             break
11127         fi
11128     done
11130     AC_MSG_RESULT([$qt_header_dir])
11131     if test "x$qt_header_dir" = "xno"; then
11132         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11133     fi
11135     dnl Check for qmake
11136     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11137     QMAKE4="$QMAKEQT4"
11138     if test "$QMAKE4" = "no"; then
11139         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11140         if test "$QMAKE4" = "no"; then
11141             AC_MSG_ERROR([Qmake not found.  Please specify
11142 the root of your Qt installation by exporting QT4DIR before running "configure".])
11143         fi
11144     fi
11146     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11147     AC_MSG_CHECKING([for Qt4 libraries])
11148     qt_lib_dir="no"
11149     for lib_dir in $qt_libdirs; do
11150         if test -r "$lib_dir/$qt_test_library"; then
11151             qt_lib_dir="$lib_dir"
11152             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11153             break
11154         fi
11155     done
11157     AC_MSG_RESULT([$qt_lib_dir])
11159     if test "x$qt_lib_dir" = "xno"; then
11160         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11161     fi
11163     dnl Check for Meta Object Compiler
11165     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11166     MOC4="$MOCQT4"
11167     if test "$MOC4" = "no"; then
11168         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11169         if test "$MOC4" = "no"; then
11170             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11171 the root of your Qt installation by exporting QT4DIR before running "configure".])
11172         fi
11173     fi
11175     dnl Check for KDE4 headers
11176     AC_MSG_CHECKING([for KDE4 headers])
11177     kde_incdir="no"
11178     for kde_check in $kde_incdirs; do
11179         if test -r "$kde_check/$kde_test_include"; then
11180             kde_incdir="$kde_check"
11181             break
11182         fi
11183     done
11184     AC_MSG_RESULT([$kde_incdir])
11185     if test "x$kde_incdir" = "xno"; then
11186         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11187     fi
11189     dnl Check for KDE4 libraries
11190     AC_MSG_CHECKING([for KDE4 libraries])
11191     kde_libdir="no"
11192     for kde_check in $kde_libdirs; do
11193         if test -r "$kde_check/$kde_test_library"; then
11194             kde_libdir="$kde_check"
11195             break
11196         fi
11197     done
11199     AC_MSG_RESULT([$kde_libdir])
11200     if test "x$kde_libdir" = "xno"; then
11201         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11202     fi
11204     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11205     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkio -lkfile -lkdeui -lkdecore -lQtCore -lQtGui"
11206     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11208     AC_LANG_PUSH([C++])
11209     save_CXXFLAGS=$CXXFLAGS
11210     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11211     AC_MSG_CHECKING([whether KDE is >= 4.2])
11212        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11213 #include <kdeversion.h>
11215 int main(int argc, char **argv) {
11216        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11217        else return 1;
11219        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11220     CXXFLAGS=$save_CXXFLAGS
11221     AC_LANG_POP([C++])
11223     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11224     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11225     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11226         [
11227         KDE_HAVE_GLIB=1
11228         AC_DEFINE(KDE_HAVE_GLIB,1)
11229         KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11230         ],
11231         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
11233 AC_SUBST(KDE4_CFLAGS)
11234 AC_SUBST(KDE4_LIBS)
11235 AC_SUBST(MOC4)
11236 AC_SUBST(KDE_GLIB_CFLAGS)
11237 AC_SUBST(KDE_GLIB_LIBS)
11238 AC_SUBST(KDE_HAVE_GLIB)
11240 dnl ===================================================================
11241 dnl Test for the enabling the lockdown pieces
11242 dnl ===================================================================
11243 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11244 ENABLE_LOCKDOWN=
11245 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11246     ENABLE_LOCKDOWN=TRUE
11247     AC_MSG_RESULT([yes])
11248 else
11249     AC_MSG_RESULT([no])
11251 AC_SUBST(ENABLE_LOCKDOWN)
11253 dnl ===================================================================
11254 dnl Test whether to include Evolution 2 support
11255 dnl ===================================================================
11256 AC_MSG_CHECKING([whether to enable evolution 2 support])
11257 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11258     AC_MSG_RESULT([yes])
11259     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11260     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11261     ENABLE_EVOAB2="TRUE"
11262 else
11263     ENABLE_EVOAB2=""
11264     AC_MSG_RESULT([no])
11266 AC_SUBST(ENABLE_EVOAB2)
11267 AC_SUBST(GOBJECT_CFLAGS)
11268 AC_SUBST(GOBJECT_LIBS)
11270 dnl ===================================================================
11271 dnl Test whether to include TDE AB support
11272 dnl ===================================================================
11273 AC_MSG_CHECKING([whether to enable TDE address book support])
11274 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11275     AC_MSG_RESULT([yes])
11276     AC_LANG_PUSH([C++])
11277     save_CXXFLAGS=$CXXFLAGS
11278     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11279     AC_MSG_CHECKING([whether TDE is at least R14.0])
11280        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11281 #include <tdeversion.h>
11283 int main(int argc, char **argv) {
11284        if (TDE_VERSION_MAJOR >= 14) return 0;
11285        else return 1;
11287        ]])],[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])],[])
11288     CXXFLAGS=$save_CXXFLAGS
11289     AC_LANG_POP([C++])
11290     ENABLE_TDEAB=TRUE
11291 else
11292     AC_MSG_RESULT([no])
11293     ENABLE_TDEAB=
11295 AC_SUBST(ENABLE_TDEAB)
11297 dnl ===================================================================
11298 dnl Test whether to include KDE AB support
11299 dnl ===================================================================
11300 AC_MSG_CHECKING([whether to enable KDE address book support])
11301 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11302     AC_MSG_RESULT([yes])
11303     AC_LANG_PUSH([C++])
11304     save_CXXFLAGS=$CXXFLAGS
11305     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11306     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11307        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11308 #include <kdeversion.h>
11310 int main(int argc, char **argv) {
11311        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11312        else return 1;
11314        ]])],[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])],[])
11315     CXXFLAGS=$save_CXXFLAGS
11316     AC_LANG_POP([C++])
11317     ENABLE_KAB=TRUE
11318 else
11319     AC_MSG_RESULT([no])
11320     ENABLE_KAB=
11322 AC_SUBST(ENABLE_KAB)
11324 dnl ===================================================================
11325 dnl Test which themes to include
11326 dnl ===================================================================
11327 AC_MSG_CHECKING([which themes to include])
11328 # if none given use default subset of available themes
11329 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11330     with_theme="crystal default hicontrast oxygen tango sifr"
11331     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11334 WITH_THEMES=""
11335 if test "x$with_theme" != "xno"; then
11336     for theme in $with_theme; do
11337         case $theme in
11338         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11339         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11340         esac
11341         WITH_THEMES="$WITH_THEMES $theme"
11342     done
11344 AC_MSG_RESULT([$WITH_THEMES])
11345 AC_SUBST([WITH_THEMES])
11347 dnl ===================================================================
11348 dnl Test whether to integrate helppacks into the product's installer
11349 dnl ===================================================================
11350 AC_MSG_CHECKING([for helppack integration])
11351 if test "$with_helppack_integration" = "no"; then
11352     WITH_HELPPACK_INTEGRATION=NO
11353     AC_MSG_RESULT([no integration])
11354 else
11355     WITH_HELPPACK_INTEGRATION=YES
11356     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11357     AC_MSG_RESULT([integration])
11359 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11361 dnl ===================================================================
11362 dnl Test whether to use CoreText framework
11363 dnl ===================================================================
11364 ENABLE_CORETEXT=
11365 if test "$_os" = "Darwin"; then
11366     AC_MSG_CHECKING([whether to use CoreText framework])
11367     if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
11368         AC_MSG_RESULT([yes])
11369         ENABLE_CORETEXT=TRUE
11370     else
11371         AC_MSG_RESULT([no])
11372     fi
11374 AC_SUBST(ENABLE_CORETEXT)
11376 ###############################################################################
11377 # Extensions checking
11378 ###############################################################################
11379 AC_MSG_CHECKING([for extensions integration])
11380 if test "x$enable_extension_integration" != "xno"; then
11381     WITH_EXTENSION_INTEGRATION=YES
11382     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11383     AC_MSG_RESULT([yes, use integration])
11384 else
11385     WITH_EXTENSION_INTEGRATION=NO
11386     AC_MSG_RESULT([no, do not integrate])
11388 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11390 dnl Should any extra extensions be included?
11391 dnl There are standalone tests for each of these below.
11392 WITH_EXTRA_EXTENSIONS=
11393 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11395 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11396 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11397 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11398 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11399 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11400 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11401 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11402 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11403 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11404 if test "x$with_java" != "xno"; then
11405     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11406     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11409 dnl ===================================================================
11410 dnl Test whether to include Sun Professional Template Pack
11411 dnl ===================================================================
11412 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11413 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11414     AC_MSG_RESULT([no integration])
11415 else
11416     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11417     sun_supported_langs="en-US de it fr es hu"
11418     if test "$with_sun_templates" = "yes"; then
11419         wanted_sun_templates="$sun_supported_langs"
11420     else
11421         # check whether the langs are supported by Sun
11422         wanted_sun_templates=
11423         for lang in $with_sun_templates; do
11424             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11425                 wanted_sun_templates="$wanted_sun_templates $lang"
11426             fi
11427         done
11428     fi
11429     SUNTEMPLATES_LANG=
11430     SUNTEMPLATES_DE_PACK=
11431     SUNTEMPLATES_EN_US_PACK=
11432     SUNTEMPLATES_ES_PACK=
11433     SUNTEMPLATES_FR_PACK=
11434     SUNTEMPLATES_HU_PACK=
11435     SUNTEMPLATES_IT_PACK=
11436     # check whether the langs are requested at all
11437     for lang in $wanted_sun_templates; do
11438     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11439         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11440         case $lang in
11441         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11442         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11443         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11444         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11445         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11446         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11447         esac
11448     fi
11449     done
11450     WITH_EXTRA_EXTENSIONS=YES
11451     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11453 AC_SUBST(SUNTEMPLATES_DE_PACK)
11454 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11455 AC_SUBST(SUNTEMPLATES_ES_PACK)
11456 AC_SUBST(SUNTEMPLATES_FR_PACK)
11457 AC_SUBST(SUNTEMPLATES_HU_PACK)
11458 AC_SUBST(SUNTEMPLATES_IT_PACK)
11460 dnl ===================================================================
11461 dnl Test whether to include fonts
11462 dnl ===================================================================
11463 AC_MSG_CHECKING([whether to include third-party fonts])
11464 if test "$with_fonts" != "no"; then
11465     AC_MSG_RESULT([yes])
11466     WITH_FONTS=YES
11467     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11468 else
11469     AC_MSG_RESULT([no])
11470     WITH_FONTS=NO
11471     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11473 AC_SUBST(WITH_FONTS)
11475 dnl ===================================================================
11476 dnl Test whether to include ppds
11477 dnl ===================================================================
11478 AC_MSG_CHECKING([whether to include PPDs])
11479 if test "$with_ppds" != "no"; then
11480     AC_MSG_RESULT([yes])
11481 else
11482     AC_MSG_RESULT([no])
11483     WITHOUT_PPDS=YES
11484     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11486 AC_SUBST(WITHOUT_PPDS)
11488 dnl ===================================================================
11489 dnl Test whether to include afms
11490 dnl ===================================================================
11491 AC_MSG_CHECKING([whether to include AFMs])
11492 if test "$with_afms" != "no"; then
11493     AC_MSG_RESULT([yes])
11494     BUILD_TYPE="$BUILD_TYPE AFMS"
11495 else
11496     AC_MSG_RESULT([no])
11497     WITHOUT_AFMS=YES
11498     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
11500 AC_SUBST(WITHOUT_AFMS)
11502 dnl ===================================================================
11503 dnl Test whether to include extra galleries
11504 dnl ===================================================================
11505 AC_MSG_CHECKING([whether to include extra galleries])
11506 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11507     AC_MSG_RESULT([no])
11508     WITH_EXTRA_GALLERY=NO
11509     OOOP_GALLERY_PACK=""
11510 else
11511     AC_MSG_RESULT([yes])
11512     WITH_EXTRA_GALLERY=YES
11513     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11514     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11515     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11517 AC_SUBST(WITH_EXTRA_GALLERY)
11518 AC_SUBST(OOOP_GALLERY_PACK)
11520 dnl ===================================================================
11521 dnl Test whether to include extra templates
11522 dnl ===================================================================
11523 AC_MSG_CHECKING([whether to include extra templates])
11524 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11525     AC_MSG_RESULT([no])
11526     WITH_EXTRA_TEMPLATE=NO
11527     OOOP_TEMPLATES_PACK=""
11528 else
11529     AC_MSG_RESULT([yes])
11530     WITH_EXTRA_TEMPLATE=YES
11531     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11532     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11533     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11535 AC_SUBST(WITH_EXTRA_TEMPLATE)
11536 AC_SUBST(OOOP_TEMPLATES_PACK)
11538 dnl ===================================================================
11539 dnl Test whether to include extra samples
11540 dnl ===================================================================
11541 AC_MSG_CHECKING([whether to include extra samples])
11542 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11543     AC_MSG_RESULT([no])
11544     WITH_EXTRA_SAMPLE=NO
11545     OOOP_SAMPLES_PACK=""
11546 else
11547     AC_MSG_RESULT([yes])
11548     WITH_EXTRA_SAMPLE=YES
11549     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11550     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11551     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11553 AC_SUBST(WITH_EXTRA_SAMPLE)
11554 AC_SUBST(OOOP_SAMPLES_PACK)
11556 dnl ===================================================================
11557 dnl Test whether to include extra fonts
11558 dnl ===================================================================
11559 AC_MSG_CHECKING([whether to include extra fonts])
11560 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11561     AC_MSG_RESULT([no])
11562     WITH_EXTRA_FONT=NO
11563     OOOP_FONTS_PACK=""
11564 else
11565     AC_MSG_RESULT([yes])
11566     WITH_EXTRA_FONT=YES
11567     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11568     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11569     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11571 AC_SUBST(WITH_EXTRA_FONT)
11572 AC_SUBST(OOOP_FONTS_PACK)
11574 dnl ===================================================================
11575 dnl Test whether to enable online update service
11576 dnl ===================================================================
11577 AC_MSG_CHECKING([whether to enable online update])
11578 ENABLE_ONLINE_UPDATE=
11579 if test "$enable_online_update" = ""; then
11580     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11581         AC_MSG_RESULT([yes])
11582         ENABLE_ONLINE_UPDATE="TRUE"
11583     else
11584         AC_MSG_RESULT([no])
11585     fi
11586 else
11587     if test "$enable_online_update" = "yes"; then
11588         AC_MSG_RESULT([yes])
11589         ENABLE_ONLINE_UPDATE="TRUE"
11590     else
11591         AC_MSG_RESULT([no])
11592     fi
11594 AC_SUBST(ENABLE_ONLINE_UPDATE)
11596 dnl ===================================================================
11597 dnl Test whether to enable ia2
11598 dnl ===================================================================
11599 AC_MSG_CHECKING([whether to enable IA2])
11600 ENABLE_IA2=
11601 if test "$enable_ia2" = "yes"; then
11602     if test "$_os" = "WINNT"; then
11603         AC_MSG_RESULT([yes])
11604         ENABLE_IA2="TRUE"
11605     else
11606         AC_MSG_RESULT([no])
11607     fi
11609 AC_SUBST(ENABLE_IA2)
11611 dnl ===================================================================
11612 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11613 dnl ===================================================================
11614 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11615 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11616     AC_MSG_RESULT([no])
11617     ENABLE_SILENT_MSI=
11618 else
11619     AC_MSG_RESULT([yes])
11620     ENABLE_SILENT_MSI=TRUE
11621     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11623 AC_SUBST(ENABLE_SILENT_MSI)
11625 AC_MSG_CHECKING([whether and how to use Xinerama])
11626 if test "$_os" = "Darwin"; then
11627     USE_XINERAMA=YES
11628     XINERAMA_LINK=dynamic
11629     AC_MSG_RESULT([yes])
11630 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11631     if test "$x_libraries" = "default_x_libraries"; then
11632         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11633         if test "x$XINERAMALIB" = x; then
11634            XINERAMALIB="/usr/lib"
11635         fi
11636     else
11637         XINERAMALIB="$x_libraries"
11638     fi
11639     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11640         # we have both versions, let the user decide but use the dynamic one
11641         # per default
11642         USE_XINERAMA=YES
11643         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11644             XINERAMA_LINK=dynamic
11645         else
11646             XINERAMA_LINK=static
11647         fi
11648     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11649         # we have only the dynamic version
11650         USE_XINERAMA=YES
11651         XINERAMA_LINK=dynamic
11652     elif test -e "$XINERAMALIB/libXinerama.a"; then
11653         # static version
11654         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11655             USE_XINERAMA=YES
11656             XINERAMA_LINK=static
11657         else
11658             USE_XINERAMA=NO
11659             XINERAMA_LINK=none
11660         fi
11661     else
11662         # no Xinerama
11663         USE_XINERAMA=NO
11664         XINERAMA_LINK=none
11665     fi
11666     if test "$USE_XINERAMA" = "YES"; then
11667         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11668         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11669             [AC_MSG_ERROR(Xinerama header not found.)], [])
11670         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11671         if test "x$XEXTLIB" = x; then
11672            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11673         fi
11674         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11675         if test "$_os" = "FreeBSD"; then
11676             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11677         fi
11678         if test "$_os" = "Linux"; then
11679             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11680         fi
11681         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11682             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11683     else
11684         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11685     fi
11686 else
11687     USE_XINERAMA=NO
11688     XINERAMA_LINK=none
11689     AC_MSG_RESULT([no])
11691 AC_SUBST(USE_XINERAMA)
11692 AC_SUBST(XINERAMA_LINK)
11694 dnl ===================================================================
11695 dnl Test whether to build cairo or rely on the system version
11696 dnl ===================================================================
11698 if test "$GUIBASE" = "unx"; then
11699     # Used in vcl/Library_vclplug_gen.mk
11700     test_cairo=yes
11703 if test "$test_cairo" = "yes"; then
11704     AC_MSG_CHECKING([whether to use the system cairo])
11706     : ${with_system_cairo:=$with_system_libs}
11707     if test "$with_system_cairo" = "yes"; then
11708         SYSTEM_CAIRO=YES
11709         AC_MSG_RESULT([yes])
11711         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11712         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11714         if test "$test_xrender" = "yes"; then
11715             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11716             AC_LANG_PUSH([C])
11717             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11718 #ifdef PictStandardA8
11719 #else
11720       return fail;
11721 #endif
11722 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11724             AC_LANG_POP([C])
11725         fi
11726         libo_MINGW_CHECK_DLL([libcairo])
11727         libo_MINGW_TRY_DLL([libfontconfig])
11728         libo_MINGW_TRY_DLL([libfreetype])
11729         libo_MINGW_TRY_DLL([libpixman])
11730         libo_MINGW_TRY_DLL([libpng15])
11731     else
11732         SYSTEM_CAIRO=NO
11733         AC_MSG_RESULT([no])
11735         BUILD_TYPE="$BUILD_TYPE CAIRO"
11736         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11737     fi
11740 AC_SUBST(SYSTEM_CAIRO)
11741 AC_SUBST(CAIRO_CFLAGS)
11742 AC_SUBST(CAIRO_LIBS)
11744 dnl ===================================================================
11745 dnl Test whether to use avahi
11746 dnl ===================================================================
11747 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11748     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11749                       [ENABLE_AVAHI="TRUE"])
11750     AC_DEFINE(HAVE_FEATURE_AVAHI)
11751     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11754 AC_SUBST(ENABLE_AVAHI)
11755 AC_SUBST(AVAHI_CFLAGS)
11756 AC_SUBST(AVAHI_LIBS)
11758 dnl ===================================================================
11759 dnl Test whether to use liblangtag
11760 dnl ===================================================================
11761 ENABLE_LIBLANGTAG=
11762 SYSTEM_LIBLANGTAG=
11763 AC_MSG_CHECKING([whether to use liblangtag])
11764 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11765     ENABLE_LIBLANGTAG=TRUE
11766     AC_MSG_RESULT([yes])
11767     AC_MSG_CHECKING([whether to use system liblangtag])
11768     if test "$with_system_liblangtag" = yes; then
11769         SYSTEM_LIBLANGTAG=YES
11770         AC_MSG_RESULT([yes])
11771         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11772         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11773         libo_MINGW_CHECK_DLL([liblangtag])
11774     else
11775         SYSTEM_LIBLANGTAG=NO
11776         AC_MSG_RESULT([no])
11777         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11778         if test "$COM" = "MSC"; then
11779             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11780         else
11781             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11782         fi
11783     fi
11784 else
11785     AC_MSG_RESULT([no])
11787 AC_SUBST(ENABLE_LIBLANGTAG)
11788 AC_SUBST(SYSTEM_LIBLANGTAG)
11789 AC_SUBST(LIBLANGTAG_CFLAGS)
11790 AC_SUBST(LIBLANGTAG_LIBS)
11792 dnl ===================================================================
11793 dnl Test whether to build libpng or rely on the system version
11794 dnl ===================================================================
11796 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11798 dnl ===================================================================
11799 dnl Check for runtime JVM search path
11800 dnl ===================================================================
11801 if test "$ENABLE_JAVA" != ""; then
11802     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11803     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11804         AC_MSG_RESULT([yes])
11805         if ! test -d "$with_jvm_path"; then
11806             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11807         fi
11808         if ! test -d "$with_jvm_path"jvm; then
11809             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11810         fi
11811         JVM_ONE_PATH_CHECK="$with_jvm_path"
11812         AC_SUBST(JVM_ONE_PATH_CHECK)
11813     else
11814         AC_MSG_RESULT([no])
11815     fi
11818 dnl ===================================================================
11819 dnl Test for the presence of Ant and that it works
11820 dnl ===================================================================
11822 if test "$ENABLE_JAVA" != ""; then
11823     ANT_HOME=; export ANT_HOME
11824     WITH_ANT_HOME=; export WITH_ANT_HOME
11825     if test -z "$with_ant_home"; then
11826         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11827     else
11828         if test "$_os" = "WINNT"; then
11829             with_ant_home=`cygpath -u "$with_ant_home"`
11830         fi
11831         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11832         WITH_ANT_HOME=$with_ant_home
11833         ANT_HOME=$with_ant_home
11834     fi
11836     if test -z "$ANT"; then
11837         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11838     else
11839         # resolve relative or absolute symlink
11840         while test -h "$ANT"; do
11841             a_cwd=`pwd`
11842             a_basename=`basename "$ANT"`
11843             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11844             cd "`dirname "$ANT"`"
11845             cd "`dirname "$a_script"`"
11846             ANT="`pwd`"/"`basename "$a_script"`"
11847             cd "$a_cwd"
11848         done
11850         AC_MSG_CHECKING([if $ANT works])
11851         cat > conftest.java << EOF
11852         public class conftest {
11853             int testmethod(int a, int b) {
11854                     return a + b;
11855             }
11856         }
11859         cat > conftest.xml << EOF
11860         <project name="conftest" default="conftest">
11861         <target name="conftest">
11862             <javac srcdir="." includes="conftest.java">
11863             </javac>
11864         </target>
11865         </project>
11868         oldJAVA_HOME=$JAVA_HOME
11869         if test "$JAVACISGCJ" = "yes"; then
11870             JAVA_HOME=; export JAVA_HOME
11871             ant_gcj="-Dbuild.compiler=gcj"
11872         fi
11873         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11874         if test $? = 0 -a -f ./conftest.class; then
11875             AC_MSG_RESULT([Ant works])
11876             if test -z "$WITH_ANT_HOME"; then
11877                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11878                 if test -z "$ANT_HOME"; then
11879                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11880                 fi
11881             else
11882                 ANT_HOME="$WITH_ANT_HOME"
11883             fi
11884         else
11885             echo "configure: Ant test failed" >&5
11886             cat conftest.java >&5
11887             cat conftest.xml >&5
11888             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11889             ANT_HOME=""
11890             add_warning "Ant does not work - Some Java projects will not build!"
11891         fi
11892         JAVA_HOME=$oldJAVA_HOME
11893         rm -f conftest* core core.* *.core
11894     fi
11895     if test -z "$ANT_HOME"; then
11896         ANT_HOME="NO_ANT_HOME"
11897     else
11898         PathFormat "$ANT_HOME"
11899         ANT_HOME="$formatted_path"
11900         PathFormat "$ANT"
11901         ANT="$ANT"
11902     fi
11903     AC_SUBST(ANT_HOME)
11904     AC_SUBST(ANT)
11906     dnl Checking for ant.jar
11907     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11908         AC_MSG_CHECKING([Ant lib directory])
11909         if test -f $ANT_HOME/lib/ant.jar; then
11910             ANT_LIB="$ANT_HOME/lib"
11911         else
11912             if test -f $ANT_HOME/ant.jar; then
11913                 ANT_LIB="$ANT_HOME"
11914             else
11915                 if test -f /usr/share/java/ant.jar; then
11916                     ANT_LIB=/usr/share/java
11917                 else
11918                     if test -f /usr/share/ant-core/lib/ant.jar; then
11919                         ANT_LIB=/usr/share/ant-core/lib
11920                     else
11921                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11922                             ANT_LIB="$ANT_HOME/lib/ant"
11923                         else
11924                             if test -f /usr/share/lib/ant/ant.jar; then
11925                                 ANT_LIB=/usr/share/lib/ant
11926                             else
11927                                 AC_MSG_ERROR([Ant libraries not found!])
11928                             fi
11929                         fi
11930                     fi
11931                 fi
11932             fi
11933         fi
11934         PathFormat "$ANT_LIB"
11935         ANT_LIB="$formatted_path"
11936         AC_MSG_RESULT([Ant lib directory found.])
11937     fi
11938     AC_SUBST(ANT_LIB)
11940     ant_minver=1.6.0
11941     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11943     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11944     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11945     ant_version_major=`echo $ant_version | cut -d. -f1`
11946     ant_version_minor=`echo $ant_version | cut -d. -f2`
11947     echo "configure: ant_version $ant_version " >&5
11948     echo "configure: ant_version_major $ant_version_major " >&5
11949     echo "configure: ant_version_minor $ant_version_minor " >&5
11950     if test "$ant_version_major" -ge "2"; then
11951         AC_MSG_RESULT([yes, $ant_version])
11952     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11953         AC_MSG_RESULT([yes, $ant_version])
11954     else
11955         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11956     fi
11958     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
11959         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
11960         rm -rf confdir
11961         mkdir confdir
11962         cat > conftest.java << EOF
11963             public class conftest {
11964                 int testmethod(int a, int b) {
11965                     return a + b;
11966                 }
11967             }
11970         cat > conftest.xml << EOF
11971             <project name="conftest" default="conftest">
11972             <target name="conftest" depends="copytest">
11973                 <javac srcdir="." includes="conftest.java">
11974                 </javac>
11975             </target>
11976             <target name="copytest">
11977                  <copy todir="confdir">
11978                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
11979                  <filterset/>
11980                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
11981                  </copy>
11982             </target>
11983             </project>
11986         if test "$JAVACISGCJ" = "yes"; then
11987             JAVA_HOME=; export JAVA_HOME
11988             ant_gcj="-Dbuild.compiler=gcj"
11989         fi
11990         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11991         if test $? = 0 -a -f ./conftest.class; then
11992             AC_MSG_RESULT([yes])
11993             rm -rf confdir
11994         else
11995             echo "configure: Ant test failed" >&5
11996             cat conftest.java >&5
11997             cat conftest.xml >&5
11998             rm -rf confdir
11999             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
12000         fi
12001     fi
12002     rm -f conftest* core core.* *.core
12005 OOO_JUNIT_JAR=
12006 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12007     AC_MSG_CHECKING([for JUnit 4])
12008     if test "$with_junit" = "yes"; then
12009         if test -e /usr/share/java/junit4.jar; then
12010             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12011         else
12012            if test -e /usr/share/lib/java/junit.jar; then
12013               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12014            else
12015               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12016            fi
12017         fi
12018     else
12019         OOO_JUNIT_JAR=$with_junit
12020     fi
12021     if test "$_os" = "WINNT"; then
12022         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12023     fi
12024     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
12025         grep org/junit/Before.class > /dev/null 2>&5
12026     if test $? -eq 0; then
12027         # check if either class-path entry is available for hamcrest or
12028         # it's bundled
12029         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
12030             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
12031             AC_MSG_RESULT([$OOO_JUNIT_JAR])
12032         else
12033             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
12034 provide a full junit jar or use --without-junit])
12035         fi
12036     else
12037         AC_MSG_RESULT([no])
12038         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
12039 location (/usr/share/java), specify its pathname via
12040 --with-junit=..., or disable it via --without-junit])
12041     fi
12042     if test $OOO_JUNIT_JAR != ""; then
12043     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12044     fi
12046 AC_SUBST(OOO_JUNIT_JAR)
12049 AC_SUBST(SCPDEFS)
12052 # check for wget and curl
12054 WGET=
12055 CURL=
12057 if test "$enable_fetch_external" != "no"; then
12059 CURL=`which curl 2>/dev/null`
12061 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12062     eval "$i --version" > /dev/null 2>&1
12063     ret=$?
12064     if test $ret -eq 0; then
12065         WGET=$i
12066         break
12067     fi
12068 done
12070 if test -z "$WGET" -a -z "$CURL"; then
12071     AC_MSG_ERROR([neither wget nor curl found!])
12076 AC_SUBST(WGET)
12077 AC_SUBST(CURL)
12080 # check for md5sum
12082 MD5SUM=
12084 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12085     if test "$i" = "md5"; then
12086         eval "$i -x" > /dev/null 2>&1
12087     else
12088         eval "$i --version" > /dev/null 2>&1
12089     fi
12090     ret=$?
12091     if test $ret -eq 0; then
12092         MD5SUM=$i
12093         break
12094     fi
12095 done
12097 if test "$MD5SUM" = "md5"; then
12098     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12099         MD5SUM="$MD5SUM -r"
12100     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12101         MD5SUM="$MD5SUM -n"
12102     fi
12105 if test -z "$MD5SUM"; then
12106     AC_MSG_ERROR([no md5sum: found!])
12109 AC_SUBST(MD5SUM)
12111 dnl ===================================================================
12112 dnl Dealing with l10n options
12113 dnl ===================================================================
12114 AC_MSG_CHECKING([which languages to be built])
12115 # get list of all languages
12116 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12117 # the sed command does the following:
12118 #   + if a line ends with a backslash, append the next line to it
12119 #   + adds " on the beginning of the value (after =)
12120 #   + adds " at the end of the value
12121 #   + removes en-US; we want to put it on the beginning
12122 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12123 [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)]
12124 ALL_LANGS="en-US $completelangiso"
12125 # check the configured localizations
12126 WITH_LANG="$with_lang"
12127 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12128     AC_MSG_RESULT([en-US])
12129 else
12130     AC_MSG_RESULT([$WITH_LANG])
12131     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12133 # check that the list is valid
12134 for lang in $WITH_LANG; do
12135     test "$lang" = "ALL" && continue
12136     # need to check for the exact string, so add space before and after the list of all languages
12137     for vl in $ALL_LANGS; do
12138         if test "$vl" = "$lang"; then
12139            break
12140         fi
12141     done
12142     if test "$vl" != "$lang"; then
12143         # if you're reading this - you prolly quoted your languages remove the quotes ...
12144         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12145     fi
12146 done
12147 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12148     echo $WITH_LANG | grep -q en-US
12149     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12151 # list with substituted ALL
12152 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12153 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12154 test "$WITH_LANG" = "en-US" && WITH_LANG=
12155 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12156     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12157     ALL_LANGS=`echo $ALL_LANGS qtz`
12159 AC_SUBST(ALL_LANGS)
12160 AC_SUBST(WITH_LANG)
12161 AC_SUBST(WITH_LANG_LIST)
12162 AC_SUBST(GIT_NEEDED_SUBMODULES)
12164 WITH_POOR_HELP_LOCALIZATIONS=
12165 if test -d "$SRC_ROOT/translations/source"; then
12166     for l in `ls -1 $SRC_ROOT/translations/source`; do
12167         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12168             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12169         fi
12170     done
12172 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12174 dnl git submodule update --reference
12175 dnl ===================================================================
12176 if test -n "${GIT_REFERENCE_SRC}"; then
12177     for repo in ${GIT_NEEDED_SUBMODULES}; do
12178         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12179             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12180         fi
12181     done
12183 AC_SUBST(GIT_REFERENCE_SRC)
12185 dnl git submodules linked dirs
12186 dnl ===================================================================
12187 if test -n "${GIT_LINK_SRC}"; then
12188     for repo in ${GIT_NEEDED_SUBMODULES}; do
12189         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12190             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12191         fi
12192     done
12194 AC_SUBST(GIT_LINK_SRC)
12196 dnl branding
12197 dnl ===================================================================
12198 AC_MSG_CHECKING([for alternative branding images directory])
12199 # initialize mapped arrays
12200 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12201 brand_files="$BRAND_INTRO_IMAGES about.svg \
12202     backing_left.png backing_right.png \
12203     backing_rtl_left.png backing_rtl_right.png \
12204     backing_space.png"
12206 if test -z "$with_branding" -o "$with_branding" = "no"; then
12207     AC_MSG_RESULT([none])
12208     DEFAULT_BRAND_IMAGES="$brand_files"
12209 else
12210     if ! test -d $with_branding ; then
12211         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12212     else
12213         AC_MSG_RESULT([$with_branding])
12214         CUSTOM_BRAND_DIR="$with_branding"
12215         for lfile in $brand_files
12216         do
12217             if ! test -f $with_branding/$lfile ; then
12218                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12219                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12220             else
12221                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12222             fi
12223         done
12224         check_for_progress="yes"
12225     fi
12227 AC_SUBST([BRAND_INTRO_IMAGES])
12228 AC_SUBST([CUSTOM_BRAND_DIR])
12229 AC_SUBST([CUSTOM_BRAND_IMAGES])
12230 AC_SUBST([DEFAULT_BRAND_IMAGES])
12233 AC_MSG_CHECKING([for 'intro' progress settings])
12234 PROGRESSBARCOLOR=
12235 PROGRESSSIZE=
12236 PROGRESSPOSITION=
12237 PROGRESSFRAMECOLOR=
12238 PROGRESSTEXTCOLOR=
12239 PROGRESSTEXTBASELINE=
12241 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12242     source "$with_branding/progress.conf"
12243     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12244 else
12245     AC_MSG_RESULT([none])
12248 AC_SUBST(PROGRESSBARCOLOR)
12249 AC_SUBST(PROGRESSSIZE)
12250 AC_SUBST(PROGRESSPOSITION)
12251 AC_SUBST(PROGRESSFRAMECOLOR)
12252 AC_SUBST(PROGRESSTEXTCOLOR)
12253 AC_SUBST(PROGRESSTEXTBASELINE)
12256 AC_MSG_CHECKING([for extra build ID])
12257 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12258     EXTRA_BUILDID="$with_extra_buildid"
12260 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12261 if test -n "$EXTRA_BUILDID" ; then
12262     AC_MSG_RESULT([$EXTRA_BUILDID])
12263 else
12264     AC_MSG_RESULT([not set])
12266 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12268 OOO_VENDOR=
12269 AC_MSG_CHECKING([for vendor])
12270 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12271     OOO_VENDOR="$USERNAME"
12273     if test -z "$OOO_VENDOR"; then
12274         OOO_VENDOR="$USER"
12275     fi
12277     if test -z "$OOO_VENDOR"; then
12278         OOO_VENDOR="`id -u -n`"
12279     fi
12281     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12282 else
12283     OOO_VENDOR="$with_vendor"
12284     AC_MSG_RESULT([$OOO_VENDOR])
12286 AC_SUBST(OOO_VENDOR)
12288 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12289 if test "$with_compat_oowrappers" = "yes"; then
12290     WITH_COMPAT_OOWRAPPERS=YES
12291     AC_MSG_RESULT(yes)
12292 else
12293     WITH_COMPAT_OOWRAPPERS=
12294     AC_MSG_RESULT(no)
12296 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12298 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
12299 AC_MSG_CHECKING([for install dirname])
12300 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12301     INSTALLDIRNAME="$with_install_dirname"
12303 AC_MSG_RESULT([$INSTALLDIRNAME])
12304 AC_SUBST(INSTALLDIRNAME)
12306 AC_MSG_CHECKING([for prefix])
12307 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12308 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12309 PREFIXDIR="$prefix"
12310 AC_MSG_RESULT([$PREFIXDIR])
12311 AC_SUBST(PREFIXDIR)
12313 LIBDIR=[$(eval echo $(eval echo $libdir))]
12314 AC_SUBST(LIBDIR)
12316 DATADIR=[$(eval echo $(eval echo $datadir))]
12317 AC_SUBST(DATADIR)
12319 MANDIR=[$(eval echo $(eval echo $mandir))]
12320 AC_SUBST(MANDIR)
12322 DOCDIR=[$(eval echo $(eval echo $docdir))]
12323 AC_SUBST(DOCDIR)
12325 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12326 AC_SUBST(INSTALLDIR)
12328 TESTINSTALLDIR="${BUILDDIR}/test-install"
12329 AC_SUBST(TESTINSTALLDIR)
12332 # ===================================================================
12333 # OAuth2 id and secrets
12334 # ===================================================================
12336 AC_MSG_CHECKING([for Google Drive client id and secret])
12337 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12338 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12339 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12340     GDRIVE_CLIENT_ID="\"\""
12343 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12344     GDRIVE_CLIENT_SECRET="\"\""
12347 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12348     AC_MSG_RESULT([not set])
12349 else
12350     AC_MSG_RESULT([set])
12353 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12354 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12356 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12357 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12358 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12359 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12360     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12363 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12364     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12367 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12368     AC_MSG_RESULT([not set])
12369 else
12370     AC_MSG_RESULT([set])
12372 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12373 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12375 # ===================================================================
12376 # De- or increase default verbosity of build process
12377 # ===================================================================
12378 AC_MSG_CHECKING([build verbosity])
12379 if test -n "$enable_verbose"; then
12380     if test "$enable_verbose" = "yes"; then
12381         VERBOSE="TRUE"
12382         AC_MSG_RESULT([high])
12383     fi
12384     if test "$enable_verbose" = "no"; then
12385         VERBOSE="FALSE"
12386         AC_MSG_RESULT([low])
12387     fi
12388 else
12389     AC_MSG_RESULT([not set])
12391 AC_SUBST(VERBOSE)
12393 dnl ===================================================================
12394 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12395 dnl --enable-dependency-tracking configure option
12396 dnl ===================================================================
12397 AC_MSG_CHECKING([whether to enable dependency tracking])
12398 if test "$enable_dependency_tracking" = "no"; then
12399     nodep=TRUE
12400     AC_MSG_RESULT([no])
12401 else
12402     AC_MSG_RESULT([yes])
12404 AC_SUBST(nodep)
12406 dnl ===================================================================
12407 dnl Number of CPUs to use during the build
12408 dnl ===================================================================
12409 AC_MSG_CHECKING([for number of processors to use])
12410 # plain --with-parallelism is just the default
12411 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12412     if test "$with_parallelism" = "no"; then
12413         PARALLELISM=1
12414     else
12415         PARALLELISM=$with_parallelism
12416     fi
12417 else
12418     if test "$enable_icecream" = "yes"; then
12419         PARALLELISM="10"
12420     else
12421         case `uname -s` in
12423         Darwin|FreeBSD|NetBSD|OpenBSD)
12424             PARALLELISM=`sysctl -n hw.ncpu`
12425             ;;
12427         Linux)
12428             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12429         ;;
12430         # what else than above does profit here *and* has /proc?
12431         *)
12432             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12433             ;;
12434         esac
12436         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12437         # unexpected format, 'wc -l' will have returned 0.
12438         if test "$PARALLELISM" -eq 0; then
12439             PARALLELISM=1
12440         fi
12441     fi
12444 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12445     if test -z "$with_parallelism"; then
12446             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12447             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12448             PARALLELISM="1"
12449     else
12450         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."
12451     fi
12454 AC_MSG_RESULT([$PARALLELISM])
12455 AC_SUBST(PARALLELISM)
12458 # Set up ILIB for MSVC build
12460 if test "$build_os" = "cygwin"; then
12461     ILIB="."
12462     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12463         ILIB="$ILIB;$JAVA_HOME/lib"
12464     fi
12465     if test "$BITNESS_OVERRIDE" = 64; then
12466         ILIB="$ILIB;$COMPATH/lib/amd64"
12467         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12468         if test "$WINDOWS_SDK_VERSION" = "80"; then
12469             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12470         fi
12471     else
12472         ILIB="$ILIB;$COMPATH/lib"
12473         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12474         if test "$WINDOWS_SDK_VERSION" = "80"; then
12475             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12476         fi
12477     fi
12478     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12480     if test "$ENABLE_DIRECTX" = "TRUE"; then
12481         ILIB="$ILIB;$DIRECTXSDK_LIB"
12482     fi
12483     AC_SUBST(ILIB)
12487 # ===================================================================
12488 # Creating bigger shared library to link against
12489 # ===================================================================
12490 AC_MSG_CHECKING([whether to create huge library])
12491 MERGELIBS=
12493 if test $_os = iOS -o $_os = Android; then
12494     # Never any point in mergelibs for these as we build just static
12495     # libraries anyway...
12496     enable_mergelibs=no
12499 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12500     if test $_os != Linux -a $_os != WINNT; then
12501         add_warning "--enable-mergelibs is not tested for this platform"
12502     fi
12503     if test "$enable_mergelibs" = "all"; then
12504         MERGELIBS="ALL"
12505         URELIBS="TRUE"
12506     else
12507         MERGELIBS="CORE"
12508     fi
12509     AC_MSG_RESULT([yes])
12510 else
12511     AC_MSG_RESULT([no])
12513 AC_SUBST([MERGELIBS])
12514 AC_SUBST([URELIBS])
12516 # ===================================================================
12517 # Create hardlinks on deliver instead of copying for smaller size and speed up
12518 # ===================================================================
12519 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12520 HARDLINKDELIVER=
12521 if test "$enable_hardlink_deliver" = "yes"; then
12522     HARDLINKDELIVER="TRUE"
12523     AC_MSG_RESULT([yes])
12524 else
12525     AC_MSG_RESULT([no])
12527 AC_SUBST(HARDLINKDELIVER)
12529 dnl ===================================================================
12530 dnl icerun is a wrapper that stops us spawning tens of processes
12531 dnl locally - for tools that can't be executed on the compile cluster
12532 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12533 dnl ===================================================================
12534 AC_MSG_CHECKING([whether to use icerun wrapper])
12535 ICECREAM_RUN=
12536 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12537     ICECREAM_RUN=icerun
12538     AC_MSG_RESULT([yes])
12539 else
12540     AC_MSG_RESULT([no])
12542 AC_SUBST(ICECREAM_RUN)
12544 dnl ===================================================================
12546 AC_MSG_CHECKING([MPL subset])
12547 MPL_SUBSET=
12549 if test "$enable_mpl_subset" = "yes"; then
12550     warn_report=false
12551     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12552         warn_report=true
12553     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12554         warn_report=true
12555     fi
12556     if test "$warn_report" = "true"; then
12557         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12558     fi
12559     if test "x$enable_postgresql_sdbc" != "xno"; then
12560         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12561     fi
12562     if test "$enable_lotuswordpro" = "yes"; then
12563         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12564     fi
12565     if test "$enable_neon" != "no" -o "x$DISABLE_NEON" != "xTRUE"; then
12566         AC_MSG_ERROR([need to --disable-neon - webdav support.])
12567     fi
12568     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12569         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12570     fi
12571     if test -n "$ENABLE_PDFIMPORT"; then
12572         if test "x$SYSTEM_POPPLER" != "xNO"; then
12573             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12574         fi
12575     fi
12576     # cf. m4/libo_check_extension.m4
12577     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12578         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12579     fi
12580     for theme in $WITH_THEMES; do
12581         case $theme in
12582         crystal|default|hicontrast|human|oxygen|sifr)
12583             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12584         *) : ;;
12585         esac
12586     done
12587     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12588         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12589     fi
12590     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12591         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12592     fi
12594     MPL_SUBSET="TRUE"
12595     AC_DEFINE(MPL_HAVE_SUBSET)
12596     AC_MSG_RESULT([only])
12597 else
12598     AC_MSG_RESULT([no restrictions])
12600 AC_SUBST(MPL_SUBSET)
12603 dnl ===================================================================
12604 dnl Setting up the environment.
12605 dnl ===================================================================
12606 echo "setting up the build environment variables..."
12608 AC_SUBST(COMPATH)
12610 if test "$build_os" = "cygwin"; then
12611     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12612         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12613         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12614     else
12615         ATL_LIB="$COMPATH/atlmfc/lib"
12616         ATL_INCLUDE="$COMPATH/atlmfc/include"
12617     fi
12618     if test "$BITNESS_OVERRIDE" = 64; then
12619         ATL_LIB="$ATL_LIB/amd64"
12620     fi
12621     PathFormat "/usr/bin/grep.exe"
12622     WIN_GREP="$formatted_path"
12623     PathFormat "/usr/bin/find.exe"
12624     WIN_FIND="$formatted_path"
12625     PathFormat "/usr/bin/ls.exe"
12626     WIN_LS="$formatted_path"
12627     PathFormat "/usr/bin/touch.exe"
12628     WIN_TOUCH="$formatted_path"
12631 AC_SUBST(ATL_INCLUDE)
12632 AC_SUBST(ATL_LIB)
12633 AC_SUBST(WIN_FIND)
12634 AC_SUBST(WIN_GREP)
12635 AC_SUBST(WIN_LS)
12636 AC_SUBST(WIN_TOUCH)
12638 AC_SUBST(BUILD_TYPE)
12640 AC_SUBST(SOLARINC)
12641 AC_SUBST(SOLARLIB)
12643 PathFormat "$PERL"
12644 PERL="$formatted_path"
12645 AC_SUBST(PERL)
12647 if test -n "$TMPDIR"; then
12648     TEMP_DIRECTORY="$TMPDIR"
12649 else
12650     TEMP_DIRECTORY="/tmp"
12652 if test "$build_os" = "cygwin"; then
12653     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12655 AC_SUBST(TEMP_DIRECTORY)
12657 # setup the PATH for the environment
12658 if test -n "$LO_PATH_FOR_BUILD"; then
12659     LO_PATH="$LO_PATH_FOR_BUILD"
12660 else
12661     LO_PATH="$PATH"
12663     case "$host_os" in
12665     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12666         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12667             pathmunge "$JAVA_HOME/bin" "after"
12668         fi
12669         ;;
12671     cygwin*)
12672         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12673         pathmunge "$ASM_HOME" "before"
12674         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12675         pathmunge "$CSC_PATH" "before"
12676         pathmunge "$MIDL_PATH" "before"
12677         pathmunge "$AL_PATH" "before"
12678         pathmunge "$MSPDB_PATH" "before"
12679         if test "$BITNESS_OVERRIDE" = 64; then
12680             pathmunge "$COMPATH/bin/amd64" "before"
12681             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12682         else
12683             pathmunge "$COMPATH/bin" "before"
12684             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12685         fi
12686         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12687             if test -d "$JAVA_HOME/jre/bin/client"; then
12688                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12689             fi
12690             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12691                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12692             fi
12693             pathmunge "$JAVA_HOME/bin" "before"
12694         fi
12695         ;;
12697     solaris*)
12698         pathmunge "/usr/css/bin" "before"
12699         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12700             pathmunge "$JAVA_HOME/bin" "after"
12701         fi
12702         ;;
12703     esac
12705     pathmunge "$SRC_ROOT/solenv/bin" "before"
12706     pathmunge "." "before"
12709 AC_SUBST(LO_PATH)
12711 # Generate a configuration md5 we can use for deps
12712 if test -f config_host.mk; then
12713     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12716 AC_CONFIG_FILES([config_host.mk
12717                  Makefile
12718                  lo.xcent
12719                  instsetoo_native/util/openoffice.lst
12720                  sysui/desktop/macosx/Info.plist
12721                  ios/lo.xcconfig])
12722 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12723 AC_CONFIG_HEADERS([config_host/config_clang.h])
12724 AC_CONFIG_HEADERS([config_host/config_eot.h])
12725 AC_CONFIG_HEADERS([config_host/config_features.h])
12726 AC_CONFIG_HEADERS([config_host/config_folders.h])
12727 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12728 AC_CONFIG_HEADERS([config_host/config_global.h])
12729 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12730 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12731 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12732 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12733 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12734 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12735 AC_CONFIG_HEADERS([config_host/config_oox.h])
12736 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12737 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12738 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12739 AC_CONFIG_HEADERS([config_host/config_version.h])
12740 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12741 AC_OUTPUT
12743 if test "$CROSS_COMPILING" = YES; then
12744     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12747 # touch the config timestamp file
12748 if test ! -f config_host.mk.stamp; then
12749     echo > config_host.mk.stamp
12750 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12751     echo "Configuration unchanged - avoiding scp2 stamp update"
12752 else
12753     echo > config_host.mk.stamp
12757 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12758 cat << _EOS
12759 ****************************************************************************
12760 WARNING:
12761 Your make version is known to be horribly slow, and hard to debug
12762 problems with. To get a reasonably functional make please do:
12764 to install a pre-compiled binary make for cygwin
12766 mkdir -p /opt/lo/bin
12767 cd /opt/lo/bin
12768 wget http://dev-www.libreoffice.org/bin/cygwin/make
12769 chmod +x make
12771 to install from source:
12772 place yourself in a working directory of you choice.
12774 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
12775 cd dev-tools/make-3.82-gbuild
12776 ./configure --prefix=/opt/lo
12777 make
12778 make install
12780 Then re-run autogen.sh
12782 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12783 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12785 _EOS
12788 cat << _EOF
12789 ****************************************************************************
12791 To build, issue:
12792 $GNUMAKE
12794 For details, run:
12795 $GNUMAKE help
12797 _EOF
12799 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
12800     cat << _EOF
12801 After the build has finished, your can immediately run it using:
12802 instdir/program/soffice
12804 If you want to run the smoketest, issue:
12805 $GNUMAKE check
12807 _EOF
12810 if test -f warn; then
12811     cat warn
12812     rm warn
12815 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: