More -WaE: nested template problems.
[LibreOffice.git] / configure.ac
blob557dbe3ec9395efd6be76feb2f08f659adebfe62
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.4.0.0.alpha0+],[],[],[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                 new_formatted_path=`realpath "$formatted_path"`
52                 if test $? -ne 0;  then
53                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
54                 else
55                     formatted_path="$new_formatted_path"
56                 fi
57             fi
58             formatted_path=`cygpath -m "$formatted_path"`
59             if test $? -ne 0;  then
60                 AC_MSG_ERROR([path conversion failed for "$1".])
61             fi
62         fi
63     fi
66 AbsolutePath()
68     # There appears to be no simple and portable method to get an absolute and
69     # canonical path, so we try creating the directory if does not exist and
70     # utilizing the shell and pwd.
71     rel="$1"
72     absolute_path=""
73     test ! -e "$rel" && mkdir -p "$rel"
74     if test -d "$rel" ; then
75         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
76         absolute_path="$(pwd)"
77         cd - &> /dev/null
78     else
79         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
80     fi
83 rm -f warn
84 have_WARNINGS="no"
85 add_warning()
87     if test "$have_WARNINGS" = "no"; then
88         echo "*************************************" > warn
89         have_WARNINGS="yes"
90         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
91             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
92             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
93         else
94             COLORWARN="* WARNING :"
95         fi
96     fi
97     echo "$COLORWARN $@" >> warn
100 echo "********************************************************************"
101 echo "*"
102 echo "*   Running ${PACKAGE_NAME} build configuration."
103 echo "*"
104 echo "********************************************************************"
105 echo ""
107 dnl ===================================================================
108 dnl checks build and host OSes
109 dnl do this before argument processing to allow for platform dependent defaults
110 dnl ===================================================================
111 AC_CANONICAL_HOST
113 AC_MSG_CHECKING([for product name])
114 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
115     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
116 else
117     PRODUCTNAME=AC_PACKAGE_NAME
119 AC_MSG_RESULT([$PRODUCTNAME])
120 AC_SUBST(PRODUCTNAME)
122 dnl ===================================================================
123 dnl Our version is defined by the AC_INIT() at the top of this script.
124 dnl ===================================================================
126 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
128 LIBO_VERSION_MAJOR=$1
129 LIBO_VERSION_MINOR=$2
130 LIBO_VERSION_MICRO=$3
131 LIBO_VERSION_PATCH=$4
133 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
134 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
135 # no way to encode that into an integer in general.
136 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
138 LIBO_VERSION_SUFFIX=$5
139 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
140 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
141 # they get undoubled before actually passed to sed.
142 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
143 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
144 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
145 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
147 AC_SUBST(LIBO_VERSION_MAJOR)
148 AC_SUBST(LIBO_VERSION_MINOR)
149 AC_SUBST(LIBO_VERSION_MICRO)
150 AC_SUBST(LIBO_VERSION_PATCH)
151 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
152 AC_SUBST(LIBO_VERSION_SUFFIX)
153 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
155 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
156 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
157 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
158 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
160 LIBO_THIS_YEAR=`date +%Y`
161 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
163 # This UPD silly thing must go away soon
164 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
165 AC_SUBST(UPD)
167 # This too should go away
168 SOURCEVERSION="OOO$UPD"
169 AC_SUBST(SOURCEVERSION)
171 dnl ===================================================================
172 dnl Product version
173 dnl ===================================================================
174 AC_MSG_CHECKING([for product version])
175 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
176 AC_MSG_RESULT([$PRODUCTVERSION])
177 AC_SUBST(PRODUCTVERSION)
179 AC_PROG_EGREP
180 # AC_PROG_EGREP doesn't set GREP on all systems as well
181 AC_PATH_PROG(GREP, grep)
183 BUILDDIR=`pwd`
184 cd $srcdir
185 SRC_ROOT=`pwd`
186 cd $BUILDDIR
187 x_Cygwin=[\#]
189 if test "$build_os" = "cygwin"; then
190     PathFormat "$SRC_ROOT"
191     SRC_ROOT="$formatted_path"
192     PathFormat "$BUILDDIR"
193     BUILDDIR="$formatted_path"
194     x_Cygwin=
197 AC_SUBST(SRC_ROOT)
198 AC_SUBST(BUILDDIR)
199 AC_SUBST(x_Cygwin)
200 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
201 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
203 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
204     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
207 # need sed in os checks...
208 AC_PATH_PROGS(SED, sed)
209 if test -z "$SED"; then
210     AC_MSG_ERROR([install sed to run this script])
213 # Set the ENABLE_LTO variable
214 # ===================================================================
215 AC_MSG_CHECKING([whether to use link-time optimization])
216 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
217     ENABLE_LTO="TRUE"
218     AC_MSG_RESULT([yes])
219     AC_DEFINE(STATIC_LINKING)
220 else
221     ENABLE_LTO=""
222     AC_MSG_RESULT([no])
224 AC_SUBST(ENABLE_LTO)
226 dnl ===================================================================
227 dnl When building for Android, --with-android-ndk,
228 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
229 dnl mandatory
230 dnl ===================================================================
232 AC_ARG_WITH(android-ndk,
233     AS_HELP_STRING([--with-android-ndk],
234         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
237 AC_ARG_WITH(android-ndk-toolchain-version,
238     AS_HELP_STRING([--with-android-ndk-toolchain-version],
239         [Specify which toolchain version to use, of those present in the
240         Android NDK you are using. Mandatory if the NDK used has several
241         toolchain versions for the host architecture you are building for.
242         Possible values are 4.6, 4.8, clang3.3 and clang3.4. Only 4.8 has been
243         tested for real...]), ,)
245 AC_ARG_WITH(android-sdk,
246     AS_HELP_STRING([--with-android-sdk],
247         [Specify location of the Android SDK. Mandatory when building for Android,
248         or when building the Impress Remote Android app.]),
251 ANDROID_NDK_HOME=
252 if test -n "$with_android_ndk"; then
253     ANDROID_NDK_HOME=$with_android_ndk
255     # Set up a lot of pre-canned defaults
257     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
258         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
259     fi
260     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
262     case $ANDROID_NDK_VERSION in
263     r8*|r9*)
264         ;;
265     *)
266         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* and r9* versions are supported])
267         ;;
268     esac
270     if test $host_cpu = arm; then
271         android_cpu=arm
272         android_platform_prefix=$android_cpu-linux-androideabi
273     elif test $host_cpu = mips; then
274         android_cpu=mips
275         android_platform_prefix=$android_cpu-linux-androideabi
276     else
277         # host_cpu is something like "i386" or "i686" I guess, NDK uses
278         # "x86" in some contexts
279         android_cpu=x86
280         android_platform_prefix=$android_cpu
281     fi
283     case "$with_android_ndk_toolchain_version" in
284     4.6|4.7|4.8)
285         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
286         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
287         ;;
288     clang3.3|clang3.4)
289         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
290         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
291         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
292         ANDROID_USING_CLANG=true
293         ;;
294     *)
295         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
296     esac
298     if test ! -d $ANDROID_BINUTILS_DIR; then
299         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
300     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
301         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
302     fi
304     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
305     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
306     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
307     # manage to link the (app-specific) single huge .so that is built for the apps in
308     # android/experimental/* if there is debug information in a significant part of the object files.
309     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
310     # all objects have been built with debug information.)
311     toolchain_system='*'
312     if test $build_os = linux-gnu; then
313         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
314         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
315         if test $build_cpu = x86_64; then
316             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
317                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
318             fi
319             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
320                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
321             fi
322         fi
323         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
324     fi
326     # This stays empty if there is just one version of the toolchain in the NDK
327     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
328     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
329     */bin\ */bin*)
330         # Trailing slash intentional and necessary, compare to how this is used
331         if test -n "$ANDROID_USING_CLANG"; then
332             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
333         else
334             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
335         fi
336         ;;
337     esac
339     if test $host_cpu = arm; then
340        android_gnu_prefix=arm-linux-androideabi
341     elif test $host_cpu = mips; then
342        android_gnu_prefix=mipsel-linux-android
343     elif test $ANDROID_NDK_VERSION = r8; then
344         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
345         android_gnu_prefix=i686-android-linux
346     else
347         android_gnu_prefix=i686-linux-android
348     fi
350     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu
351     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
352     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
353     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
354     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
355     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
357     if test $host_cpu = arm; then
358         ANDROID_APP_ABI=armeabi-v7a
359         if test -n "$ANDROID_USING_CLANG"; then
360             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
361             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
362             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
363         else
364             :
365         fi
366         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
367         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
368     elif test $host_cpu = mips; then
369         ANDROID_APP_ABI=mips
370         ANDROIDCFLAGS=""
371     else # x86
372         ANDROID_APP_ABI=x86
373         ANDROIDCFLAGS="-march=atom"
374     fi
375     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
376     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
377     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu"
378     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
380     if test -n "$ANDROID_USING_CLANG"; then
381         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
382     else
383         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
384     fi
386     # When using the 4.6 or newer toolchain, use the gold linker
387     case "$with_android_ndk_toolchain_version" in
388     4.[[6789]]*|[[56789]].*|clang*)
389         # The NDK doesn't have ld.gold for MIPS for some reason
390         if test "$host_cpu" != mips -a "$ENABLE_LTO" != TRUE; then
391             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
392         fi
393         ;;
394     esac
396     if test "$ENABLE_LTO" = TRUE; then
397         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
398         # $CC and $CXX when building external libraries
399         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
400     fi
402     # gdbserver can be in different locations
403     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
404         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
405     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
406         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
407     else
408         AC_MSG_ERROR([Can't find gdbserver for your Android target])
409     fi
411     if test $host_cpu = arm; then
412         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"
413     elif test $host_cpu = mips; then
414         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"
415     else # x86
416         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"
417     fi
419     if test -z "$CC"; then
420         case "$with_android_ndk_toolchain_version" in
421         4.*)
422             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
423             ;;
424         clang*)
425             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
426         esac
427     fi
428     if test -z "$CXX"; then
429         case "$with_android_ndk_toolchain_version" in
430         4.*)
431             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
432             ;;
433         clang*)
434             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
435             ;;
436         esac
437     fi
439 AC_SUBST(ANDROID_NDK_GDBSERVER)
440 AC_SUBST(ANDROID_APP_ABI)
442 dnl ===================================================================
443 dnl Also --with-android-sdk is mandatory
444 dnl ===================================================================
445 ANDROID_SDK_HOME=
446 if test -n "$with_android_sdk"; then
447     ANDROID_SDK_HOME=$with_android_sdk
448     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
450 AC_SUBST(ANDROID_SDK_HOME)
452 dnl ===================================================================
453 dnl The following is a list of supported systems.
454 dnl Sequential to keep the logic very simple
455 dnl These values may be checked and reset later.
456 dnl ===================================================================
457 #defaults unless the os test overrides this:
458 test_randr=yes
459 test_xrender=yes
460 test_cups=yes
461 test_dbus=yes
462 test_fontconfig=yes
463 test_cairo=no
465 # Default values, as such probably valid just for Linux, set
466 # differently below just for Mac OSX,but at least better than
467 # hardcoding these as we used to do. Much of this is duplicated also
468 # in solenv for old build system and for gbuild, ideally we should
469 # perhaps define stuff like this only here in configure.ac?
471 LINKFLAGSSHL="-shared"
472 PICSWITCH="-fpic"
473 DLLPOST=".so"
475 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
477 INSTROOTSUFFIX=
478 SDKDIRNAME=sdk
480 case "$host_os" in
482 solaris*)
483     test_gtk=yes
484     build_gstreamer=yes
485     build_gstreamer_0_10=yes
486     test_tde=yes
487     test_kde=yes
488     test_freetype=yes
489     test_gstreamer=yes
490     _os=SunOS
492     dnl ===========================================================
493     dnl Check whether we're using Solaris 10 - SPARC or Intel.
494     dnl ===========================================================
495     AC_MSG_CHECKING([the Solaris operating system release])
496     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
497     if test "$_os_release" -lt "10"; then
498         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
499     else
500         AC_MSG_RESULT([ok ($_os_release)])
501     fi
503     dnl Check whether we're using a SPARC or i386 processor
504     AC_MSG_CHECKING([the processor type])
505     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
506         AC_MSG_RESULT([ok ($host_cpu)])
507     else
508         AC_MSG_ERROR([only SPARC and i386 processors are supported])
509     fi
510     ;;
512 linux-gnu*|k*bsd*-gnu*)
513     test_gtk=yes
514     build_gstreamer=yes
515     build_gstreamer_0_10=yes
516     test_tde=yes
517     test_kde=yes
518     test_kde4=yes
519     test_freetype=yes
520     _os=Linux
521     ;;
523 gnu)
524     test_randr=no
525     test_xrender=no
526     _os=GNU
527      ;;
529 cygwin*|interix*|mingw32*)
531     # When building on Windows normally with MSVC under Cygwin,
532     # configure thinks that the host platform (the platform the
533     # built code will run on) is Cygwin, even if it obviously is
534     # Windows, which in Autoconf terminology is called
535     # "mingw32". (Which is misleading as MinGW is the name of the
536     # tool-chain, not an operating system.)
538     # Somewhat confusing, yes. But this configure script doesn't
539     # look at $host etc that much, it mostly uses its own $_os
540     # variable, set here in this case statement.
542     # When cross-compiling to Windows from Unix, the host platform
543     # is "mingw32" (because in that case it is the MinGW
544     # tool-chain that is used).
546     test_cups=no
547     test_dbus=no
548     test_randr=no
549     test_xrender=no
550     test_freetype=no
551     test_fontconfig=no
552     _os=WINNT
554     DLLPOST=".dll"
555     LINKFLAGSNOUNDEFS=
557     # If the host OS matches "mingw32*", that means we are using the
558     # MinGW cross-compiler, because we don't see the point in building
559     # LibreOffice using MinGW on Windows. If you want to build on
560     # Windows, use MSVC. If you want to use MinGW, surely you want to
561     # cross-compile (from Linux or some other Unix).
563     case "$host_os" in
564     mingw32*)
565         WITH_MINGW=yes
566         if test -z "$CC"; then
567             CC="$host_cpu-$host_vendor-$host_os-gcc"
568         fi
569         if test -z "$CXX"; then
570             CXX="$host_cpu-$host_vendor-$host_os-g++"
571         fi
572         ;;
573     esac
574     ;;
576 darwin*) # Mac OS X or iOS
577     test_gtk=yes
578     test_randr=no
579     test_xrender=no
580     test_freetype=no
581     test_fontconfig=no
582     test_dbus=no
583     if test "$host_cpu" = "arm"; then
584         _os=iOS
585         test_gtk=no
586         test_cups=no
587     else
588         _os=Darwin
589         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
590         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
591     fi
592     enable_systray=no
593     # See comment above the case "$host_os"
594     LINKFLAGSSHL="-dynamiclib -single_module"
596     # -fPIC is default
597     PICSWITCH=""
599     DLLPOST=".dylib"
601     # -undefined error is the default
602     LINKFLAGSNOUNDEFS=""
605 freebsd*)
606     test_gtk=yes
607     build_gstreamer=yes
608     build_gstreamer_0_10=yes
609     test_tde=yes
610     test_kde=yes
611     test_kde4=yes
612     test_freetype=yes
613     AC_MSG_CHECKING([the FreeBSD operating system release])
614     if test -n "$with_os_version"; then
615         OSVERSION="$with_os_version"
616     else
617         OSVERSION=`/sbin/sysctl -n kern.osreldate`
618     fi
619     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
620     AC_MSG_CHECKING([which thread library to use])
621     if test "$OSVERSION" -lt "500016"; then
622         PTHREAD_CFLAGS="-D_THREAD_SAFE"
623         PTHREAD_LIBS="-pthread"
624     elif test "$OSVERSION" -lt "502102"; then
625         PTHREAD_CFLAGS="-D_THREAD_SAFE"
626         PTHREAD_LIBS="-lc_r"
627     else
628         PTHREAD_CFLAGS=""
629         PTHREAD_LIBS="-pthread"
630     fi
631     AC_MSG_RESULT([$PTHREAD_LIBS])
632     _os=FreeBSD
633     ;;
635 *netbsd*)
636     test_gtk=yes
637     build_gstreamer=yes
638     build_gstreamer_0_10=yes
639     test_tde=no
640     test_kde=no
641     test_kde4=yes
642     test_freetype=yes
643     PTHREAD_LIBS="-pthread -lpthread"
644     _os=NetBSD
645     ;;
647 aix*)
648     test_randr=no
649     test_freetype=yes
650     PTHREAD_LIBS=-pthread
651     _os=AIX
652     ;;
654 openbsd*)
655     test_gtk=yes
656     test_tde=yes
657     test_kde=yes
658     test_freetype=yes
659     PTHREAD_CFLAGS="-D_THREAD_SAFE"
660     PTHREAD_LIBS="-pthread"
661     _os=OpenBSD
662     ;;
664 dragonfly*)
665     test_gtk=yes
666     build_gstreamer=yes
667     build_gstreamer_0_10=yes
668     test_tde=yes
669     test_kde=yes
670     test_kde4=yes
671     test_freetype=yes
672     PTHREAD_LIBS="-pthread"
673     _os=DragonFly
674     ;;
676 linux-android*)
677     build_gstreamer=no
678     build_gstreamer_0_10=no
679     enable_lotuswordpro=no
680     enable_mpl_subset=yes
681     enable_opengl=no
682     enable_coinmp=yes
683     enable_lpsolve=no
684     enable_report_builder=no
685     with_theme="tango"
686     test_cups=no
687     test_dbus=no
688     test_fontconfig=no
689     test_freetype=no
690     test_gtk=no
691     test_tde=no
692     test_kde=no
693     test_kde4=no
694     test_randr=no
695     test_xrender=no
696     _os=Android
698     if test -z "$with_android_ndk"; then
699         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
700     fi
702     if test -z "$with_android_ndk_toolchain_version"; then
703         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
704     fi
706     # Verify that the NDK and SDK options are proper
707     if test ! -f "$ANDROID_NDK_HOME/platforms/android-15/arch-arm/usr/lib/libc.a"; then
708         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
709     fi
711     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
712     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
713     ;;
716     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
717     ;;
718 esac
720 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
721     if test -z "$with_android_sdk"; then
722         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
723     fi
725     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
726         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
727     fi
730 if test "$_os" = "AIX"; then
731     AC_PATH_PROG(GAWK, gawk)
732     if test -z "$GAWK"; then
733         AC_MSG_ERROR([gawk not found in \$PATH])
734     fi
737 AC_SUBST(SDKDIRNAME)
739 AC_SUBST(WITH_MINGW)
740 AC_SUBST(PTHREAD_CFLAGS)
741 AC_SUBST(PTHREAD_LIBS)
743 ###############################################################################
744 # Extensions switches --enable/--disable
745 ###############################################################################
746 # By default these should be enabled unless having extra dependencies.
747 # If there is extra dependency over configure options then the enable should
748 # be automagic based on whether the requiring feature is enabled or not.
749 # All this options change anything only with --enable-extension-integration.
751 # The name of this option and its help string makes it sound as if
752 # extensions are built anyway, just not integrated in the installer,
753 # if you use --disable-extension-integration. Is that really the
754 # case?
756 AC_ARG_ENABLE(extension-integration,
757     AS_HELP_STRING([--disable-extension-integration],
758         [Disable integration of the built extensions in the installer of the
759          product. Use this switch to disable the integration.])
762 AC_ARG_ENABLE(export,
763     AS_HELP_STRING([--disable-export],
764         [Disable (some) code for document export. Useful when building viewer-only apps that lack
765          save/export functionality, to avoid having an excessive amount of code and data used
766          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
769 AC_ARG_ENABLE(avmedia,
770     AS_HELP_STRING([--disable-avmedia],
771         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
774 AC_ARG_ENABLE(database-connectivity,
775     AS_HELP_STRING([--disable-database-connectivity],
776         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
779 # This doesn't mean not building (or "integrating") extensions
780 # (although it probably should; i.e. it should imply
781 # --disable-extension-integration I guess), it means not supporting
782 # any extension mechanism at all
783 AC_ARG_ENABLE(extensions,
784     AS_HELP_STRING([--disable-extensions],
785         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
788 AC_ARG_ENABLE(scripting,
789     AS_HELP_STRING([--disable-scripting],
790         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
793 # This is mainly for Android and iOS, but could potentially be used in some
794 # special case otherwise, too, so factored out as a separate setting
796 AC_ARG_ENABLE(dynamic-loading,
797     AS_HELP_STRING([--disable-dynamic-loading],
798         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
801 AC_ARG_ENABLE(ext-mariadb-connector,
802     AS_HELP_STRING([--enable-ext-mariadb-connector],
803         [Enable the build of the MariaDB/MySQL Connector extension.])
806 AC_ARG_ENABLE(report-builder,
807     AS_HELP_STRING([--disable-report-builder],
808         [Disable the Report Builder.])
811 AC_ARG_ENABLE(ext-wiki-publisher,
812     AS_HELP_STRING([--enable-ext-wiki-publisher],
813         [Enable the Wiki Publisher extension.])
816 AC_ARG_ENABLE(lpsolve,
817     AS_HELP_STRING([--disable-lpsolve],
818         [Disable compilation of the lp solve solver ])
820 AC_ARG_ENABLE(coinmp,
821     AS_HELP_STRING([--disable-coinmp],
822         [Disable compilation of the CoinMP solver ])
825 AC_ARG_ENABLE(pdfimport,
826     AS_HELP_STRING([--disable-pdfimport],
827         [Disable building the PDF import feature.])
830 ###############################################################################
832 dnl ---------- *** ----------
834 AC_ARG_ENABLE([hardlink-deliver],
835     AS_HELP_STRING([--enable-hardlink-deliver],
836         [Put files into deliver folder as hardlinks instead of copying them
837         over. Saves space and speeds up build.])
840 AC_ARG_ENABLE(mergelibs,
841     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
842         [Enables linking of big, merged, library. Experimental feature, tested
843         only for Linux at some stage in history, but possibly does not work even
844         for Linux any more. 'all' will link a lot of libraries into libmerged
845         while 'yes' will do it for just a core set of libraries.])
848 AC_ARG_ENABLE(graphite,
849     AS_HELP_STRING([--enable-graphite],
850         [Enables the compilation of Graphite smart font rendering.])
853 AC_ARG_ENABLE(orcus,
854     AS_HELP_STRING([--enable-orcus],
855         [Enables orcus for extra file import filters for Calc.])
858 AC_ARG_ENABLE(fetch-external,
859     AS_HELP_STRING([--disable-fetch-external],
860         [Disables fetching external tarballs from web sources.])
863 AC_ARG_ENABLE(lockdown,
864     AS_HELP_STRING([--disable-lockdown],
865         [Disables the gconf integration work in LibreOffice.]),
868 AC_ARG_ENABLE(vba,
869     AS_HELP_STRING([--disable-vba],
870         [Disables the vba compatibility feature.])
873 AC_ARG_ENABLE(pch,
874     AS_HELP_STRING([--enable-pch],
875         [Enables precompiled header support for C++.])
878 AC_ARG_ENABLE(win-mozab-driver,
879     AS_HELP_STRING([--enable-win-mozab-driver],
880         [LibreOffice includes a driver to connect to Mozilla
881          address books under Windows, to build with this version, use this option.])
884 AC_ARG_ENABLE(epm,
885     AS_HELP_STRING([--enable-epm],
886         [LibreOffice includes self-packaging code, that requires epm, however epm is
887          useless for large scale package building.])
890 AC_ARG_ENABLE(odk,
891     AS_HELP_STRING([--disable-odk],
892         [LibreOffice includes an ODK, office development kit which some packagers may
893          wish to build without.])
896 AC_ARG_ENABLE(mpl-subset,
897     AS_HELP_STRING([--enable-mpl-subset],
898         [Don't compile any pieces which are not MPL or more liberally licensed])
901 AC_ARG_ENABLE(evolution2,
902     AS_HELP_STRING([--enable-evolution2],
903         [Allows the built-in evolution 2 addressbook connectivity build to be
904          enabled.])
907 AC_ARG_ENABLE(directx,
908     AS_HELP_STRING([--disable-directx],
909         [Remove DirectX implementation for the new XCanvas interface.
910          The DirectX support requires more stuff installed on Windows to
911          compile. (DirectX SDK, GDI+ libs)])
914 AC_ARG_ENABLE(activex,
915     AS_HELP_STRING([--disable-activex],
916         [Disable the use of ActiveX for a Windows build.
917         This switch is mandatory when using an Express edition of Visual Studio.])
920 AC_ARG_ENABLE(atl,
921     AS_HELP_STRING([--disable-atl],
922         [Disable the use of ATL for a Windows build.])
923     [
924         This switch is mandatory when using an Express edition of Visual Studio.
925     ],
928 AC_ARG_ENABLE(avahi,
929     AS_HELP_STRING([--enable-avahi],
930         [Determines whether to use Avahi to advertise Impress to remote controls.]),
933 AC_ARG_ENABLE(werror,
934     AS_HELP_STRING([--enable-werror],
935         [Turn warnings to errors. (Has no effect in modules where the treating
936          of warnings as errors is disabled explicitly.)]),
939 AC_ARG_ENABLE(assert-always-abort,
940     AS_HELP_STRING([--enable-assert-always-abort],
941         [make assert() abort even in release code.]),
944 AC_ARG_ENABLE(dbgutil,
945     AS_HELP_STRING([--enable-dbgutil],
946         [Provide debugging support from --enable-debug and include additional debugging
947          utilities such as object counting or more expensive checks.
948          This is the recommended option for developers.
949          Note that this makes the build ABI incompatible, it is not possible to mix object
950          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
952 AC_ARG_ENABLE(debug,
953     AS_HELP_STRING([--enable-debug],
954         [Include debugging information, disable compiler optimization and inlining plus
955          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
957 AC_ARG_ENABLE(selective-debuginfo,
958     AS_HELP_STRING([--enable-selective-debuginfo],
959         [If --enable-debug or --enable-dbgutil is used, build debugging information
960          (-g compiler flag) only for the specified gbuild build targets
961          (where all means everything, - prepended means not to enable, / appended means
962          everything in the directory; there is no ordering, more specific overrides
963          more general, and disabling takes precedence).
964          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
966 AC_ARG_ENABLE(symbols,
967     AS_HELP_STRING([--enable-symbols],
968         [Include debugging symbols in output while preserve optimization.
969          This enables -g compiler flag for GCC or equivalent,
970          without changing anything else compared to productive code.]))
972 AC_ARG_ENABLE(runtime-optimizations,
973     AS_HELP_STRING([--disable-runtime-optimizations],
974         [Statically disable certain runtime optimizations (like rtl/alloc.h or
975          JVM JIT) that are known to interact badly with certain dynamic analysis
976          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
977          CC contains "-fsanitize=address".  (For Valgrind, those runtime
978          optimizations are typcially disabled dynamically via
979          RUNNING_ON_VALGRIND.)]))
981 AC_ARG_ENABLE(compiler-plugins,
982     AS_HELP_STRING([--enable-compiler-plugins],
983         [Enable compiler plugins that will perform additional checks during
984          building. Enabled automatically by --enable-dbgutil.]))
986 AC_ARG_ENABLE(ooenv,
987     AS_HELP_STRING([--disable-ooenv],
988         [Disable ooenv for the instdir installation.]))
990 AC_ARG_ENABLE(lto,
991     AS_HELP_STRING([--enable-lto],
992         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
993          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
994          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
995          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
996          are working on it.)]))
998 AC_ARG_ENABLE(crashdump,
999     AS_HELP_STRING([--enable-crashdump],
1000         [Enable the crashdump feature.]))
1002 AC_ARG_ENABLE(python,
1003     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1004         [Enables or disables Python support at run-time and build-time.
1005          Also specifies what Python to use. 'auto' is the default.
1006          'fully-internal' even forces the internal version for uses of Python
1007          during the build (for testing purposes, mainly).]))
1009 AC_ARG_ENABLE(gtk,
1010     AS_HELP_STRING([--disable-gtk],
1011         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1012 ,enable_gtk=yes)
1014 AC_ARG_ENABLE(gtk3,
1015     AS_HELP_STRING([--enable-gtk3],
1016         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1017 ,enable_gtk3=no)
1019 AC_ARG_ENABLE(systray,
1020     AS_HELP_STRING([--disable-systray],
1021         [Determines whether to build the systray quickstarter.]),
1022 ,enable_systray=yes)
1024 AC_ARG_ENABLE(split-app-modules,
1025     AS_HELP_STRING([--enable-split-app-modules],
1026         [Split file lists for app modules, e.g. base, calc.
1027          Has effect only with make distro-pack-install]),
1030 AC_ARG_ENABLE(split-opt-features,
1031     AS_HELP_STRING([--enable-split-opt-features],
1032         [Split file lists for some optional features, .e.g. pyuno, testtool.
1033          Has effect only with make distro-pack-install]),
1036 AC_ARG_ENABLE(cairo-canvas,
1037 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1038                           platforms where Cairo is available.
1041 AC_ARG_ENABLE(opengl,
1042     AS_HELP_STRING([--disable-opengl],
1043         [Determines whether to build the OpenGL 3D slide transitions and canvas component.]))
1045 AC_ARG_ENABLE(opencl,
1046     AS_HELP_STRING([--disable-opencl],
1047         [Determines whether to build with OpenCL support.]))
1049 AC_ARG_ENABLE(dbus,
1050     AS_HELP_STRING([--disable-dbus],
1051         [Determines whether to enable features that depend on dbus.
1052          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1053 ,enable_dbus=yes)
1055 AC_ARG_ENABLE(packagekit,
1056     AS_HELP_STRING([--enable-packagekit],
1057         [Determines whether to enable features using packagekit.
1058          Right now that is auto font install]),
1061 AC_ARG_ENABLE(sdremote,
1062     AS_HELP_STRING([--disable-sdremote],
1063         [Determines whether to enable Impress remote control (i.e. the server component).]),
1064 ,enable_sdremote=yes)
1066 AC_ARG_ENABLE(sdremote-bluetooth,
1067     AS_HELP_STRING([--disable-sdremote-bluetooth],
1068         [Determines whether to build sdremote with bluetooth support.
1069          Requires dbus on Linux.]))
1071 AC_ARG_ENABLE(sdremote-android,
1072     AS_HELP_STRING([--enable-sdremote-android],
1073         [Determines whether to build the Impress Remote Android app -- requires
1074         a correctly configured android sdk.]),
1075 ,enable_sdremote_android=no)
1077 AC_ARG_ENABLE(gconf,
1078     AS_HELP_STRING([--disable-gconf],
1079         [Determines whether to use the GConf support.]),
1080 ,enable_gconf=yes)
1082 AC_ARG_ENABLE(gnome-vfs,
1083     AS_HELP_STRING([--enable-gnome-vfs],
1084         [Determines whether to use the Gnome Virtual Filing System on platforms
1085          where that VFS is available.]),
1086 ,enable_gnome_vfs=no)
1088 AC_ARG_ENABLE(gio,
1089     AS_HELP_STRING([--disable-gio],
1090         [Determines whether to use the GIO support.]),
1091 ,enable_gio=yes)
1093 AC_ARG_ENABLE(telepathy,
1094     AS_HELP_STRING([--enable-telepathy],
1095         [Determines whether to enable Telepathy for collaboration.]),
1096 ,enable_telepathy=no)
1098 AC_ARG_ENABLE(tde,
1099     AS_HELP_STRING([--enable-tde],
1100         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1101          TDE are available.]),
1104 AC_ARG_ENABLE(tdeab,
1105     AS_HELP_STRING([--disable-tdeab],
1106         [Disable the TDE address book support.]),
1108     if test "$enable_tde" = "yes"; then
1109         enable_tdeab=yes
1110     fi
1113 AC_ARG_ENABLE(kde,
1114     AS_HELP_STRING([--enable-kde],
1115         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1116          KDE3 are available.]),
1119 AC_ARG_ENABLE(kdeab,
1120     AS_HELP_STRING([--disable-kdeab],
1121         [Disable the KDE3 address book support.]),
1123     if test "$enable_kde" = "yes"; then
1124         enable_kdeab=yes
1125     fi
1128 AC_ARG_ENABLE(kde4,
1129     AS_HELP_STRING([--enable-kde4],
1130         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1131          KDE4 are available. May be used with --enable-kde if you want to support
1132          both KDE3 and KDE4.]),
1135 AC_ARG_ENABLE(headless,
1136     AS_HELP_STRING([--enable-headless],
1137         [Disable building of GUIs to reduce dependencies. Useful for
1138         server usage. Work in progress, use only if you are hacking on
1139         it. Not related to the --headless option.]), ,)
1141 AC_ARG_ENABLE(randr,
1142     AS_HELP_STRING([--disable-randr],
1143         [Disable RandR support in the vcl project.]),
1144 ,enable_randr=yes)
1146 AC_ARG_ENABLE(randr-link,
1147     AS_HELP_STRING([--disable-randr-link],
1148         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1149 ,enable_randr_link=yes)
1151 AC_ARG_ENABLE(gstreamer,
1152     AS_HELP_STRING([--enable-gstreamer],
1153         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1154 ,enable_gstreamer=no)
1156 AC_ARG_ENABLE(gstreamer-0-10,
1157     AS_HELP_STRING([--disable-gstreamer-0-10],
1158         [Disable building the gstreamer avmedia backend.]),
1159 ,enable_gstreamer_0_10=yes)
1161 AC_ARG_ENABLE(vlc,
1162     AS_HELP_STRING([--enable-vlc],
1163         [Enable building with the VLC avmedia backend.]),
1164 ,enable_vlc=no)
1166 AC_ARG_ENABLE(neon,
1167     AS_HELP_STRING([--disable-neon],
1168         [Disable neon and the compilation of webdav binding.]),
1171 AC_ARG_ENABLE([eot],
1172     [AS_HELP_STRING([--enable-eot],
1173         [Enable support for Embedded OpenType fonts.])],
1174 , [enable_eot=no])
1176 AC_ARG_ENABLE(cve-tests,
1177     AS_HELP_STRING([--disable-cve-tests],
1178         [Prevent CVE tests to be executed]),
1181 AC_ARG_ENABLE(chart-tests,
1182     AS_HELP_STRING([--enable-chart-tests],
1183         [Executes chart XShape tests]),
1186 AC_ARG_ENABLE(build-unowinreg,
1187     AS_HELP_STRING([--enable-build-unowinreg],
1188         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1189          compiler is needed on Linux.])
1190     [
1191                           Usage:     --enable-build-unowinreg
1192     ],
1195 AC_ARG_ENABLE(verbose,
1196     AS_HELP_STRING([--enable-verbose],
1197         [Increase build verbosity.])[
1198   --disable-verbose       Decrease build verbosity.],
1201 AC_ARG_ENABLE(dependency-tracking,
1202     AS_HELP_STRING([--enable-dependency-tracking],
1203         [Do not reject slow dependency extractors.])[
1204   --disable-dependency-tracking
1205                           Disables generation of dependency information.
1206                           Speed up one-time builds.],
1209 AC_ARG_ENABLE(icecream,
1210     AS_HELP_STRING([--enable-icecream],
1211         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1212          It defaults to /opt/icecream for the location of the icecream gcc/g++
1213          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1216 AC_ARG_ENABLE(cups,
1217     AS_HELP_STRING([--disable-cups],
1218         [Do not build cups support.])
1221 AC_ARG_ENABLE(ccache,
1222     AS_HELP_STRING([--disable-ccache],
1223         [Do not try to use ccache automatically.
1224          By default, we will try to detect if ccache is available; in that case if
1225          CC/CXX are not yet set, and --enable-icecream is not given, we
1226          attempt to use ccache. --disable-ccache disables ccache completely.
1230 AC_ARG_ENABLE(64-bit,
1231     AS_HELP_STRING([--enable-64-bit],
1232         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit. Works fine for OS
1233          X. In other cases this option is experimental and possibly quite broken, use only if you are
1234          hacking on 64-bit support.]), ,)
1236 AC_ARG_ENABLE(extra-gallery,
1237     AS_HELP_STRING([--enable-extra-gallery],
1238         [Add extra gallery content.]),
1241 AC_ARG_ENABLE(extra-template,
1242     AS_HELP_STRING([--enable-extra-template],
1243         [Add extra template content.]),
1246 AC_ARG_ENABLE(extra-sample,
1247     AS_HELP_STRING([--enable-extra-sample],
1248         [Add extra sample content.]),
1251 AC_ARG_ENABLE(extra-font,
1252     AS_HELP_STRING([--enable-extra-font],
1253         [Add extra font content.]),
1256 AC_ARG_ENABLE(online-update,
1257     AS_HELP_STRING([--enable-online-update],
1258         [Enable the online update service that will check for new versions of
1259          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1262 AC_ARG_ENABLE(release-build,
1263     AS_HELP_STRING([--enable-release-build],
1264         [Enable release build.
1265          See http://wiki.documentfoundation.org/DevBuild]),
1268 AC_ARG_ENABLE(windows-build-signing,
1269     AS_HELP_STRING([--enable-windows-build-signing],
1270         [Enable signing of windows binaries (*.exe, *.dll)]),
1273 AC_ARG_ENABLE(silent-msi,
1274     AS_HELP_STRING([--enable-silent-msi],
1275         [Enable MSI with LIMITUI=1 (silent install).]),
1278 AC_ARG_ENABLE(macosx-retina,
1279     AS_HELP_STRING([--enable-macosx-retina],
1280         [Declare the application as High Resolution Capable. (retina display)
1281          ]),
1284 AC_ARG_ENABLE(macosx-code-signing,
1285     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1286         [Sign executables, dylibs, frameworks and the app bundle. If you
1287          don't provide an identity the first suitable certificate
1288          in your keychain is used.]),
1291 AC_ARG_ENABLE(macosx-package-signing,
1292     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1293         [Create a .pkg suitable for uploading to the Mac App Store and sign
1294          it. If you don't provide an identity the first suitable certificate
1295          in your keychain is used.]),
1298 AC_ARG_ENABLE(macosx-sandbox,
1299     AS_HELP_STRING([--enable-macosx-sandbox],
1300         [Make the app bundle run in a sandbox. Requires code signing.
1301          Is required by apps distributed in the Mac App Store, and implies
1302          adherence to App Store rules.]),
1305 AC_ARG_ENABLE(canonical-installation-tree-structure,
1306     AS_HELP_STRING([--enable-canonical-installation-tree-structure],
1307         [Make the installation tree structure be more canonical for
1308          the platform. Implemented only for OS X. Experimental and currently broken.]),
1312 AC_ARG_WITH(macosx-bundle-identifier,
1313     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1314         [Define the OS X bundle identifier. Default is the somewhat weird
1315          org.libreoffice.script ("script", huh?).]),
1316 ,with_macosx_bundle_identifier=org.libreoffice.script)
1318 AC_ARG_WITH(macosx-app-name,
1319     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1320         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1321 ,with_macosx_app_name=$PRODUCTNAME)
1323 AC_ARG_ENABLE(ios-simulator,
1324     AS_HELP_STRING([--enable-ios-simulator],
1325         [Build for the iOS Simulator, not iOS device.]),
1328 AC_ARG_ENABLE(readonly-installset,
1329     AS_HELP_STRING([--enable-readonly-installset],
1330         [Prevents any attempts by LibreOffice to write into its installation. That means
1331          at least that no "system-wide" extensions can be added. Experimental work in
1332          progress.]),
1335 AC_ARG_ENABLE(postgresql-sdbc,
1336     AS_HELP_STRING([--disable-postgresql-sdbc],
1337         [Disable the build of the PostgreSQL-SDBC driver.])
1340 AC_ARG_ENABLE(lotuswordpro,
1341     AS_HELP_STRING([--disable-lotuswordpro],
1342         [Disable the build of the Lotus Word Pro filter.]),
1343 ,enable_lotuswordpro=yes)
1345 AC_ARG_ENABLE(firebird-sdbc,
1346     AS_HELP_STRING([--disable-firebird-sdbc],
1347         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1348 ,enable_firebird_sdbc=yes)
1350 AC_ARG_ENABLE(winegcc,
1351     AS_HELP_STRING([--enable-winegcc],
1352         [Enable use of winegcc during the build, in order to create msi* tools
1353          needed for MinGW cross-compilation.]),
1356 AC_ARG_ENABLE(liblangtag,
1357     AS_HELP_STRING([--disable-liblangtag],
1358         [Disable use of liblangtag, and instead use an own simple
1359          implementation.]),
1362 AC_ARG_ENABLE(bogus-pkg-config,
1363     AS_HELP_STRING([--enable-bogus-pkg-config],
1364         [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.]),
1367 AC_ARG_ENABLE(openssl,
1368     AS_HELP_STRING([--disable-openssl],
1369         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1370          components will either use GNUTLS or NSS. Work in progress,
1371          use only if you are hacking on it.]),
1372 ,enable_openssl=yes)
1374 AC_ARG_ENABLE(library-bin-tar,
1375     AS_HELP_STRING([--enable-library-bin-tar],
1376         [Enable the building and reused of tarball of binary build for some 'external' libraries
1377         Some libraries can save their build result in a tarball
1378         stored in TARFILE_LOCATION. that binary tarball is
1379         uniquely identified by the source tarbal,
1380         the content of the config_host.mk file and the content
1381         of the top-level directory in core for that library
1382         If this option is enabled, then if such a tarfile exist, it will be untarred
1383         isntead of the source tarfile, and the build step will be skipped for that
1384         library.
1385         If a proper tarfile does not exist, then the normal source-based
1386         build is done for taht library and a proper binary tarfile is created
1387         for the next time.]),
1390 AC_ARG_ENABLE(gltf,
1391     AS_HELP_STRING([--disable-gltf],
1392         [Determines whether to build libraries related to glTF 3D model rendering.]))
1394 dnl ===================================================================
1395 dnl Optional Packages (--with/without-)
1396 dnl ===================================================================
1398 AC_ARG_WITH(gnu-patch,
1399     AS_HELP_STRING([--with-gnu-patch],
1400         [Specify location of GNU patch on Solaris or FreeBSD.]),
1403 AC_ARG_WITH(build-platform-configure-options,
1404         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1406 AC_ARG_WITH(gnu-cp,
1407     AS_HELP_STRING([--with-gnu-cp],
1408         [Specify location of GNU cp on Solaris or FreeBSD.]),
1411 AC_ARG_WITH(external-tar,
1412     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1413         [Specify an absolute path of where to find (and store) tarfiles.]),
1414     TARFILE_LOCATION=$withval ,
1417 AC_ARG_WITH(referenced-git,
1418     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1419         [Specify another checkout directory to reference. This makes use of
1420                  git submodule update --reference, and saves a lot of diskspace
1421                  when having multiple trees side-by-side.]),
1422     GIT_REFERENCE_SRC=$withval ,
1425 AC_ARG_WITH(linked-git,
1426     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1427         [Specify a directory where the repositories of submodules are located.
1428          This uses a method similar to git-new-workdir to get submodules.]),
1429     GIT_LINK_SRC=$withval ,
1432 AC_ARG_WITH(galleries,
1433     AS_HELP_STRING([--with-galleries],
1434         [Specify how galleries should be built. It is possible either to
1435          build these internally from source ("build"),
1436          or to disable them ("no")]),
1439 AC_ARG_WITH(theme,
1440     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1441         [Choose which themes to include. By default those themes with an '*' are included.
1442          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1445 AC_ARG_WITH(helppack-integration,
1447   --without-helppack-integration      It will not integrate the helppacks to the installer
1448                           of the product.
1449                           Please use this switch to use the online help or separate help packages.],
1452 AC_ARG_WITH(fonts,
1453     AS_HELP_STRING([--without-fonts],
1454         [LibreOffice includes some third-party fonts to provide a reliable basis for
1455          help content, templates, samples, etc. When these fonts are already
1456          known to be available on the system then you should use this option.]),
1459 AC_ARG_WITH(ppds,
1460     AS_HELP_STRING([--without-ppds],
1461         [Removes Postscript Printer definition files from LibreOffice
1462          installation set, for people building for specific distributions where
1463          PPDs are known to be already available (every recent distro with CUPS backend).]),
1466 AC_ARG_WITH(epm,
1467     AS_HELP_STRING([--with-epm],
1468         [Decides which epm to use. Default is to use the one from the system if
1469          one is built. When either this is not there or you say =internal epm
1470          will be built.]),
1473 AC_ARG_WITH(package-format,
1474     AS_HELP_STRING([--with-package-format],
1475         [Specify package format(s) for LibreOffice installation sets. The
1476          implicit --without-package-format leads to no installation sets being
1477          generated. Possible values: aix, archive, bsd, deb, dmg,
1478          installed, msi, native, pkg, portable, and rpm.
1479          Example: --with-package-format='deb rpm']),
1482 AC_ARG_WITH(tls,
1483     AS_HELP_STRING([--with-tls],
1484         [Decides which TLS/SSL and cryptographic implementations to use for
1485          LibreOffice's code. Notice that this doesn't apply for depending
1486          libraries like "neon", for example. Default is to use OpenSSL
1487          although NSS is also possible. Notice that selecting NSS restricts
1488          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1489          restrict by now the usage of NSS in LO's code. Possible values:
1490          openssl, nss. Example: --with-tls="nss"]),
1493 AC_ARG_WITH(system-libs,
1494     AS_HELP_STRING([--with-system-libs],
1495         [Use libraries already on system -- enables all --with-system-* flags.]),
1498 AC_ARG_WITH(system-headers,
1499     AS_HELP_STRING([--with-system-headers],
1500         [Use headers already on system -- enables all --with-system-* flags for
1501          external packages whose headers are the only entities used i.e.
1502          boost/vigra/odbc/sane-header(s).]),,
1503     [with_system_headers="$with_system_libs"])
1505 AC_ARG_WITH(system-jars,
1506     AS_HELP_STRING([--without-system-jars],
1507         [When building with --with-system-libs, also the needed jars are expected
1508          on the system. Use this to disable that]),,
1509     [with_system_jars="$with_system_libs"])
1511 AC_ARG_WITH(system-cairo,
1512     AS_HELP_STRING([--with-system-cairo],
1513         [Use cairo libraries already on system.  Happens automatically for
1514          (implicit) --enable-gtk and for --enable-gtk3.]))
1516 AC_ARG_WITH(myspell-dicts,
1517     AS_HELP_STRING([--with-myspell-dicts],
1518         [Adds myspell dictionaries to the LibreOffice installation set]),
1521 AC_ARG_WITH(system-dicts,
1522     AS_HELP_STRING([--without-system-dicts],
1523         [Do not use dictionaries from system paths.]),
1526 AC_ARG_WITH(external-dict-dir,
1527     AS_HELP_STRING([--with-external-dict-dir],
1528         [Specify external dictionary dir.]),
1531 AC_ARG_WITH(external-hyph-dir,
1532     AS_HELP_STRING([--with-external-hyph-dir],
1533         [Specify external hyphenation pattern dir.]),
1536 AC_ARG_WITH(external-thes-dir,
1537     AS_HELP_STRING([--with-external-thes-dir],
1538         [Specify external thesaurus dir.]),
1541 AC_ARG_WITH(system-zlib,
1542     AS_HELP_STRING([--with-system-zlib],
1543         [Use zlib already on system.]),,
1544     [with_system_zlib=auto])
1546 AC_ARG_WITH(system-jpeg,
1547     AS_HELP_STRING([--with-system-jpeg],
1548         [Use jpeg already on system.]),,
1549     [with_system_jpeg=auto])
1551 AC_ARG_WITH(system-clucene,
1552     AS_HELP_STRING([--with-system-clucene],
1553         [Use clucene already on system.]),,
1554     [with_system_clucene="$with_system_libs"])
1556 AC_ARG_WITH(system-expat,
1557     AS_HELP_STRING([--with-system-expat],
1558         [Use expat already on system.]),,
1559     [with_system_expat="$with_system_libs"])
1561 AC_ARG_WITH(system-libxml,
1562     AS_HELP_STRING([--with-system-libxml],
1563         [Use libxml/libxslt already on system.]),,
1564     [with_system_libxml=auto])
1566 AC_ARG_WITH(system-icu,
1567     AS_HELP_STRING([--with-system-icu],
1568         [Use icu already on system.]),,
1569     [with_system_icu="$with_system_libs"])
1571 AC_ARG_WITH(system-ucpp,
1572     AS_HELP_STRING([--with-system-ucpp],
1573         [Use ucpp already on system.]),,
1574     [])
1576 AC_ARG_WITH(system-openldap,
1577     AS_HELP_STRING([--with-system-openldap],
1578         [Use the OpenLDAP LDAP SDK already on system.]),,
1579     [with_system_openldap="$with_system_libs"])
1581 AC_ARG_WITH(system-poppler,
1582     AS_HELP_STRING([--with-system-poppler],
1583         [Use system poppler (only needed for PDF import).]),,
1584     [with_system_poppler="$with_system_libs"])
1586 AC_ARG_WITH(system-apache-commons,
1587     AS_HELP_STRING([--with-system-apache-commons],
1588         [Use Apache commons libraries already on system.]),,
1589     [with_system_apache_commons="$with_system_jars"])
1591 AC_ARG_WITH(system-mariadb,
1592     AS_HELP_STRING([--with-system-mariadb],
1593         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1594          extension.]),,
1595     [with_system_mariadb="$with_system_libs"])
1597 AC_ARG_ENABLE(bundle-mariadb,
1598     AS_HELP_STRING([--enable-bundle-mariadb],
1599         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1602 AC_ARG_WITH(system-mysql-cppconn,
1603     AS_HELP_STRING([--with-system-mysql-cppconn],
1604         [Use MySQL C++ Connector libraries already on system.]),,
1605     [with_system_mysql_cppconn="$with_system_libs"])
1607 AC_ARG_WITH(system-postgresql,
1608     AS_HELP_STRING([--with-system-postgresql],
1609         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1610          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1611     [with_system_postgresql="$with_system_libs"])
1613 AC_ARG_WITH(libpq-path,
1614     AS_HELP_STRING([--with-libpq-path],
1615         [Use this PostgreSQL C interface (libpq) installation for building
1616          the PostgreSQL-SDBC extension.])
1617     [
1618                           Usage:     --with-libpq-path=<absolute path to
1619                                                   your libpq installation>
1620     ],
1623 AC_ARG_WITH(system-firebird,
1624     AS_HELP_STRING([--with-system-firebird],
1625         [Use Firebird libraries already on system, for building the Firebird-SDBC
1626          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1627     [with_system_firebird="$with_system_libs"])
1629 AC_ARG_WITH(system-hsqldb,
1630     AS_HELP_STRING([--with-system-hsqldb],
1631         [Use hsqldb already on system.]))
1633 AC_ARG_WITH(hsqldb-jar,
1634     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1635         [Specify path to jarfile manually.]),
1636     HSQLDB_JAR=$withval)
1638 AC_ARG_ENABLE(scripting-beanshell,
1639     AS_HELP_STRING([--disable-scripting-beanshell],
1640         [Disable support for scripts in BeanShell.]),
1644 AC_ARG_WITH(system-beanshell,
1645     AS_HELP_STRING([--with-system-beanshell],
1646         [Use beanshell already on system.]),,
1647     [with_system_beanshell="$with_system_jars"])
1649 AC_ARG_WITH(beanshell-jar,
1650     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1651         [Specify path to jarfile manually.]),
1652     BSH_JAR=$withval)
1654 AC_ARG_ENABLE(scripting-javascript,
1655     AS_HELP_STRING([--disable-scripting-javascript],
1656         [Disable support for scripts in JavaScript.]),
1660 AC_ARG_WITH(system-rhino,
1661     AS_HELP_STRING([--with-system-rhino],
1662         [Use rhino already on system.]),,)
1663 #    [with_system_rhino="$with_system_jars"])
1664 # Above is not used as we have different debug interface
1665 # patched into internal rhino. This code needs to be fixed
1666 # before we can enable it by default.
1668 AC_ARG_WITH(rhino-jar,
1669     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1670         [Specify path to jarfile manually.]),
1671     RHINO_JAR=$withval)
1673 AC_ARG_WITH(commons-codec-jar,
1674     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1675         [Specify path to jarfile manually.]),
1676     COMMONS_CODEC_JAR=$withval)
1678 AC_ARG_WITH(commons-lang-jar,
1679     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1680         [Specify path to jarfile manually.]),
1681     COMMONS_LANG_JAR=$withval)
1683 AC_ARG_WITH(commons-httpclient-jar,
1684     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1685         [Specify path to jarfile manually.]),
1686     COMMONS_HTTPCLIENT_JAR=$withval)
1688 AC_ARG_WITH(commons-logging-jar,
1689     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1690         [Specify path to jarfile manually.]),
1691     COMMONS_LOGGING_JAR=$withval)
1693 AC_ARG_WITH(system-jfreereport,
1694     AS_HELP_STRING([--with-system-jfreereport],
1695         [Use JFreeReport already on system.]),,
1696     [with_system_jfreereport="$with_system_jars"])
1698 AC_ARG_WITH(sac-jar,
1699     AS_HELP_STRING([--with-sac-jar=JARFILE],
1700         [Specify path to jarfile manually.]),
1701     SAC_JAR=$withval)
1703 AC_ARG_WITH(libxml-jar,
1704     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1705         [Specify path to jarfile manually.]),
1706     LIBXML_JAR=$withval)
1708 AC_ARG_WITH(flute-jar,
1709     AS_HELP_STRING([--with-flute-jar=JARFILE],
1710         [Specify path to jarfile manually.]),
1711     FLUTE_JAR=$withval)
1713 AC_ARG_WITH(jfreereport-jar,
1714     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1715         [Specify path to jarfile manually.]),
1716     JFREEREPORT_JAR=$withval)
1718 AC_ARG_WITH(liblayout-jar,
1719     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1720         [Specify path to jarfile manually.]),
1721     LIBLAYOUT_JAR=$withval)
1723 AC_ARG_WITH(libloader-jar,
1724     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1725         [Specify path to jarfile manually.]),
1726     LIBLOADER_JAR=$withval)
1728 AC_ARG_WITH(libloader-jar,
1729     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1730         [Specify path to jarfile manually.]),
1731     LIBLOADER_JAR=$withval)
1733 AC_ARG_WITH(libformula-jar,
1734     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1735         [Specify path to jarfile manually.]),
1736     LIBFORMULA_JAR=$withval)
1738 AC_ARG_WITH(librepository-jar,
1739     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1740         [Specify path to jarfile manually.]),
1741     LIBREPOSITORY_JAR=$withval)
1743 AC_ARG_WITH(libfonts-jar,
1744     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1745         [Specify path to jarfile manually.]),
1746     LIBFONTS_JAR=$withval)
1748 AC_ARG_WITH(libserializer-jar,
1749     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1750         [Specify path to jarfile manually.]),
1751     LIBSERIALIZER_JAR=$withval)
1753 AC_ARG_WITH(libbase-jar,
1754     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1755         [Specify path to jarfile manually.]),
1756     LIBBASE_JAR=$withval)
1758 AC_ARG_WITH(system-odbc,
1759     AS_HELP_STRING([--with-system-odbc],
1760         [Use the odbc headers already on system.]),,
1761     [with_system_odbc="$with_system_headers"])
1763 AC_ARG_WITH(system-sane,
1764     AS_HELP_STRING([--with-system-sane],
1765         [Use sane.h already on system.]),,
1766     [with_system_sane="$with_system_headers"])
1768 AC_ARG_WITH(system-bluez,
1769     AS_HELP_STRING([--with-system-bluez],
1770         [Use bluetooth.h already on system.]),,
1771     [with_system_bluez="$with_system_headers"])
1773 AC_ARG_WITH(system-mesa-headers,
1774     AS_HELP_STRING([--with-system-mesa-headers],
1775         [Use Mesa headers already on system.]),,
1776     [with_system_mesa_headers="$with_system_headers"])
1778 AC_ARG_WITH(system-curl,
1779     AS_HELP_STRING([--with-system-curl],
1780         [Use curl already on system.]),,
1781     [with_system_curl=auto])
1783 AC_ARG_WITH(system-boost,
1784     AS_HELP_STRING([--with-system-boost],
1785         [Use boost already on system.]),,
1786     [with_system_boost="$with_system_headers"])
1788 AC_ARG_WITH(system-glm,
1789     AS_HELP_STRING([--with-system-glm],
1790         [Use glm already on system.]),,
1791     [with_system_glm="$with_system_headers"])
1793 AC_ARG_WITH(system-vigra,
1794     AS_HELP_STRING([--with-system-vigra],
1795         [Use vigra already on system.]),,
1796     [with_system_vigra="$with_system_headers"])
1798 AC_ARG_WITH(system-hunspell,
1799     AS_HELP_STRING([--with-system-hunspell],
1800         [Use libhunspell already on system.]),,
1801     [with_system_hunspell="$with_system_libs"])
1803 AC_ARG_WITH(system-mythes,
1804     AS_HELP_STRING([--with-system-mythes],
1805         [Use mythes already on system.]),,
1806     [with_system_mythes="$with_system_libs"])
1808 AC_ARG_WITH(system-altlinuxhyph,
1809     AS_HELP_STRING([--with-system-altlinuxhyph],
1810         [Use ALTLinuxhyph already on system.]),,
1811     [with_system_altlinuxhyph="$with_system_libs"])
1813 AC_ARG_WITH(system-lpsolve,
1814     AS_HELP_STRING([--with-system-lpsolve],
1815         [Use lpsolve already on system.]),,
1816     [with_system_lpsolve="$with_system_libs"])
1818 AC_ARG_WITH(system-liblangtag,
1819     AS_HELP_STRING([--with-system-liblangtag],
1820         [Use liblangtag library already on system.]),,
1821     [with_system_liblangtag="$with_system_libs"])
1823 AC_ARG_WITH(system-npapi-headers,
1824     AS_HELP_STRING([--with-system-npapi-headers],
1825         [Use NPAPI headers provided by system instead of bundled ones. Used in
1826          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=TRUE) and
1827          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1828     [with_system_npapi_headers="$with_system_headers"]
1831 AC_ARG_WITH(webdav,
1832     AS_HELP_STRING([--with-webdav],
1833         [Specify which library to use for webdav implementation.
1834          Possible values: "neon", "serf", "no". The default value is "neon".
1835          Example: --with-webdav="serf"]),
1836     WITH_WEBDAV=$withval,
1837     WITH_WEBDAV="neon")
1839 AC_ARG_WITH(linker-hash-style,
1840     AS_HELP_STRING([--with-linker-hash-style],
1841         [Use linker with --hash-style=<style> when linking shared objects.
1842          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1843          if supported on the build system, and "sysv" otherwise.]))
1845 AC_ARG_WITH(jdk-home,
1846     AS_HELP_STRING([--with-jdk-home],
1847         [If you have installed JDK 1.3 or later on your system please supply the
1848          path here. Note that this is not the location of the java command but the
1849          location of the entire distribution.])
1850     [
1851                           Usage:     --with-jdk-home=<absolute path to JDK home>
1852     ],
1855 AC_ARG_WITH(help,
1856     AS_HELP_STRING([--with-help],
1857         [Enable the build of help. There is a special parameter "common" that
1858          can be used to bundle only the common part, .e.g help-specific icons.
1859          This is useful when you build the helpcontent separately.])
1860     [
1861                           Usage:     --with-help    build the entire local help
1862                                  --without-help     no local help (default)
1863                                  --with-help=common bundle common files for the local
1864                                                     help but do not build the whole help
1865     ],
1868 AC_ARG_WITH(java,
1869     AS_HELP_STRING([--with-java],
1870         [Specify the name of the Java interpreter command. Typically "java"
1871          which is the default.
1873          To build without support for Java components, applets, accessibility
1874          or the XML filters written in Java, use --without-java or --with-java=no.])
1875     [
1876                           Usage:     --with-java==<java command>
1877                                      --without-java
1878     ],
1879     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1880     [ with_java=java ]
1883 AC_ARG_WITH(jvm-path,
1884     AS_HELP_STRING([--with-jvm-path],
1885         [Use a specific JVM search path at runtime.])
1886     [
1887                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1889                           e. g.: --with-jvm-path=/usr/lib/
1890                                  to find JRE/JDK in /usr/lib/jvm/
1891     ],
1894 AC_ARG_WITH(ant-home,
1895     AS_HELP_STRING([--with-ant-home],
1896         [If you have installed Jakarta Ant on your system, please supply the path here.
1897          Note that this is not the location of the Ant binary but the location
1898          of the entire distribution.])
1899     [
1900                           Usage:     --with-ant-home=<absolute path to Ant home>
1901     ],
1904 AC_ARG_WITH(export-validation,
1905     AS_HELP_STRING([--with-export-validation],
1906         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1907          Note: You need an executable script officeotron that takes the path to the file.])
1908     [
1909                             Usage: --with-export-validation
1910     ],
1913 AC_ARG_WITH(junit,
1914     AS_HELP_STRING([--with-junit],
1915         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1916          --without-junit disables those tests. Not relevant in the --without-java case.])
1917     [
1918                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1919     ],
1920 ,with_junit=yes)
1922 AC_ARG_WITH(perl-home,
1923     AS_HELP_STRING([--with-perl-home],
1924         [If you have installed Perl 5 Distribution, on your system, please
1925          supply the path here. Note that this is not the location of the Perl
1926          binary but the location of the entire distribution.])
1927     [
1928                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1929     ],
1932 AC_ARG_WITH(
1933     [doxygen],
1934     AS_HELP_STRING(
1935         [--with-doxygen],
1936         [Specifies the doxygen executable to use when generating ODK C/C++
1937          documentation. --without-doxygen disables generation of ODK C/C++
1938          documentation. Not relevant in the --disable-odk case.])
1939     [
1940                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1941     ],,
1942     [with_doxygen=yes])
1944 AC_ARG_WITH(visual-studio,
1945     AS_HELP_STRING([--with-visual-studio=<2012/2010/2013>],
1946         [Specify which Visual Studio version to use in case several are
1947          are installed. If not specified, the order of preference is
1948          2012, 2010, 2013 (including Express editions).])
1949     [
1950                           Usage:     --with-visual-studio=<2012/2010/2013>
1951     ],
1954 AC_ARG_WITH(windows-sdk,
1955     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1956         [Specify which Windows SDK, or "Windows Kit", version to use
1957          in case the one that came with the selected Visual Studio
1958          is not what you want for some reason. Note that not all compiler/SDK
1959          combinations are supported. The intent is that this option should not
1960          be needed.])
1961     [
1962                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1963     ],
1966 AC_ARG_WITH(lang,
1967     AS_HELP_STRING([--with-lang],
1968         [Use this option to build LibreOffice with additional UI language support.
1969          English (US) is always included by default.
1970          Separate multiple languages with space.
1971          For all languages, use --with-lang=ALL.])
1972     [
1973                           Usage:     --with-lang="es sw tu cs sk"
1974     ],
1977 AC_ARG_WITH(locales,
1978     AS_HELP_STRING([--with-locales],
1979         [Use this option to limit the locale information built in.
1980          Separate multiple locales with space.
1981          Very experimental and might well break stuff.
1982          Just a desperate measure to shrink code and data size.
1983          By default all the locales available is included.
1984          This option is completely unrelated to --with-lang.])
1985     [
1986                           Affects also our character encoding conversion
1987                           tables for encodings mainly targeted for a
1988                           particular locale, like EUC-CN and EUC-TW for
1989                           zh, ISO-2022-JP for ja.
1991                           Affects also our add-on break iterator data for
1992                           some languages.
1994                           For the default, all locales, don't use this switch at all.
1995                           Specifying just the language part of a locale means all matching
1996                           locales will be included.
1998                           Usage:     --with-locales="en es pt fr zh kr ja"
1999     ],
2002 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2003 AC_ARG_WITH(krb5,
2004     AS_HELP_STRING([--with-krb5],
2005         [Enable MIT Kerberos 5 support in modules that support it.
2006          By default automatically enabled on platforms
2007          where a good system Kerberos 5 is available.]),
2010 AC_ARG_WITH(gssapi,
2011     AS_HELP_STRING([--with-gssapi],
2012         [Enable GSSAPI support in modules that support it.
2013          By default automatically enabled on platforms
2014          where a good system GSSAPI is available.]),
2017 dnl ===================================================================
2018 dnl Branding
2019 dnl ===================================================================
2021 AC_ARG_WITH(branding,
2022     AS_HELP_STRING([--with-branding],
2023         [Use given path to retrieve branding images set.])
2024     [
2025                           Search for intro.png about.svg and flat_logo.svg.
2026                           If any is missing, default ones will be used instead.
2028                           Search also progress.conf for progress
2029                           settings on intro screen :
2031                           PROGRESSBARCOLOR="255,255,255" Set color of
2032                           progress bar. Comma separated RGB decimal values.
2033                           PROGRESSSIZE="407,6" Set size of progress bar.
2034                           Comma separated decimal values (width, height).
2035                           PROGRESSPOSITION="61,317" Set position of progress
2036                           bar from left,top. Comma separated decimal values.
2037                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2038                           bar frame. Comma separated RGB decimal values.
2039                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2040                           bar text. Comma separated RGB decimal values.
2041                           PROGRESSTEXTBASELINE="287" Set vertical position of
2042                           progress bar text from top. Decimal value.
2044                           Default values will be used if not found.
2046                           Usage:     --with-branding=/path/to/images
2047     ],
2051 AC_ARG_WITH(extra-buildid,
2052     AS_HELP_STRING([--with-extra-buildid],
2053         [Show addition build identification in about dialog.])
2054     [
2055                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2056     ],
2060 AC_ARG_WITH(vendor,
2061     AS_HELP_STRING([--with-vendor],
2062         [Set vendor of the build.])
2063     [
2064                           Usage:     --with-vendor="John the Builder"
2065     ],
2068 AC_ARG_WITH(compat-oowrappers,
2069     AS_HELP_STRING([--with-compat-oowrappers],
2070         [Install oo* wrappers in parallel with
2071          lo* ones to keep backward compatibility.
2072          Has effect only with make distro-pack-install]),
2075 AC_ARG_WITH(os-version,
2076     AS_HELP_STRING([--with-os-version],
2077         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2078     [
2079                           Usage:     --with-os-version=<OSVERSION>
2080     ],
2083 AC_ARG_WITH(mingw-cross-compiler,
2084     AS_HELP_STRING([--with-mingw-cross-compiler],
2085         [Specify the MinGW cross-compiler to use.])
2086     [
2087                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2089                           When building on the ODK on Unix and building unowinreg.dll,
2090                           specify the MinGW C++ cross-compiler.
2091     ],
2094 AC_ARG_WITH(idlc-cpp,
2095     AS_HELP_STRING([--with-idlc-cpp],
2096         [Specify the C Preprocessor to use for idlc.])
2097     [
2098                           Usage:     --with-idlc-cpp=cpp
2100                           Default is ucpp.
2101     ]
2104 AC_ARG_WITH(build-version,
2105     AS_HELP_STRING([--with-build-version],
2106         [Allows the builder to add a custom version tag that will appear in the
2107          Help/About box for QA purposes.])
2108     [
2109                           Usage:     --with-build-version="Built by Jim"
2110     ],
2111     with_build_version=$withval ,
2114 AC_ARG_WITH(alloc,
2115     AS_HELP_STRING([--with-alloc],
2116         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2117          Note that on FreeBSD/NetBSD system==jemalloc]),
2120 AC_ARG_WITH(sun-templates,
2121     AS_HELP_STRING([--with-sun-templates],
2122         [Integrate Sun template packages.]),
2125 AC_ARG_WITH(parallelism,
2126     AS_HELP_STRING([--with-parallelism],
2127         [Number of jobs to run simultaneously during build. Parallel builds can
2128         save a lot of time on multi-cpu machines. Defaults to the number of
2129         CPUs on the machine, unless you configure --enable-icecream - then to
2130         10.]),
2133 AC_ARG_WITH(all-tarballs,
2134     AS_HELP_STRING([--with-all-tarballs],
2135         [Download all external tarballs unconditionally]))
2137 AC_ARG_WITH(gdrive-client-id,
2138     AS_HELP_STRING([--with-gdrive-client-id],
2139         [Provides the client id of the application for OAuth2 authentication
2140         on Google Drive. If either this or --with-gdrive-client-secret is
2141         empty, the feature will be disabled]),
2144 AC_ARG_WITH(gdrive-client-secret,
2145     AS_HELP_STRING([--with-gdrive-client-secret],
2146         [Provides the client secret of the application for OAuth2
2147         authentication on Google Drive. If either this or
2148         --with-gdrive-client-id is empty, the feature will be disabled]),
2151 AC_ARG_WITH(alfresco-cloud-client-id,
2152     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2153         [Provides the client id of the application for OAuth2 authentication
2154         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2155         empty, the feature will be disabled]),
2158 AC_ARG_WITH(alfresco-cloud-client-secret,
2159     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2160         [Provides the client secret of the application for OAuth2
2161         authentication on Alfresco Cloud. If either this or
2162         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2165 dnl ===================================================================
2166 dnl Do we want to use pre-build binary tarball for recompile
2167 dnl ===================================================================
2169 if test "$enable_library_bin_tar" = "yes" ; then
2170    USE_LIBRARY_BIN_TAR=TRUE
2171 else
2172    USE_LIBRARY_BIN_TAR=
2174 AC_SUBST(USE_LIBRARY_BIN_TAR)
2176 dnl ===================================================================
2177 dnl Test whether build target is Release Build
2178 dnl ===================================================================
2179 AC_MSG_CHECKING([whether build target is Release Build])
2180 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2181     AC_MSG_RESULT([no])
2182     ENABLE_RELEASE_BUILD=
2183 else
2184     AC_MSG_RESULT([yes])
2185     ENABLE_RELEASE_BUILD=TRUE
2187 AC_SUBST(ENABLE_RELEASE_BUILD)
2189 dnl ===================================================================
2190 dnl Test whether to sign Windows Build
2191 dnl ===================================================================
2192 AC_MSG_CHECKING([whether to sign windows build])
2193 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2194     AC_MSG_RESULT([yes])
2195     WINDOWS_BUILD_SIGNING="TRUE"
2196 else
2197     AC_MSG_RESULT([no])
2198     WINDOWS_BUILD_SIGNING="FALSE"
2200 AC_SUBST(WINDOWS_BUILD_SIGNING)
2202 dnl ===================================================================
2203 dnl MacOSX build and runtime environment options
2204 dnl ===================================================================
2206 AC_ARG_WITH(macosx-sdk,
2207     AS_HELP_STRING([--with-macosx-sdk],
2208         [Use a specific SDK for building.])
2209     [
2210                           Usage:     --with-macosx-sdk=<version>
2212                           e. g.: --with-macosx-sdk=10.6
2214                           there are 3 options to control the MacOSX build:
2215                           --with-macosx-sdk (refered as 'sdk' below)
2216                           --with-macosx-version-min-required (refered as 'min' below)
2217                           --with-macosx-version-max-allowed (refered as 'max' below)
2219                           the connection between these value and the default they take is as follow:
2220                           ( ? means not specified on the command line, s means the SDK version found,
2221                           constraint: x <= y <= z)
2223                           ==========================================
2224                            command line      || config result
2225                           ==========================================
2226                           min  | max  | sdk  || min  | max  | sdk  |
2227                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
2228                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
2229                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
2230                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
2231                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2232                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2233                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2234                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2237                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2238                           for a detailled technical explanation of these variables
2240                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2242                           Note that even if in theory using a --with-macosx-version-max-allowed
2243                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2244                           should work, in practice Apple doesn't seem to test that, and at least
2245                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2246                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2247                           headers, but still.
2248     ],
2251 AC_ARG_WITH(macosx-version-min-required,
2252     AS_HELP_STRING([--with-macosx-version-min-required],
2253         [set the minimum OS version needed to run the built LibreOffice])
2254     [
2255                           Usage:     --with-macosx-version-min-required=<version>
2257                           e. g.: --with-macos-version-min-required=10.6
2258                           see --with-macosx-sdk for more info
2259     ],
2262 AC_ARG_WITH(macosx-version-max-allowed,
2263     AS_HELP_STRING([--with-macosx-version-max-allowed],
2264         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2265     [
2266                           Usage:     --with-macosx-version-max-allowed=<version>
2268                           e. g.: --with-macos-version-max-allowed=10.6
2269                           see --with-macosx-sdk for more info
2270     ],
2274 dnl ===================================================================
2275 dnl options for stuff used during cross-compilation build
2276 dnl These are superseded by --with-build-platform-configure-options.
2277 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2278 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2279 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2280 dnl ===================================================================
2282 AC_ARG_WITH(system-boost-for-build,
2283     AS_HELP_STRING([--with-system-boost-for-build],
2284         [Use boost already on system for build tools (cross-compilation only).]))
2286 AC_ARG_WITH(system-cppunit-for-build,
2287     AS_HELP_STRING([--with-system-cppunit-for-build],
2288         [Use cppunit already on system for build tools (cross-compilation only).]))
2290 AC_ARG_WITH(system-expat-for-build,
2291     AS_HELP_STRING([--with-system-expat-for-build],
2292         [Use expat already on system for build tools (cross-compilation only).]))
2294 AC_ARG_WITH(system-icu-for-build,
2295     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2296         [Use icu already on system for build tools (cross-compilation only).]))
2298 AC_ARG_WITH(system-libxml-for-build,
2299     AS_HELP_STRING([--with-system-libxml-for-build],
2300         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2303 dnl ===================================================================
2304 dnl check for required programs (grep, awk, sed, bash)
2305 dnl ===================================================================
2307 pathmunge ()
2309     if test -n "$1"; then
2310         if test "$build_os" = "cygwin"; then
2311             PathFormat "$1"
2312             new_path=`cygpath -u "$formatted_path"`
2313         else
2314             new_path="$1"
2315         fi
2316         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2317             if test "$2" = "after"; then
2318                 LO_PATH="$LO_PATH:$new_path"
2319             else
2320                 LO_PATH="$new_path:$LO_PATH"
2321             fi
2322         fi
2323         unset new_path
2324     fi
2327 AC_PROG_AWK
2328 AC_PATH_PROG( AWK, $AWK)
2329 if test -z "$AWK"; then
2330     AC_MSG_ERROR([install awk to run this script])
2333 AC_PATH_PROG(BASH, bash)
2334 if test -z "$BASH"; then
2335     AC_MSG_ERROR([bash not found in \$PATH])
2337 AC_SUBST(BASH)
2339 AC_MSG_CHECKING([for GNU or BSD tar])
2340 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2341     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2342     if test $? -eq 0;  then
2343         GNUTAR=$a
2344         break
2345     fi
2346 done
2347 AC_MSG_RESULT($GNUTAR)
2348 if test -z "$GNUTAR"; then
2349     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2351 AC_SUBST(GNUTAR)
2353 AC_MSG_CHECKING([for tar's option to strip components])
2354 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2355 if test $? -eq 0; then
2356     STRIP_COMPONENTS="--strip-components"
2357 else
2358     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2359     if test $? -eq 0; then
2360         STRIP_COMPONENTS="--strip-path"
2361     else
2362         STRIP_COMPONENTS="unsupported"
2363     fi
2365 AC_MSG_RESULT($STRIP_COMPONENTS)
2366 if test x$STRIP_COMPONENTS = xunsupported; then
2367     AC_MSG_ERROR([you need a tar that is able to strip components.])
2369 AC_SUBST(STRIP_COMPONENTS)
2371 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2372 dnl desktop OSes from "mobile" ones.
2374 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2375 dnl In other words, that when building for an OS that is not a
2376 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2378 dnl Note the direction of the implication; there is no assumption that
2379 dnl cross-compiling would imply a non-desktop OS.
2381 if test $_os != iOS -a $_os != Android; then
2382     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2383     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2384     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2387 DISABLE_EXPORT=''
2388 if test "$enable_export" != no; then
2389     BUILD_TYPE="$BUILD_TYPE EXPORT"
2390 else
2391     DISABLE_EXPORT='TRUE'
2392     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2394 AC_SUBST(DISABLE_EXPORT)
2396 # Whether to build "avmedia" functionality or not.
2397 # We probably don't want it for non-desktop.
2399 if test -z "$enable_avmedia"; then
2400     if test $_os != iOS -a $_os != Android; then
2401         enable_avmedia=yes
2402     fi
2405 if test "$enable_avmedia" = yes; then
2406     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2407     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2408 else
2409     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2412 # Decide whether to build database connectivity stuff (including
2413 # Base) or not. We probably don't want to on non-desktop OSes.
2415 if test -z "$enable_database_connectivity"; then
2416     # --disable-database-connectivity is unfinished work in progress
2417     # and the iOS test app doesn't link if we actually try to use it.
2418     # if test $_os != iOS -a $_os != Android; then
2419         enable_database_connectivity=yes
2420     # fi
2423 if test "$enable_database_connectivity" = yes; then
2424     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2425     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2428 if test -z "$enable_extensions"; then
2429     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2430     if test $_os != iOS -a $_os != Android; then
2431         enable_extensions=yes
2432     fi
2435 if test "$enable_extensions" = yes; then
2436     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2437     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2440 if test -z "$enable_scripting"; then
2441     # Disable scripting for iOS unless specifically overridden
2442     # with --enable-scripting.
2443     if test $_os != iOS; then
2444         enable_scripting=yes
2445     fi
2448 DISABLE_SCRIPTING=''
2449 if test "$enable_scripting" = yes; then
2450     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2451 else
2452     DISABLE_SCRIPTING='TRUE'
2453     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2455 AC_SUBST(DISABLE_SCRIPTING)
2457 if test $_os = iOS -o $_os = Android; then
2458     # Disable dynamic_loading always for iOS and Android
2459     enable_dynamic_loading=no
2460 elif test -z "$enable_dynamic_loading"; then
2461     # Otherwise enable it unless speficically disabled
2462     enable_dynamic_loading=yes
2465 DISABLE_DYNLOADING=''
2466 if test "$enable_dynamic_loading" = yes; then
2467     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2468 else
2469     DISABLE_DYNLOADING='TRUE'
2470     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2472 AC_SUBST(DISABLE_DYNLOADING)
2474 # remenber SYSBASE value
2475 AC_SUBST(SYSBASE)
2477 dnl ===================================================================
2478 dnl  Sort out various gallery compilation options
2479 dnl ===================================================================
2480 AC_MSG_CHECKING([how to build and package galleries])
2481 if test -n "${with_galleries}"; then
2482     if test "$with_galleries" = "build"; then
2483         WITH_GALLERY_BUILD=TRUE
2484         AC_MSG_RESULT([build from source images internally])
2485     elif test "$with_galleries" = "no"; then
2486         WITH_GALLERY_BUILD=
2487         AC_MSG_RESULT([disable non-internal gallery build])
2488     else
2489         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2490     fi
2491 else
2492     if test $_os != iOS -a $_os != Android; then
2493         WITH_GALLERY_BUILD=TRUE
2494         AC_MSG_RESULT([internal src images for desktop])
2495     else
2496         WITH_GALLERY_BUILD=
2497         AC_MSG_RESULT([disable src imgage build])
2498     fi
2500 AC_SUBST(WITH_GALLERY_BUILD)
2502 dnl ===================================================================
2503 dnl  Checks if ccache is available
2504 dnl ===================================================================
2505 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2506     case "%$CC%$CXX%" in
2507     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2508     # assume that's good then
2509     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2510         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2511         ;;
2512     *)
2513         AC_PATH_PROG([CCACHE],[ccache],[not found])
2514         if test "$CCACHE" = "not found"; then
2515             CCACHE=""
2516         else
2517             # Need to check for ccache version: otherwise prevents
2518             # caching of the results (like "-x objective-c++" for Mac)
2519             if test $_os = Darwin -o $_os = iOS; then
2520                 # Check ccache version
2521                 AC_MSG_CHECKING([whether version of ccache is suitable])
2522                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2523                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2524                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2525                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2526                 else
2527                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2528                     CCACHE=""
2529                 fi
2530             fi
2531         fi
2532         ;;
2533     esac
2534 else
2535     CCACHE=""
2538 if test "$CCACHE" != ""; then
2539     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2540     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2541     if test "$ccache_size" = ""; then
2542         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2543         if test "$ccache_size" = ""; then
2544             ccache_size=0
2545         fi
2546         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2547         if test $ccache_size -lt 1024; then
2548             CCACHE=""
2549             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2550             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2551         else
2552             # warn that ccache may be too small for debug build
2553             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2554             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2555         fi
2556     else
2557         if test $ccache_size -lt 5; then
2558             #warn that ccache may be too small for debug build
2559             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2560             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2561         fi
2562     fi
2565 dnl ===================================================================
2566 dnl  Checks for C compiler,
2567 dnl  The check for the C++ compiler is later on.
2568 dnl ===================================================================
2569 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2570     GCC_HOME_SET="true"
2571     AC_MSG_CHECKING([gcc home])
2572     if test -z "$with_gcc_home"; then
2573         if test "$enable_icecream" = "yes"; then
2574             if test -d "/usr/lib/icecc/bin"; then
2575                 GCC_HOME="/usr/lib/icecc/"
2576             else
2577                 GCC_HOME="/opt/icecream/"
2578             fi
2579         else
2580             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2581             GCC_HOME_SET="false"
2582         fi
2583     else
2584         GCC_HOME="$with_gcc_home"
2585     fi
2586     AC_MSG_RESULT($GCC_HOME)
2587     AC_SUBST(GCC_HOME)
2589     if test "$GCC_HOME_SET" = "true"; then
2590         if test -z "$CC"; then
2591             CC="$GCC_HOME/bin/gcc"
2592         fi
2593         if test -z "$CXX"; then
2594             CXX="$GCC_HOME/bin/g++"
2595         fi
2596     fi
2599 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2600 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2601     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2602     save_CFLAGS=$CFLAGS
2603     AC_PROG_CC
2604     CFLAGS=$save_CFLAGS
2607 COMPATH=`dirname "$CC"`
2608 if test "$COMPATH" = "."; then
2609     AC_PATH_PROGS(COMPATH, $CC)
2610     dnl double square bracket to get single because of M4 quote...
2611     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2613 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2615 dnl ===================================================================
2616 dnl Java support
2617 dnl ===================================================================
2618 AC_MSG_CHECKING([whether to build with Java support])
2619 if test "$with_java" != "no"; then
2620     if test "$DISABLE_SCRIPTING" = TRUE; then
2621         AC_MSG_RESULT([no, overridden by --disable-scripting])
2622         ENABLE_JAVA=""
2623         with_java=no
2624     else
2625         AC_MSG_RESULT([yes])
2626         ENABLE_JAVA="TRUE"
2627         AC_DEFINE(HAVE_FEATURE_JAVA)
2628     fi
2629 else
2630     AC_MSG_RESULT([no])
2631     ENABLE_JAVA=""
2634 AC_SUBST(ENABLE_JAVA)
2636 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2638 dnl ENABLE_JAVA="" indicate no Java support at all
2640 dnl ===================================================================
2641 dnl Export file validation
2642 dnl ===================================================================
2643 AC_MSG_CHECKING([whether to enable export file validation])
2644 if test "$with_export_validation" = yes; then
2645     AC_MSG_RESULT([yes])
2646     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2647 else
2648     AC_MSG_RESULT([no])
2651 dnl ===================================================================
2652 dnl  Test the Solaris compiler version
2653 dnl ===================================================================
2654 if test "$_os" = "SunOS"; then
2655     if test "$CC" = "cc"; then
2656         AC_PATH_PROGS(_cc, cc)
2657         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2658         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2659         dnl cc -V outputs to standard error!!!!
2660         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2661         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2662         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2663         if test "$_sunstudio_major" != "5"; then
2664             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2665         else
2666             _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" }'`
2667             if test "$_sunstudio_minor" = "false"; then
2668                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2669             else
2670                 dnl compiler will do
2671                 AC_MSG_RESULT([checked])
2672             fi
2673         fi
2674     fi
2678 dnl ===================================================================
2679 dnl Check OS X SDK and compiler
2680 dnl ===================================================================
2682 if test $_os = Darwin; then
2684     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2685         bitness=-m32
2686     else
2687         bitness=-m64
2688         BITNESS_OVERRIDE=64
2689     fi
2691     # If no --with-macosx-sdk option is given, look for 10.6,
2692     # 10.7, 10.8 and 10.9 SDKs, in that order. If not found
2693     # in some default locations, try the xcode-select tool.
2694     # 10.5 must be specified explicitely to be considered
2696     # The intent is that for "most" Mac-based developers, a suitable
2697     # SDK will be found automatically without any configure options.
2699     # For developers still using old Xcode in /Developer, either
2700     # because it is the only Xcode they have, or they have that in
2701     # addition to Xcode 4 in /Applications/Xcode.app, the 10.5 SDK
2702     # or 10.6 SDK should be found.
2704     # For developers with a current Xcode, the lowest-numbered SDK
2705     # should be found.
2707     AC_MSG_CHECKING([what Mac OS X SDK to use])
2709     if test -z "$with_macosx_sdk"; then
2710         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2711             with_macosx_sdk=10.6
2712         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2713             with_macosx_sdk=10.6
2714         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2715             with_macosx_sdk=10.6
2716         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2717             with_macosx_sdk=10.7
2718         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2719             with_macosx_sdk=10.6
2720         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2721             with_macosx_sdk=10.7
2722         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2723             with_macosx_sdk=10.8
2724         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2725             with_macosx_sdk=10.9
2726         elif test -x /usr/bin/xcode-select; then
2727             xcodepath="`xcode-select -print-path`"
2728             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2729                 with_macosx_sdk=10.6
2730             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2731                 with_macosx_sdk=10.7
2732             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2733                 with_macosx_sdk=10.8
2734             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2735                 with_macosx_sdk=10.9
2736             fi
2737         fi
2738         if test -z "$with_macosx_sdk"; then
2739             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2740         fi
2741     fi
2743     case $with_macosx_sdk in
2744     10.5)
2745         MACOSX_SDK_VERSION=1050
2746         ;;
2747     10.6)
2748         MACOSX_SDK_VERSION=1060
2749         ;;
2750     10.7)
2751         MACOSX_SDK_VERSION=1070
2752         ;;
2753     10.8)
2754         MACOSX_SDK_VERSION=1080
2755         ;;
2756     10.9)
2757         MACOSX_SDK_VERSION=1090
2758         ;;
2759     10.10)
2760         MACOSX_SDK_VERSION=101000
2761         ;;
2762     *)
2763         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.5--10])
2764         ;;
2765     esac
2767     # Next find it (again, if we deduced its version above by finding
2768     # it... but we need to look for it once more in case
2769     # --with-macosx-sdk was given so that the above search did not
2770     # happen).
2771     if test -z "$MACOSX_SDK_PATH"; then
2772         case $with_macosx_sdk in
2773         10.5)
2774             if test -x /usr/bin/xcode-select; then
2775                 xcodepath="`xcode-select -print-path`"
2776                 if test -d "$xcodepath/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2777                     MACOSX_SDK_PATH="$xcodepath/SDKs/MacOSX$with_macosx_sdk.sdk"
2778                 fi
2779             elif test -d /Developer/SDKs/MacOSX10.5.sdk; then
2780                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.5.sdk
2781             elif test -d /Developer-old/SDKs/MacOSX10.5.sdk; then
2782                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.5.sdk
2783             elif test -d /Xcode3/SDKs/MacOSX10.5.sdk; then
2784                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.5.sdk
2785             fi
2786             ;;
2787         10.6)
2788             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2789                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2790             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2791                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2792             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2793                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2794             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2795                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2796             elif test -x /usr/bin/xcode-select; then
2797                 xcodepath="`xcode-select -print-path`"
2798                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2799                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2800                 fi
2801             fi
2802             ;;
2803         10.7)
2804             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2805                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2806             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2807                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2808             elif test -x /usr/bin/xcode-select; then
2809                 xcodepath="`xcode-select -print-path`"
2810                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2811                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2812                 fi
2813             fi
2814             ;;
2815         10.8|10.9|10.10)
2816             xcodepath="`xcode-select -print-path`"
2817             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2818                 MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2819             fi
2820             ;;
2821         esac
2822         if test -z "$MACOSX_SDK_PATH"; then
2823             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2824         fi
2825     fi
2826     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2828     if test "$with_macosx_version_min_required" = ""; then
2829         case $with_macosx_sdk in
2830         10.5)
2831             with_macosx_version_min_required="10.5";;
2832         *)
2833             with_macosx_version_min_required="10.6";;
2834         esac
2835     fi
2837     if test "$with_macosx_version_max_allowed" = ""; then
2838         with_macosx_version_max_allowed="$with_macosx_sdk"
2839     fi
2841     # export this so that "xcrun" invocations later return matching values
2842     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2843     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2844     export DEVELOPER_DIR
2845     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2846     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2848     case "$with_macosx_version_min_required" in
2849     10.5)
2850         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2851         ;;
2852     10.6)
2853         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2854         ;;
2855     10.7)
2856         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2857         ;;
2858     10.8)
2859         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2860         ;;
2861     10.9)
2862         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2863         ;;
2864     10.10)
2865         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2866         ;;
2867     *)
2868         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.5--10])
2869         ;;
2870     esac
2872     if test "$BITNESS_OVERRIDE" = ""; then
2873         case "$with_macosx_version_min_required" in
2874         10.5)
2875             case "$with_macosx_sdk" in
2876             10.5)
2877                 ;;
2878             *)
2879                 AC_MSG_WARN([Building with a SDK > 10.5 possibly breaks 10.5 compatibility.])
2880                 add_warning "Building with a SDK > 10.5 possibly breaks 10.5 compatibility."
2881                 ;;
2882             esac
2883             ;;
2884         esac
2885     fi
2887     # If no CC and CXX environment vars, try to guess where the compiler is
2888     LIBTOOL=libtool
2889     INSTALL_NAME_TOOL=install_name_tool
2890     if test -z "$save_CC"; then
2891         AC_MSG_CHECKING([what compiler to use])
2892         case $with_macosx_sdk in
2893         10.5)
2894             CC="${gccprefix}gcc-4.2 $arch -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2895             CXX="${gccprefix}g++-4.2 $arch -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2896             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2897             ;;
2898         10.6)
2899             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2900             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2901                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2902                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2903             else
2904                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2905                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2906             fi
2907             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2908             LIBTOOL=libtool
2909             ;;
2910         10.7|10.8|10.9|10.10)
2911             if test "$with_macosx_version_min_required" != 10.6; then
2912                 # Use libc++ instead of libstdc++ when possible
2913                 stdlib=-stdlib=libc++
2914             fi
2915             if test "$ENABLE_LTO" = TRUE; then
2916                 lto=-flto
2917             fi
2918             CC="`xcrun -find clang` $bitness $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2919             CXX="`xcrun -find clang++` $bitness $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2920             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2921             AR=`xcrun -find ar`
2922             NM=`xcrun -find nm`
2923             STRIP=`xcrun -find strip`
2924             LIBTOOL=`xcrun -find libtool`
2925             RANLIB=`xcrun -find ranlib`
2926             ;;
2927         esac
2928         AC_MSG_RESULT([$CC and $CXX])
2929     fi
2931     case "$with_macosx_version_max_allowed" in
2932     10.5)
2933         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2934         ;;
2935     10.6)
2936         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2937         ;;
2938     10.7)
2939         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2940         ;;
2941     10.8)
2942         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2943         ;;
2944     10.9)
2945         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2946         ;;
2947     10.10)
2948         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2949         ;;
2950     *)
2951         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.5--10])
2952         ;;
2953     esac
2955     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2956     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2957         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2958     else
2959         AC_MSG_RESULT([ok])
2960     fi
2962     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2963     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2964         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2965     else
2966         AC_MSG_RESULT([ok])
2967     fi
2968     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2969     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2971     AC_MSG_CHECKING([whether to do code signing])
2973     if test "$enable_macosx_code_signing" = yes; then
2974         # By default use the first suitable certificate (?).
2976         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2977         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2978         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2979         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2980         # "Developer ID Application" one.
2982         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2983         if test -n "$identity"; then
2984             MACOSX_CODESIGNING_IDENTITY=$identity
2985             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2986             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2987         fi
2988     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2989         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2990         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2991         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2992     else
2993         AC_MSG_RESULT([no])
2994     fi
2996     AC_MSG_CHECKING([whether to create a Mac App Store package])
2998     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2999         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3000     elif test "$enable_macosx_package_signing" = yes; then
3001         # By default use the first suitable certificate.
3002         # It should be a "3rd Party Mac Developer Installer" one
3004         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3005         if test -n "$identity"; then
3006             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3007             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3008             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3009         else
3010             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3011         fi
3012     elif test -n "$enable_macosx_package_signing"; then
3013         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3014         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3015         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3016     else
3017         AC_MSG_RESULT([no])
3018     fi
3020     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3021         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3022     fi
3024     AC_MSG_CHECKING([whether to sandbox the application])
3026     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3027         AC_MSG_ERROR([OS X sandboxing requires code signing])
3028     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3029         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
3030     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3031         ENABLE_MACOSX_SANDBOX=TRUE
3032         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3033         AC_MSG_RESULT([yes])
3034     else
3035         AC_MSG_RESULT([no])
3036     fi
3038     AC_MSG_CHECKING([what OS X app bundle identifier to use])
3039     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3040     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3042     AC_MSG_CHECKING([what OS X app name to use])
3043     MACOSX_APP_NAME="$with_macosx_app_name"
3044     AC_MSG_RESULT([$MACOSX_APP_NAME])
3046     AC_MSG_CHECKING([build with mac retina support])
3047     if test "$enable_macosx_retina" = yes ; then
3048         MACOSX_HIGH_RESOLUTION_VALUE=true
3049     else
3050         MACOSX_HIGH_RESOLUTION_VALUE=false
3051     fi
3052     AC_MSG_RESULT([$MACOSX_HIGH_RESOLUTION_VALUE])
3054 AC_SUBST(MACOSX_SDK_PATH)
3055 AC_SUBST(MACOSX_SDK_VERSION)
3056 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3057 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3058 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3059 AC_SUBST(INSTALL_NAME_TOOL)
3060 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
3061 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3062 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3063 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3064 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3065 AC_SUBST(MACOSX_APP_NAME)
3066 AC_SUBST(MACOSX_HIGH_RESOLUTION_VALUE)
3068 dnl ===================================================================
3069 dnl Check iOS SDK and compiler
3070 dnl ===================================================================
3072 if test $_os = iOS; then
3074     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3075         :
3076     else
3077         BITNESS_OVERRIDE=64
3078     fi
3080     AC_MSG_CHECKING([what iOS SDK to use])
3082     if test "$enable_ios_simulator" = yes; then
3083         platform=iPhoneSimulator
3084     else
3085         platform=iPhoneOS
3086     fi
3088     xcode_developer=`xcode-select -print-path`
3090     pref_sdk_ver=7.0
3091     for sdkver in 7.1 7.0 6.1 6.0; do
3092         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3093         if test -d $t; then
3094             ios_sdk=$sdkver
3095             sysroot=$t
3096             break
3097         fi
3098     done
3100     if test -z "$sysroot"; then
3101         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
3102     fi
3104     AC_MSG_RESULT($sysroot)
3106     if test "$enable_ios_simulator" = yes; then
3107         if test "$BITNESS_OVERRIDE" = 64; then
3108             XCODE_ARCHS=x86_64
3109             versionmin=-mios-simulator-version-min=7.0
3110         else
3111             XCODE_ARCHS=i386
3112             case $sdkver in
3113             7.*)
3114                 versionmin=-mios-simulator-version-min=6.1
3115                 ;;
3116             *)
3117                 versionmin=-mmacosx-version-min=10.7
3118                 ;;
3119             esac
3120         fi
3121     else
3122         platform=iPhoneOS
3123         if test "$BITNESS_OVERRIDE" = 64; then
3124             XCODE_ARCHS=arm64
3125             versionmin=-miphoneos-version-min=7.0
3126         else
3127             XCODE_ARCHS=armv7
3128             versionmin=-miphoneos-version-min=6.1
3129         fi
3130     fi
3132     # LTO is not really recommended for iOS builds,
3133     # the link time will be astronomical
3134     if test "$ENABLE_LTO" = TRUE; then
3135         lto=-flto
3136     fi
3137     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3138     # get compiled with it, to avoid ld warnings when linking all that together into one
3139     # executable.
3141     # Use libc++ for iOS 7 SDK and libstdc++ for earlier (but we don't really expect anybody to
3142     # be be using an earlier SDK)
3144     XCODE_CLANG_CXX_LIBRARY=libstdc++
3145     case $ios_sdk in
3146     6.*)
3147         ;;
3148     *)
3149         XCODE_CLANG_CXX_LIBRARY=libc++
3150         ;;
3151     esac
3153     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3155     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3156     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3158     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3159     AR=`xcrun -find ar`
3160     NM=`xcrun -find nm`
3161     STRIP=`xcrun -find strip`
3162     LIBTOOL=`xcrun -find libtool`
3163     RANLIB=`xcrun -find ranlib`
3166 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3167 AC_SUBST(XCODE_ARCHS)
3169 AC_MSG_CHECKING([whether to treat the installation as read-only])
3171 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3172         "$enable_extensions" != yes; then
3173     enable_readonly_installset=yes
3175 if test "$enable_readonly_installset" = yes; then
3176     AC_MSG_RESULT([yes])
3177     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3178 else
3179     AC_MSG_RESULT([no])
3182 dnl ===================================================================
3183 dnl Structure of install set
3184 dnl ===================================================================
3186 if test $_os = Darwin -a "$enable_canonical_installation_tree_structure" = yes; then
3187     LIBO_BIN_FOLDER=MacOS
3188     LIBO_ETC_FOLDER=Resources
3189     LIBO_LIBEXEC_FOLDER=MacOS
3190     LIBO_LIB_FOLDER=Frameworks
3191     LIBO_SHARE_FOLDER=Resources
3192     LIBO_SHARE_HELP_FOLDER=Resources/help
3193     LIBO_SHARE_JAVA_FOLDER=Resources/java
3194     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3195     LIBO_LIB_PYUNO_FOLDER=Resources
3196     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3197     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3198     LIBO_URE_BIN_FOLDER=MacOS
3199     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3200     LIBO_URE_LIB_FOLDER=Frameworks
3201     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3202     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3203     ENABLE_MACOSX_MACLIKE_APP_STRUCTURE=TRUE
3204     AC_DEFINE(HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE)
3205 elif test $_os = Darwin; then
3206     LIBO_BIN_FOLDER=MacOS
3207     LIBO_ETC_FOLDER=MacOS
3208     LIBO_LIBEXEC_FOLDER=MacOS
3209     LIBO_LIB_FOLDER=MacOS
3210     LIBO_LIB_PYUNO_FOLDER=MacOS
3211     LIBO_SHARE_FOLDER=share
3212     LIBO_SHARE_HELP_FOLDER=help
3213     LIBO_SHARE_JAVA_FOLDER=MacOS/classes
3214     LIBO_SHARE_PRESETS_FOLDER=presets
3215     LIBO_SHARE_RESOURCE_FOLDER=MacOS/resource
3216     LIBO_SHARE_SHELL_FOLDER=MacOS/shell
3217     LIBO_URE_BIN_FOLDER=ure-link/bin
3218     LIBO_URE_ETC_FOLDER=ure-link/lib
3219     LIBO_URE_LIB_FOLDER=ure-link/lib
3220     LIBO_URE_SHARE_FOLDER=ure-link/share
3221     LIBO_URE_SHARE_JAVA_FOLDER=ure-link/share/java
3222 elif test $_os = WINNT; then
3223     LIBO_BIN_FOLDER=program
3224     LIBO_ETC_FOLDER=program
3225     LIBO_LIBEXEC_FOLDER=program
3226     LIBO_LIB_FOLDER=program
3227     LIBO_LIB_PYUNO_FOLDER=program
3228     LIBO_SHARE_FOLDER=share
3229     LIBO_SHARE_HELP_FOLDER=help
3230     LIBO_SHARE_JAVA_FOLDER=program/classes
3231     LIBO_SHARE_PRESETS_FOLDER=presets
3232     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3233     LIBO_SHARE_SHELL_FOLDER=program/shell
3234     LIBO_URE_BIN_FOLDER=URE/bin
3235     LIBO_URE_ETC_FOLDER=URE/bin
3236     LIBO_URE_LIB_FOLDER=URE/bin
3237     LIBO_URE_SHARE_FOLDER=URE
3238     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3239 else
3240     LIBO_BIN_FOLDER=program
3241     LIBO_ETC_FOLDER=program
3242     LIBO_LIBEXEC_FOLDER=program
3243     LIBO_LIB_FOLDER=program
3244     LIBO_LIB_PYUNO_FOLDER=program
3245     LIBO_SHARE_FOLDER=share
3246     LIBO_SHARE_HELP_FOLDER=help
3247     LIBO_SHARE_JAVA_FOLDER=program/classes
3248     LIBO_SHARE_PRESETS_FOLDER=presets
3249     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3250     LIBO_SHARE_SHELL_FOLDER=program/shell
3251     LIBO_URE_BIN_FOLDER=ure/bin
3252     LIBO_URE_ETC_FOLDER=ure/lib
3253     LIBO_URE_LIB_FOLDER=ure/lib
3254     LIBO_URE_SHARE_FOLDER=ure/share
3255     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3257 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3258 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3259 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3260 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3261 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3262 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3263 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3264 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3265 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3266 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3267 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3268 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3269 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3270 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3271 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3272 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3274 # Not all of them needed in config_host.mk, add more if need arises
3275 AC_SUBST(LIBO_BIN_FOLDER)
3276 AC_SUBST(LIBO_ETC_FOLDER)
3277 AC_SUBST(LIBO_LIB_FOLDER)
3278 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3279 AC_SUBST(LIBO_SHARE_FOLDER)
3280 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3281 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3282 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3283 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3284 AC_SUBST(LIBO_URE_BIN_FOLDER)
3285 AC_SUBST(LIBO_URE_ETC_FOLDER)
3286 AC_SUBST(LIBO_URE_LIB_FOLDER)
3287 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3288 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3289 AC_SUBST(ENABLE_MACOSX_MACLIKE_APP_STRUCTURE)
3291 dnl ===================================================================
3292 dnl Windows specific tests and stuff
3293 dnl ===================================================================
3295 # Get a value from the 32-bit side of the Registry
3296 reg_get_value_32()
3298     # Return value: $regvalue
3299     unset regvalue
3300     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3302     if test $? -eq 0; then
3303         regvalue=$_regvalue
3304     fi
3307 # Get a value from the 64-bit side of the Registry
3308 reg_get_value_64()
3310     # Return value: $regvalue
3311     unset regvalue
3312     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3314     if test $? -eq 0; then
3315         regvalue=$_regvalue
3316     fi
3319 if test "$_os" = "WINNT"; then
3320     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3321     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3322         AC_MSG_RESULT([no])
3323         WINDOWS_SDK_ARCH="x86"
3324     else
3325         AC_MSG_RESULT([yes])
3326         WINDOWS_SDK_ARCH="x64"
3327         BITNESS_OVERRIDE=64
3328     fi
3331 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3332     AC_MSG_CHECKING([whether to use DirectX])
3333     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3334         ENABLE_DIRECTX="TRUE"
3335         AC_MSG_RESULT([yes])
3336     else
3337         ENABLE_DIRECTX=""
3338         AC_MSG_RESULT([no])
3339     fi
3341     AC_MSG_CHECKING([whether to use ActiveX])
3342     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
3343         DISABLE_ACTIVEX=""
3344         AC_MSG_RESULT([yes])
3345     else
3346         DISABLE_ACTIVEX="TRUE"
3347         AC_MSG_RESULT([no])
3348     fi
3350     AC_MSG_CHECKING([whether to use ATL])
3351     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
3352         DISABLE_ATL=""
3353         AC_MSG_RESULT([yes])
3354     else
3355         DISABLE_ATL="TRUE"
3356         AC_MSG_RESULT([no])
3357     fi
3358 else
3359     ENABLE_DIRECTX=""
3360     DISABLE_ACTIVEX="TRUE"
3361     DISABLE_ATL="TRUE"
3364 AC_SUBST(ENABLE_DIRECTX)
3365 AC_SUBST(DISABLE_ACTIVEX)
3366 AC_SUBST(DISABLE_ATL)
3368 if test "$cross_compiling" = "yes"; then
3369     export CROSS_COMPILING=TRUE
3370     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3371 else
3372     CROSS_COMPILING=
3373     BUILD_TYPE="$BUILD_TYPE NATIVE"
3375 AC_SUBST(CROSS_COMPILING)
3377 dnl ===================================================================
3378 dnl  Is GCC actually Clang?
3379 dnl ===================================================================
3381 COM_GCC_IS_CLANG=
3382 if test "$GCC" = "yes"; then
3383     AC_MSG_CHECKING([whether GCC is actually Clang])
3384     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3385         #ifndef __clang__
3386         you lose
3387         #endif
3388         int foo=42;
3389         ]])],
3390         [AC_MSG_RESULT([yes])
3391          COM_GCC_IS_CLANG=TRUE],
3392         [AC_MSG_RESULT([no])])
3394     if test "$COM_GCC_IS_CLANG" = TRUE; then
3395         AC_MSG_CHECKING([the Clang version])
3396         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3397         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3398         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3399         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3400         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3401     fi
3403 AC_SUBST(COM_GCC_IS_CLANG)
3405 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3406     if test -z "$CCACHE_CPP2"; then
3407             AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3408             add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3409     fi
3412 dnl ===================================================================
3413 dnl  Test the gcc version
3414 dnl ===================================================================
3415 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3416     AC_MSG_CHECKING([the GCC version])
3417     _gcc_version=`$CC -dumpversion`
3418     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3420     if test "$_os" = "Darwin"; then
3421         if test "$with_macosx_sdk" = "10.5"; then
3422             # use gcc 4.2 for OS X SDK 10.5
3423             if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.2"; then
3424                 export CC="$GCC_HOME/bin/gcc-4.2" # make CC finally available to config.guess
3425             fi
3426             AC_MSG_RESULT([using CC=$CC])
3427         fi
3428     else
3429         AC_MSG_RESULT([gcc $_gcc_version])
3430     fi
3432     if test "$GCC_VERSION" -lt 0401; then
3433         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.1.0])
3434     fi
3435 else
3436     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3437     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3438     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3439     # (which reports itself as GCC 4.2.1).
3440     GCC_VERSION=
3442 AC_SUBST(GCC_VERSION)
3444 # ===================================================================
3445 # check various GCC options that Clang does not support now but maybe
3446 # will somewhen in the future, check them even for GCC, so that the
3447 # flags are set
3448 # ===================================================================
3450 HAVE_GCC_GGDB2=
3451 HAVE_GCC_FINLINE_LIMIT=
3452 HAVE_GCC_FNO_INLINE=
3453 if test "$GCC" = "yes"; then
3454     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3455     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3456         # Option just ignored and silly warning that isn't a real
3457         # warning printed
3458         :
3459     else
3460         save_CFLAGS=$CFLAGS
3461         CFLAGS="$CFLAGS -Werror -ggdb2"
3462         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3463         CFLAGS=$save_CFLAGS
3464     fi
3465     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3466         AC_MSG_RESULT([yes])
3467     else
3468         AC_MSG_RESULT([no])
3469     fi
3471     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3472     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3473         # As above
3474         :
3475     else
3476         save_CFLAGS=$CFLAGS
3477         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3478         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3479         CFLAGS=$save_CFLAGS
3480     fi
3481     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3482         AC_MSG_RESULT([yes])
3483     else
3484         AC_MSG_RESULT([no])
3485     fi
3487     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3488     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3489         # Ditto
3490         :
3491     else
3492         save_CFLAGS=$CFLAGS
3493         CFLAGS="$CFLAGS -Werror -fno-inline"
3494         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3495         CFLAGS=$save_CFLAGS
3496     fi
3497     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3498         AC_MSG_RESULT([yes])
3499     else
3500         AC_MSG_RESULT([no])
3501     fi
3503 AC_SUBST(HAVE_GCC_GGDB2)
3504 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3505 AC_SUBST(HAVE_GCC_FNO_INLINE)
3507 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3508 if test "$GCC" = "yes"; then
3509     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3510     bsymbolic_functions_ldflags_save=$LDFLAGS
3511     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3512     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3513 #include <stdio.h>
3514         ],[
3515 printf ("hello world\n");
3516         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3517     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3518         AC_MSG_RESULT( found )
3519     else
3520         AC_MSG_RESULT( not found )
3521     fi
3522     LDFLAGS=$bsymbolic_functions_ldflags_save
3524 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3526 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3527 # NOTE: must _not_ be used for bundled external libraries!
3528 ISYSTEM=
3529 if test "$GCC" = "yes"; then
3530     AC_MSG_CHECKING( for -isystem )
3531     save_CFLAGS=$CFLAGS
3532     CFLAGS="$CFLAGS -Werror"
3533     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3534     CFLAGS=$save_CFLAGS
3535     if test -n "$ISYSTEM"; then
3536         AC_MSG_RESULT(yes)
3537     else
3538         AC_MSG_RESULT(no)
3539     fi
3541 if test -z "$ISYSTEM"; then
3542     # fall back to using -I
3543     ISYSTEM=-I
3545 AC_SUBST(ISYSTEM)
3547 dnl ===================================================================
3548 dnl  Check which Visual Studio or MinGW compiler is used
3549 dnl ===================================================================
3551 map_vs_year_to_version()
3553     # Return value: $vsversion
3555     unset vsversion
3557     case $1 in
3558     2010)
3559         vsversion=10.0;;
3560     2012)
3561         vsversion=11.0;;
3562     2013)
3563         vsversion=12.0;;
3564     *)
3565         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3566     esac
3569 vs_versions_to_check()
3571     # Args: $1 (optional) : versions to check, in the order of preference
3572     # Return value: $vsversions
3574     unset vsversions
3576     if test -n "$1"; then
3577         map_vs_year_to_version "$1"
3578         vsversions=$vsversion
3579     else
3580         # By default we prefer 2012, then 2010, then 2013
3581         vsversions="11.0 10.0 12.0"
3582     fi
3585 find_msvs()
3587     # Find Visual Studio 2012/2010/2013
3588     # Args: $1 (optional) : versions to check, in the order of preference
3589     # Return value: $vstest
3591     unset vstest
3593     vs_versions_to_check "$1"
3595     for ver in $vsversions; do
3596         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3597         if test -n "$regvalue"; then
3598             vstest=$regvalue
3599             break
3600         fi
3601         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3602         if test -n "$regvalue"; then
3603             vstest=$regvalue
3604             break
3605         fi
3606     done
3609 find_msvc()
3611     # Find Visual C++ 2012/2010/2013
3612     # Args: $1 (optional) : The VS version year
3613     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3615     unset vctest vcnum vcnumwithdot
3617     vs_versions_to_check "$1"
3619     for ver in $vsversions; do
3620         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3621         if test -n "$regvalue"; then
3622             vctest=$regvalue
3623             break
3624         fi
3625         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3626         if test -n "$regvalue"; then
3627             vctest=$regvalue
3628             break
3629         fi
3630     done
3631     if test -n "$vctest"; then
3632         vcnumwithdot=$ver
3633         case "$vcnumwithdot" in
3634         10.0)
3635             vcyear=2010
3636             vcnum=100
3637             ;;
3638         11.0)
3639             vcyear=2012
3640             vcnum=110
3641             ;;
3642         12.0)
3643             vcyear=2013
3644             vcnum=120
3645             ;;
3646         esac
3647     fi
3650 SHOWINCLUDES_PREFIX=
3651 if test "$_os" = "WINNT"; then
3652     if test "$WITH_MINGW" != "yes"; then
3653         AC_MSG_CHECKING([Visual C++])
3655         find_msvc "$with_visual_studio"
3657         if test -z "$vctest"; then
3658             if test -n "$with_visual_studio"; then
3659                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3660             else
3661                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2013 installation found])
3662             fi
3663         fi
3665         if test "$BITNESS_OVERRIDE" = ""; then
3666             if test -f "$vctest/bin/cl.exe"; then
3667                 VC_PRODUCT_DIR=$vctest
3668             else
3669                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3670             fi
3671         else
3672             if test -f "$vctest/bin/amd64/cl.exe"; then
3673                 VC_PRODUCT_DIR=$vctest
3674             else
3675                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3676             fi
3677         fi
3679         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3680         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3681         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3683         dnl ===========================================================
3684         dnl  Check for the corresponding mspdb*.dll
3685         dnl ===========================================================
3687         MSPDB_PATH=
3689         if test "$BITNESS_OVERRIDE" = ""; then
3690             if test "$vcnum" = "120"; then
3691                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3692             else
3693                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3694             fi
3695         else
3696             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3697         fi
3699         mspdbnum=$vcnum
3701         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3702             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3703         fi
3705         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3706         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3708         dnl The path needs to be added before cl is called
3709         PATH="$MSPDB_PATH:$PATH"
3711         AC_MSG_CHECKING([cl.exe])
3713         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3714         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3715         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3716         # is not enough?
3718         if test -z "$CC"; then
3719             if test "$BITNESS_OVERRIDE" = ""; then
3720                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3721                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3722                 fi
3723             else
3724                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3725                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3726                 fi
3727             fi
3729             # This gives us a posix path with 8.3 filename restrictions
3730             CC=`cygpath -d "$CC"`
3731             CC=`cygpath -u "$CC"`
3732         fi
3734         if test -n "$CC"; then
3735             # Remove /cl.exe from CC case insensitive
3736             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3737             if test "$BITNESS_OVERRIDE" = ""; then
3738                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3739             else
3740                 if test -n "$VC_PRODUCT_DIR"; then
3741                     # Huh, why not just an assignment?
3742                     COMPATH=`echo $VC_PRODUCT_DIR`
3743                 fi
3744             fi
3745             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3747             PathFormat "$COMPATH"
3748             COMPATH="$formatted_path"
3750             VCVER=$vcnum
3751             MSVSVER=$vcyear
3753             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3754             # are always "better", we list them in reverse chronological order.
3756             case $vcnum in
3757             100)
3758                 COMEX=13
3759                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3760                 if test "$ENABLE_LTO" = TRUE; then
3762                     AC_MSG_WARN([LTO is known to cause problems with MSVC 2010])
3763                     add_warning "LTO is known to cause problems with MSVC 2010"
3764                 fi
3765                 ;;
3766             110)
3767                 COMEX=14
3768                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3769                 ;;
3770             120)
3771                 COMEX=15
3772                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3773                 ;;
3774             esac
3776             # The expectation is that --with-windows-sdk should not need to be used
3777             if test -n "$with_windows_sdk"; then
3778                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3779                 *" "$with_windows_sdk" "*)
3780                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3781                     ;;
3782                 *)
3783                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3784                     ;;
3785                 esac
3786             fi
3788             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3789             ac_objext=obj
3790             ac_exeext=exe
3792         else
3793             AC_MSG_ERROR([Visual C++ not found after all, huh])
3794         fi
3796         dnl We need to guess the prefix of the -showIncludes output, it can be
3797         dnl localized
3798         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3799         echo "#include <stdlib.h>" > conftest.c
3800         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3801             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3802         rm -f conftest.c conftest.obj
3803         if test -z "$SHOWINCLUDES_PREFIX"; then
3804             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3805         else
3806             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3807         fi
3809         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3810         # version of the Explorer extension (and maybe other small
3811         # bits, too) needed when installing a 32-bit LibreOffice on a
3812         # 64-bit OS. The 64-bit Explorer extension is a feature that
3813         # has been present since long in OOo. Don't confuse it with
3814         # building LibreOffice itself as 64-bit code, which is
3815         # unfinished work and highly experimental.
3817         BUILD_X64=
3818         CXX_X64_BINARY=
3819         LINK_X64_BINARY=
3821         if test "$BITNESS_OVERRIDE" = ""; then
3822             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3823             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3824                 # Prefer native x64 compiler to cross-compiler, in case we are running
3825                 # the build on a 64-bit OS.
3826                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3827                     BUILD_X64=TRUE
3828                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3829                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3830                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3831                     BUILD_X64=TRUE
3832                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3833                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3834                 fi
3835             fi
3836             if test "$BUILD_X64" = TRUE; then
3837                 AC_MSG_RESULT([found])
3838             else
3839                 AC_MSG_RESULT([not found])
3840                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3841             fi
3842         fi
3843         AC_SUBST(BUILD_X64)
3845         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3846         AC_SUBST(CXX_X64_BINARY)
3847         AC_SUBST(LINK_X64_BINARY)
3848     else
3849         AC_MSG_CHECKING([the compiler is MinGW])
3850         MACHINE_PREFIX=`$CC -dumpmachine`
3851         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3852             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3853             AC_MSG_RESULT([yes])
3854         else
3855             AC_MSG_ERROR([Compiler is not MinGW.])
3856         fi
3857     fi
3859 AC_SUBST(VCVER)
3860 PathFormat "$MSPDB_PATH"
3861 MSPDB_PATH="$formatted_path"
3862 AC_SUBST(SHOWINCLUDES_PREFIX)
3865 # dbghelp.dll
3867 if test "$_os" = "WINNT"; then
3868     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3872 # unowinreg.dll
3874 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3875 AC_SUBST(UNOWINREG_DLL)
3878 # prefix C with ccache if needed
3880 if test "$CCACHE" != ""; then
3881     AC_MSG_CHECKING([whether $CC is already ccached])
3883     AC_LANG_PUSH([C])
3884     save_CFLAGS=$CFLAGS
3885     CFLAGS="$CFLAGS --ccache-skip -O2"
3886     dnl an empty program will do, we're checking the compiler flags
3887     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3888                       [use_ccache=yes], [use_ccache=no])
3889     if test $use_ccache = yes; then
3890         AC_MSG_RESULT([yes])
3891     else
3892         CC="$CCACHE $CC"
3893         AC_MSG_RESULT([no])
3894     fi
3895     CFLAGS=$save_CFLAGS
3896     AC_LANG_POP([C])
3899 dnl Set the ENABLE_DBGUTIL variable
3900 dnl ===================================================================
3901 AC_MSG_CHECKING([whether to build with additional debug utilities])
3902 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3903     ENABLE_DBGUTIL="TRUE"
3904     # this is an extra var so it can have different default on different MSVC
3905     # versions (in case there are version specific problems with it)
3906     MSVC_USE_DEBUG_RUNTIME="TRUE"
3908     AC_MSG_RESULT([yes])
3909     # cppunit and graphite expose STL in public headers
3910     if test "$with_system_cppunit" = "yes"; then
3911         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3912     else
3913         with_system_cppunit=no
3914     fi
3915     if test "$with_system_graphite" = "yes"; then
3916         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3917     else
3918         with_system_graphite=no
3919     fi
3920     if test "$with_system_mysql_cppconn" = "yes"; then
3921         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3922     else
3923         with_system_mysql_cppconn=no
3924     fi
3925     if test "$with_system_orcus" = "yes"; then
3926         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3927     else
3928         with_system_orcus=no
3929     fi
3930     if test "$with_system_libcmis" = "yes"; then
3931         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3932     else
3933         with_system_libcmis=no
3934     fi
3935     if test "$enable_win_mozab_driver" = "yes"; then
3936         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3937     fi
3938 else
3939     ENABLE_DBGUTIL=""
3940     MSVC_USE_DEBUG_RUNTIME=""
3941     AC_MSG_RESULT([no])
3943 AC_SUBST(ENABLE_DBGUTIL)
3944 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3946 dnl Set the ENABLE_DEBUG variable.
3947 dnl ===================================================================
3948 AC_MSG_CHECKING([whether to do a debug build])
3949 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3950     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3952 if test -n "$ENABLE_DBGUTIL"; then
3953     if test "$enable_debug" = "no"; then
3954         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3955     fi
3956     ENABLE_DEBUG="TRUE"
3957     AC_MSG_RESULT([yes (dbgutil)])
3958 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3959     ENABLE_DEBUG="TRUE"
3960     AC_MSG_RESULT([yes])
3961 else
3962     ENABLE_DEBUG=""
3963     AC_MSG_RESULT([no])
3965 AC_SUBST(ENABLE_DEBUG)
3967 dnl Selective debuginfo
3968 ENABLE_DEBUGINFO_FOR=
3969 if test -n "$ENABLE_DEBUG"; then
3970     AC_MSG_CHECKING([whether to use selective debuginfo])
3971     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3972         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3973         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3974     else
3975         ENABLE_DEBUGINFO_FOR=all
3976         AC_MSG_RESULT([no, for all])
3977     fi
3979 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3981 dnl Check for enable symbols option
3982 dnl ===================================================================
3983 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3984 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3985     ENABLE_SYMBOLS="TRUE"
3986     if test -n "$ENABLE_DBGUTIL"; then
3987         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3988     elif test -n "$ENABLE_DEBUG"; then
3989         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3990     fi
3991     AC_MSG_RESULT([yes])
3992 else
3993     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3994         ENABLE_SYMBOLS="FALSE"
3995     else
3996         ENABLE_SYMBOLS=
3997     fi
3998     AC_MSG_RESULT([no])
4000 AC_SUBST(ENABLE_SYMBOLS)
4002 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
4003 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
4004 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
4005 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
4006 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
4007     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4009 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4011 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4012 # By default use the ones specified by our build system,
4013 # but explicit override is possible.
4014 AC_MSG_CHECKING(for explicit AFLAGS)
4015 if test -n "$AFLAGS"; then
4016     AC_MSG_RESULT([$AFLAGS])
4017     x_AFLAGS=
4018 else
4019     AC_MSG_RESULT(no)
4020     x_AFLAGS=[\#]
4022 AC_MSG_CHECKING(for explicit CFLAGS)
4023 if test -n "$CFLAGS"; then
4024     AC_MSG_RESULT([$CFLAGS])
4025     x_CFLAGS=
4026 else
4027     AC_MSG_RESULT(no)
4028     x_CFLAGS=[\#]
4030 AC_MSG_CHECKING(for explicit CXXFLAGS)
4031 if test -n "$CXXFLAGS"; then
4032     AC_MSG_RESULT([$CXXFLAGS])
4033     x_CXXFLAGS=
4034 else
4035     AC_MSG_RESULT(no)
4036     x_CXXFLAGS=[\#]
4038 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4039 if test -n "$OBJCFLAGS"; then
4040     AC_MSG_RESULT([$OBJCFLAGS])
4041     x_OBJCFLAGS=
4042 else
4043     AC_MSG_RESULT(no)
4044     x_OBJCFLAGS=[\#]
4046 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4047 if test -n "$OBJCXXFLAGS"; then
4048     AC_MSG_RESULT([$OBJCXXFLAGS])
4049     x_OBJCXXFLAGS=
4050 else
4051     AC_MSG_RESULT(no)
4052     x_OBJCXXFLAGS=[\#]
4054 AC_MSG_CHECKING(for explicit LDFLAGS)
4055 if test -n "$LDFLAGS"; then
4056     AC_MSG_RESULT([$LDFLAGS])
4057     x_LDFLAGS=
4058 else
4059     AC_MSG_RESULT(no)
4060     x_LDFLAGS=[\#]
4062 AC_SUBST(AFLAGS)
4063 AC_SUBST(CFLAGS)
4064 AC_SUBST(CXXFLAGS)
4065 AC_SUBST(OBJCFLAGS)
4066 AC_SUBST(OBJCXXFLAGS)
4067 AC_SUBST(LDFLAGS)
4068 AC_SUBST(x_AFLAGS)
4069 AC_SUBST(x_CFLAGS)
4070 AC_SUBST(x_CXXFLAGS)
4071 AC_SUBST(x_OBJCFLAGS)
4072 AC_SUBST(x_OBJCXXFLAGS)
4073 AC_SUBST(x_LDFLAGS)
4076 # determine CPUNAME, GUIBASE, ...
4078 LIB64="lib"
4079 SOLARINC=
4081 case "$host_os" in
4083 aix*)
4084     COM=GCC
4085     CPUNAME=POWERPC
4086     GUIBASE=unx
4087     OS=AIX
4088     RTL_OS=AIX
4089     RTL_ARCH=PowerPC
4090     PLATFORMID=aix_powerpc
4091     OUTPATH=unxaigppc
4092     P_SEP=:
4093     ;;
4095 cygwin*)
4096     COM=MSC
4097     GUIBASE=not-used
4098     OS=WNT
4099     RTL_OS=Windows
4100     P_SEP=";"
4102     case "$host_cpu" in
4103     i*86|x86_64)
4104         if test "$BITNESS_OVERRIDE" = 64; then
4105             CPUNAME=X86_64
4106             RTL_ARCH=X86_64
4107             LIB64="lib/x64"
4108             PLATFORMID=windows_x86_64
4109             OUTPATH=wntmscx$COMEX
4110         else
4111             CPUNAME=INTEL
4112             RTL_ARCH=x86
4113             PLATFORMID=windows_x86
4114             OUTPATH=wntmsci$COMEX
4115         fi
4116         ;;
4117     *)
4118         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4119         ;;
4120     esac
4121     SCPDEFS="$SCPDEFS -D_MSC_VER"
4122     ;;
4124 darwin*)
4125     COM=GCC
4126     GUIBASE=not-used
4127     OS=MACOSX
4128     RTL_OS=MacOSX
4129     P_SEP=:
4131     case "$host_cpu" in
4132     arm*)
4133         CPUNAME=ARM
4134         RTL_ARCH=ARM_EABI
4135         PLATFORMID=ios_arm
4136         OUTPATH=unxiosr
4137         OS=IOS
4138         SDKDIR=sdk
4139         ;;
4140     powerpc*)
4141         CPUNAME=POWERPC
4142         RTL_ARCH=PowerPC
4143         PLATFORMID=macosx_powerpc
4144         OUTPATH=unxmacxp
4145         ;;
4146     i*86)
4147         if test "$BITNESS_OVERRIDE" = 64; then
4148             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4149         fi
4150         CPUNAME=INTEL
4151         RTL_ARCH=x86
4152         PLATFORMID=macosx_x86
4153         OUTPATH=unxmacxi
4154         ;;
4155     x86_64)
4156         if test "$BITNESS_OVERRIDE" = 64; then
4157             CPUNAME=X86_64
4158             RTL_ARCH=X86_64
4159             PLATFORMID=macosx_x86_64
4160             OUTPATH=unxmacxx
4161         else
4162             CPUNAME=INTEL
4163             RTL_ARCH=x86
4164             PLATFORMID=macosx_x86
4165             OUTPATH=unxmacxi
4166         fi
4167         ;;
4168     *)
4169         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4170         ;;
4171     esac
4172     ;;
4174 dragonfly*)
4175     COM=GCC
4176     GUIBASE=unx
4177     OS=DRAGONFLY
4178     RTL_OS=DragonFly
4179     OUTPATH=unxdfly
4180     P_SEP=:
4182     case "$host_cpu" in
4183     i*86)
4184         CPUNAME=INTEL
4185         RTL_ARCH=x86
4186         PLATFORMID=dragonfly_x86
4187         ;;
4188     x86_64)
4189         CPUNAME=X86_64
4190         RTL_ARCH=X86_64
4191         PLATFORMID=dragonfly_x86_64
4192         ;;
4193     *)
4194         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4195         ;;
4196     esac
4197     ;;
4199 freebsd*)
4200     COM=GCC
4201     GUIBASE=unx
4202     RTL_OS=FreeBSD
4203     OS=FREEBSD
4204     OUTPATH=unxfbsd
4205     P_SEP=:
4207     case "$host_cpu" in
4208     i*86)
4209         CPUNAME=INTEL
4210         RTL_ARCH=x86
4211         PLATFORMID=freebsd_x86
4212         OUTPATH=unxfbsdi
4213         ;;
4214     x86_64|amd64)
4215         CPUNAME=X86_64
4216         RTL_ARCH=X86_64
4217         PLATFORMID=freebsd_x86_64
4218         ;;
4219     *)
4220         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4221         ;;
4222     esac
4223     ;;
4225 kfreebsd*)
4226     COM=GCC
4227     GUIBASE=unx
4228     OS=LINUX
4229     RTL_OS=kFreeBSD
4230     P_SEP=:
4232     case "$host_cpu" in
4234     i*86)
4235         CPUNAME=INTEL
4236         RTL_ARCH=x86
4237         PLATFORMID=kfreebsd_x86
4238         OUTPATH=unxkfgi6
4239         ;;
4240     x86_64)
4241         CPUNAME=X86_64
4242         RTL_ARCH=X86_64
4243         LIB64="lib64"
4244         PLATFORMID=kfreebsd_x86_64
4245         OUTPATH=unxkfgx6
4246         ;;
4247     *)
4248         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4249         ;;
4250     esac
4251     ;;
4253 linux-gnu*)
4254     COM=GCC
4255     GUIBASE=unx
4256     OS=LINUX
4257     RTL_OS=Linux
4258     P_SEP=:
4260     case "$host_cpu" in
4262     alpha)
4263         CPUNAME=AXP
4264         RTL_ARCH=ALPHA
4265         PLATFORMID=linux_alpha
4266         OUTPATH=unxlngaxp
4267         ;;
4268     arm*)
4269         CPUNAME=ARM
4270         EPM_FLAGS="-a arm"
4271         OUTPATH=unxlngr
4272         RTL_ARCH=ARM_EABI
4273         PLATFORMID=linux_arm_eabi
4274         case "$host_cpu" in
4275         arm*-linux)
4276             RTL_ARCH=ARM_OABI
4277             PLATFORMID=linux_arm_oabi
4278             ;;
4279         esac
4280         ;;
4281     hppa)
4282         CPUNAME=HPPA
4283         RTL_ARCH=HPPA
4284         EPM_FLAGS="-a hppa"
4285         PLATFORMID=linux_hppa
4286         OUTPATH=unxlnghppa
4287         ;;
4288     i*86)
4289         CPUNAME=INTEL
4290         RTL_ARCH=x86
4291         PLATFORMID=linux_x86
4292         OUTPATH=unxlngi6
4293         ;;
4294     ia64)
4295         CPUNAME=IA64
4296         RTL_ARCH=IA64
4297         PLATFORMID=linux_ia64
4298         OUTPATH=unxlnga
4299         ;;
4300     mips)
4301         CPUNAME=GODSON
4302         RTL_ARCH=MIPS_EB
4303         EPM_FLAGS="-a mips"
4304         PLATFORMID=linux_mips_eb
4305         OUTPATH=unxlngmips
4306         ;;
4307     mips64)
4308         CPUNAME=GODSON
4309         RTL_ARCH=MIPS_EB
4310         EPM_FLAGS="-a mips64"
4311         PLATFORMID=linux_mips_eb
4312         OUTPATH=unxlngmips
4313         ;;
4314     mips64el)
4315         CPUNAME=GODSON
4316         RTL_ARCH=MIPS_EL
4317         EPM_FLAGS="-a mips64el"
4318         PLATFORMID=linux_mips_el
4319         OUTPATH=unxlngmips
4320         ;;
4321     mipsel)
4322         CPUNAME=GODSON
4323         RTL_ARCH=MIPS_EL
4324         EPM_FLAGS="-a mipsel"
4325         PLATFORMID=linux_mips_el
4326         OUTPATH=unxlngmips
4327         ;;
4328     m68k)
4329         CPUNAME=M68K
4330         RTL_ARCH=M68K
4331         PLATFORMID=linux_m68k
4332         OUTPATH=unxlngm68k
4333         ;;
4334     powerpc)
4335         CPUNAME=POWERPC
4336         RTL_ARCH=PowerPC
4337         PLATFORMID=linux_powerpc
4338         OUTPATH=unxlngppc
4339         ;;
4340     powerpc64)
4341         CPUNAME=POWERPC64
4342         RTL_ARCH=PowerPC_64
4343         LIB64="lib64"
4344         PLATFORMID=linux_powerpc64
4345         OUTPATH=unxlngppc64
4346         ;;
4347     sparc)
4348         CPUNAME=SPARC
4349         RTL_ARCH=SPARC
4350         PLATFORMID=linux_sparc
4351         OUTPATH=unxlngs
4352         ;;
4353     s390)
4354         CPUNAME=S390
4355         RTL_ARCH=S390
4356         PLATFORMID=linux_s390
4357         OUTPATH=unxlngs390
4358         ;;
4359     s390x)
4360         CPUNAME=S390X
4361         RTL_ARCH=S390x
4362         LIB64="lib64"
4363         PLATFORMID=linux_s390x
4364         OUTPATH=unxlngs390x
4365         ;;
4366     x86_64)
4367         CPUNAME=X86_64
4368         RTL_ARCH=X86_64
4369         LIB64="lib64"
4370         PLATFORMID=linux_x86_64
4371         OUTPATH=unxlngx6
4372         ;;
4373     *)
4374         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4375         ;;
4376     esac
4377     ;;
4379 linux-android*)
4380     COM=GCC
4381     GUIBASE=not-used
4382     OS=ANDROID
4383     RTL_OS=Android
4384     P_SEP=:
4386     case "$host_cpu" in
4388     arm|armel)
4389         CPUNAME=ARM
4390         RTL_ARCH=ARM_EABI
4391         PLATFORMID=android_arm_eabi
4392         OUTPATH=unxandr
4393         ;;
4394     mips|mipsel)
4395         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4396         RTL_ARCH=MIPS_EL
4397         PLATFORMID=android_mips_el
4398         OUTPATH=unxandm
4399         ;;
4400     i*86)
4401         CPUNAME=INTEL
4402         RTL_ARCH=x86
4403         PLATFORMID=android_x86
4404         OUTPATH=unxandi
4405         ;;
4406     *)
4407         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4408         ;;
4409     esac
4410     ;;
4412 mingw*)
4413     COM=GCC
4414     GUIBASE=not-used
4415     OS=WNT
4416     RTL_OS=Windows
4417     P_SEP=:
4419     case "$host_cpu" in
4420     i*86|x86_64)
4421         if test "$BITNESS_OVERRIDE" = 64; then
4422             CPUNAME=X86_64
4423             RTL_ARCH=X86_84
4424             PLATFORMID=windows_x86_64
4425             OUTPATH=wntgccx$COMEX
4426             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4427         else
4428             CPUNAME=INTEL
4429             RTL_ARCH=x86
4430             PLATFORMID=windows_x86
4431             OUTPATH=wntgcci$COMEX
4432             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4433         fi
4434         ;;
4435     *)
4436         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4437         ;;
4438     esac
4439     ;;
4441 *netbsd*)
4443     COM=GCC
4444     GUIBASE=unx
4445     OS=NETBSD
4446     RTL_OS=NetBSD
4447     OUTPATH=unxnbsd
4448     P_SEP=:
4450     case "$host_cpu" in
4451     i*86)
4452         CPUNAME=INTEL
4453         RTL_ARCH=x86
4454         PLATFORMID=netbsd_x86
4455         ;;
4456     powerpc)
4457         CPUNAME=POWERPC
4458         RTL_ARCH=PowerPC
4459         PLATFORMID=netbsd_powerpc
4460         ;;
4461     sparc)
4462         CPUNAME=SPARC
4463         RTL_ARCH=SPARC
4464         PLATFORMID=netbsd_sparc
4465         ;;
4466     x86_64)
4467         CPUNAME=X86_64
4468         RTL_ARCH=X86_64
4469         PLATFORMID=netbsd_x86_64
4470         ;;
4471     *)
4472         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4473         ;;
4474     esac
4475     ;;
4477 openbsd*)
4478     COM=GCC
4479     GUIBASE=unx
4480     OS=OPENBSD
4481     RTL_OS=OpenBSD
4482     OUTPATH=unxobsd
4483     P_SEP=:
4485     case "$host_cpu" in
4486     i*86)
4487         CPUNAME=INTEL
4488         RTL_ARCH=x86
4489         PLATFORMID=openbsd_x86
4490         ;;
4491     x86_64)
4492         CPUNAME=X86_64
4493         RTL_ARCH=X86_64
4494         PLATFORMID=openbsd_x86_64
4495         ;;
4496     *)
4497         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4498         ;;
4499     esac
4500     SOLARINC="$SOLARINC -I/usr/local/include"
4501     ;;
4503 solaris*)
4505     COM=GCC
4506     GUIBASE=unx
4507     OS=SOLARIS
4508     RTL_OS=Solaris
4509     P_SEP=:
4511     case "$host_cpu" in
4512     i*86)
4513         CPUNAME=INTEL
4514         RTL_ARCH=x86
4515         PLATFORMID=solaris_x86
4516         OUTPATH=unxsogi
4517         ;;
4518     sparc)
4519         CPUNAME=SPARC
4520         RTL_ARCH=SPARC
4521         PLATFORMID=solaris_sparc
4522         OUTPATH=unxsogs
4523         ;;
4524     sparc64)
4525         CPUNAME=SPARC64
4526         RTL_ARCH=SPARC64
4527         PLATFORMID=solaris_sparc64
4528         OUTPATH=unxsogu
4529         ;;
4530     *)
4531         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4532         ;;
4533     esac
4534     SOLARINC="$SOLARINC -I/usr/local/include"
4535     ;;
4538     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4539     ;;
4540 esac
4542 if test "$enable_headless" = "yes"; then
4543     if test "$GUIBASE" != "unx"; then
4544         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
4545     fi
4546     GUIBASE=not-used
4549 WORKDIR="${BUILDDIR}/workdir"
4550 INSTDIR="${BUILDDIR}/instdir"
4551 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4552 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4553 AC_SUBST(COM)
4554 AC_SUBST(CPUNAME)
4555 AC_SUBST(RTL_OS)
4556 AC_SUBST(RTL_ARCH)
4557 AC_SUBST(EPM_FLAGS)
4558 AC_SUBST(GUIBASE)
4559 AC_SUBST([INSTDIR])
4560 AC_SUBST([INSTROOT])
4561 AC_SUBST(OS)
4562 AC_SUBST(OUTPATH)
4563 AC_SUBST(P_SEP)
4564 AC_SUBST(WORKDIR)
4565 AC_SUBST(PLATFORMID)
4566 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4568 dnl ===================================================================
4569 dnl Test which package format to use
4570 dnl ===================================================================
4571 AC_MSG_CHECKING([which package format to use])
4572 if test -n "$with_package_format" -a "$with_package_format" != no; then
4573     for i in $with_package_format; do
4574         case "$i" in
4575         aix | bsd | deb | pkg | rpm | native | portable | archive | dmg | installed | msi)
4576             ;;
4577         *)
4578             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4579 aix - AIX software distribution
4580 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4581 deb - Debian software distribution
4582 pkg - Solaris software distribution
4583 rpm - RedHat software distribution
4584 native - "Native" software distribution for the platform
4585 portable - Portable software distribution
4587 LibreOffice additionally supports:
4588 archive - .tar.gz or .zip
4589 dmg - Mac OS X .dmg
4590 installed - installation tree
4591 msi - Windows .msi
4592         ])
4593             ;;
4594         esac
4595     done
4596     PKGFORMAT="$with_package_format"
4597     AC_MSG_RESULT([$PKGFORMAT])
4598 else
4599     PKGFORMAT=
4600     AC_MSG_RESULT([none])
4602 AC_SUBST(PKGFORMAT)
4604 dnl ===================================================================
4605 dnl Set up a different compiler to produce tools to run on the build
4606 dnl machine when doing cross-compilation
4607 dnl ===================================================================
4609 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4610 if test "$cross_compiling" = "yes"; then
4611     AC_MSG_CHECKING([for BUILD platform configuration])
4612     echo
4613     rm -rf CONF-FOR-BUILD config_build.mk
4614     mkdir CONF-FOR-BUILD
4615     # Here must be listed all files needed when running the configure script. In particular, also
4616     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4617     # keep them in the same order as there.
4618     (cd $SRC_ROOT && tar cf - \
4619         config.guess \
4620         bin/get_config_variables \
4621         solenv/bin/getcompver.awk \
4622         solenv/inc/langlist.mk \
4623         config_host.mk.in \
4624         Makefile.in \
4625         lo.xcent.in \
4626         instsetoo_native/util/openoffice.lst.in \
4627         config_host/*.in \
4628         sysui/desktop/macosx/Info.plist.in \
4629         ios/lo.xcconfig.in) \
4630     | (cd CONF-FOR-BUILD && tar xf -)
4631     cp configure CONF-FOR-BUILD
4632     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4633     (
4634     unset COM GUIBASE OS CPUNAME
4635     unset CC CXX SYSBASE CFLAGS
4636     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4637     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4638     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4639     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4640     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4641     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4642     cd CONF-FOR-BUILD
4643     sub_conf_opts=""
4644     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4645     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4646     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4647     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4648     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4649     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4650     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4651     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4652     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4653     # we need the msi build tools on mingw if we are creating the
4654     # installation set
4655     if test "$WITH_MINGW" = "yes"; then
4656         enable_winegcc_for_build=
4657         for pkgformat in $PKGFORMAT; do
4658             case "$pkgformat" in
4659             msi|native) enable_winegcc_for_build=yes ;;
4660             esac
4661         done
4662         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4663     fi
4664     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4665     # Don't bother having configure look for stuff not needed for the build platform anyway
4666     ./configure \
4667         --disable-cups \
4668         --disable-graphite \
4669         --disable-pdfimport \
4670         --disable-postgresql-sdbc \
4671         --with-parallelism="$with_parallelism" \
4672         --without-doxygen \
4673         --without-java \
4674         $sub_conf_opts \
4675         --srcdir=$srcdir \
4676         2>&1 | sed -e 's/^/    /'
4677     test -f ./config_host.mk 2>/dev/null || exit
4678     cp config_host.mk ../config_build.mk
4679     mv config.log ../config.Build.log
4680     mkdir -p ../config_build
4681     mv config_host/*.h ../config_build
4682     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXSLT WORKDIR
4684     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXSLT; do
4685         VV='$'$V
4686         VV=`eval "echo $VV"`
4687         if test -n "$VV"; then
4688             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4689             echo "$line" >>build-config
4690         fi
4691     done
4693     for V in INSTDIR INSTROOT WORKDIR; do
4694         VV='$'$V
4695         VV=`eval "echo $VV"`
4696         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4697         if test -n "$VV"; then
4698             line="${V}_FOR_BUILD='$VV'"
4699             echo "$line" >>build-config
4700         fi
4701     done
4703     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4704     echo "$line" >>build-config
4706     )
4707     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4708     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])
4709     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4710              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4712     eval `cat CONF-FOR-BUILD/build-config`
4714     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4716     rm -rf CONF-FOR-BUILD
4717 else
4718     OS_FOR_BUILD="$OS"
4719     CC_FOR_BUILD="$CC"
4720     CXX_FOR_BUILD="$CXX"
4721     INSTDIR_FOR_BUILD="$INSTDIR"
4722     INSTROOT_FOR_BUILD="$INSTROOT"
4723     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4724     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4725     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4726     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4727     WORKDIR_FOR_BUILD="$WORKDIR"
4729 AC_SUBST(OS_FOR_BUILD)
4730 AC_SUBST(INSTDIR_FOR_BUILD)
4731 AC_SUBST(INSTROOT_FOR_BUILD)
4732 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4733 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4734 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4735 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4736 AC_SUBST(WORKDIR_FOR_BUILD)
4738 dnl ===================================================================
4739 dnl Check for syslog header
4740 dnl ===================================================================
4741 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4743 dnl ===================================================================
4744 dnl Set the ENABLE_CRASHDUMP variable.
4745 dnl ===================================================================
4746 AC_MSG_CHECKING([whether to enable crashdump feature])
4747 if test "$enable_crashdump" = "yes"; then
4748     ENABLE_CRASHDUMP="TRUE"
4749     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4750     AC_MSG_RESULT([yes])
4751 else
4752     ENABLE_CRASHDUMP=""
4753     AC_MSG_RESULT([no])
4755 AC_SUBST(ENABLE_CRASHDUMP)
4758 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4759 dnl ===================================================================
4760 AC_MSG_CHECKING([whether to turn warnings to errors])
4761 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4762     ENABLE_WERROR="TRUE"
4763     AC_MSG_RESULT([yes])
4764 else
4765     AC_MSG_RESULT([no])
4767 AC_SUBST(ENABLE_WERROR)
4769 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4770 dnl ===================================================================
4771 AC_MSG_CHECKING([whether to have assert to abort in release code])
4772 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4773     ASSERT_ALWAYS_ABORT="TRUE"
4774     AC_MSG_RESULT([yes])
4775 else
4776     ASSERT_ALWAYS_ABORT="FALSE"
4777     AC_MSG_RESULT([no])
4779 AC_SUBST(ASSERT_ALWAYS_ABORT)
4781 # Determine whether to use ooenv for the instdir installation
4782 # ===================================================================
4783 if test $_os != "WINNT" -a $_os != "Darwin"; then
4784     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4785     if test "$enable_ooenv" = "no"; then
4786         AC_MSG_RESULT([no])
4787     else
4788         ENABLE_OOENV="TRUE"
4789         AC_MSG_RESULT([yes])
4790     fi
4792 AC_SUBST(ENABLE_OOENV)
4794 if test "$enable_headless" = "yes"; then
4795     # be sure to do not mess with uneeded stuff
4796     test_randr=no
4797     test_xrender=no
4798     test_cups=no
4799     test_dbus=no
4800     test_fontconfig=yes
4801     test_gtk=no
4802     build_gstreamer=no
4803     build_gstreamer_0_10=no
4804     test_tde=no
4805     test_kde=no
4806     test_kde4=no
4807     enable_cairo_canvas=no
4808     enable_gnome_vfs=no
4811 dnl ===================================================================
4812 dnl check for cups support
4813 dnl ===================================================================
4814 ENABLE_CUPS=""
4816 if test "$enable_cups" = "no"; then
4817     test_cups=no
4820 AC_MSG_CHECKING([whether to enable CUPS support])
4821 if test "$test_cups" = "yes"; then
4822     ENABLE_CUPS="TRUE"
4823     AC_MSG_RESULT([yes])
4825     AC_MSG_CHECKING([whether cups support is present])
4826     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4827     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4828     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4829         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4830     fi
4832 else
4833     AC_MSG_RESULT([no])
4836 AC_SUBST(ENABLE_CUPS)
4838 # fontconfig checks
4839 if test "$test_fontconfig" = "yes"; then
4840     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4841     SYSTEM_FONTCONFIG=TRUE
4843 AC_SUBST(FONTCONFIG_CFLAGS)
4844 AC_SUBST(FONTCONFIG_LIBS)
4845 AC_SUBST([SYSTEM_FONTCONFIG])
4847 dnl whether to find & fetch external tarballs?
4848 dnl ===================================================================
4849 if test -z "$TARFILE_LOCATION"; then
4850     if test -d "$SRC_ROOT/src" ; then
4851         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4852         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4853     fi
4854     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4855 else
4856     AbsolutePath "$TARFILE_LOCATION"
4857     PathFormat "${absolute_path}"
4858     TARFILE_LOCATION="${formatted_path}"
4860 AC_SUBST(TARFILE_LOCATION)
4862 AC_MSG_CHECKING([whether we want to fetch tarballs])
4863 if test "$enable_fetch_external" != "no"; then
4864     if test "$with_all_tarballs" = "yes"; then
4865         AC_MSG_RESULT(["yes, all of them"])
4866         DO_FETCH_TARBALLS="ALL"
4867     else
4868         AC_MSG_RESULT(["yes, if we use them"])
4869         DO_FETCH_TARBALLS="TRUE"
4870     fi
4871 else
4872     AC_MSG_RESULT([no])
4873     DO_FETCH_TARBALLS=
4875 AC_SUBST(DO_FETCH_TARBALLS)
4877 AC_MSG_CHECKING([whether to build help])
4878 HELP_COMMON_ONLY=FALSE
4879 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4880     BUILD_TYPE="$BUILD_TYPE HELP"
4881     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4882     if test "$with_help" = "common" ; then
4883         HELP_COMMON_ONLY=TRUE
4884         AC_MSG_RESULT([common only])
4885     else
4886         SCPDEFS="$SCPDEFS -DWITH_HELP"
4887         AC_MSG_RESULT([yes])
4888     fi
4889 else
4890     AC_MSG_RESULT([no])
4892 AC_SUBST(HELP_COMMON_ONLY)
4894 dnl Test whether to include MySpell dictionaries
4895 dnl ===================================================================
4896 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4897 if test "$with_myspell_dicts" = "yes"; then
4898     AC_MSG_RESULT([yes])
4899     WITH_MYSPELL_DICTS=TRUE
4900     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4901     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4902 else
4903     AC_MSG_RESULT([no])
4904     WITH_MYSPELL_DICTS=
4906 AC_SUBST(WITH_MYSPELL_DICTS)
4908 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4909 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4910     if test "$with_system_dicts" = yes; then
4911         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4912     fi
4913     with_system_dicts=no
4916 AC_MSG_CHECKING([whether to use dicts from external paths])
4917 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4918     AC_MSG_RESULT([yes])
4919     SYSTEM_DICTS=TRUE
4920     AC_MSG_CHECKING([for spelling dictionary directory])
4921     if test -n "$with_external_dict_dir"; then
4922         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4923     else
4924         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4925         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4926             DICT_SYSTEM_DIR=file:///usr/share/myspell
4927         fi
4928     fi
4929     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4930     AC_MSG_CHECKING([for hyphenation patterns directory])
4931     if test -n "$with_external_hyph_dir"; then
4932         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4933     else
4934         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4935     fi
4936     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4937     AC_MSG_CHECKING([for thesaurus directory])
4938     if test -n "$with_external_thes_dir"; then
4939         THES_SYSTEM_DIR=file://$with_external_thes_dir
4940     else
4941         THES_SYSTEM_DIR=file:///usr/share/mythes
4942     fi
4943     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4944 else
4945     AC_MSG_RESULT([no])
4946     SYSTEM_DICTS=
4948 AC_SUBST(SYSTEM_DICTS)
4949 AC_SUBST(DICT_SYSTEM_DIR)
4950 AC_SUBST(HYPH_SYSTEM_DIR)
4951 AC_SUBST(THES_SYSTEM_DIR)
4953 dnl ===================================================================
4954 AC_MSG_CHECKING([whether to enable pch feature])
4955 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4956     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4957         ENABLE_PCH="TRUE"
4958         AC_MSG_RESULT([yes])
4959     elif test "$GCC" = "yes"; then
4960         ENABLE_PCH="TRUE"
4961         AC_MSG_RESULT([yes])
4962     else
4963         ENABLE_PCH=""
4964         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4965     fi
4966 else
4967     ENABLE_PCH=""
4968     AC_MSG_RESULT([no])
4970 AC_SUBST(ENABLE_PCH)
4972 dnl ===================================================================
4973 dnl Search all the common names for GNU make
4974 dnl ===================================================================
4975 AC_MSG_CHECKING([for GNU make])
4977 # try to use our own make if it is available and GNUMAKE was not already defined
4978 if test -z "$GNUMAKE"; then
4979     if test -x "/opt/lo/bin/make"; then
4980         GNUMAKE="/opt/lo/bin/make"
4981     fi
4984 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4985     if test -n "$a"; then
4986         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4987         if test $? -eq 0;  then
4988             GNUMAKE=`which $a`
4989             break
4990         fi
4991     fi
4992 done
4993 AC_MSG_RESULT($GNUMAKE)
4994 if test -z "$GNUMAKE"; then
4995     AC_MSG_ERROR([not found. install GNU make.])
4998 TAB=`printf '\t'`
5000 AC_MSG_CHECKING([the GNU make version])
5001 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5002 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5003 if test "$_make_longver" -ge "038200"; then
5004     AC_MSG_RESULT([$GNUMAKE $_make_version])
5006 elif test "$_make_longver" -ge "038100"; then
5007     if test "$build_os" = "cygwin"; then
5008         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5009     fi
5010     AC_MSG_RESULT([$GNUMAKE $_make_version])
5012     dnl ===================================================================
5013     dnl Search all the common names for sha1sum
5014     dnl ===================================================================
5015     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5016     if test -z "$SHA1SUM"; then
5017         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
5018     elif test "$SHA1SUM" = "openssl"; then
5019         SHA1SUM="openssl sha1"
5020     fi
5021     AC_MSG_CHECKING([for GNU make bug 20033])
5022     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5023     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5024 A := \$(wildcard *.a)
5026 .PHONY: all
5027 all: \$(A:.a=.b)
5028 <TAB>@echo survived bug20033.
5030 .PHONY: setup
5031 setup:
5032 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5034 define d1
5035 @echo lala \$(1)
5036 @sleep 1
5037 endef
5039 define d2
5040 @echo tyty \$(1)
5041 @sleep 1
5042 endef
5044 %.b : %.a
5045 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5046 <TAB>\$(call d1,\$(CHECKSUM)),\
5047 <TAB>\$(call d2,\$(CHECKSUM)))
5049     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5050         no_parallelism_make="YES"
5051         AC_MSG_RESULT([yes, disable parallelism])
5052     else
5053         AC_MSG_RESULT([no, keep parallelism enabled])
5054     fi
5055     rm -rf $TESTGMAKEBUG20033
5056 else
5057     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5060 # find if gnumake support file function
5061 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
5062 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5063 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5064 \$(file >test.txt,Success )
5066 .PHONY: all
5067 all:
5068 <TAB>@cat test.txt
5071 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5072 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5073     HAVE_GNUMAKE_FILE_FUNC=TRUE
5074     AC_MSG_RESULT([yes])
5075 else
5076     AC_MSG_RESULT([no])
5078 rm -rf $TESTGMAKEFILEFUNC
5079 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5080 AC_SUBST(GNUMAKE)
5082 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
5083 STALE_MAKE=
5084 make_warning=
5085 if test "$_make_ver_check" = ""; then
5086    STALE_MAKE=TRUE
5089 HAVE_LD_HASH_STYLE=FALSE
5090 WITH_LINKER_HASH_STYLE=
5091 AC_MSG_CHECKING( for --hash-style gcc linker support )
5092 if test "$GCC" = "yes"; then
5093     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5094         hash_styles="gnu sysv"
5095     elif test "$with_linker_hash_style" = "no"; then
5096         hash_styles=
5097     else
5098         hash_styles="$with_linker_hash_style"
5099     fi
5101     for hash_style in $hash_styles; do
5102         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5103         hash_style_ldflags_save=$LDFLAGS
5104         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5106         AC_LINK_IFELSE([AC_LANG_PROGRAM(
5107             [
5108 #include <stdio.h>
5109             ],[
5110 printf ("");
5111             ])],
5112             [ if ./conftest$EXEEXT; then
5113                   HAVE_LD_HASH_STYLE=TRUE
5114                   WITH_LINKER_HASH_STYLE=$hash_style
5115               fi],
5116             [HAVE_LD_HASH_STYLE=FALSE])
5117         LDFLAGS=$hash_style_ldflags_save
5118     done
5120     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5121         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5122     else
5123         AC_MSG_RESULT( no )
5124     fi
5125     LDFLAGS=$hash_style_ldflags_save
5126 else
5127     AC_MSG_RESULT( no )
5129 AC_SUBST(HAVE_LD_HASH_STYLE)
5130 AC_SUBST(WITH_LINKER_HASH_STYLE)
5132 dnl ===================================================================
5133 dnl Check whether there's a Perl version available.
5134 dnl ===================================================================
5135 if test -z "$with_perl_home"; then
5136     AC_PATH_PROG(PERL, perl)
5137 else
5138     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5139     _perl_path="$with_perl_home/bin/perl"
5140     if test -x "$_perl_path"; then
5141         PERL=$_perl_path
5142     else
5143         AC_MSG_ERROR([$_perl_path not found])
5144     fi
5147 dnl ===================================================================
5148 dnl Testing for Perl version 5 or greater.
5149 dnl $] is the Perl version variable, it is returned as an integer
5150 dnl ===================================================================
5151 if test "$PERL"; then
5152     AC_MSG_CHECKING([the Perl version])
5153     ${PERL} -e "exit($]);"
5154     _perl_version=$?
5155     if test "$_perl_version" -lt 5; then
5156         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5157     fi
5158     AC_MSG_RESULT([checked (perl $_perl_version)])
5159 else
5160     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5163 dnl ===================================================================
5164 dnl Testing for required Perl modules
5165 dnl ===================================================================
5167 AC_MSG_CHECKING([for required Perl modules])
5168 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5169     AC_MSG_RESULT([all modules found])
5170 else
5171     AC_MSG_RESULT([failed to find some modules])
5172     # Find out which modules are missing.
5173     missing_perl_modules=
5174     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5175        missing_perl_modules=Archive::Zip
5176     fi
5177     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5178        missing_perl_modules="$missing_perl_modules Cwd"
5179     fi
5180     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5181        missing_perl_modules="$missing_perl_modules Digest::MD5"
5182     fi
5183        AC_MSG_ERROR([
5184     The missing Perl modules are: $missing_perl_modules
5185     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5188 dnl ===================================================================
5189 dnl Check for pkg-config
5190 dnl ===================================================================
5191 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5192     PKG_PROG_PKG_CONFIG
5195 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5197     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5198     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5199     # explicitly. Or put /path/to/compiler in PATH yourself.
5201     AC_CHECK_TOOL(AR,ar)
5202     AC_CHECK_TOOL(NM,nm)
5203     AC_CHECK_TOOL(OBJDUMP,objdump)
5204     AC_CHECK_TOOL(RANLIB,ranlib)
5205     AC_CHECK_TOOL(STRIP,strip)
5206     if test "$_os" = "WINNT"; then
5207         AC_CHECK_TOOL(DLLTOOL,dlltool)
5208         AC_CHECK_TOOL(WINDRES,windres)
5209     fi
5211 AC_SUBST(AR)
5212 AC_SUBST(DLLTOOL)
5213 AC_SUBST(NM)
5214 AC_SUBST(OBJDUMP)
5215 AC_SUBST(PKG_CONFIG)
5216 AC_SUBST(RANLIB)
5217 AC_SUBST(STRIP)
5218 AC_SUBST(WINDRES)
5220 dnl ===================================================================
5221 dnl pkg-config checks on Mac OS X
5222 dnl ===================================================================
5224 if test $_os = Darwin; then
5225     AC_MSG_CHECKING([for bogus pkg-config])
5226     if test -n "$PKG_CONFIG"; then
5227         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5228             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5229         else
5230             if test "$enable_bogus_pkg_config" = "yes"; then
5231                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5232             else
5233                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5234             fi
5235         fi
5236     else
5237         AC_MSG_RESULT([no, good])
5238     fi
5241 find_csc()
5243     # Return value: $csctest
5245     unset csctest
5247     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5248     if test -n "$regvalue"; then
5249         csctest=$regvalue
5250         return
5251     fi
5254 find_al()
5256     # Return value: $altest
5258     unset altest
5260     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5261         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5262         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5263             altest=$regvalue
5264             return
5265         fi
5266     done
5269 find_dotnetsdk()
5271     # Return value: $frametest (that's a silly name...)
5273     unset frametest
5275     for ver in 1.1 2.0; do
5276         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5277         if test -n "$regvalue"; then
5278             frametest=$regvalue
5279             return
5280         fi
5281     done
5284 find_winsdk_version()
5286     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5287     # Return value: $winsdktest
5289     unset winsdktest
5291     # Why we look for them in this particular order I don't know. But OTOH I
5292     case "$1" in
5293     6.0*|7.*)
5294         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5295         if test -n "$regvalue"; then
5296             winsdktest=$regvalue
5297             return
5298         fi
5299         ;;
5300     8.*)
5301         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5302         if test -n "$regvalue"; then
5303             winsdktest=$regvalue
5304             return
5305         fi
5306         ;;
5307     esac
5310 find_winsdk()
5312     # Args: $1 (optional) : list of acceptable SDK versions
5313     # Return value: $winsdktest
5315     unset winsdktest
5317     if test -n "$1"; then
5318         sdkversions=$1
5319     else
5320         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5321     fi
5323     for ver in $sdkversions; do
5324         find_winsdk_version $ver
5325         if test -n "$winsdktest"; then
5326             return
5327         fi
5328     done
5331 find_msms()
5333     for ver in 10.0 11.0; do
5334         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5335         if test -n "$regvalue"; then
5336             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5337                 msmdir=$regvalue
5338                 break
5339             fi
5340         fi
5341     done
5342     if test -z "$msmdir"; then
5343         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "${COMMONPROGRAMFILES}/Merge Modules/"])
5344         msmdir="${COMMONPROGRAMFILES}/Merge Modules/"
5345     fi
5346     msmdir=`cygpath -m "$msmdir"`
5347     if test -z "$msmdir"; then
5348         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5349             AC_MSG_ERROR([Merge modules not found in $msmdir])
5350         else
5351             AC_MSG_WARN([Merge modules not found in $msmdir])
5352             msmdir=""
5353         fi
5354     fi
5357 find_msvc_x64_dlls()
5359     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5360     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5361     for dll in $msvcdlls; do
5362         if ! test -f "$msvcdllpath/$dll"; then
5363             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5364         fi
5365     done
5368 if test "$build_os" = "cygwin"; then
5369     dnl Check midl.exe
5370     AC_MSG_CHECKING([for midl.exe])
5372     find_winsdk
5373     if test -f "$winsdktest/Bin/midl.exe"; then
5374         MIDL_PATH="$winsdktest/Bin"
5375     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5376         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5377     fi
5378     if test ! -f "$MIDL_PATH/midl.exe"; then
5379         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5380     else
5381         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5382     fi
5384     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5385     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
5386     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
5388     dnl Check csc.exe
5389     AC_MSG_CHECKING([for csc.exe])
5390     find_csc
5391     if test -f "$csctest/csc.exe"; then
5392         CSC_PATH="$csctest"
5393     fi
5394     if test ! -f "$CSC_PATH/csc.exe"; then
5395         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5396     else
5397         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5398     fi
5400     CSC_PATH=`cygpath -d "$CSC_PATH"`
5401     CSC_PATH=`cygpath -u "$CSC_PATH"`
5403     dnl Check al.exe
5404     AC_MSG_CHECKING([for al.exe])
5405     find_winsdk
5406     if test -f "$winsdktest/Bin/al.exe"; then
5407         AL_PATH="$winsdktest/Bin"
5408     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5409         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5410     fi
5412     if test -z "$AL_PATH"; then
5413         find_al
5414         if test -f "$altest/bin/al.exe"; then
5415             AL_PATH="$altest/bin"
5416         elif test -f "$altest/al.exe"; then
5417             AL_PATH="$altest"
5418         fi
5419     fi
5420     if test ! -f "$AL_PATH/al.exe"; then
5421         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5422     else
5423         AC_MSG_RESULT([$AL_PATH/al.exe])
5424     fi
5426     AL_PATH=`cygpath -d "$AL_PATH"`
5427     AL_PATH=`cygpath -u "$AL_PATH"`
5429     dnl Check mscoree.lib / .NET Framework dir
5430     AC_MSG_CHECKING(.NET Framework)
5431     find_dotnetsdk
5432     if test -f "$frametest/lib/mscoree.lib"; then
5433         DOTNET_FRAMEWORK_HOME="$frametest"
5434     else
5435         find_winsdk
5436         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5437             DOTNET_FRAMEWORK_HOME="$winsdktest"
5438         fi
5439     fi
5441     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5442         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5443     fi
5444     AC_MSG_RESULT(found)
5446     PathFormat "$MIDL_PATH"
5447     MIDL_PATH="$formatted_path"
5449     PathFormat "$AL_PATH"
5450     AL_PATH="$formatted_path"
5452     PathFormat "$DOTNET_FRAMEWORK_HOME"
5453     DOTNET_FRAMEWORK_HOME="$formatted_path"
5455     PathFormat "$CSC_PATH"
5456     CSC_PATH="$formatted_path"
5459 dnl ===================================================================
5460 dnl Check if stdc headers are available excluding MSVC.
5461 dnl ===================================================================
5462 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5463     AC_HEADER_STDC
5466 dnl ===================================================================
5467 dnl Testing for C++ compiler and version...
5468 dnl ===================================================================
5470 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5471     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5472     save_CXXFLAGS=$CXXFLAGS
5473     AC_PROG_CXX
5474     CXXFLAGS=$save_CXXFLAGS
5475 else
5476     if test -n "$CC" -a -z "$CXX"; then
5477         CXX="$CC"
5478     fi
5481 dnl check for GNU C++ compiler version
5482 if test "$GXX" = "yes"; then
5483     AC_MSG_CHECKING([the GNU C++ compiler version])
5485     _gpp_version=`$CXX -dumpversion`
5486     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5488     if test "$_gpp_majmin" -lt "401"; then
5489         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5490     else
5491         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5492     fi
5494     dnl see https://code.google.com/p/android/issues/detail?id=41770
5495     if test "$_gpp_majmin" -ge "401"; then
5496         glibcxx_threads=no
5497         AC_LANG_PUSH([C++])
5498         AC_REQUIRE_CPP
5499         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5500         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5501             #include <bits/c++config.h>]],[[
5502             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5503             && !defined(_GLIBCXX__PTHREADS) \
5504             && !defined(_GLIBCXX_HAS_GTHREADS)
5505             choke me
5506             #endif
5507         ]])],[AC_MSG_RESULT([yes])
5508         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5509         AC_LANG_POP([C++])
5510         if test $glibcxx_threads = yes; then
5511               BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5512         fi
5513      fi
5515 AC_SUBST(BOOST_CXXFLAGS)
5518 # prefx CXX with ccache if needed
5520 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5521     if test "$CCACHE" != ""; then
5522         AC_MSG_CHECKING([whether $CXX is already ccached])
5523         AC_LANG_PUSH([C++])
5524         save_CXXFLAGS=$CXXFLAGS
5525         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5526         dnl an empty program will do, we're checking the compiler flags
5527         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5528                           [use_ccache=yes], [use_ccache=no])
5529         if test $use_ccache = yes; then
5530             AC_MSG_RESULT([yes])
5531         else
5532             CXX="$CCACHE $CXX"
5533             AC_MSG_RESULT([no])
5534         fi
5535         CXXFLAGS=$save_CXXFLAGS
5536         AC_LANG_POP([C++])
5537     fi
5540 dnl ===================================================================
5541 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5542 dnl ===================================================================
5544 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5545     AC_PROG_CXXCPP
5547     dnl Check whether there's a C pre-processor.
5548     dnl ===================================================================
5549     dnl When using SunStudio compiler, there is a bug with the cc
5550     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5551     dnl See Issuezilla #445.
5552     dnl ===================================================================
5553     if test "$_os" = "SunOS"; then
5554         CPP=$CXXCPP
5555     else
5556         AC_PROG_CPP
5557     fi
5561 dnl ===================================================================
5562 dnl Find integral type sizes and alignments
5563 dnl ===================================================================
5565 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5567     AC_CHECK_SIZEOF(long)
5568     AC_CHECK_SIZEOF(short)
5569     AC_CHECK_SIZEOF(int)
5570     AC_CHECK_SIZEOF(long long)
5571     AC_CHECK_SIZEOF(double)
5572     AC_CHECK_SIZEOF(void*)
5574     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5575     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5576     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5577     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5578     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5580     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5581     m4_pattern_allow([AC_CHECK_ALIGNOF])
5582     m4_ifdef([AC_CHECK_ALIGNOF],
5583         [
5584             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5585             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5586             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5587             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5588         ],
5589         [
5590             case "$_os-$host_cpu" in
5591             Linux-i686)
5592                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5593                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5594                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5595                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5596                 ;;
5597             Linux-x86_64)
5598                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5599                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5600                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5601                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5602                 ;;
5603             *)
5604                 if test -z "$ac_cv_alignof_short" -o \
5605                         -z "$ac_cv_alignof_int" -o \
5606                         -z "$ac_cv_alignof_long" -o \
5607                         -z "$ac_cv_alignof_double"; then
5608                    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.])
5609                 fi
5610                 ;;
5611             esac
5612         ])
5614     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5615     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5616     if test $ac_cv_sizeof_long -eq 8; then
5617         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5618     elif test $ac_cv_sizeof_double -eq 8; then
5619         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5620     else
5621         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5622     fi
5624     dnl Check for large file support
5625     AC_SYS_LARGEFILE
5626     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5627         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5628     fi
5629     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5630         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5631     fi
5632 else
5633     # Hardcode for MSVC
5634     SAL_TYPES_SIZEOFSHORT=2
5635     SAL_TYPES_SIZEOFINT=4
5636     SAL_TYPES_SIZEOFLONG=4
5637     SAL_TYPES_SIZEOFLONGLONG=8
5638     if test "$BITNESS_OVERRIDE" = ""; then
5639         SAL_TYPES_SIZEOFPOINTER=4
5640     else
5641         SAL_TYPES_SIZEOFPOINTER=8
5642     fi
5643     SAL_TYPES_ALIGNMENT2=2
5644     SAL_TYPES_ALIGNMENT4=4
5645     SAL_TYPES_ALIGNMENT8=8
5646     LFS_CFLAGS=''
5648 AC_SUBST(LFS_CFLAGS)
5650 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5651 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5652 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5653 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5654 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5655 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5656 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5657 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5659 dnl ===================================================================
5660 dnl Check whether to enable runtime optimizations
5661 dnl ===================================================================
5662 ENABLE_RUNTIME_OPTIMIZATIONS=
5663 AC_MSG_CHECKING([whether to enable runtime optimizations])
5664 if test -z "$enable_runtime_optimizations"; then
5665     for i in $CC; do
5666         case $i in
5667         -fsanitize=address)
5668             enable_runtime_optimizations=no
5669             break
5670             ;;
5671         esac
5672     done
5674 if test "$enable_runtime_optimizations" != no; then
5675     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5676     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5677     AC_MSG_RESULT([yes])
5678 else
5679     AC_MSG_RESULT([no])
5681 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5683 dnl ===================================================================
5684 dnl Check if valgrind headers are available
5685 dnl ===================================================================
5686 ENABLE_VALGRIND=
5687 if test "$cross_compiling" != yes; then
5688     prev_cppflags=$CPPFLAGS
5689     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5690     # or where does it come from?
5691     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5692     AC_CHECK_HEADER([valgrind/valgrind.h],
5693         [ENABLE_VALGRIND=TRUE])
5694     CPPFLAGS=$prev_cppflags
5696 AC_SUBST([ENABLE_VALGRIND])
5697 if test -z "$ENABLE_VALGRIND"; then
5698     VALGRIND_CFLAGS=
5700 AC_SUBST([VALGRIND_CFLAGS])
5703 dnl ===================================================================
5704 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5705 dnl ===================================================================
5707 # We need at least the sys/sdt.h include header.
5708 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5709 if test "$SDT_H_FOUND" = "TRUE"; then
5710   # Found sys/sdt.h header, now make sure the c++ compiler works.
5711   # Old g++ versions had problems with probes in constructors/destructors.
5712   AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5713   AC_LANG_PUSH([C++])
5714   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5715     #include <sys/sdt.h>
5716     class ProbeClass
5717     {
5718     private:
5719       int& ref;
5720       const char *name;
5722     public:
5723       ProbeClass(int& v, const char *n) : ref(v), name(n)
5724       {
5725         DTRACE_PROBE2(_test_, cons, name, ref);
5726       }
5728       void method(int min)
5729       {
5730         DTRACE_PROBE3(_test_, meth, name, ref, min);
5731         ref -= min;
5732       }
5734       ~ProbeClass()
5735       {
5736         DTRACE_PROBE2(_test_, dest, name, ref);
5737       }
5738     };
5739   ]],[[
5740     int i = 64;
5741     DTRACE_PROBE1(_test_, call, i);
5742     ProbeClass inst = ProbeClass(i, "call");
5743     inst.method(24);
5744   ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5745         [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5746   AC_LANG_POP([C++])
5748 AC_CONFIG_HEADERS([config_host/config_probes.h])
5750 dnl ===================================================================
5751 dnl Set the MinGW sys-root
5752 dnl ===================================================================
5753 if test "$WITH_MINGW" = "yes"; then
5754     AC_MSG_CHECKING([for MinGW sysroot])
5755     sysroot=`$CC -print-sysroot`
5756     AS_IF([test -d "$sysroot"/mingw],
5757           [MINGW_SYSROOT="$sysroot"/mingw
5758            AC_MSG_RESULT([$MINGW_SYSROOT])],
5759           [AC_MSG_RESULT([not found])
5760            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5762 AC_SUBST([MINGW_DLLS])
5763 AC_SUBST([MINGW_SYSROOT])
5765 dnl ===================================================================
5766 dnl Set the MinGW include directories
5767 dnl ===================================================================
5768 if test "$WITH_MINGW" = "yes"; then
5769     AC_MSG_CHECKING([for MinGW include path])
5770     cat >conftest.$ac_ext <<_ACEOF
5771 #include <stddef.h>
5772 #include <bits/c++config.h>
5773 _ACEOF
5774     _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`
5775     rm conftest.$ac_ext
5776     if test -z "$_mingw_lib_include_path"; then
5777         _mingw_lib_include_path="NO_LIB_INCLUDE"
5778         AC_MSG_RESULT([no MinGW include path])
5779     else
5780         AC_MSG_RESULT([$_mingw_lib_include_path])
5781     fi
5782     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5783     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5785     AC_LANG_PUSH([C++])
5787     AC_MSG_CHECKING([for dynamic libgcc])
5788     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5789 #include <iostream>
5790 using namespace std;
5791 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5792             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5793             if test -n "$MINGW_GCCDLL"; then
5794                 MINGW_SHARED_GCCLIB=TRUE
5795                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5796             else
5797                 MINGW_SHARED_GCCLIB=
5798                 AC_MSG_RESULT([no])
5799             fi
5800        ],[ AC_MSG_RESULT([no])
5802     ])
5804     AC_MSG_CHECKING([for dynamic libstdc++])
5805     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5806 #include <iostream>
5807 using namespace std;
5808 ]], [[ cout << "Hello there." << endl; ]])],[
5809             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5810             if test -n "$MINGW_GXXDLL"; then
5811                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5812                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5813                 if test "$CROSS_COMPILING" = "TRUE"; then
5814                     dnl m4 escaping!
5815                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5816                 fi
5817                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5818                 MINGW_SHARED_GXXLIB=TRUE
5819                 AC_MSG_RESULT([$MINGW_GXXDLL])
5820             else
5821                 MINGW_SHARED_GXXLIB=
5822                 AC_MSG_RESULT([no])
5823             fi
5824        ],[ AC_MSG_RESULT([no])
5826     ])
5828     AC_LANG_POP([C++])
5830     AC_SUBST(MINGW_SHARED_GCCLIB)
5831     AC_SUBST(MINGW_SHARED_GXXLIB)
5832     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5833     AC_SUBST(MINGW_GCCDLL)
5834     AC_SUBST(MINGW_GXXDLL)
5837 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5838     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5841 if test "$WITH_MINGW" = "yes"; then
5842     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5843     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5844     [
5845     #include <usp10.h>
5846     ],
5847     [
5848     SCRIPT_CONTROL c;
5849     c.fMergeNeutralItems = 1;
5850     ])],
5851     [
5852     AC_MSG_RESULT(yes)
5853     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5854     ],
5855     [AC_MSG_RESULT(no)])
5858 dnl ===================================================================
5859 dnl Extra checking for the SunOS compiler
5860 dnl ===================================================================
5861 if test "$_os" = "SunOS"; then
5862     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5863     if test "$CC" = "cc"; then
5864     AC_MSG_CHECKING([SunStudio C++ Compiler])
5865         if test "$CXX" != "CC"; then
5866             AC_MSG_WARN([SunStudio C++ was not found])
5867             add_warning "SunStudio C++ was not found"
5868         else
5869             AC_MSG_RESULT([checked])
5870         fi
5871     fi
5874 dnl *************************************************************
5875 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5876 dnl *************************************************************
5877 if test "$WITH_MINGW" = "yes"; then
5878     AC_MSG_CHECKING([exception type])
5879     AC_LANG_PUSH([C++])
5880     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5882         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5884         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5885     ])
5886     AC_MSG_RESULT($exceptions_type)
5887     AC_LANG_POP([C++])
5890 EXCEPTIONS="$exceptions_type"
5891 AC_SUBST(EXCEPTIONS)
5893 dnl ===================================================================
5894 dnl thread-safe statics
5895 dnl ===================================================================
5896 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5897 unset HAVE_THREADSAFE_STATICS
5898 if test "$GCC" = "yes"; then
5899     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5900     dnl us.  However, some C++ runtimes use a single lock for all static
5901     dnl variables, which can cause deadlock in multi-threaded applications.
5902     dnl This is not easily tested here; for POSIX-based systems, if executing
5903     dnl the following C++ program does not terminate then the tool chain
5904     dnl apparently has this problem:
5905     dnl
5906     dnl   #include <pthread.h>
5907     dnl   int h() { return 0; }
5908     dnl   void * g(void * unused) {
5909     dnl     static int n = h();
5910     dnl     return &n;
5911     dnl   }
5912     dnl   int f() {
5913     dnl     pthread_t t;
5914     dnl     pthread_create(&t, 0, g, 0);
5915     dnl     pthread_join(t, 0);
5916     dnl     return 0;
5917     dnl   }
5918     dnl   int main() {
5919     dnl     static int n = f();
5920     dnl     return n;
5921     dnl   }
5922     dnl
5923     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5924     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5925     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5926     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5927     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5928     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5929     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5930     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5931     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5932     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5933     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5934     dnl "too old"):
5935     if test "$_os" != Darwin -a "$_os" != Android; then
5936         if test "$COM_GCC_IS_CLANG" = TRUE; then
5937             AC_LANG_PUSH([C++])
5938             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5939 #include <list>
5940 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5941 #error
5942 #endif
5943                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5944             AC_LANG_POP([C++])
5945         elif test "${GCC_VERSION?}" -ge 0403; then
5946             HAVE_THREADSAFE_STATICS=TRUE
5947         fi
5948     fi
5949     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5950         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5951         AC_MSG_RESULT([yes])
5952     else
5953         AC_MSG_RESULT([broken (i.e., no)])
5954     fi
5955 else
5956     AC_MSG_RESULT([unknown (assuming no)])
5958 AC_SUBST(HAVE_THREADSAFE_STATICS)
5960 dnl ===================================================================
5961 dnl visibility and other gcc features
5962 dnl ===================================================================
5963 if test "$GCC" = "yes"; then
5964     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5965     save_CFLAGS=$CFLAGS
5966     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5967     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5968     CFLAGS=$save_CFLAGS
5970     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5971         AC_MSG_RESULT([yes])
5972     else
5973         AC_MSG_RESULT([no])
5974     fi
5976     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5977     save_CFLAGS=$CFLAGS
5978     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5979     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5980     CFLAGS=$save_CFLAGS
5981     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5982         AC_MSG_RESULT([yes])
5983     else
5984         AC_MSG_RESULT([no])
5985     fi
5987     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5988     save_CFLAGS=$CFLAGS
5989     CFLAGS="$CFLAGS -Werror -mno-avx"
5990     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5991     CFLAGS=$save_CFLAGS
5992     if test "$HAVE_GCC_AVX" = "TRUE"; then
5993         AC_MSG_RESULT([yes])
5994     else
5995         AC_MSG_RESULT([no])
5996     fi
5998     AC_MSG_CHECKING([whether $CC supports atomic functions])
5999     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6000     int v = 0;
6001     if (__sync_add_and_fetch(&v, 1) != 1 ||
6002         __sync_sub_and_fetch(&v, 1) != 0)
6003         return 1;
6004     __sync_synchronize();
6005     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6006         v != 1)
6007         return 1;
6008     return 0;
6009 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6010     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6011         AC_MSG_RESULT([yes])
6012         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6013     else
6014         AC_MSG_RESULT([no])
6015     fi
6017     AC_MSG_CHECKING(
6018         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
6019     save_CFLAGS=$CFLAGS
6020     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6021     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6022             #pragma GCC diagnostic ignored "-Wunused-parameter"
6023             void dummy(int n) {}
6024         ])], [
6025             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
6026             AC_MSG_RESULT([yes])
6027         ], [AC_MSG_RESULT([no])])
6028     CFLAGS=$save_CFLAGS
6030     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
6031     save_CFLAGS=$CFLAGS
6032     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6033     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6034             #pragma GCC diagnostic push
6035             #pragma GCC diagnostic ignored "-Wunused-parameter"
6036             void dummy(int n) {}
6037             #pragma GCC diagnostic pop
6038         ])], [
6039             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
6040             AC_MSG_RESULT([yes])
6041         ], [AC_MSG_RESULT([no])])
6042     CFLAGS=$save_CFLAGS
6044     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6045     save_CFLAGS=$CFLAGS
6046     CFLAGS="$CFLAGS -Werror"
6047     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6048             __attribute__((deprecated("test"))) void f();
6049         ])], [
6050             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6051             AC_MSG_RESULT([yes])
6052         ], [AC_MSG_RESULT([no])])
6053     CFLAGS=$save_CFLAGS
6055     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6056     AC_LANG_PUSH([C++])
6057     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6058             #include <cxxabi.h>
6059             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6060         ])], [
6061             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6062             AC_MSG_RESULT([yes])
6063         ], [AC_MSG_RESULT([no])])
6064     AC_LANG_POP([C++])
6066     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6067     AC_LANG_PUSH([C++])
6068     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6069             #include <cxxabi.h>
6070             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6071         ])], [
6072             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6073             AC_MSG_RESULT([yes])
6074         ], [AC_MSG_RESULT([no])])
6075     AC_LANG_POP([C++])
6077     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6078     AC_LANG_PUSH([C++])
6079     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6080             #include <cxxabi.h>
6081             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6082         ])], [
6083             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6084             AC_MSG_RESULT([yes])
6085         ], [AC_MSG_RESULT([no])])
6086     AC_LANG_POP([C++])
6088     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6089     AC_LANG_PUSH([C++])
6090     save_CXXFLAGS=$CXXFLAGS
6091     CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
6092     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6093             struct __attribute__((warn_unused)) dummy {};
6094         ])], [
6095             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6096             AC_MSG_RESULT([yes])
6097         ], [AC_MSG_RESULT([no])])
6098     CXXFLAGS=$save_CXXFLAGS
6099     AC_LANG_POP([C++])
6101     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6102     AC_LANG_PUSH([C++])
6103     save_CXXFLAGS=$CXXFLAGS
6104     CXXFLAGS="$CFLAGS -Werror -Wunused"
6105     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6106             #include <string>
6107             void f() { std::string s; }
6108         ])], [
6109             AC_MSG_RESULT([no])
6110         ], [
6111             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6112             AC_MSG_RESULT([yes])])
6113     CXXFLAGS=$save_CXXFLAGS
6114     AC_LANG_POP([C++])
6117 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
6118 AC_SUBST(HAVE_GCC_AVX)
6119 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6121 dnl ===================================================================
6122 dnl Identify the C++ library
6123 dnl ===================================================================
6125 AC_MSG_CHECKING([What the C++ library is])
6126 AC_LANG_PUSH([C++])
6127 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6128 #include <utility>
6129 #ifndef __GLIBCXX__
6130 foo bar
6131 #endif
6132 ]])],
6133     [CPP_LIBRARY=GLIBCXX
6134      cpp_library_name="GNU libstdc++"
6135     ],
6136     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6137 #include <utility>
6138 #ifndef _LIBCPP_VERSION
6139 foo bar
6140 #endif
6141 ]])],
6142     [CPP_LIBRARY=LIBCPP
6143      cpp_library_name="LLVM libc++"
6144     ],
6145     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6146 #include <utility>
6147 #ifndef _MSC_VER
6148 foo bar
6149 #endif
6150 ]])],
6151     [CPP_LIBRARY=MSVCRT
6152      cpp_library_name="Microsoft"
6153     ],
6154     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6155 AC_MSG_RESULT([$cpp_library_name])
6156 AC_LANG_POP([C++])
6157 AC_SUBST(CPP_LIBRARY)
6159 dnl ===================================================================
6160 dnl C++11
6161 dnl ===================================================================
6163 CXXFLAGS_CXX11=
6164 HAVE_CXX11=
6165 if test "$COM" = MSC; then
6166     AC_MSG_CHECKING([whether $CXX supports C++11])
6167     AC_MSG_RESULT(yes)
6168     # MSVC supports (a subset of) CXX11 without any switch
6169     HAVE_CXX11=TRUE
6170     CXXFLAGS_CXX11=
6171 elif test "$GCC" = "yes"; then
6172     CXXFLAGS_CXX11=
6173     AC_MSG_CHECKING([whether $CXX supports C++11])
6174     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6175         save_CXXFLAGS=$CXXFLAGS
6176         CXXFLAGS="$CXXFLAGS $flag -Werror"
6177         AC_LANG_PUSH([C++])
6178         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6179         AC_LANG_POP([C++])
6180         CXXFLAGS=$save_CXXFLAGS
6181         if test -n "$CXXFLAGS_CXX11"; then
6182             HAVE_CXX11=TRUE
6183             break
6184         fi
6185     done
6186     if test "$HAVE_CXX11" = TRUE; then
6187         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6188     else
6189         AC_MSG_RESULT(no)
6190     fi
6193 if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then
6194     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6195     AC_LANG_PUSH([C++])
6196     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6197 #include <list>
6198 #if !defined(__GLIBCXX__)
6199 /* ok */
6200 #elif __GLIBCXX__ < 20111004
6201 /* before breakage */
6202 #elif __GLIBCXX__ > 20120703
6203 /* after breakage */
6204 #else
6205 abi broken
6206 #endif
6207         ]])], [AC_MSG_RESULT(no, ok)],
6208         [AC_MSG_RESULT(yes, disabling C++11)
6209          HAVE_CXX11=])
6210     AC_LANG_POP([C++])
6213 if test "$HAVE_CXX11" = TRUE; then
6214     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6215     save_CXXFLAGS=$CXXFLAGS
6216     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6217     AC_LANG_PUSH([C++])
6219     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6220 #include <stddef.h>
6222 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6224 namespace
6226         struct b
6227         {
6228                 int i;
6229                 int j;
6230         };
6232 ]], [[
6233 struct a
6235         int i;
6236         int j;
6238 a thinga[]={{0,0}, {1,1}};
6239 b thingb[]={{0,0}, {1,1}};
6240 size_t i = sizeof(sal_n_array_size(thinga));
6241 size_t j = sizeof(sal_n_array_size(thingb));
6242 return !(i != 0 && j != 0);
6244         ], [ AC_MSG_RESULT(yes) ],
6245         [ AC_MSG_RESULT(no)
6246           HAVE_CXX11=
6247         ])
6248     AC_LANG_POP([C++])
6249     CXXFLAGS=$save_CXXFLAGS
6252 if test "$HAVE_CXX11" = TRUE; then
6253     AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6254     save_CXXFLAGS=$CXXFLAGS
6255     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6256     AC_LANG_PUSH([C++])
6258     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6259 #include <vector>
6260     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6261     // (__float128)
6263     ],[ AC_MSG_RESULT(yes) ],
6264     [
6265         AC_MSG_RESULT(no)
6266         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6267         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6268         # __float128 is available during its build, but it's usually built using GCC,
6269         # and so c++config.h hardcodes __float128 being supported). As the only place
6270         # where __float128 is actually used is in a template specialization,
6271         # -D__float128=void will avoid the problem there while still causing a problem
6272         # if somebody actually uses the type.
6273         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6274         CXXFLAGS="$CXXFLAGS -D__float128=void"
6275         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6276 #include <vector>
6277     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6278     // (__float128)
6280         ],
6281         [
6282          AC_MSG_RESULT(yes)
6283          CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6284         ],
6285         [
6286          AC_MSG_RESULT(no)
6287          HAVE_CXX11=
6288         ])
6289     ])
6291     AC_LANG_POP([C++])
6292     CXXFLAGS=$save_CXXFLAGS
6295 if test "$HAVE_CXX11" = "TRUE"; then
6296     AC_DEFINE(HAVE_CXX11)
6297 elif test -n "$CXXFLAGS_CXX11"; then
6298     AC_MSG_NOTICE([Disabling C++11 support])
6299     CXXFLAGS_CXX11=
6300 elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
6301     AC_MSG_ERROR([Selected libc++ but C++11 support broken])
6304 AC_SUBST(CXXFLAGS_CXX11)
6305 AC_SUBST(HAVE_CXX11)
6307 AC_MSG_CHECKING([for std::shared_ptr])
6308 if test "$HAVE_CXX11" = "TRUE" -a "$GCC" = "yes"; then
6309     save_CXXFLAGS=$CXXFLAGS
6310     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6311     AC_LANG_PUSH([C++])
6312     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
6313         #include <memory>
6314         using std::shared_ptr;
6315         ])],
6316       [ have_std_shared_ptr=yes ],
6317       [ have_std_shared_ptr=no ]
6318     )
6319     AC_LANG_POP([C++])
6320     CXXFLAGS=$save_CXXFLAGS
6321 elif test "$COM" = "MSC"; then
6322     have_std_shared_ptr=yes
6323 else
6324     have_std_shared_ptr=no
6326 AC_MSG_RESULT([$have_std_shared_ptr])
6328 dnl ==================================
6329 dnl Check for C++11 "= delete" support
6330 dnl ==================================
6332 if test "$HAVE_CXX11" = "TRUE"; then
6333     AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6334     save_CXXFLAGS=$CXXFLAGS
6335     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6336     AC_LANG_PUSH([C++])
6337     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6338 struct A
6339     {
6340     void test() = delete;
6341     };
6342 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6344     AC_LANG_POP([C++])
6345     CXXFLAGS=$save_CXXFLAGS
6346     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6347         AC_MSG_RESULT([yes])
6348         AC_DEFINE([HAVE_CXX11_DELETE])
6349     else
6350         AC_MSG_RESULT([no])
6351     fi
6354 dnl ==================================
6355 dnl Check for C++11 "override" support
6356 dnl ==================================
6358 if test "$HAVE_CXX11" = "TRUE"; then
6359     AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6360     save_CXXFLAGS=$CXXFLAGS
6361     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6362     AC_LANG_PUSH([C++])
6363     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6364 struct A
6366         virtual void test();
6369 struct B : A
6371         virtual void test() override;
6373 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6375     AC_LANG_POP([C++])
6376     CXXFLAGS=$save_CXXFLAGS
6377     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6378         AC_MSG_RESULT([yes])
6379         AC_DEFINE([HAVE_CXX11_OVERRIDE])
6380     else
6381         AC_MSG_RESULT([no])
6382     fi
6385 dnl ==================================
6386 dnl Check for C++11 "final" support
6387 dnl ==================================
6389 if test "$HAVE_CXX11" = "TRUE"; then
6390     AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6391     save_CXXFLAGS=$CXXFLAGS
6392     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6393     AC_LANG_PUSH([C++])
6394     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6395 // First check that this correct program that uses "final" compiles
6396 struct A final
6400 struct B
6402         virtual void test();
6405 struct C : B
6407         void test() final;
6409 ]])],[have_final=yes],[])
6411     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6412 // Then check that the "final" works as expected,
6413 // that this program fails to compile
6414 struct A final
6418 struct B : A
6421 ]])],[],[final_class_works=yes])
6423     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6424 // Also this should fail to compile
6425 struct B
6427         virtual void test();
6430 struct C : B
6432         void test() final;
6435 struct D : C
6437         void test();
6439 ]])],[],[final_method_works=yes])
6440     AC_LANG_POP([C++])
6442     CXXFLAGS=$save_CXXFLAGS
6444     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6445         AC_MSG_RESULT([yes])
6446         AC_DEFINE([HAVE_CXX11_FINAL])
6447     else
6448         AC_MSG_RESULT([no])
6449     fi
6452 dnl ===================================================================
6453 dnl Check for C++11 perfect forwarding support
6454 dnl ===================================================================
6455 if test "$HAVE_CXX11" = "TRUE"; then
6456     AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6457     save_CXXFLAGS=$CXXFLAGS
6458     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6459     AC_LANG_PUSH([C++])
6460     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6461         #include <utility>
6462         template<typename T, typename... Args> T * f(Args &&... v) {
6463             return new T(std::forward<Args>(v)...);
6464         }
6465         ]], [[
6466         f<int>(0);
6467         ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6468     AC_LANG_POP([C++])
6469     CXXFLAGS=$save_CXXFLAGS
6470     AC_MSG_RESULT([$perfect_forwarding])
6471     if test "$perfect_forwarding" = yes; then
6472         AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6473     fi
6476 HAVE_GCC_PRAGMA_OPERATOR=
6477 dnl _Pragma support (may require C++11)
6478 if test "$GCC" = "yes"; then
6479     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6480     AC_LANG_PUSH([C++])
6481     save_CXXFLAGS=$CXXFLAGS
6482     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6483     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6484             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6485         ])], [
6486             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6487             HAVE_GCC_PRAGMA_OPERATOR=1
6488             AC_MSG_RESULT([yes])
6489         ], [AC_MSG_RESULT([no])])
6490     AC_LANG_POP([C++])
6491     CXXFLAGS=$save_CXXFLAGS
6493 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6495 dnl ===================================================================
6496 dnl system stl sanity tests
6497 dnl ===================================================================
6498 HAVE_GCC_VISIBILITY_BROKEN=
6499 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6501     AC_LANG_PUSH([C++])
6503     save_CPPFLAGS="$CPPFLAGS"
6504     if test -n "$MACOSX_SDK_PATH"; then
6505         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6506     fi
6508     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6509     # only.
6510     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6511         dnl gcc#19664, gcc#22482, rhbz#162935
6512         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6513         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6514         AC_MSG_RESULT([$stlvisok])
6515         if test "$stlvisok" = "no"; then
6516             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6517             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6518             unset HAVE_GCC_VISIBILITY_FEATURE
6519         fi
6520     fi
6522     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6523         sharedlink_ldflags_save=$LDFLAGS
6524         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6526         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6527         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6528 #include <sstream>
6529 using namespace std;
6530             ]], [[
6531 istringstream strm( "test" ); return 0;
6532             ]])],
6533             # Ugh, surely bad to assume an error message will contain
6534             # the word "unresolvable", a problem with
6535             # -fvisibility-inlines-hidden and STL headers might cause
6536             # some more obscure message on some platform, and anway,
6537             # the error message could be localised.
6538             [$EGREP -q unresolvable conftest.err;
6539             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6540         ])
6541         AC_MSG_RESULT([$gccvisok])
6542         if test "$gccvisok" = "no"; then
6543             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6544             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6545             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6546         fi
6548         LDFLAGS=$sharedlink_ldflags_save
6549     fi
6551     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6552     # when we don't make any dynamic libraries?
6553     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6554         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6555         cat > conftestlib1.cc <<_ACEOF
6556 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6557 struct S2: S1<int> { virtual ~S2(); };
6558 S2::~S2() {}
6559 _ACEOF
6560         cat > conftestlib2.cc <<_ACEOF
6561 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6562 struct S2: S1<int> { virtual ~S2(); };
6563 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6564 _ACEOF
6565         gccvisinlineshiddenok=yes
6566         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6567             gccvisinlineshiddenok=no
6568         else
6569             dnl At least Clang -fsanitize=address is known to not work with
6570             dnl -z defs (unsetting which makes the test moot, though):
6571             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6572             if test "$COM_GCC_IS_CLANG" = TRUE; then
6573                 for i in $CXX; do
6574                     case $i in
6575                     -fsanitize=address)
6576                         my_linkflagsnoundefs=
6577                         break
6578                         ;;
6579                     esac
6580                 done
6581             fi
6582             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6583                 gccvisinlineshiddenok=no
6584             fi
6585         fi
6587         rm -fr libconftest*
6588         AC_MSG_RESULT([$gccvisinlineshiddenok])
6589         if test "$gccvisinlineshiddenok" = "no"; then
6590             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6591             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6592             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6593         fi
6594     fi
6596     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6597         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6598         cat >visibility.cxx <<_ACEOF
6599 #pragma GCC visibility push(hidden)
6600 struct __attribute__ ((visibility ("default"))) TestStruct {
6601   static void Init();
6603 __attribute__ ((visibility ("default"))) void TestFunc() {
6604   TestStruct::Init();
6606 _ACEOF
6607         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6608             gccvisbroken=yes
6609         else
6610             case "$host_cpu" in
6611             i?86|x86_64)
6612                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6613                     gccvisbroken=no
6614                 else
6615                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6616                         gccvisbroken=no
6617                     else
6618                         gccvisbroken=yes
6619                     fi
6620                 fi
6621                 ;;
6622             *)
6623                 gccvisbroken=no
6624                 ;;
6625             esac
6626         fi
6627         rm -f visibility.s visibility.cxx
6629         AC_MSG_RESULT([$gccvisbroken])
6630         if test "$gccvisbroken" = "yes"; then
6631             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6632             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6633             unset HAVE_GCC_VISIBILITY_FEATURE
6634         fi
6635     fi
6637     CPPFLAGS="$save_CPPFLAGS"
6639     AC_LANG_POP([C++])
6642 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6643 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6645 dnl ===================================================================
6646 dnl  Clang++ tests
6647 dnl ===================================================================
6649 HAVE_GCC_FNO_DEFAULT_INLINE=
6650 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6651 if test "$GCC" = "yes"; then
6652     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6653     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6654         # Option just ignored and silly warning that isn't a real
6655         # warning printed
6656         :
6657     else
6658         AC_LANG_PUSH([C++])
6659         save_CXXFLAGS=$CXXFLAGS
6660         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6661         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6662         CXXFLAGS=$save_CXXFLAGS
6663         AC_LANG_POP([C++])
6664     fi
6665     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6666         AC_MSG_RESULT([yes])
6667     else
6668         AC_MSG_RESULT([no])
6669     fi
6671     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6672     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6673         # As above
6674         :
6675     else
6676         AC_LANG_PUSH([C++])
6677         save_CXXFLAGS=$CXXFLAGS
6678         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6679         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6680         CXXFLAGS=$save_CXXFLAGS
6681         AC_LANG_POP([C++])
6682     fi
6683     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6684         AC_MSG_RESULT([yes])
6685     else
6686         AC_MSG_RESULT([no])
6687     fi
6689 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6690 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6692 dnl ===================================================================
6693 dnl Compiler plugins
6694 dnl ===================================================================
6696 COMPILER_PLUGINS=
6697 # currently only Clang
6698 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6699     if test -n "$enable_compiler_plugins"; then
6700         compiler_plugins="$enable_compiler_plugins"
6701     elif test -n "$ENABLE_DBGUTIL"; then
6702         compiler_plugins=test
6703     else
6704         compiler_plugins=no
6705     fi
6706     if test "$compiler_plugins" != "no"; then
6707         dnl The prefix where Clang resides, override to where Clang resides if
6708         dnl using a source build:
6709         if test -z "$CLANGDIR"; then
6710             CLANGDIR=/usr
6711         fi
6712         AC_LANG_PUSH([C++])
6713         save_CPPFLAGS=$CPPFLAGS
6714         save_CXX=$CXX
6715         # compiler plugins must be built with "native" bitness of clang
6716         # because they link against clang libraries
6717         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6718         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6719         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6720             [COMPILER_PLUGINS=TRUE],
6721             [
6722             if test "$compiler_plugins" = "yes"; then
6723                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6724             else
6725                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6726                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6727             fi
6728             ])
6729         CXX=$save_CXX
6730         CPPFLAGS=$save_CPPFLAGS
6731         AC_LANG_POP([C++])
6732     fi
6733 else
6734     if test "$enable_compiler_plugins" = "yes"; then
6735         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6736     fi
6738 AC_SUBST(COMPILER_PLUGINS)
6739 AC_SUBST(CLANGDIR)
6741 # Plugin to help linker.
6742 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6743 # This makes --enable-lto build with clang work.
6744 AC_SUBST(LD_PLUGIN)
6746 dnl ===================================================================
6747 dnl allocator
6748 dnl ===================================================================
6749 AC_MSG_CHECKING([which memory allocator to use])
6750 if test "$with_alloc" = "system"; then
6751     AC_MSG_RESULT([system])
6752     ALLOC="SYS_ALLOC"
6754 if test "$with_alloc" = "tcmalloc"; then
6755     AC_MSG_RESULT(tcmalloc)
6756     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6757         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6758     fi
6759     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6760         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6761     ALLOC="TCMALLOC"
6763 if test "$with_alloc" = "jemalloc"; then
6764     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6765         AC_MSG_RESULT(jemalloc)
6766         save_CFLAGS=$CFLAGS
6767         CFLAGS="$CFLAGS -pthread"
6768         AC_CHECK_LIB([jemalloc], [malloc], [:],
6769             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6770         ALLOC="JEMALLOC"
6771         CFLAGS=$save_CFLAGS
6772     else
6773         AC_MSG_RESULT([system])
6774         ALLOC="SYS_ALLOC"
6775     fi
6777 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6778     AC_MSG_RESULT([internal])
6780 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6781 AC_SUBST(HAVE_POSIX_FALLOCATE)
6782 AC_SUBST(ALLOC)
6784 dnl ===================================================================
6785 dnl Custom build version
6786 dnl ===================================================================
6788 AC_MSG_CHECKING([whether to add custom build version])
6789 if test "$with_build_version" != ""; then
6790     BUILD_VER_STRING=$with_build_version
6791     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6792 else
6793     BUILD_VER_STRING=
6794     AC_MSG_RESULT([no])
6796 AC_SUBST(BUILD_VER_STRING)
6798 JITC_PROCESSOR_TYPE=""
6799 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6800     # IBMs JDK needs this...
6801     JITC_PROCESSOR_TYPE=6
6802     export JITC_PROCESSOR_TYPE
6804 AC_SUBST([JITC_PROCESSOR_TYPE])
6806 # Misc Windows Stuff
6807 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6808     find_msvc_x64_dlls
6809     find_msms
6810     MSVC_DLL_PATH="$msvcdllpath"
6811     MSVC_DLLS="$msvcdlls"
6812     MSM_PATH="$msmdir"
6813     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6816 AC_SUBST(MSVC_DLL_PATH)
6817 AC_SUBST(MSVC_DLLS)
6818 AC_SUBST(MSM_PATH)
6820 dnl ===================================================================
6821 dnl Checks for Java
6822 dnl ===================================================================
6823 if test "$ENABLE_JAVA" != ""; then
6825     # Windows-specific tests
6826     if test "$build_os" = "cygwin"; then
6827         if test "$BITNESS_OVERRIDE" = 64; then
6828             bitness=64
6829         else
6830             bitness=32
6831         fi
6833         if test -z "$with_jdk_home"; then
6834             for ver in 1.8 1.7 1.6; do
6835                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6836                if test -n "$regvalue"; then
6837                    _jdk_home=$regvalue
6838                    break
6839                fi
6840             done
6841             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6842                 with_jdk_home="$_jdk_home"
6843                 howfound="found automatically"
6844             else
6845                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6846             fi
6847         else
6848             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6849             howfound="you passed"
6850         fi
6851     fi
6853     # MacOS X: /usr/libexec/java_home helps to set the current JDK_HOME. Actually JDK_HOME should NOT be set where java (/usr/bin/java) is located.
6854     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6855     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6856         with_jdk_home=`/usr/libexec/java_home`
6857     fi
6859     JAVA_HOME=; export JAVA_HOME
6860     if test -z "$with_jdk_home"; then
6861         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6862     else
6863         _java_path="$with_jdk_home/bin/$with_java"
6864         dnl Check if there is a Java interpreter at all.
6865         if test -x "$_java_path"; then
6866             JAVAINTERPRETER=$_java_path
6867         else
6868             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6869         fi
6870     fi
6872     if test "$build_os" = "cygwin"; then
6873         # Check that the JDK found is correct architecture
6874         # Why is this necessary, we don't link with any library from the JDK I think,
6876         shortjdkhome=`cygpath -d "$with_jdk_home"`
6877         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
6878             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6879             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6880         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
6881             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6882             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6883         fi
6885         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6886             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6887         fi
6888         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6889         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6890     elif test $_os = Darwin -a "$BITNESS_OVERRIDE" = ""; then
6891         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6892         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6893         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6894         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6895         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6896             AC_MSG_RESULT([yes])
6897             JAVAIFLAGS=-d32
6898         else
6899             AC_MSG_RESULT([no])
6900         fi
6901     elif test "$cross_compiling" != "yes"; then
6902         # at least 2 reasons to check: officebean needs to link -ljawt,
6903         # and libjpipe.so needs to be loaded by java to run JunitTests.
6904         case $CPUNAME in
6905             AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64)
6906                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6907                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6908                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6909                 fi
6910                 ;;
6911             *) # assumption: everything else 32-bit
6912                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6913                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6914                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6915                 fi
6916                 ;;
6917         esac
6918     fi
6921 HAVE_JAVA6=
6922 dnl ===================================================================
6923 dnl Checks for JDK.
6924 dnl ===================================================================
6926 # Note that JAVA_HOME as for now always means the *build* platform's
6927 # JAVA_HOME. Whether all the complexity here actually is needed any
6928 # more or not, no idea.
6930 if test "$ENABLE_JAVA" != ""; then
6931     _gij_longver=0
6932     AC_MSG_CHECKING([the installed JDK])
6933     if test -n "$JAVAINTERPRETER"; then
6934         dnl java -version sends output to stderr!
6935         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6936             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6937         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6938             JDK=gcj
6939             AC_MSG_RESULT([checked (gcj)])
6940             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6941             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6943         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6944             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6945         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6946             JDK=ibm
6948             dnl IBM JDK specific tests
6949             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6950             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6952             if test "$_jdk_ver" -lt 10500; then
6953                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6954             fi
6955             if test "$_jdk_ver" -ge 10600; then
6956                 HAVE_JAVA6=TRUE
6957             fi
6959             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6961             if test "$with_jdk_home" = ""; then
6962                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6963 you must use the "--with-jdk-home" configure option explicitly])
6964             fi
6966            JAVA_HOME=$with_jdk_home
6968         else
6969             JDK=sun
6971             dnl Sun JDK specific tests
6972             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6973             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6975             if test "$_jdk_ver" -lt 10500; then
6976                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6977             fi
6978             if test "$_jdk_ver" -gt 10600; then
6979                 JAVA_CLASSPATH_NOT_SET="1"
6980             fi
6981             if test "$_jdk_ver" -ge 10600; then
6982                 HAVE_JAVA6=TRUE
6983             fi
6985             AC_MSG_RESULT([checked (JDK $_jdk)])
6986             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6987             if test "$_os" = "WINNT"; then
6988                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6989             fi
6990         fi
6991     else
6992         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6993     fi
6994 else
6995     dnl Java disabled
6996     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6998 AC_SUBST([HAVE_JAVA6])
7000 dnl ===================================================================
7001 dnl Set target Java bytecode version
7002 dnl ===================================================================
7003 if test "$ENABLE_JAVA" != ""; then
7004     _java_target_ver="1.5"
7006     JAVA_SOURCE_VER="$_java_target_ver"
7007     JAVA_TARGET_VER="$_java_target_ver"
7010 dnl ===================================================================
7011 dnl Checks for javac
7012 dnl ===================================================================
7013 if test "$ENABLE_JAVA" != ""; then
7014     if test "$JDK" = "gcj"; then
7015         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
7016     else
7017         javacompiler="javac"
7018     fi
7019     if test -z "$with_jdk_home"; then
7020         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7021     else
7022         _javac_path="$with_jdk_home/bin/$javacompiler"
7023         dnl Check if there is a Java compiler at all.
7024         if test -x "$_javac_path"; then
7025             JAVACOMPILER=$_javac_path
7026         fi
7027     fi
7028     if test -z "$JAVACOMPILER"; then
7029         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7030     fi
7031     if test "$build_os" = "cygwin"; then
7032         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7033             JAVACOMPILER="${JAVACOMPILER}.exe"
7034         fi
7035         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
7036         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
7037     fi
7039     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
7040         AC_MSG_CHECKING([re-checking JDK])
7041         JDK=gcj
7042         AC_MSG_RESULT([checked (ecj)])
7043         _gij_longver="40200"
7044     fi
7047 JAVACISGCJ=""
7048 dnl ===================================================================
7049 dnl Checks that javac is gcj
7050 dnl ===================================================================
7051 if test "$ENABLE_JAVA" != ""; then
7052     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
7053         JAVACISGCJ="yes"
7054     fi
7056 AC_SUBST(JAVACISGCJ)
7058 dnl ===================================================================
7059 dnl Checks for javadoc
7060 dnl ===================================================================
7061 if test "$ENABLE_JAVA" != ""; then
7062     if test -z "$with_jdk_home"; then
7063         AC_PATH_PROG(JAVADOC, javadoc)
7064     else
7065         _javadoc_path="$with_jdk_home/bin/javadoc"
7066         dnl Check if there is a javadoc at all.
7067         if test -x "$_javadoc_path"; then
7068             JAVADOC=$_javadoc_path
7069         else
7070             AC_PATH_PROG(JAVADOC, javadoc)
7071         fi
7072     fi
7073     if test -z "$JAVADOC"; then
7074         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7075     fi
7076     if test "$build_os" = "cygwin"; then
7077         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7078             JAVADOC="${JAVADOC}.exe"
7079         fi
7080         JAVADOC=`cygpath -d "$JAVADOC"`
7081         JAVADOC=`cygpath -u "$JAVADOC"`
7082     fi
7084     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7085     JAVADOCISGJDOC="yes"
7086     fi
7088 AC_SUBST(JAVADOCISGJDOC)
7090 if test "$ENABLE_JAVA" != ""; then
7091     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7092     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7093         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7094            # try to recover first by looking whether we have a alternatives
7095            # system as in Debian or newer SuSEs where following /usr/bin/javac
7096            # over /etc/alternatives/javac leads to the right bindir where we
7097            # just need to strip a bit away to get a valid JAVA_HOME
7098            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7099         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7100             # maybe only one level of symlink (e.g. on Mac)
7101             JAVA_HOME=$(readlink $JAVACOMPILER)
7102             if test "$(dirname $JAVA_HOME)" = "."; then
7103                 # we've got no path to trim back
7104                 JAVA_HOME=""
7105             fi
7106         else
7107             # else warn
7108             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7109             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7110             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7111             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7112         fi
7113         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
7114         if test "$JAVA_HOME" != "/usr"; then
7115             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7116                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7117                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7118                 dnl Tiger already returns a JDK path..
7119                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7120             else
7121                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7122             fi
7123         fi
7124     fi
7125     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7127     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7128     if test -z "$JAVA_HOME"; then
7129         if test "x$with_jdk_home" = "x"; then
7130             cat > findhome.java <<_ACEOF
7131 [import java.io.File;
7133 class findhome
7135     public static void main(String args[])
7136     {
7137         String jrelocation = System.getProperty("java.home");
7138         File jre = new File(jrelocation);
7139         System.out.println(jre.getParent());
7140     }
7142 _ACEOF
7143             AC_MSG_CHECKING([if javac works])
7144             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7145             AC_TRY_EVAL(javac_cmd)
7146             if test $? = 0 -a -f ./findhome.class; then
7147                 AC_MSG_RESULT([javac works])
7148             else
7149                 echo "configure: javac test failed" >&5
7150                 cat findhome.java >&5
7151                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7152             fi
7153             AC_MSG_CHECKING([if gij knows its java.home])
7154             JAVA_HOME=`$JAVAINTERPRETER findhome`
7155             if test $? = 0 -a "$JAVA_HOME" != ""; then
7156                 AC_MSG_RESULT([$JAVA_HOME])
7157             else
7158                 echo "configure: java test failed" >&5
7159                 cat findhome.java >&5
7160                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7161             fi
7162             # clean-up after ourselves
7163             rm -f ./findhome.java ./findhome.class
7164         else
7165             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7166         fi
7167     fi
7169     dnl second sanity check JAVA_HOME if possible
7170     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
7171         # now check if $JAVA_HOME is really valid
7172         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7173             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7174                 JAVA_HOME_OK="NO"
7175             fi
7176         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7177             JAVA_HOME_OK="NO"
7178         fi
7179         if test "$JAVA_HOME_OK" = "NO"; then
7180             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7181             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7182             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7183             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7184             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7185             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7186         fi
7187     fi
7188     PathFormat "$JAVA_HOME"
7189     JAVA_HOME="$formatted_path"
7192 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7193     "$_os" != Darwin
7194 then
7195     AC_MSG_CHECKING([for JAWT lib])
7196     if test "$_os" = WINNT; then
7197         if test "$WITH_MINGW" = yes; then
7198             # The path is taken care of in gb_LinkTarget__use_jawt
7199             # in RepositoryExternal.mk:
7200             JAWTLIB=-ljawt
7201         else
7202             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7203             JAWTLIB=jawt.lib
7204         fi
7205     else
7206         case "$host_cpu" in
7207         arm*)
7208             my_java_arch=arm
7209             ;;
7210         i*86)
7211             my_java_arch=i386
7212             ;;
7213         m68k)
7214             my_java_arch=mk68
7215             ;;
7216         powerpc)
7217             my_java_arch=ppc
7218             ;;
7219         powerpc64)
7220             my_java_arch=ppc64
7221             ;;
7222         x86_64)
7223             my_java_arch=amd64
7224             ;;
7225         *)
7226             my_java_arch=$host_cpu
7227             ;;
7228         esac
7229         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7230     fi
7231     AC_MSG_RESULT([$JAWTLIB])
7233 AC_SUBST(JAWTLIB)
7235 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7236     case "$host_os" in
7238     aix*)
7239         JAVAINC="-I$JAVA_HOME/include"
7240         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7241         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7242         ;;
7244     cygwin*)
7245         JAVAINC="-I$JAVA_HOME/include/win32"
7246         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7247         ;;
7249     darwin*)
7250         if test -d "$JAVA_HOME/include/darwin"; then
7251             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7252         else
7253             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7254         fi
7255         ;;
7257     dragonfly*)
7258         JAVAINC="-I$JAVA_HOME/include"
7259         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7260         ;;
7262     freebsd*)
7263         JAVAINC="-I$JAVA_HOME/include"
7264         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7265         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7266         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7267         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7268         ;;
7270     k*bsd*-gnu*)
7271         JAVAINC="-I$JAVA_HOME/include"
7272         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7273         ;;
7275     linux-gnu*)
7276         JAVAINC="-I$JAVA_HOME/include"
7277         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7278         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7279         ;;
7281     mingw*)
7282         JAVAINC="-I$JAVA_HOME/include"
7283         ;;
7285     *netbsd*)
7286         JAVAINC="-I$JAVA_HOME/include"
7287         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7288         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7289        ;;
7291     openbsd*)
7292         JAVAINC="-I$JAVA_HOME/include"
7293         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7294         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7295         ;;
7297     solaris*)
7298         JAVAINC="-I$JAVA_HOME/include"
7299         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7300         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7301         ;;
7302     esac
7304 SOLARINC="$SOLARINC $JAVAINC"
7306 AC_SUBST(JAVACOMPILER)
7307 AC_SUBST(JAVADOC)
7308 AC_SUBST(JAVAINTERPRETER)
7309 AC_SUBST(JAVAIFLAGS)
7310 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7311 AC_SUBST(JAVA_HOME)
7312 AC_SUBST(JAVA_SOURCE_VER)
7313 AC_SUBST(JAVA_TARGET_VER)
7314 AC_SUBST(JDK)
7316 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7317 if test -n "$with_idlc_cpp"; then
7318     AC_MSG_RESULT([$with_idlc_cpp])
7319     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7320 else
7321     AC_MSG_RESULT([ucpp])
7322     AC_MSG_CHECKING([which ucpp tp use])
7323     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7324         AC_MSG_RESULT([external])
7325         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7326     else
7327         AC_MSG_RESULT([internal])
7328         BUILD_TYPE="$BUILD_TYPE UCPP"
7329     fi
7331 AC_SUBST(SYSTEM_UCPP)
7333 dnl ===================================================================
7334 dnl Check for epm (not needed for Windows)
7335 dnl ===================================================================
7336 AC_MSG_CHECKING([whether to enable EPM for packing])
7337 if test "$enable_epm" = "yes"; then
7338     AC_MSG_RESULT([yes])
7339     if test "$_os" != "WINNT"; then
7340         if test $_os = Darwin; then
7341             EPM=internal
7342         elif test -n "$with_epm"; then
7343             EPM=$with_epm
7344         else
7345             AC_PATH_PROG(EPM, epm, no)
7346         fi
7347         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7348             echo "EPM will be built."
7349             BUILD_TYPE="$BUILD_TYPE EPM"
7350             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7351         else
7352             # Gentoo has some epm which is something different...
7353             AC_MSG_CHECKING([whether the found epm is the right epm])
7354             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7355                 AC_MSG_RESULT([yes])
7356             else
7357                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7358             fi
7359             AC_MSG_CHECKING([epm version])
7360             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7361             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7362                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7363                 AC_MSG_RESULT([OK, >= 3.7])
7364             else
7365                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7366                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7367             fi
7368         fi
7369     fi
7371     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7372         AC_MSG_CHECKING([for rpm])
7373         for a in "$RPM" rpmbuild rpm; do
7374             $a --usage >/dev/null 2> /dev/null
7375             if test $? -eq 0; then
7376                 RPM=$a
7377                 break
7378             else
7379                 $a --version >/dev/null 2> /dev/null
7380                 if test $? -eq 0; then
7381                     RPM=$a
7382                     break
7383                 fi
7384             fi
7385         done
7386         if test -z "$RPM"; then
7387             AC_MSG_ERROR([not found])
7388         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7389             RPM_PATH=`which $RPM`
7390             AC_MSG_RESULT([$RPM_PATH])
7391             SCPDEFS="$SCPDEFS -DWITH_RPM"
7392         else
7393             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7394         fi
7395     fi
7396     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7397         AC_PATH_PROG(DPKG, dpkg, no)
7398         if test "$DPKG" = "no"; then
7399             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7400         fi
7401     fi
7402     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7403        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7404         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7405             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7406                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7407                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7408                     AC_MSG_RESULT([yes])
7409                 else
7410                     AC_MSG_RESULT([no])
7411                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7412                         _pt="rpm"
7413                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7414                         add_warning "the rpms will need to be installed with --nodeps"
7415                     else
7416                         _pt="pkg"
7417                     fi
7418                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7419                     add_warning "the ${_pt}s will not be relocateable"
7420                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7421                                  relocation will work, you need to patch your epm with the
7422                                  patch in epm/epm-3.7.patch or build with
7423                                  --with-epm=internal which will build a suitable epm])
7424                 fi
7425             fi
7426         fi
7427     fi
7428     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7429         AC_PATH_PROG(PKGMK, pkgmk, no)
7430         if test "$PKGMK" = "no"; then
7431             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7432         fi
7433     fi
7434     AC_SUBST(RPM)
7435     AC_SUBST(DPKG)
7436     AC_SUBST(PKGMK)
7437 else
7438     for i in $PKGFORMAT; do
7439         case "$i" in
7440         aix | bsd | deb | pkg | rpm | native | portable)
7441             AC_MSG_ERROR(
7442                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7443             ;;
7444         esac
7445     done
7446     AC_MSG_RESULT([no])
7447     EPM=NO
7449 AC_SUBST(EPM)
7451 dnl ===================================================================
7452 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7453 dnl ===================================================================
7454 WINEGCC=
7455 if test "$enable_winegcc" = "yes"; then
7456     AC_PATH_PROG(WINEGCC, winegcc)
7457     if test "$WINEGCC" = ""; then
7458         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7459     fi
7460     CC_save="$CC"
7461     ac_exeext_save="$ac_exeext"
7462     CC="$WINEGCC -m32"
7463     ac_exeext=".exe"
7464     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7465 #include <stdio.h>
7466         ],[
7467 printf ("hello world\n");
7468         ])],,
7469         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7470     )
7471     CC="$CC_save"
7472     ac_exeext="$ac_exeext_save"
7474 AC_SUBST(WINEGCC)
7476 if test $_os = iOS; then
7477     enable_mpl_subset=yes
7478     enable_opengl=no
7479     enable_lotuswordpro=no
7480     enable_coinmp=yes
7481     enable_lpsolve=no
7482     enable_postgresql_sdbc=no
7483     enable_extension_integration=no
7484     enable_report_builder=no
7485     with_theme="tango"
7486     with_ppds=no
7489 ENABLE_LWP=
7490 if test "$enable_lotuswordpro" = "yes"; then
7491     ENABLE_LWP="TRUE"
7492     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7494 AC_SUBST(ENABLE_LWP)
7496 dnl ===================================================================
7497 dnl Check for gperf
7498 dnl ===================================================================
7499 AC_PATH_PROG(GPERF, gperf)
7500 if test -z "$GPERF"; then
7501     AC_MSG_ERROR([gperf not found but needed. Install it.])
7503 AC_MSG_CHECKING([gperf version])
7504 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7505     AC_MSG_RESULT([OK])
7506 else
7507     AC_MSG_ERROR([too old, you need at least 3.0.0])
7509 AC_SUBST(GPERF)
7511 dnl ===================================================================
7512 dnl Check for building ODK
7513 dnl ===================================================================
7514 if test "$enable_odk" = no; then
7515     unset DOXYGEN
7516 else
7517     if test "$with_doxygen" = no; then
7518         AC_MSG_CHECKING([for doxygen])
7519         unset DOXYGEN
7520         AC_MSG_RESULT([no])
7521     else
7522         if test "$with_doxygen" = yes; then
7523             AC_PATH_PROG([DOXYGEN], [doxygen])
7524             if test -z "$DOXYGEN"; then
7525                 if test "$enable_odk" = "" ; then
7526                     enable_odk="no"
7527                 else
7528                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7529                 fi
7530             fi
7531         else
7532             AC_MSG_CHECKING([for doxygen])
7533             DOXYGEN=$with_doxygen
7534             AC_MSG_RESULT([$DOXYGEN])
7535         fi
7536         if test -n "$DOXYGEN"; then
7537            DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7538            DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7539            if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7540               AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7541            fi
7542         fi
7543     fi
7545 AC_SUBST([DOXYGEN])
7547 AC_MSG_CHECKING([whether to build the ODK])
7548 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7549     AC_MSG_RESULT([yes])
7551     if test "$with_java" != "no"; then
7552         AC_MSG_CHECKING([whether to build unowinreg.dll])
7553         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7554             # build on Win by default
7555             enable_build_unowinreg=yes
7556         fi
7557         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7558             AC_MSG_RESULT([no])
7559             BUILD_UNOWINREG=
7560         else
7561             AC_MSG_RESULT([yes])
7562             BUILD_UNOWINREG=TRUE
7563         fi
7564         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7565             if test -z "$with_mingw_cross_compiler"; then
7566                 dnl Guess...
7567                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7568             elif test -x "$with_mingw_cross_compiler"; then
7569                  MINGWCXX="$with_mingw_cross_compiler"
7570             else
7571                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7572             fi
7574             if test "$MINGWCXX" = "false"; then
7575                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7576             fi
7578             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7579             if test -x "$mingwstrip_test"; then
7580                 MINGWSTRIP="$mingwstrip_test"
7581             else
7582                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7583             fi
7585             if test "$MINGWSTRIP" = "false"; then
7586                 AC_MSG_ERROR(MinGW32 binutils not found.)
7587             fi
7588         fi
7589     fi
7590     BUILD_TYPE="$BUILD_TYPE ODK"
7591 else
7592     AC_MSG_RESULT([no])
7593     BUILD_UNOWINREG=
7595 AC_SUBST(BUILD_UNOWINREG)
7596 AC_SUBST(MINGWCXX)
7597 AC_SUBST(MINGWSTRIP)
7599 dnl ===================================================================
7600 dnl Check for system zlib
7601 dnl ===================================================================
7602 if test "$with_system_zlib" = "auto"; then
7603     case "$_os" in
7604     WINNT)
7605         with_system_zlib="$with_system_libs"
7606         ;;
7607     *)
7608         with_system_zlib=yes
7609         ;;
7610     esac
7613 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7614 dnl and has no pkg-config for it at least on some tinderboxes,
7615 dnl so leaving that out for now
7616 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7617 AC_MSG_CHECKING([which zlib to use])
7618 if test "$with_system_zlib" = "yes"; then
7619     AC_MSG_RESULT([external])
7620     SYSTEM_ZLIB=TRUE
7621     AC_CHECK_HEADER(zlib.h, [],
7622         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7623     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7624         [AC_MSG_ERROR(zlib not found or functional)], [])
7625 else
7626     AC_MSG_RESULT([internal])
7627     SYSTEM_ZLIB=
7628     BUILD_TYPE="$BUILD_TYPE ZLIB"
7629     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7630     ZLIB_LIBS="-lzlib"
7632 AC_SUBST(ZLIB_CFLAGS)
7633 AC_SUBST(ZLIB_LIBS)
7634 AC_SUBST(SYSTEM_ZLIB)
7636 dnl ===================================================================
7637 dnl Check for system jpeg
7638 dnl ===================================================================
7639 AC_MSG_CHECKING([which jpeg to use])
7640 if test "$with_system_jpeg" = "auto"; then
7641     case "$_os" in
7642     WINNT|Darwin|iOS|Android)
7643         with_system_jpeg="$with_system_libs"
7644         ;;
7645     *)
7646         with_system_jpeg=yes
7647         ;;
7648     esac
7651 if test "$with_system_jpeg" = "yes"; then
7652     AC_MSG_RESULT([external])
7653     SYSTEM_JPEG=TRUE
7654     AC_CHECK_HEADER(jpeglib.h, [],
7655         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7656     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7657     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7658     libo_MINGW_CHECK_DLL([libjpeg])
7659 else
7660     AC_MSG_RESULT([internal])
7661     SYSTEM_JPEG=
7662     BUILD_TYPE="$BUILD_TYPE JPEG"
7664 AC_SUBST(SYSTEM_JPEG)
7667 dnl ===================================================================
7668 dnl Check for system clucene
7669 dnl ===================================================================
7670 dnl we should rather be using
7671 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7672 dnl but the contribs-lib check seems tricky
7673 AC_MSG_CHECKING([which clucene to use])
7674 if test "$with_system_clucene" = "yes"; then
7675     AC_MSG_RESULT([external])
7676     SYSTEM_CLUCENE=TRUE
7677     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7678     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7679     AC_LANG_PUSH([C++])
7680     save_CXXFLAGS=$CXXFLAGS
7681     save_CPPFLAGS=$CPPFLAGS
7682     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7683     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7684     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7685     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7686     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7687                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7688     CXXFLAGS=$save_CXXFLAGS
7689     CPPFLAGS=$save_CPPFLAGS
7690     AC_LANG_POP([C++])
7692     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7693 else
7694     AC_MSG_RESULT([internal])
7695     SYSTEM_CLUCENE=
7696     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7698 AC_SUBST(SYSTEM_CLUCENE)
7699 AC_SUBST(CLUCENE_CFLAGS)
7700 AC_SUBST(CLUCENE_LIBS)
7702 dnl ===================================================================
7703 dnl Check for system expat
7704 dnl ===================================================================
7705 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7706 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7707 AC_MSG_CHECKING([which expat to use])
7708 if test "$with_system_expat" = "yes"; then
7709     AC_MSG_RESULT([external])
7710     SYSTEM_EXPAT=TRUE
7711     AC_CHECK_HEADER(expat.h, [],
7712         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7713     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7714         [AC_MSG_RESULT(expat library not found or functional.)], [])
7715     libo_MINGW_CHECK_DLL([libexpat])
7716 else
7717     AC_MSG_RESULT([internal])
7718     SYSTEM_EXPAT=
7719     BUILD_TYPE="$BUILD_TYPE EXPAT"
7721 AC_SUBST(SYSTEM_EXPAT)
7723 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7724 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7725     ENABLE_EOT="TRUE"
7726     AC_DEFINE([ENABLE_EOT])
7727     AC_MSG_RESULT([yes])
7729     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7730 else
7731     ENABLE_EOT=
7732     AC_MSG_RESULT([no])
7734 AC_SUBST([ENABLE_EOT])
7736 dnl ===================================================================
7737 dnl Check for system librevenge
7738 dnl ===================================================================
7739 AS_IF([test "$COM" = "MSC"],
7740       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7741       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7743 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7745 dnl ===================================================================
7746 dnl Check for system libe-book
7747 dnl ===================================================================
7748 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7750 dnl ===================================================================
7751 dnl Check for system libetonyek
7752 dnl ===================================================================
7753 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.1])
7755 dnl ===================================================================
7756 dnl Check for system libfreehand
7757 dnl ===================================================================
7758 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7760 dnl ===================================================================
7761 dnl Check for system libodfgen
7762 dnl ===================================================================
7763 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7765 dnl ===================================================================
7766 dnl Check for system libcdr
7767 dnl ===================================================================
7768 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7770 dnl ===================================================================
7771 dnl Check for system libmspub
7772 dnl ===================================================================
7773 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7775 dnl ===================================================================
7776 dnl Check for system libmwaw
7777 dnl ===================================================================
7778 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7780 dnl ===================================================================
7781 dnl Check for system libpagemaker
7782 dnl ===================================================================
7783 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7785 dnl ===================================================================
7786 dnl Check for system libvisio
7787 dnl ===================================================================
7788 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7790 dnl ===================================================================
7791 dnl Check for system libcmis
7792 dnl ===================================================================
7793 # libcmis requires curl and we can't build curl for iOS
7794 if test $_os != iOS; then
7795     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.4 >= 0.4.0])
7796     ENABLE_CMIS=TRUE
7797 else
7798     ENABLE_CMIS=
7800 AC_SUBST(ENABLE_CMIS)
7802 dnl ===================================================================
7803 dnl Check for system libwpd
7804 dnl ===================================================================
7805 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs -lwpd-0.10"])
7807 dnl ===================================================================
7808 dnl Check for system lcms2
7809 dnl ===================================================================
7810 if test "$with_system_lcms2" = "yes"; then
7811     libo_MINGW_CHECK_DLL([liblcms2])
7812 else
7813     SYSTEM_LCMS2=
7815 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7816 if test "$GCC" = "yes"; then
7817     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7819 if test "$COM" = "MSC"; then # override the above
7820     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7823 dnl ===================================================================
7824 dnl Check for system cppunit
7825 dnl ===================================================================
7826 if test "$cross_compiling" != "yes"; then
7827     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7830 dnl ===================================================================
7831 dnl Check whether freetype is available
7832 dnl ===================================================================
7833 if test  "$test_freetype" = "yes"; then
7834     AC_MSG_CHECKING([whether freetype is available])
7835     # FreeType has 3 different kinds of versions
7836     # * release, like 2.4.10
7837     # * libtool, like 13.0.7 (this what pkg-config returns)
7838     # * soname
7839     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7840     #
7841     # 9.9.3 is 2.2.0
7842     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7843     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7844     SYSTEM_FREETYPE=TRUE
7845     _save_libs="$LIBS"
7846     _save_cflags="$CFLAGS"
7847     LIBS="$LIBS $FREETYPE_LIBS"
7848     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7849     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7850     LIBS="$_save_libs"
7851     CFLAGS="$_save_cflags"
7853 AC_SUBST(FREETYPE_CFLAGS)
7854 AC_SUBST(FREETYPE_LIBS)
7855 AC_SUBST([SYSTEM_FREETYPE])
7857 dnl ===================================================================
7858 dnl Check for system libabw
7859 dnl ===================================================================
7860 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7862 dnl ===================================================================
7863 dnl Check for system libwps
7864 dnl ===================================================================
7865 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.3])
7867 dnl ===================================================================
7868 dnl Check for system libwpg
7869 dnl ===================================================================
7870 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7872 # ===================================================================
7873 # Check for system libxslt
7874 # to prevent incompatibilities between internal libxml2 and external libxslt,
7875 # or vice versa, use with_system_libxml here
7876 # ===================================================================
7877 if test "$with_system_libxml" = "auto"; then
7878     case "$_os" in
7879     WINNT|iOS|Android)
7880         with_system_libxml="$with_system_libs"
7881         ;;
7882     *)
7883         with_system_libxml=yes
7884         ;;
7885     esac
7888 AC_MSG_CHECKING([which libxslt to use])
7889 if test "$with_system_libxml" = "yes"; then
7890     AC_MSG_RESULT([external])
7891     SYSTEM_LIBXSLT=TRUE
7892     if test "$_os" = "Darwin"; then
7893         dnl make sure to use SDK path
7894         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7895         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7896         dnl omit -L/usr/lib
7897         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7898         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7899     else
7900         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7901         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7902         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7903         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7904     fi
7906     dnl Check for xsltproc
7907     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7908     if test "$XSLTPROC" = "no"; then
7909         AC_MSG_ERROR([xsltproc is required])
7910     fi
7912     libo_MINGW_CHECK_DLL([libxslt])
7913     libo_MINGW_CHECK_DLL([libexslt])
7914     libo_MINGW_TRY_DLL([iconv])
7915 else
7916     AC_MSG_RESULT([internal])
7917     SYSTEM_LIBXSLT=
7918     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7920     if test "$cross_compiling" = "yes"; then
7921         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7922         if test "$XSLTPROC" = "no"; then
7923             AC_MSG_ERROR([xsltproc is required])
7924         fi
7925     fi
7927 AC_SUBST(SYSTEM_LIBXSLT)
7928 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7929     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7931 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7933 AC_SUBST(LIBEXSLT_CFLAGS)
7934 AC_SUBST(LIBEXSLT_LIBS)
7935 AC_SUBST(LIBXSLT_CFLAGS)
7936 AC_SUBST(LIBXSLT_LIBS)
7937 AC_SUBST(XSLTPROC)
7939 # ===================================================================
7940 # Check for system libxml
7941 # ===================================================================
7942 AC_MSG_CHECKING([which libxml to use])
7943 if test "$with_system_libxml" = "yes"; then
7944     AC_MSG_RESULT([external])
7945     SYSTEM_LIBXML=TRUE
7946     if test "$_os" = "Darwin"; then
7947         dnl make sure to use SDK path
7948         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7949         dnl omit -L/usr/lib
7950         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7951     elif test $_os = iOS; then
7952         dnl make sure to use SDK path
7953         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7954         LIBXML_CFLAGS="-I$usr/include/libxml2"
7955         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7956     else
7957         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7958         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7959     fi
7961     dnl Check for xmllint
7962     AC_PATH_PROG(XMLLINT, xmllint, no)
7963     if test "$XMLLINT" = "no"; then
7964         AC_MSG_ERROR([xmllint is required])
7965     fi
7967     libo_MINGW_CHECK_DLL([libxml2])
7968     libo_MINGW_TRY_DLL([zlib1])
7969 else
7970     AC_MSG_RESULT([internal])
7971     SYSTEM_LIBXML=
7972     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7974 AC_SUBST(SYSTEM_LIBXML)
7975 AC_SUBST(LIBXML_CFLAGS)
7976 AC_SUBST(LIBXML_LIBS)
7977 AC_SUBST(XMLLINT)
7979 # =====================================================================
7980 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7981 # runtime requires Python 3 compatible version (>= 2.6)
7982 # Optionally user can pass an option to configure, i. e.
7983 # ./configure PYTHON=/usr/bin/python
7984 # =====================================================================
7985 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7986     # This allows a lack of system python with no error, we use internal one in that case.
7987     AM_PATH_PYTHON([2.5],, [:])
7988     # Clean PYTHON_VERSION checked below if cross-compiling
7989     PYTHON_VERSION=""
7990     if test "$PYTHON" != ":"; then
7991         PYTHON_FOR_BUILD=$PYTHON
7992     fi
7994 AC_SUBST(PYTHON_FOR_BUILD)
7996 # Checks for Python to use for Pyuno
7997 AC_MSG_CHECKING([which Python to use for Pyuno])
7998 case "$enable_python" in
7999 no|disable)
8000     if test -z $PYTHON_FOR_BUILD; then
8001         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8002         # requirement from the choice whether to include Python stuff in the installer, but why
8003         # bother?
8004         AC_MSG_ERROR([Python is required at build time.])
8005     fi
8006     enable_python=no
8007     AC_MSG_RESULT([none])
8008     ;;
8009 ""|yes|auto)
8010     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8011         AC_MSG_RESULT([no, overridden by --disable-scripting])
8012         enable_python=no
8013     elif test $build_os = cygwin; then
8014         dnl When building on Windows we don't attempt to use any installed
8015         dnl "system"  Python.
8016         dnl
8017         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8018         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8019         dnl MinGW cross-compilation setups.)
8020         AC_MSG_RESULT([fully internal])
8021         enable_python=internal
8022     elif test "$cross_compiling" = yes; then
8023         AC_MSG_RESULT([system])
8024         enable_python=system
8025     else
8026         # Unset variables set by the above AM_PATH_PYTHON so that
8027         # we actually do check anew.
8028         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
8029         AM_PATH_PYTHON([3.3],, [:])
8030         if test "$PYTHON" = :; then
8031             AC_MSG_RESULT([internal])
8032             enable_python=internal
8033         else
8034             AC_MSG_RESULT([system])
8035             enable_python=system
8036         fi
8037     fi
8038     ;;
8039 internal)
8040     AC_MSG_RESULT([internal])
8041     ;;
8042 fully-internal)
8043     AC_MSG_RESULT([fully internal])
8044     enable_python=internal
8045     ;;
8046 system)
8047     AC_MSG_RESULT([system])
8048     ;;
8050     AC_MSG_ERROR([Incorrect --enable-python option])
8051     ;;
8052 esac
8054 if test $enable_python != no; then
8055     BUILD_TYPE="$BUILD_TYPE PYUNO"
8058 if test $enable_python = system; then
8059     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8060         # We already have logic above to make sure the system Python
8061         # is used only when building against SDK 10.6 or newer.
8063         # Make sure we use the 2.6 Python when building against the
8064         # 10.6 SDK.
8065         case $with_macosx_sdk in
8066         10.6)
8067             python_version=2.6;;
8068         10.7|10.8)
8069             python_version=2.7;;
8070         *)
8071             # ???
8072             python_version=2.7;;
8073         esac
8074         PYTHON=python$python_version
8075         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8076             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8077             PYTHON_LIBS="-framework Python"
8078         else
8079             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8080             PYTHON_LIBS="`$PYTHON-config --libs`"
8081         fi
8082     fi
8083     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8084         # Fallback: Accept these in the environment, or as set above
8085         # for MacOSX.
8086         :
8087     elif test "$cross_compiling" != yes; then
8088         # Unset variables set by the above AM_PATH_PYTHON so that
8089         # we actually do check anew.
8090         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
8091         # This causes an error if no python command is found
8092         AM_PATH_PYTHON([3.3])
8093         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8094         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8095         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8096         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8097         if test -z "$PKG_CONFIG"; then
8098             PYTHON_CFLAGS="-I$python_include"
8099             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8100         elif $PKG_CONFIG --exists python-$python_version; then
8101             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8102             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8103         else
8104             PYTHON_CFLAGS="-I$python_include"
8105             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8106         fi
8107     else
8108         dnl How to find out the cross-compilation Python installation path?
8109         dnl Let's hardocode what we know for different distributions for now...
8110         for python_version in 2.6; do
8111             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8112                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8113                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8114                 AC_MSG_CHECKING([for python.exe])
8115                 libo_MINGW_CHECK_DLL([libpython$python_version])
8116                 libo_MINGW_CHECK_DLL([libreadline6])
8117                 libo_MINGW_CHECK_DLL([libtermcap])
8118                 # could we somehow extract the really mingw python version from
8119                 # actual distro package?
8120                 # 2.6.2 currently on OpenSUSE 12.1?
8121                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8122                 PYTHON_VERSION=$python_version.2
8123                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8124                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8125                 break
8126             fi
8127         done
8128         AC_MSG_CHECKING([for python version])
8129         AS_IF([test -n "$PYTHON_VERSION"],
8130               [AC_MSG_RESULT([$PYTHON_VERSION])],
8131               [AC_MSG_RESULT([not found])
8132                AC_MSG_ERROR([no usable python found])])
8133         test -n "$PYTHON_CFLAGS" && break
8134     fi
8135     # let the PYTHON_FOR_BUILD match the same python installation that
8136     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8137     # better for PythonTests.
8138     PYTHON_FOR_BUILD=$PYTHON
8141 dnl By now enable_python should be "system", "internal" or "no"
8142 case $enable_python in
8143 system)
8144     SYSTEM_PYTHON=TRUE
8146     if test "$CROSS_COMPILING" != TRUE; then
8147         dnl Check if the headers really work
8148         save_CPPFLAGS="$CPPFLAGS"
8149         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8150         AC_CHECK_HEADER(Python.h, [],
8151            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8152            [])
8153         CPPFLAGS="$save_CPPFLAGS"
8155         AC_LANG_PUSH(C)
8156         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8157         AC_MSG_CHECKING([for correct python library version])
8158            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8159 #include <Python.h>
8161 int main(int argc, char **argv) {
8162        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8163            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8164        else return 1;
8166            ]])],[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])],[])
8167         CFLAGS=$save_CFLAGS
8168         AC_LANG_POP(C)
8170         dnl FIXME Check if the Python library can be linked with, too?
8171     fi
8172     ;;
8174 internal)
8175     SYSTEM_PYTHON=
8176     PYTHON_VERSION_MAJOR=3
8177     PYTHON_VERSION_MINOR=3
8178     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8179     BUILD_TYPE="$BUILD_TYPE PYTHON"
8180     # Embedded Python dies without Home set
8181     if test "$HOME" = ""; then
8182         export HOME=""
8183     fi
8184     # bz2 tarball and bzip2 is not standard
8185     if test -z "$BZIP2"; then
8186         AC_PATH_PROG( BZIP2, bzip2)
8187         if test -z "$BZIP2"; then
8188             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8189         fi
8190     fi
8191     ;;
8193     DISABLE_PYTHON=TRUE
8194     SYSTEM_PYTHON=
8195     ;;
8197     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8198     ;;
8199 esac
8201 AC_SUBST(DISABLE_PYTHON)
8202 AC_SUBST(SYSTEM_PYTHON)
8203 AC_SUBST(PYTHON_CFLAGS)
8204 AC_SUBST(PYTHON_LIBS)
8205 AC_SUBST(PYTHON_VERSION)
8206 AC_SUBST(PYTHON_VERSION_MAJOR)
8207 AC_SUBST(PYTHON_VERSION_MINOR)
8209 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8210 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8211     AC_MSG_RESULT([yes])
8212     ENABLE_MARIADBC=TRUE
8213     MARIADBC_MAJOR=1
8214     MARIADBC_MINOR=0
8215     MARIADBC_MICRO=2
8216     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8217 else
8218     AC_MSG_RESULT([no])
8219     ENABLE_MARIADBC=
8221 AC_SUBST(ENABLE_MARIADBC)
8222 AC_SUBST(MARIADBC_MAJOR)
8223 AC_SUBST(MARIADBC_MINOR)
8224 AC_SUBST(MARIADBC_MICRO)
8226 if test "$ENABLE_MARIADBC" = "TRUE"; then
8228     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8230     dnl ===================================================================
8231     dnl Check for system MariaDB
8232     dnl ===================================================================
8233     AC_MSG_CHECKING([which MariaDB to use])
8234     if test "$with_system_mariadb" = "yes"; then
8235         AC_MSG_RESULT([external])
8236         SYSTEM_MARIADB=TRUE
8237         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8238         if test -z "$MARIADBCONFIG"; then
8239             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8240             if test -z "$MARIADBCONFIG"; then
8241                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8242                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8243             fi
8244         fi
8245         AC_MSG_CHECKING([MariaDB version])
8246         MARIADB_VERSION=`$MARIADBCONFIG --version`
8247         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8248         if test "$MARIADB_MAJOR" -ge "5"; then
8249             AC_MSG_RESULT([OK])
8250         else
8251             AC_MSG_ERROR([too old, use 5.0.x or later])
8252         fi
8253         AC_MSG_CHECKING([for MariaDB Client library])
8254         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8255         if test "$COM_GCC_IS_CLANG" = TRUE; then
8256             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8257         fi
8258         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8259         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8260         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8261         dnl linux32:
8262         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8263             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8264             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8265                 | sed -e 's|/lib64/|/lib/|')
8266         fi
8267         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8268         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8269         if test "$enable_bundle_mariadb" = "yes"; then
8270             AC_MSG_RESULT([yes])
8271             BUNDLE_MARIADB=TRUE
8272             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8273             if test "$_os" = "Darwin"; then
8274                 LIBMARIADB=${LIBMARIADB}.dylib
8275             elif test "$_os" = "WINNT"; then
8276                 LIBMARIADB=${LIBMARIADB}.dll
8277             else
8278                 LIBMARIADB=${LIBMARIADB}.so
8279             fi
8280             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8281             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8282             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8283                 AC_MSG_RESULT([found.])
8284                 PathFormat "$LIBMARIADB_PATH"
8285                 LIBMARIADB_PATH="$formatted_path"
8286             else
8287                 AC_MSG_ERROR([not found.])
8288             fi
8289         else
8290             AC_MSG_RESULT([no])
8291             BUNDLE_MARIADB=
8292         fi
8293     else
8294         AC_MSG_RESULT([internal])
8295         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8296         SYSTEM_MARIADB=
8297         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8298         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8299         BUILD_TYPE="$BUILD_TYPE MARIADB"
8300     fi
8302     AC_SUBST(SYSTEM_MARIADB)
8303     AC_SUBST(MARIADB_CFLAGS)
8304     AC_SUBST(MARIADB_LIBS)
8305     AC_SUBST(LIBMARIADB)
8306     AC_SUBST(LIBMARIADB_PATH)
8307     AC_SUBST(BUNDLE_MARIADB)
8309     AC_LANG_PUSH([C++])
8310     dnl ===================================================================
8311     dnl Check for system MySQL C++ Connector
8312     dnl ===================================================================
8313     # FIXME!
8314     # who thought this too-generic cppconn dir was a good idea?
8315     AC_MSG_CHECKING([MySQL Connector/C++])
8316     if test "$with_system_mysql_cppconn" = "yes"; then
8317         AC_MSG_RESULT([external])
8318         SYSTEM_MYSQL_CPPCONN=TRUE
8319         AC_LANG_PUSH([C++])
8320         AC_CHECK_HEADER(mysql_driver.h, [],
8321                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8322         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8323                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8324         save_LIBS=$LIBS
8325         LIBS="$LIBS -lmysqlcppconn"
8326         AC_MSG_CHECKING([version])
8327         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8328 #include <mysql_driver.h>
8330 int main(int argc, char **argv) {
8331     sql::Driver *driver;
8332     driver = get_driver_instance();
8333     if (driver->getMajorVersion() > 1 || \
8334        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8335        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8336         return 0;
8337       else
8338         return 1;
8340       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8342         AC_LANG_POP([C++])
8343         LIBS=$save_LIBS
8344     else
8345         AC_MSG_RESULT([internal])
8346         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8347         SYSTEM_MYSQL_CPPCONN=
8348     fi
8349     AC_LANG_POP([C++])
8351 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8353 dnl ===================================================================
8354 dnl Check for system hsqldb
8355 dnl ===================================================================
8356 if test "$with_java" != "no"; then
8357 HSQLDB_USE_JDBC_4_1=
8358 AC_MSG_CHECKING([which hsqldb to use])
8359 if test "$with_system_hsqldb" = "yes"; then
8360     AC_MSG_RESULT([external])
8361     SYSTEM_HSQLDB=TRUE
8362     if test -z $HSQLDB_JAR; then
8363         HSQLDB_JAR=/usr/share/java/hsqldb.jar
8364     fi
8365     AC_CHECK_FILE($HSQLDB_JAR, [],
8366                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8367     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8368     export HSQLDB_JAR
8369     if $PERL -e 'use Archive::Zip;
8370             my $file = "$ENV{'HSQLDB_JAR'}";
8371             my $zip = Archive::Zip->new( $file );
8372             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8373             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
8374                push @l, split(/\n/, $mf);
8375                foreach my $line (@l) {
8376                   if ($line =~ m/Specification-Version:/) {
8377                       ($t, $version) = split (/:/,$line);
8378                       $version =~ s/^\s//;
8379                       ($a, $b, $c, $d) = split (/\./,$version);
8380                       if ($c == "0" && $d > "8")  {
8381                           exit 0;
8382                       } else {
8383                           exit 1;
8384                       }
8385                   }
8386                }
8387             } else {
8388                 exit 1;
8389             }'; then
8390         AC_MSG_RESULT([yes])
8391     else
8392         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8393     fi
8394 else
8395     AC_MSG_RESULT([internal])
8396     SYSTEM_HSQLDB=
8397     BUILD_TYPE="$BUILD_TYPE HSQLDB"
8398     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8399     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8400     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8401         AC_MSG_RESULT([yes])
8402         HSQLDB_USE_JDBC_4_1=TRUE
8403     else
8404         AC_MSG_RESULT([no])
8405     fi
8407 AC_SUBST(SYSTEM_HSQLDB)
8408 AC_SUBST(HSQLDB_JAR)
8409 AC_SUBST([HSQLDB_USE_JDBC_4_1])
8412 dnl ===================================================================
8413 dnl Check for PostgreSQL stuff
8414 dnl ===================================================================
8415 if test "x$enable_postgresql_sdbc" != "xno"; then
8416     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8418     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8419         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8420     fi
8421     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8422         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8423     fi
8425     AC_MSG_CHECKING([PostgreSQL C interface])
8426     if test "$with_system_postgresql" = "yes"; then
8427         AC_MSG_RESULT([external PostgreSQL])
8428         SYSTEM_POSTGRESQL=TRUE
8429         if test "$_os" = Darwin; then
8430             supp_path=''
8431             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8432                 pg_supp_path="$P_SEP$d$pg_supp_path"
8433             done
8434         fi
8435         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8436         if test -z "$PGCONFIG"; then
8437             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8438         fi
8439         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8440         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8441     else
8442         # if/when anything else than PostgreSQL uses Kerberos,
8443         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8444         WITH_KRB5=
8445         WITH_GSSAPI=
8446         case "$_os" in
8447         Darwin)
8448             # MacOS X has system MIT Kerberos 5 since 10.4
8449             if test "$with_krb5" != "no"; then
8450                 WITH_KRB5=TRUE
8451                 save_LIBS=$LIBS
8452                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8453                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8454                 KRB5_LIBS=$LIBS
8455                 LIBS=$save_LIBS
8456                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8457                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8458                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8459                 LIBS=$save_LIBS
8460             fi
8461             if test "$with_gssapi" != "no"; then
8462               WITH_GSSAPI=TRUE
8463               save_LIBS=$LIBS
8464               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8465                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8466               GSSAPI_LIBS=$LIBS
8467               LIBS=$save_LIBS
8468             fi
8469             ;;
8470         WINNT)
8471             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8472                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8473             fi
8474             ;;
8475         Linux|GNU|*BSD|DragonFly)
8476             if test "$with_krb5" != "no"; then
8477                 WITH_KRB5=TRUE
8478                 save_LIBS=$LIBS
8479                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8480                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8481                 KRB5_LIBS=$LIBS
8482                 LIBS=$save_LIBS
8483                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8484                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8485                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8486                 LIBS=$save_LIBS
8487             fi
8488             if test "$with_gssapi" != "no"; then
8489                 WITH_GSSAPI=TRUE
8490                 save_LIBS=$LIBS
8491                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8492                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8493                 GSSAPI_LIBS=$LIBS
8494                 LIBS=$save_LIBS
8495             fi
8496             ;;
8497         *)
8498             if test "$with_krb5" = "yes"; then
8499                 WITH_KRB5=TRUE
8500                 save_LIBS=$LIBS
8501                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8502                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8503                 KRB5_LIBS=$LIBS
8504                 LIBS=$save_LIBS
8505                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8506                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8507                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8508                 LIBS=$save_LIBS
8509             fi
8510             if test "$with_gssapi" = "yes"; then
8511                 WITH_GSSAPI=TRUE
8512                 save_LIBS=$LIBS
8513                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8514                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8515                 LIBS=$save_LIBS
8516                 GSSAPI_LIBS=$LIBS
8517             fi
8518         esac
8520         if test -n "$with_libpq_path"; then
8521             SYSTEM_POSTGRESQL=TRUE
8522             AC_MSG_RESULT([external libpq])
8523             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8524             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8525         else
8526             SYSTEM_POSTGRESQL=
8527             AC_MSG_RESULT([internal])
8528             POSTGRESQL_LIB=""
8529             POSTGRESQL_INC="%OVERRIDE_ME%"
8530             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8531         fi
8532     fi
8533     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8534         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8535         save_CFLAGS=$CFLAGS
8536         save_CPPFLAGS=$CPPFLAGS
8537         save_LIBS=$LIBS
8538         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8539         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8540         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8541         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8542             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8543         CFLAGS=$save_CFLAGS
8544         CPPFLAGS=$save_CPPFLAGS
8545         LIBS=$save_LIBS
8546     fi
8547     BUILD_POSTGRESQL_SDBC=TRUE
8549 AC_SUBST(WITH_KRB5)
8550 AC_SUBST(WITH_GSSAPI)
8551 AC_SUBST(GSSAPI_LIBS)
8552 AC_SUBST(KRB5_LIBS)
8553 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8554 AC_SUBST(SYSTEM_POSTGRESQL)
8555 AC_SUBST(POSTGRESQL_INC)
8556 AC_SUBST(POSTGRESQL_LIB)
8558 dnl ===================================================================
8559 dnl Check for Firebird stuff
8560 dnl ===================================================================
8561 ENABLE_FIREBIRD_SDBC=""
8562 if test "x$enable_firebird_sdbc" = "xyes"; then
8563     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8565     dnl ===================================================================
8566     dnl Check for system Firebird
8567     dnl ===================================================================
8568     AC_MSG_CHECKING([which Firebird to use])
8569     if test "$with_system_firebird" = "yes"; then
8570         AC_MSG_RESULT([external])
8571         SYSTEM_FIREBIRD=TRUE
8572         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8573         if test -z "$FIREBIRDCONFIG"; then
8574             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8575             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8576             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8577         else
8578             AC_MSG_NOTICE([fb_config found])
8579             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8580             AC_MSG_CHECKING([for Firebird Client library])
8581             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8582             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8583         fi
8584         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8585         AC_MSG_CHECKING([Firebird version])
8586         if test -n "${FIREBIRD_VERSION}"; then
8587             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8588             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8589             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8590                 AC_MSG_RESULT([OK])
8591             else
8592                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8593             fi
8594         else
8595             __save_CFLAGS="${CFLAGS}"
8596             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8597             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8598 #if defined(FB_API_VER) && FB_API_VER == 25
8599 #else
8600 #error "Wrong Firebird API version"
8601 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8602             CFLAGS="${__save_CFLAGS}"
8603         fi
8604         ENABLE_FIREBIRD_SDBC="TRUE"
8605     elif test "$enable_database_connectivity" != yes; then
8606         AC_MSG_RESULT([none])
8607     elif test "$cross_compiling" = "yes"; then
8608         AC_MSG_RESULT([none])
8609     else
8610         dnl We need libatomic-ops for any non X86/X64 system
8611         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8612             dnl ===================================================================
8613             dnl Check for system libatomic-ops
8614             dnl ===================================================================
8615             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8616             if test "$with_system_libatomic_ops" = "yes"; then
8617                 SYSTEM_LIBATOMIC_OPS=TRUE
8618                 AC_CHECK_HEADERS(atomic_ops.h, [],
8619                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8620             else
8621                 SYSTEM_LIBATOMIC_OPS=
8622                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8623                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8624                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8625             fi
8626         fi
8628         AC_MSG_RESULT([internal])
8629         SYSTEM_FIREBIRD=
8630         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8631         FIREBIRD_LIBS="-lfbembed"
8633         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8634         ENABLE_FIREBIRD_SDBC="TRUE"
8635     fi
8638 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8639 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8640 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8641 AC_SUBST(LIBATOMIC_OPS_LIBS)
8642 AC_SUBST(SYSTEM_FIREBIRD)
8643 AC_SUBST(FIREBIRD_CFLAGS)
8644 AC_SUBST(FIREBIRD_LIBS)
8645 dnl AC_SUBST([TOMMATH_CFLAGS])
8646 dnl AC_SUBST([TOMMATH_LIBS])
8648 dnl ===================================================================
8649 dnl Check for system curl
8650 dnl ===================================================================
8651 AC_MSG_CHECKING([which libcurl to use])
8652 if test "$with_system_curl" = "auto"; then
8653     with_system_curl="$with_system_libs"
8656 if test "$with_system_curl" = "yes"; then
8657     AC_MSG_RESULT([external])
8658     SYSTEM_CURL=TRUE
8660     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8662     # First try PKGCONFIG and then fall back
8663     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8665     if test -n "$CURL_PKG_ERRORS"; then
8666         AC_PATH_PROG(CURLCONFIG, curl-config)
8667         if test -z "$CURLCONFIG"; then
8668             AC_MSG_ERROR([curl developement files not found])
8669         fi
8670         CURL_LIBS=`$CURLCONFIG --libs`
8671         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8672         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8674         case $curl_version in
8675         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8676         dnl so they need to be doubled to end up in the configure script
8677         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8678             ;;
8679         *)
8680             AC_MSG_ERROR([no, you have $curl_version])
8681             ;;
8682         esac
8683     fi
8684     AC_MSG_RESULT([yes])
8686     libo_MINGW_CHECK_DLL([libcurl])
8687     libo_MINGW_TRY_DLL([libintl])
8688     libo_MINGW_TRY_DLL([libidn])
8689     libo_MINGW_TRY_DLL([libnspr4])
8690     libo_MINGW_TRY_DLL([nssutil3])
8691     libo_MINGW_TRY_DLL([libplc4])
8692     libo_MINGW_TRY_DLL([libplds4])
8693     libo_MINGW_TRY_DLL([nss3])
8694     libo_MINGW_TRY_DLL([ssl3])
8695     libo_MINGW_TRY_DLL([libgpg-error])
8696     libo_MINGW_TRY_DLL([libgcrypt])
8697     libo_MINGW_TRY_DLL([libssh2])
8698     ENABLE_CURL=TRUE
8699 elif test $_os = iOS; then
8700     # Let's see if we need curl, I think not?
8701     AC_MSG_RESULT([none])
8702     ENABLE_CURL=
8703 else
8704     AC_MSG_RESULT([internal])
8705     SYSTEM_CURL=
8706     BUILD_TYPE="$BUILD_TYPE CURL"
8707     ENABLE_CURL=TRUE
8709 AC_SUBST(SYSTEM_CURL)
8710 AC_SUBST(CURL_CFLAGS)
8711 AC_SUBST(CURL_LIBS)
8712 AC_SUBST(ENABLE_CURL)
8714 dnl ===================================================================
8715 dnl Check for system boost
8716 dnl ===================================================================
8717 AC_MSG_CHECKING([which boost to use])
8718 if test "$with_system_boost" = "yes"; then
8719     AC_MSG_RESULT([external])
8720     SYSTEM_BOOST=TRUE
8721     AX_BOOST_BASE(1.47)
8722     AX_BOOST_DATE_TIME
8723     AX_BOOST_IOSTREAMS
8724     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8725     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8726     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8727         # if not found, try again with 'lib' prefix
8728         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8729     fi
8730     AC_LANG_PUSH([C++])
8731     save_CXXFLAGS=$CXXFLAGS
8732     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8733     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8734        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8735     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8736        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8737     AC_CHECK_HEADER(boost/function.hpp, [],
8738        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8739     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8740     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8741     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8742 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8743     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8744         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8745     else
8746         AC_MSG_RESULT([yes])
8747     fi
8748     CXXFLAGS=$save_CXXFLAGS
8749     AC_LANG_POP([C++])
8750 else
8751     AC_MSG_RESULT([internal])
8752     BUILD_TYPE="$BUILD_TYPE BOOST"
8753     SYSTEM_BOOST=
8755 AC_SUBST(SYSTEM_BOOST)
8757 dnl ===================================================================
8758 dnl Check for system mdds
8759 dnl ===================================================================
8760 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.10.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8762 dnl ===================================================================
8763 dnl Check for system glm
8764 dnl ===================================================================
8765 AC_MSG_CHECKING([which glm to use])
8766 if test "$with_system_glm" = "yes"; then
8767     AC_MSG_RESULT([external])
8768     SYSTEM_GLM=TRUE
8769     AC_LANG_PUSH([C++])
8770     AC_CHECK_HEADER([glm/glm.hpp], [],
8771        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8772     AC_LANG_POP([C++])
8773 else
8774     AC_MSG_RESULT([internal])
8775     BUILD_TYPE="$BUILD_TYPE GLM"
8776     SYSTEM_GLM=
8778 AC_SUBST([SYSTEM_GLM])
8780 dnl ===================================================================
8781 dnl Check for system glew
8782 dnl ===================================================================
8783 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8785 dnl ===================================================================
8786 dnl Check for system vigra
8787 dnl ===================================================================
8788 AC_MSG_CHECKING([which vigra to use])
8789 if test "$with_system_vigra" = "yes"; then
8790     AC_MSG_RESULT([external])
8791     SYSTEM_VIGRA=TRUE
8792     AC_LANG_PUSH([C++])
8793     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8794        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8795     AC_LANG_POP([C++])
8796 else
8797     AC_MSG_RESULT([internal])
8798     BUILD_TYPE="$BUILD_TYPE VIGRA"
8799     SYSTEM_VIGRA=
8801 AC_SUBST(SYSTEM_VIGRA)
8803 dnl ===================================================================
8804 dnl Check for system odbc
8805 dnl ===================================================================
8806 AC_MSG_CHECKING([which odbc headers to use])
8807 if test "$with_system_odbc" = "yes" ; then
8808     AC_MSG_RESULT([external])
8809     SYSTEM_ODBC_HEADERS=TRUE
8811     AC_CHECK_HEADER(sqlext.h, [],
8812       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8813 elif test "$enable_database_connectivity" != yes; then
8814     AC_MSG_RESULT([none])
8815 else
8816     AC_MSG_RESULT([internal])
8817     SYSTEM_ODBC_HEADERS=
8819 AC_SUBST(SYSTEM_ODBC_HEADERS)
8822 dnl ===================================================================
8823 dnl Check for system openldap
8824 dnl ===================================================================
8826 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8827 AC_MSG_CHECKING([which openldap library to use])
8828 if test "$with_system_openldap" = "yes"; then
8829     AC_MSG_RESULT([external])
8830     SYSTEM_OPENLDAP=TRUE
8831     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8832     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8833     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8834 else
8835     AC_MSG_RESULT([internal])
8836     SYSTEM_OPENLDAP=
8837     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8840 AC_SUBST(SYSTEM_OPENLDAP)
8842 dnl ===================================================================
8843 dnl Check for mozilla ab connectivity for windows
8844 dnl ===================================================================
8846 if test "$_os" = "WINNT"; then
8847     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8848     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8849         WITH_MOZAB4WIN=TRUE
8850         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8851         BUILD_TYPE="$BUILD_TYPE MOZ"
8852         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8853         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8854         for dll in $MSVC80_DLLS; do
8855             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8856                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8857             fi
8858         done
8859     else
8860         AC_MSG_RESULT([no])
8861         WITH_MOZAB4WIN=
8862     fi
8864 AC_SUBST(WITH_MOZAB4WIN)
8865 AC_SUBST(MSVC80_DLLS)
8866 AC_SUBST(MSVC80_DLL_PATH)
8868 dnl ===================================================================
8869 dnl Check for TLS/SSL and cryptographic implementation to use
8870 dnl ===================================================================
8871 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8872 if test -n "$with_tls"; then
8873     case $with_tls in
8874     openssl)
8875         AC_DEFINE(USE_TLS_OPENSSL)
8876         TLS=OPENSSL
8878         if test "$enable_openssl" != "yes"; then
8879             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8880         fi
8882         # warn that OpenSSL has been selected but not all TLS code has this option
8883         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8884         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8885         ;;
8886     nss)
8887         AC_DEFINE(USE_TLS_NSS)
8888         TLS=NSS
8889         ;;
8890     *)
8891         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8892 openssl - OpenSSL
8893 nss - Mozilla's Network Security Services (NSS)
8894     ])
8895         ;;
8896     esac
8897 elif test $_os = iOS -o $_os = Android; then
8898     # We don't build NSS for iOS and Android
8899     AC_DEFINE(USE_TLS_OPENSSL)
8900     TLS=OPENSSL
8901 else
8902     # default to using NSS, it results in smaller oox lib
8903     AC_DEFINE(USE_TLS_NSS)
8904     TLS=NSS
8906 AC_MSG_RESULT([$TLS])
8907 AC_SUBST(TLS)
8909 dnl ===================================================================
8910 dnl Check for system NSS
8911 dnl ===================================================================
8912 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8913 if test "$with_system_nss" = "yes"; then
8914     libo_MINGW_CHECK_DLL([libnspr4])
8915     libo_MINGW_CHECK_DLL([libplc4])
8916     libo_MINGW_CHECK_DLL([libplds4])
8917     libo_MINGW_CHECK_DLL([nss3])
8918     libo_MINGW_CHECK_DLL([nssutil3])
8919     libo_MINGW_CHECK_DLL([smime3])
8920     libo_MINGW_CHECK_DLL([ssl3])
8923 dnl ===================================================================
8924 dnl Check for system mozilla headers
8925 dnl ===================================================================
8926 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8927 AC_MSG_CHECKING([which NPAPI headers to use])
8929 if test "$with_system_npapi_headers" = "yes"; then
8930     AC_MSG_RESULT([external])
8931     SYSTEM_NPAPI_HEADERS=TRUE
8932     # First try npapi-sdk:
8933     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8934     # Then go with libxul:
8935     if test "x$LOCATED" != "xyes"; then
8936         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8937     fi
8938     if test "x$LOCATED" != "xyes"; then
8939         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8940     fi
8941     # if still not found bail out
8942     if test "x$LOCATED" != "xyes"; then
8943         AC_MSG_ERROR([npapi.h header file not found])
8944     fi
8946     AC_LANG_PUSH([C])
8947     save_CFLAGS=$CFLAGS
8948     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8949     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8950     AC_COMPILE_IFELSE(
8951         [AC_LANG_SOURCE([[
8952             #define XP_UNIX
8953             #include <npapi.h>
8954             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8955             ]])],
8956         [AC_MSG_RESULT([const char*])],
8957         [
8958         AC_MSG_RESULT([char*])
8959         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8960         ])
8961     CFLAGS=$save_CFLAGS
8962     AC_LANG_POP([C])
8963     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8964 else
8965     AC_MSG_RESULT([internal])
8966         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8967         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
8968     SYSTEM_NPAPI_HEADERS=
8970 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8971 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8972 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8974 dnl ===================================================================
8975 dnl Check for system sane
8976 dnl ===================================================================
8977 AC_MSG_CHECKING([which sane header to use])
8978 if test "$with_system_sane" = "yes"; then
8979     AC_MSG_RESULT([external])
8980     AC_CHECK_HEADER(sane/sane.h, [],
8981       [AC_MSG_ERROR(sane not found. install sane)], [])
8982 else
8983     AC_MSG_RESULT([internal])
8984     BUILD_TYPE="$BUILD_TYPE SANE"
8987 dnl ===================================================================
8988 dnl Check for system icu
8989 dnl ===================================================================
8990 SYSTEM_GENBRK=
8991 SYSTEM_GENCCODE=
8992 SYSTEM_GENCMN=
8994 ICU_MAJOR=53
8995 ICU_MINOR=1
8996 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8997 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8998 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8999 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9000 AC_MSG_CHECKING([which icu to use])
9001 if test "$with_system_icu" = "yes"; then
9002     AC_MSG_RESULT([external])
9003     SYSTEM_ICU=TRUE
9004     AC_LANG_PUSH([C++])
9005     AC_MSG_CHECKING([for unicode/rbbi.h])
9006     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9007     AC_LANG_POP([C++])
9009     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9010         ICUPATH="$PATH"
9011         if test "$WITH_MINGW" = "yes"; then
9012             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9013         fi
9014         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9016         AC_MSG_CHECKING([ICU version])
9017         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9018         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9019         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9021         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
9022             AC_MSG_RESULT([OK, $ICU_VERSION])
9023         else
9024             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
9025         fi
9026     fi
9028     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9029         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9030         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9031         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9032         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9033         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9034         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9035             AC_MSG_RESULT([yes])
9036         else
9037             AC_MSG_RESULT([no])
9038             if test "$with_system_icu_for_build" != "force"; then
9039                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9040 You can use --with-system-icu-for-build=force to use it anyway.])
9041             fi
9042         fi
9043     fi
9045     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9046         # using the system icu tools can lead to version confusion, use the
9047         # ones from the build environment when cross-compiling
9048         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9049         if test -z "$SYSTEM_GENBRK"; then
9050             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9051         fi
9052         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9053         if test -z "$SYSTEM_GENCCODE"; then
9054             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9055         fi
9056         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9057         if test -z "$SYSTEM_GENCMN"; then
9058             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9059         fi
9060         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
9061             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
9062         else
9063             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
9064         fi
9065         if test "$ICU_MAJOR" -ge "49"; then
9066             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9067             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9068             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9069         else
9070             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9071             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9072             ICU_RECLASSIFIED_HEBREW_LETTER=
9073         fi
9074     fi
9076     if test "$cross_compiling" = "yes"; then
9077        if test "$ICU_MAJOR" -ge "50"; then
9078             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9079             ICU_MINOR=""
9080        fi
9081     fi
9083     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9084     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9085     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9086 else
9087     AC_MSG_RESULT([internal])
9088     SYSTEM_ICU=
9089     BUILD_TYPE="$BUILD_TYPE ICU"
9090     # surprisingly set these only for "internal" (to be used by various other
9091     # external libs): the system icu-config is quite unhelpful and spits out
9092     # dozens of weird flags and also default path -I/usr/include
9093     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9094     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9096 AC_SUBST(SYSTEM_ICU)
9097 AC_SUBST(SYSTEM_GENBRK)
9098 AC_SUBST(SYSTEM_GENCCODE)
9099 AC_SUBST(SYSTEM_GENCMN)
9100 AC_SUBST(ICU_MAJOR)
9101 AC_SUBST(ICU_MINOR)
9102 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9103 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9104 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9105 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9106 AC_SUBST(ICU_CFLAGS)
9107 AC_SUBST(ICU_LIBS)
9109 dnl ===================================================================
9110 dnl Graphite
9111 dnl ===================================================================
9113 AC_MSG_CHECKING([whether to enable graphite support])
9114 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9115     AC_MSG_RESULT([yes])
9116     ENABLE_GRAPHITE="TRUE"
9117     AC_DEFINE(ENABLE_GRAPHITE)
9118     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9119     if test "$with_system_graphite" = "yes"; then
9120         libo_MINGW_CHECK_DLL([libgraphite2])
9121     fi
9122 else
9123     AC_MSG_RESULT([no])
9125 AC_SUBST(ENABLE_GRAPHITE)
9127 dnl ===================================================================
9128 dnl Orcus
9129 dnl ===================================================================
9131 AC_MSG_CHECKING([whether to enable orcus])
9132 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9133     AC_MSG_RESULT([yes])
9134     ENABLE_ORCUS="TRUE"
9135     AC_DEFINE(ENABLE_ORCUS)
9137     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
9138     if test "$with_system_orcus" != "yes"; then
9139         if test "$SYSTEM_BOOST" = "TRUE"; then
9140             # ===========================================================
9141             # Determine if we are going to need to link with Boost.System
9142             # ===========================================================
9143             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9144             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9145             dnl in documentation has no effect.
9146             AC_MSG_CHECKING([if we need to link with Boost.System])
9147             AC_LANG_PUSH([C++])
9148             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9149                     @%:@include <boost/version.hpp>
9150                 ]],[[
9151                     #if BOOST_VERSION >= 105000
9152                     #   error yes, we need to link with Boost.System
9153                     #endif
9154                 ]])],[
9155                     AC_MSG_RESULT([no])
9156                 ],[
9157                     AC_MSG_RESULT([yes])
9158                     AX_BOOST_SYSTEM
9159             ])
9160             AC_LANG_POP([C++])
9161         fi
9162     fi
9163     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9164     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9165     AC_SUBST([BOOST_SYSTEM_LIB])
9166     AC_SUBST(SYSTEM_LIBORCUS)
9168 else
9169     AC_MSG_RESULT([no])
9171 AC_SUBST(ENABLE_ORCUS)
9173 dnl ===================================================================
9174 dnl HarfBuzz
9175 dnl ===================================================================
9176 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9177 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9178     AC_MSG_RESULT([yes])
9179     ENABLE_HARFBUZZ="TRUE"
9180     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9181         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"])
9182     else
9183         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9184     fi
9185 else
9186     AC_MSG_RESULT([no])
9188 AC_SUBST(ENABLE_HARFBUZZ)
9190 dnl ===================================================================
9191 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9192 dnl ===================================================================
9193 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9194 # Obviously no such thing on iOS or Android. Also not possible when building
9195 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9196 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9197         "$enable_headless" != yes -a "$enable_mpl_subset" != yes
9198 then
9199     AC_MSG_RESULT([yes])
9200     ENABLE_NPAPI_FROM_BROWSER=TRUE
9201 else
9202     AC_MSG_RESULT([no])
9203     ENABLE_NPAPI_FROM_BROWSER=
9205 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9207 dnl ===================================================================
9208 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9209 dnl ===================================================================
9210 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9211 if test "$enable_mpl_subset" != yes -a \( "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9212         "$enable_headless" != yes -a "$enable_gtk" != no \)
9213 then
9214     AC_MSG_RESULT([yes])
9215     ENABLE_NPAPI_INTO_BROWSER=TRUE
9216 else
9217     AC_MSG_RESULT([no])
9218     ENABLE_NPAPI_INTO_BROWSER=
9220 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9222 AC_MSG_CHECKING([whether to use X11])
9223 dnl ***************************************
9224 dnl testing for X libraries and includes...
9225 dnl ***************************************
9226 WANT_X11="no"
9227 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9228     WANT_X11="yes"
9229     AC_DEFINE(HAVE_FEATURE_X11)
9231 AC_MSG_RESULT([$WANT_X11])
9233 if test "$WANT_X11" = "yes"; then
9234     AC_PATH_X
9235     AC_PATH_XTRA
9236     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9238     if test -z "$x_includes"; then
9239         x_includes="default_x_includes"
9240     fi
9241     if test -z "$x_libraries"; then
9242         x_libraries="default_x_libraries"
9243     fi
9244     CFLAGS="$CFLAGS $X_CFLAGS"
9245     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9246     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9247 else
9248     x_includes="no_x_includes"
9249     x_libraries="no_x_libraries"
9252 if test "$WANT_X11" = "yes"; then
9253     dnl ===================================================================
9254     dnl Check for Composite.h for Mozilla plugin
9255     dnl ===================================================================
9256     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9257      [#include <X11/Intrinsic.h>])
9259     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9260     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9261         [AC_MSG_ERROR(Xt library not found)])
9263     dnl ===================================================================
9264     dnl Check for extension headers
9265     dnl ===================================================================
9266     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9267      [#include <X11/extensions/shape.h>])
9269     # vcl needs ICE and SM
9270     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9271     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9272         [AC_MSG_ERROR(ICE library not found)])
9273     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9274     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9275         [AC_MSG_ERROR(SM library not found)])
9278 dnl ===================================================================
9279 dnl Check for system Xrender
9280 dnl ===================================================================
9281 AC_MSG_CHECKING([whether to use Xrender])
9282 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9283     AC_MSG_RESULT([yes])
9284     PKG_CHECK_MODULES(XRENDER, xrender)
9285     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9286     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9287       [AC_MSG_ERROR(libXrender not found or functional)], [])
9288     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9289       [AC_MSG_ERROR(Xrender not found. install X)], [])
9290 else
9291     AC_MSG_RESULT([no])
9293 AC_SUBST(XRENDER_CFLAGS)
9294 AC_SUBST(XRENDER_LIBS)
9296 dnl ===================================================================
9297 dnl Check for XRandr
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([whether to enable RandR support])
9300 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9301     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9302         XRANDR_DLOPEN="TRUE"
9303         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9304     else
9305         AC_MSG_RESULT([yes])
9306         XRANDR_DLOPEN="FALSE"
9307         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9308         if test "$ENABLE_RANDR" != "TRUE"; then
9309             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9310                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9311             XRANDR_CFLAGS=" "
9312             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9313               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9314             XRANDR_LIBS="-lXrandr "
9315             ENABLE_RANDR="TRUE"
9316         fi
9317         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9318     fi
9319 else
9320     ENABLE_RANDR=""
9321     AC_MSG_RESULT([no])
9323 AC_SUBST(XRANDR_DLOPEN)
9324 AC_SUBST(XRANDR_CFLAGS)
9325 AC_SUBST(XRANDR_LIBS)
9326 AC_SUBST(ENABLE_RANDR)
9328 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9329     WITH_WEBDAV="serf"
9331 if test $_os = iOS -o $_os = Android; then
9332     WITH_WEBDAV="no"
9334 AC_MSG_CHECKING([for webdav library])
9335 case "$WITH_WEBDAV" in
9336 serf)
9337     AC_MSG_RESULT([serf])
9338     # Check for system apr-util
9339     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9340                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9341                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9342     if test "$COM" = "MSC"; then
9343         APR_LIB_DIR="LibR"
9344         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9345         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9346     fi
9348     # Check for system serf
9349     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9350                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9351     if test "$COM" = "MSC"; then
9352         SERF_LIB_DIR="Release"
9353         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9354         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9355     fi
9356     ;;
9357 neon)
9358     AC_MSG_RESULT([neon])
9359     # Check for system neon
9360     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9361     if test "$with_system_neon" = "yes"; then
9362         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9363         libo_MINGW_CHECK_DLL([libneon])
9364         libo_MINGW_TRY_DLL([libtasn1])
9365         libo_MINGW_TRY_DLL([libgnutls])
9366     else
9367         NEON_VERSION=0295
9368     fi
9369     AC_SUBST(NEON_VERSION)
9370     ;;
9372     AC_MSG_RESULT([none, disabled])
9373     WITH_WEBDAV=""
9374     ;;
9375 esac
9376 AC_SUBST(WITH_WEBDAV)
9378 dnl ===================================================================
9379 dnl Check for disabling cve_tests
9380 dnl ===================================================================
9381 AC_MSG_CHECKING([whether to execute CVE tests])
9382 if test "$enable_cve_tests" = "no"; then
9383     AC_MSG_RESULT([no])
9384     DISABLE_CVE_TESTS=TRUE
9385     AC_SUBST(DISABLE_CVE_TESTS)
9386 else
9387     AC_MSG_RESULT([yes])
9390 dnl ===================================================================
9391 dnl Check for enabling chart XShape tests
9392 dnl ===================================================================
9393 AC_MSG_CHECKING([whether to execute chart XShape tests])
9394 if test "$enable_chart_tests" = "yes"; then
9395     AC_MSG_RESULT([yes])
9396     ENABLE_CHART_TESTS=TRUE
9397     AC_SUBST(ENABLE_CHART_TESTS)
9398 else
9399     AC_MSG_RESULT([no])
9402 dnl ===================================================================
9403 dnl Check for system openssl
9404 dnl ===================================================================
9405 DISABLE_OPENSSL=
9406 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9407 if test "$enable_openssl" = "yes"; then
9408     AC_MSG_RESULT([no])
9409     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9410         # OpenSSL is deprecated when building for 10.7 or later.
9411         #
9412         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9413         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9415         with_system_openssl=no
9416         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9417     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9418             && test "$with_system_openssl" != "no"; then
9419         with_system_openssl=yes
9420         SYSTEM_OPENSSL=TRUE
9421         OPENSSL_CFLAGS=
9422         OPENSSL_LIBS="-lssl -lcrypto"
9423     else
9424         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9425     fi
9426     if test "$with_system_openssl" = "yes"; then
9427         libo_MINGW_CHECK_DLL([libssl])
9428         libo_MINGW_CHECK_DLL([libcrypto])
9429         AC_MSG_CHECKING([whether openssl supports SHA512])
9430         AC_LANG_PUSH([C])
9431         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9432             SHA512_CTX context;
9433 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9434         AC_LANG_POP(C)
9435     fi
9436 else
9437     AC_MSG_RESULT([yes])
9438     DISABLE_OPENSSL=TRUE
9440     # warn that although OpenSSL is disabled, system libraries may be depending on it
9441     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9442     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9445 AC_SUBST([DISABLE_OPENSSL])
9447 dnl ===================================================================
9448 dnl Check for building gnutls
9449 dnl ===================================================================
9450 AC_MSG_CHECKING([whether to use gnutls])
9451 if test "$WITH_WEBDAV" = "neon" && test "$enable_openssl" = "no"; then
9452     AC_MSG_RESULT([yes])
9453     AM_PATH_LIBGCRYPT()
9454     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9455         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9456                       available in the system to use as replacement.]]))
9459 AC_SUBST([LIBGCRYPT_CFLAGS])
9460 AC_SUBST([LIBGCRYPT_LIBS])
9462 dnl ===================================================================
9463 dnl Check for system redland
9464 dnl ===================================================================
9465 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9466 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9467 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9468 if test "$with_system_redland" = "yes"; then
9469     libo_MINGW_CHECK_DLL([librdf])
9470     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9471             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9472     libo_MINGW_TRY_DLL([libraptor])
9473     libo_MINGW_TRY_DLL([librasqal])
9474     libo_MINGW_TRY_DLL([libsqlite3])
9475 else
9476     RAPTOR_MAJOR="0"
9477     RASQAL_MAJOR="3"
9478     REDLAND_MAJOR="0"
9480 AC_SUBST(RAPTOR_MAJOR)
9481 AC_SUBST(RASQAL_MAJOR)
9482 AC_SUBST(REDLAND_MAJOR)
9484 dnl ===================================================================
9485 dnl Check for system hunspell
9486 dnl ===================================================================
9487 AC_MSG_CHECKING([which libhunspell to use])
9488 if test "$with_system_hunspell" = "yes"; then
9489     AC_MSG_RESULT([external])
9490     SYSTEM_HUNSPELL=TRUE
9491     AC_LANG_PUSH([C++])
9492     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9493     if test "$HUNSPELL_PC" != "TRUE"; then
9494         AC_CHECK_HEADER(hunspell.hxx, [],
9495             [
9496             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9497             [AC_MSG_ERROR(hunspell headers not found.)], [])
9498             ], [])
9499         AC_CHECK_LIB([hunspell], [main], [:],
9500            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9501         HUNSPELL_LIBS=-lhunspell
9502     fi
9503     AC_LANG_POP([C++])
9504     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9505     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9506 else
9507     AC_MSG_RESULT([internal])
9508     SYSTEM_HUNSPELL=
9509     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9510     if test "$COM" = "MSC"; then
9511         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9512     else
9513         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9514     fi
9515     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9517 AC_SUBST(SYSTEM_HUNSPELL)
9518 AC_SUBST(HUNSPELL_CFLAGS)
9519 AC_SUBST(HUNSPELL_LIBS)
9521 dnl ===================================================================
9522 dnl Checking for altlinuxhyph
9523 dnl ===================================================================
9524 AC_MSG_CHECKING([which altlinuxhyph to use])
9525 if test "$with_system_altlinuxhyph" = "yes"; then
9526     AC_MSG_RESULT([external])
9527     SYSTEM_HYPH=TRUE
9528     AC_CHECK_HEADER(hyphen.h, [],
9529        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9530     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9531        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9532        [#include <hyphen.h>])
9533     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9534         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9535     if test -z "$HYPHEN_LIB"; then
9536         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9537            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9538     fi
9539     if test -z "$HYPHEN_LIB"; then
9540         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9541            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9542     fi
9543     libo_MINGW_CHECK_DLL([libhyphen])
9544 else
9545     AC_MSG_RESULT([internal])
9546     SYSTEM_HYPH=
9547     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9548     if test "$COM" = "MSC"; then
9549         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9550     else
9551         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9552     fi
9554 AC_SUBST(SYSTEM_HYPH)
9555 AC_SUBST(HYPHEN_LIB)
9557 dnl ===================================================================
9558 dnl Checking for mythes
9559 dnl ===================================================================
9560 AC_MSG_CHECKING([which mythes to use])
9561 if test "$with_system_mythes" = "yes"; then
9562     AC_MSG_RESULT([external])
9563     SYSTEM_MYTHES=TRUE
9564     AC_LANG_PUSH([C++])
9565     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9566     if test "$MYTHES_PKGCONFIG" = "no"; then
9567         AC_CHECK_HEADER(mythes.hxx, [],
9568             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9569         AC_CHECK_LIB([mythes-1.2], [main], [:],
9570             [ MYTHES_FOUND=no], [])
9571     if test "$MYTHES_FOUND" = "no"; then
9572         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9573                 [ MYTHES_FOUND=no], [])
9574     fi
9575     if test "$MYTHES_FOUND" = "no"; then
9576         AC_MSG_ERROR([mythes library not found!.])
9577     fi
9578     fi
9579     AC_LANG_POP([C++])
9580     libo_MINGW_CHECK_DLL([libmythes-1.2])
9581     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9582 else
9583     AC_MSG_RESULT([internal])
9584     SYSTEM_MYTHES=
9585     BUILD_TYPE="$BUILD_TYPE MYTHES"
9586     if test "$COM" = "MSC"; then
9587         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9588     else
9589         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9590     fi
9592 AC_SUBST(SYSTEM_MYTHES)
9593 AC_SUBST(MYTHES_CFLAGS)
9594 AC_SUBST(MYTHES_LIBS)
9596 dnl ===================================================================
9597 dnl How should we build the linear programming solver ?
9598 dnl ===================================================================
9600 ENABLE_COINMP=
9601 AC_MSG_CHECKING([whether to build with CoinMP])
9602 if test "$enable_coinmp" != "no"; then
9603     ENABLE_COINMP=TRUE
9604     AC_MSG_RESULT([yes])
9605     # Should we check for system CoinMP ? How to do that ?
9606     BUILD_TYPE="$BUILD_TYPE COINMP"
9607 else
9608     AC_MSG_RESULT([no])
9610 AC_SUBST(ENABLE_COINMP)
9612 ENABLE_LPSOLVE=
9613 AC_MSG_CHECKING([whether to build with lpsolve])
9614 if test "$enable_lpsolve" != "no"; then
9615     ENABLE_LPSOLVE=TRUE
9616     AC_MSG_RESULT([yes])
9617 else
9618     AC_MSG_RESULT([no])
9620 AC_SUBST(ENABLE_LPSOLVE)
9622 if test "$ENABLE_LPSOLVE" = TRUE; then
9623     AC_MSG_CHECKING([which lpsolve to use])
9624     if test "$with_system_lpsolve" = "yes"; then
9625         AC_MSG_RESULT([external])
9626         SYSTEM_LPSOLVE=TRUE
9627         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9628            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9629         save_LIBS=$LIBS
9630         # some systems need this. Like Ubuntu....
9631         AC_CHECK_LIB(m, floor)
9632         AC_CHECK_LIB(dl, dlopen)
9633         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9634             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9635         LIBS=$save_LIBS
9636         libo_MINGW_CHECK_DLL([lpsolve55])
9637     else
9638         AC_MSG_RESULT([internal])
9639         SYSTEM_LPSOLVE=
9640         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9641     fi
9643 AC_SUBST(SYSTEM_LPSOLVE)
9645 dnl ===================================================================
9646 dnl Checking for libexttextcat
9647 dnl ===================================================================
9648 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9649 if test "$with_system_libexttextcat" = "yes"; then
9650     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9652 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9654 dnl ***************************************
9655 dnl testing libc version for Linux...
9656 dnl ***************************************
9657 if test "$_os" = "Linux"; then
9658     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9659     exec 6>/dev/null # no output
9660     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9661     exec 6>&1 # output on again
9662     if test "$HAVE_LIBC"; then
9663         AC_MSG_RESULT([yes])
9664     else
9665         AC_MSG_ERROR([no, upgrade libc])
9666     fi
9669 dnl =========================================
9670 dnl Check for the Windows  SDK.
9671 dnl =========================================
9672 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9673 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9674 if test "$_os" = "WINNT"; then
9675     AC_MSG_CHECKING([for Windows SDK])
9676     if test "$build_os" = "cygwin"; then
9677         find_winsdk
9678         WINDOWS_SDK_HOME=$winsdktest
9680         # normalize if found
9681         if test -n "$WINDOWS_SDK_HOME"; then
9682             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9683             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9684         fi
9685     fi
9687     if test -n "$WINDOWS_SDK_HOME"; then
9688         # Remove a possible trailing backslash
9689         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9691         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9692              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9693              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9694             have_windows_sdk_headers=yes
9695         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9696              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9697              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9698             have_windows_sdk_headers=yes
9699         else
9700             have_windows_sdk_headers=no
9701         fi
9703         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9704             have_windows_sdk_libs=yes
9705         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9706             have_windows_sdk_libs=yes
9707         else
9708             have_windows_sdk_libs=no
9709         fi
9711         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9712             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9713 the  Windows SDK are installed.])
9714         fi
9716         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9717              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9718              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9719              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9720         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9721              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9722              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9723              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9724         else
9725             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9726         fi
9727     fi
9729     if test -z "$WINDOWS_SDK_HOME"; then
9730         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9731     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9732         WINDOWS_SDK_VERSION=60
9733         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9734     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9735         WINDOWS_SDK_VERSION=61
9736         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9737     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9738         WINDOWS_SDK_VERSION=70
9739         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9740     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9741         WINDOWS_SDK_VERSION=80
9742         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9743         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9744         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9745             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9746             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9747             add_warning "If a build created with VS 2012 should run on Windows XP,"
9748             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9749         fi
9750     else
9751         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9752     fi
9753     PathFormat "$WINDOWS_SDK_HOME"
9754     WINDOWS_SDK_HOME="$formatted_path"
9755     if test "$build_os" = "cygwin"; then
9756         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9757         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9758             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9759         fi
9760     fi
9762     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9763     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9764     dnl but not in v8.0), so allow this to be overridden with a
9765     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9766     dnl and configuration error if no WiLangId.vbs is found would arguably be
9767     dnl better, but I do not know under which conditions exactly it is needed by
9768     dnl msiglobal.pm:
9769     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9770         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9771         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9772             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9773         fi
9774         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9775             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9776         fi
9777         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9778             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9779             add_warning "WiLangId.vbs not found - building translated packages will fail"
9780         fi
9781     fi
9783 AC_SUBST(WINDOWS_SDK_HOME)
9784 AC_SUBST(WINDOWS_SDK_VERSION)
9785 AC_SUBST(WINDOWS_SDK_WILANGID)
9787 dnl =========================================
9788 dnl Check for uuidgen
9789 dnl =========================================
9790 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9791     if test "$WITH_MINGW" = "yes"; then
9792         AC_PATH_PROG([UUIDGEN], [uuid])
9793         if test -z "$UUIDGEN"; then
9794             AC_MSG_WARN([uuid is needed for dev-install])
9795         fi
9796     else
9797         # presence is already tested above in the WINDOWS_SDK_HOME check
9798         UUIDGEN=uuidgen.exe
9799         AC_SUBST(UUIDGEN)
9800     fi
9801 else
9802     AC_PATH_PROG([UUIDGEN], [uuidgen])
9803     if test -z "$UUIDGEN"; then
9804         AC_MSG_WARN([uuid is needed for dev-install])
9805     fi
9808 dnl =========================================
9809 dnl Check for the Microsoft DirectX SDK.
9810 dnl =========================================
9811 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9812     AC_MSG_CHECKING([for DirectX SDK])
9813     if test "$build_os" = "cygwin"; then
9814         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9815         if test -n "$DXSDK_DIR"; then
9816             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9817             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9818         fi
9819         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9820         # the "DirectX SDK not found" error later.
9821         # (Where?)
9823         # Remove a possible trailing backslash
9824         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9825     fi
9827     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9828         HAVE_DIRECTXSDK_H="yes"
9829     else
9830         HAVE_DIRECTXSDK_H="no"
9831     fi
9833     if test "$BITNESS_OVERRIDE" = 64; then
9834         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9835     else
9836         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9837     fi
9838     PathFormat "$DIRECTXSDK_LIB"
9839     DIRECTXSDK_LIB="$formatted_path"
9841     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9842         HAVE_DIRECTXSDK_LIB="yes"
9843     else
9844         HAVE_DIRECTXSDK_LIB="no"
9845     fi
9847     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9848         AC_MSG_RESULT([found])
9849     else
9850         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9851     fi
9852     if test -n "$DIRECTXSDK_HOME"; then
9853         PathFormat "$DIRECTXSDK_HOME"
9854         DIRECTXSDK_HOME="$formatted_path"
9855         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9856     fi
9858 AC_SUBST(DIRECTXSDK_HOME)
9860 dnl ***************************************
9861 dnl Checking for bison and flex
9862 dnl ***************************************
9863 AC_PATH_PROG(BISON, bison)
9864 if test -z "$BISON"; then
9865     AC_MSG_ERROR([no bison found in \$PATH, install it])
9866 else
9867     AC_MSG_CHECKING([the bison version])
9868     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9869     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9870     # Accept newer than 2.0
9871     if test "$_bison_longver" -lt 2000; then
9872         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9873     fi
9876 AC_PATH_PROG(FLEX, flex)
9877 if test -z "$FLEX"; then
9878     AC_MSG_ERROR([no flex found in \$PATH, install it])
9879 else
9880     AC_MSG_CHECKING([the flex version])
9881     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9882     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9883         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9884     fi
9886 AC_SUBST([FLEX])
9887 dnl ***************************************
9888 dnl Checking for patch
9889 dnl ***************************************
9890 AC_PATH_PROG(PATCH, patch)
9891 if test -z "$PATCH"; then
9892     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9895 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9896 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9897     if test -z "$with_gnu_patch"; then
9898         GNUPATCH=$PATCH
9899     else
9900         if test -x "$with_gnu_patch"; then
9901             GNUPATCH=$with_gnu_patch
9902         else
9903             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9904         fi
9905     fi
9907     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9908     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9909         AC_MSG_RESULT([yes])
9910     else
9911         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9912     fi
9913 else
9914     GNUPATCH=$PATCH
9917 dnl We also need to check for --with-gnu-cp
9919 if test -z "$with_gnu_cp"; then
9920     # check the place where the good stuff is hidden on Solaris...
9921     if test -x /usr/gnu/bin/cp; then
9922         GNUCP=/usr/gnu/bin/cp
9923     else
9924         AC_PATH_PROGS(GNUCP, gnucp cp)
9925     fi
9926     if test -z $GNUCP; then
9927         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9928     fi
9929 else
9930     if test -x "$with_gnu_cp"; then
9931         GNUCP=$with_gnu_cp
9932     else
9933         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9934     fi
9937 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9938 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9939     AC_MSG_RESULT([yes])
9940 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9941     AC_MSG_RESULT([yes])
9942 else
9943     case "$build_os" in
9944     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9945         x_GNUCP=[\#]
9946         GNUCP=''
9947         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9948         ;;
9949     *)
9950         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9951         ;;
9952     esac
9955 AC_SUBST(GNUPATCH)
9956 AC_SUBST(GNUCP)
9957 AC_SUBST(x_GNUCP)
9959 dnl ***************************************
9960 dnl testing assembler path
9961 dnl ***************************************
9962 ML_EXE=""
9963 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9964     if test "$BITNESS_OVERRIDE" = ""; then
9965         assembler=ml.exe
9966         assembler_bin=bin
9967     else
9968         assembler=ml64.exe
9969         assembler_bin=bin/amd64
9970     fi
9972     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9973     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9974         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9975         AC_MSG_RESULT([found])
9976         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9977     else
9978         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9979     fi
9981     PathFormat "$ASM_HOME"
9982     ASM_HOME="$formatted_path"
9983 else
9984     ASM_HOME=""
9987 AC_SUBST(ML_EXE)
9989 dnl ===================================================================
9990 dnl We need zip and unzip
9991 dnl ===================================================================
9992 AC_PATH_PROG(ZIP, zip)
9993 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9994 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9995     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],,)
9998 AC_PATH_PROG(UNZIP, unzip)
9999 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10001 dnl ===================================================================
10002 dnl Zip must be a specific type for different build types.
10003 dnl ===================================================================
10004 if test $build_os = cygwin; then
10005     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10006         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10007     fi
10010 dnl ===================================================================
10011 dnl We need touch with -h option support.
10012 dnl ===================================================================
10013 AC_PATH_PROG(TOUCH, touch)
10014 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10015 touch warn
10016 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10017     AC_MSG_ERROR([touch version with -h option support is required to build, please install it and make sure it is the one found first in PATH],,)
10020 dnl ===================================================================
10021 dnl Test which vclplugs have to be built.
10022 dnl ===================================================================
10023 R=""
10024 GTK3_CFLAGS=""
10025 GTK3_LIBS=""
10026 ENABLE_GTK3=""
10027 if test "x$enable_gtk3" = "xyes"; then
10028     if test "$with_system_cairo" = no; then
10029         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10030     fi
10031     : ${with_system_cairo:=yes}
10032     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="")
10033     if test "x$ENABLE_GTK3" = "xTRUE"; then
10034         R="gtk3"
10035     else
10036         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
10037     fi
10038     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10040 AC_SUBST(GTK3_LIBS)
10041 AC_SUBST(GTK3_CFLAGS)
10042 AC_SUBST(ENABLE_GTK3)
10044 AC_MSG_CHECKING([which VCLplugs shall be built])
10045 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
10046     enable_gtk=no
10048 ENABLE_GTK=""
10049 if test "x$enable_gtk" = "xyes"; then
10050     if test "$with_system_cairo" = no; then
10051         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10052     fi
10053     : ${with_system_cairo:=yes}
10054     ENABLE_GTK="TRUE"
10055     AC_DEFINE(ENABLE_GTK)
10056     R="gtk $R"
10058 AC_SUBST(ENABLE_GTK)
10060 ENABLE_TDE=""
10061 if test "x$enable_tde" = "xyes"; then
10062     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
10063     # are built from the same sources. So we only allow one of them.
10064     if test "x$enable_kde" = "xyes"; then
10065         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
10066     fi
10067     ENABLE_TDE="TRUE"
10068     AC_DEFINE(ENABLE_TDE)
10069     R="$R tde"
10071 AC_SUBST(ENABLE_TDE)
10073 ENABLE_KDE=""
10074 if test "x$enable_kde" = "xyes"; then
10075     ENABLE_KDE="TRUE"
10076     AC_DEFINE(ENABLE_KDE)
10077     R="$R kde"
10079 AC_SUBST(ENABLE_KDE)
10081 ENABLE_KDE4=""
10082 if test "x$enable_kde4" = "xyes"; then
10083     ENABLE_KDE4="TRUE"
10084     AC_DEFINE(ENABLE_KDE4)
10085     R="$R kde4"
10087 AC_SUBST(ENABLE_KDE4)
10089 ENABLE_HEADLESS=""
10090 if test "x$enable_headless" = "xyes"; then
10091     ENABLE_HEADLESS="TRUE"
10092     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10093     R="headless"
10095 AC_SUBST(ENABLE_HEADLESS)
10097 if test -z "$R"; then
10098     AC_MSG_RESULT([none])
10099 else
10100     AC_MSG_RESULT([$R])
10103 dnl ===================================================================
10104 dnl GCONF check
10105 dnl ===================================================================
10107 ENABLE_GCONF=
10108 AC_MSG_CHECKING([whether to enable GConf support])
10109 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
10110     ENABLE_GCONF="TRUE"
10111     AC_MSG_RESULT([yes])
10112     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
10113     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10114 else
10115     AC_MSG_RESULT([no])
10117 AC_SUBST(GCONF_LIBS)
10118 AC_SUBST(GCONF_CFLAGS)
10119 AC_SUBST(ENABLE_GCONF)
10121 dnl ===================================================================
10122 dnl Gnome VFS check
10123 dnl ===================================================================
10125 ENABLE_GNOMEVFS=""
10126 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10127 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10128     ENABLE_GNOMEVFS="TRUE"
10129     AC_MSG_RESULT([yes])
10130     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10131     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10132     AC_DEFINE(ENABLE_GNOME_VFS)
10133 else
10134     AC_MSG_RESULT([no])
10136 AC_SUBST(GNOMEVFS_LIBS)
10137 AC_SUBST(GNOMEVFS_CFLAGS)
10138 AC_SUBST(ENABLE_GNOMEVFS)
10140 dnl ===================================================================
10141 dnl check for dbus support
10142 dnl ===================================================================
10143 ENABLE_DBUS=""
10144 DBUS_CFLAGS=""
10145 DBUS_LIBS=""
10147 if test "$enable_dbus" = "no"; then
10148     test_dbus=no
10151 AC_MSG_CHECKING([whether to enable DBUS support])
10152 if test "$test_dbus" = "yes"; then
10153     ENABLE_DBUS="TRUE"
10154     AC_MSG_RESULT([yes])
10155     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10156     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10157 else
10158     AC_MSG_RESULT([no])
10161 AC_SUBST(ENABLE_DBUS)
10162 AC_SUBST(DBUS_CFLAGS)
10163 AC_SUBST(DBUS_LIBS)
10165 AC_MSG_CHECKING([whether to enable font install via packagekit])
10166 if test "$ENABLE_DBUS" = "TRUE"; then
10167     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10168         ENABLE_PACKAGEKIT=TRUE
10169         AC_MSG_RESULT([yes])
10170     else
10171         ENABLE_PACKAGEKIT=
10172         AC_MSG_RESULT([no])
10173     fi
10174 else
10175     AC_MSG_RESULT([no, dbus disabled.])
10177 AC_SUBST(ENABLE_PACKAGEKIT)
10179 AC_MSG_CHECKING([whether to enable Impress remote control])
10180 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10181     AC_MSG_RESULT([yes])
10182     ENABLE_SDREMOTE=TRUE
10183     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10185     # If not explicitly enabled or disabled, default
10186     if test -z "$enable_sdremote_bluetooth"; then
10187         case "$OS" in
10188         LINUX|MACOSX|WNT)
10189             # Default to yes for these
10190             enable_sdremote_bluetooth=yes
10191             ;;
10192         *)
10193             # otherwise no
10194             enable_sdremote_bluetooth=no
10195             ;;
10196         esac
10197     fi
10198     # $enable_sdremote_bluetooth is guaranteed non-empty now
10200     if test "$enable_sdremote_bluetooth" != "no"; then
10201         if test "$OS" = "LINUX"; then
10202             if test "$ENABLE_DBUS" = "TRUE"; then
10203                 AC_MSG_RESULT([yes])
10204                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10205                 dnl ===================================================================
10206                 dnl Check for system bluez
10207                 dnl ===================================================================
10208                 AC_MSG_CHECKING([which Bluetooth header to use])
10209                 if test "$with_system_bluez" = "yes"; then
10210                     AC_MSG_RESULT([external])
10211                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10212                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10213                     SYSTEM_BLUEZ=TRUE
10214                 else
10215                     AC_MSG_RESULT([internal])
10216                     SYSTEM_BLUEZ=
10217                 fi
10218             else
10219                 AC_MSG_RESULT([no, dbus disabled])
10220                 ENABLE_SDREMOTE_BLUETOOTH=
10221                 SYSTEM_BLUEZ=
10222             fi
10223         else
10224             AC_MSG_RESULT([yes])
10225             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10226             SYSTEM_BLUEZ=
10227         fi
10228     else
10229         AC_MSG_RESULT([no])
10230         ENABLE_SDREMOTE_BLUETOOTH=
10231         SYSTEM_BLUEZ=
10232     fi
10233 else
10234     ENABLE_SDREMOTE=
10235     SYSTEM_BLUEZ=
10236     AC_MSG_RESULT([no])
10238 AC_SUBST(ENABLE_SDREMOTE)
10239 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10240 AC_SUBST(SYSTEM_BLUEZ)
10242 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10243 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10244     AC_MSG_RESULT([yes])
10245     ENABLE_SDREMOTE_ANDROID=TRUE
10246 else
10247     AC_MSG_RESULT([no])
10248     ENABLE_SDREMOTE_ANDROID=
10250 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10252 dnl ===================================================================
10253 dnl Check whether the gtk 2.0 libraries are available.
10254 dnl ===================================================================
10256 GTK_CFLAGS=""
10257 GTK_LIBS=""
10258 ENABLE_SYSTRAY_GTK=""
10259 if test  "$test_gtk" = "yes"; then
10261     if test "$ENABLE_GTK" = "TRUE"; then
10262         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]))
10263         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10264         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]))
10265         BUILD_TYPE="$BUILD_TYPE GTK"
10266         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10268     AC_MSG_CHECKING([whether to enable the systray quickstarter])
10269         if test "x$enable_systray" = "xyes"; then
10270             AC_MSG_RESULT([yes])
10271             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10272                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10273                             [ ENABLE_SYSTRAY_GTK="" ])
10274         else
10275             AC_MSG_RESULT([no])
10276         fi
10278         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10279         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10280                           [ENABLE_GTK_PRINT="TRUE"],
10281                           [ENABLE_GTK_PRINT=""])
10282         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10284         AC_MSG_CHECKING([whether to enable GIO support])
10285         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10286             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10287                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10288             fi
10289             dnl Need at least 2.26 for the dbus support.
10290             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10291                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10292             if test "$ENABLE_GIO" = "TRUE"; then
10293                 AC_DEFINE(ENABLE_GIO)
10294                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10295             fi
10296         else
10297             AC_MSG_RESULT([no])
10298         fi
10299     fi
10301 AC_SUBST(ENABLE_GIO)
10302 AC_SUBST(GIO_CFLAGS)
10303 AC_SUBST(GIO_LIBS)
10304 AC_SUBST(ENABLE_SYSTRAY_GTK)
10305 AC_SUBST(GTK_CFLAGS)
10306 AC_SUBST(GTK_LIBS)
10307 AC_SUBST(GTHREAD_CFLAGS)
10308 AC_SUBST(GTHREAD_LIBS)
10309 AC_SUBST([ENABLE_GTK_PRINT])
10310 AC_SUBST([GTK_PRINT_CFLAGS])
10311 AC_SUBST([GTK_PRINT_LIBS])
10314 dnl ===================================================================
10315 dnl Check whether the Telepathy libraries are available.
10316 dnl ===================================================================
10318 ENABLE_TELEPATHY=""
10319 TELEPATHY_CFLAGS=""
10320 TELEPATHY_LIBS=""
10322 AC_MSG_CHECKING([whether to enable Telepathy support])
10323 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10324     ENABLE_TELEPATHY="TRUE"
10325     AC_DEFINE(ENABLE_TELEPATHY)
10326     AC_MSG_RESULT([yes])
10327     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 )
10328     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10329 else
10330     AC_MSG_RESULT([no])
10333 AC_SUBST(ENABLE_TELEPATHY)
10334 AC_SUBST(TELEPATHY_CFLAGS)
10335 AC_SUBST(TELEPATHY_LIBS)
10338 dnl ===================================================================
10340 SPLIT_APP_MODULES=""
10341 if test "$enable_split_app_modules" = "yes"; then
10342     SPLIT_APP_MODULES="TRUE"
10344 AC_SUBST(SPLIT_APP_MODULES)
10346 SPLIT_OPT_FEATURES=""
10347 if test "$enable_split_opt_features" = "yes"; then
10348     SPLIT_OPT_FEATURES="TRUE"
10350 AC_SUBST(SPLIT_OPT_FEATURES)
10352 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10353     if test "$enable_cairo_canvas" = yes; then
10354         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10355     fi
10356     enable_cairo_canvas=no
10357 elif test -z "$enable_cairo_canvas"; then
10358     enable_cairo_canvas=yes
10361 ENABLE_CAIRO_CANVAS=""
10362 if test "$enable_cairo_canvas" = "yes"; then
10363     test_cairo=yes
10364     ENABLE_CAIRO_CANVAS="TRUE"
10366 AC_SUBST(ENABLE_CAIRO_CANVAS)
10368 dnl ===================================================================
10369 dnl Check whether the GStreamer libraries are available.
10370 dnl ===================================================================
10372 ENABLE_GSTREAMER=""
10374 if test "$build_gstreamer" = "yes"; then
10376     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10377     if test "$enable_avmedia" = yes -a "$enable_gstreamer" != no; then
10378         ENABLE_GSTREAMER="TRUE"
10379         AC_MSG_RESULT([yes])
10380         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10381         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10382     else
10383         AC_MSG_RESULT([no])
10384     fi
10386 AC_SUBST(GSTREAMER_CFLAGS)
10387 AC_SUBST(GSTREAMER_LIBS)
10388 AC_SUBST(ENABLE_GSTREAMER)
10391 ENABLE_GSTREAMER_0_10=""
10392 if test "$build_gstreamer_0_10" = "yes"; then
10394     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10395     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10396         ENABLE_GSTREAMER_0_10="TRUE"
10397         AC_MSG_RESULT([yes])
10398         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10399             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10400         ])
10401         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10402     else
10403         AC_MSG_RESULT([no])
10404     fi
10407 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10408 AC_SUBST(GSTREAMER_0_10_LIBS)
10409 AC_SUBST(ENABLE_GSTREAMER_0_10)
10411 dnl ===================================================================
10412 dnl Check whether to build the VLC avmedia backend
10413 dnl ===================================================================
10415 ENABLE_VLC=""
10417 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10418 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10419     ENABLE_VLC="TRUE"
10420     AC_MSG_RESULT([yes])
10421 else
10422     AC_MSG_RESULT([no])
10424 AC_SUBST(ENABLE_VLC)
10426 dnl ===================================================================
10427 dnl Check whether the OpenGL libraries are available
10428 dnl ===================================================================
10430 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10431 ENABLE_OPENGL=
10433 if test -z "$enable_opengl"; then
10434     if test $_os = WINNT; then
10435         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10436         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10437         # code for Windows.
10438         enable_opengl=no
10439     elif test $_os = iOS; then
10440         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10441         # build fine for iOS, too, but let's leave that for later
10442         enable_opengl=no
10443     elif test "$enable_headless" = "yes"; then
10444         enable_opengl=no
10445     else
10446         enable_opengl=yes
10447     fi
10450 if test "x$enable_opengl" = "xno"; then
10451     AC_MSG_RESULT([no])
10452 elif test "$_os" = "Darwin"; then
10453     # We use frameworks on Mac OS X, no need for detail checks
10454     ENABLE_OPENGL=TRUE
10455     ENABLE_OPENGL_CANVAS=
10456     add_warning "openGL canvas not adapted for Mac yet - disabling"
10457     SYSTEM_MESA_HEADERS=TRUE
10458     AC_MSG_RESULT([yes])
10459 elif test $_os = WINNT; then
10460     # Experimental: try to use OpenGL on Windows
10461     ENABLE_OPENGL=TRUE
10462     ENABLE_OPENGL_CANVAS=TRUE
10463     # We need the internal "Mesa" headers.
10464     SYSTEM_MESA_HEADERS=
10465     BUILD_TYPE="$BUILD_TYPE MESA"
10466     AC_MSG_RESULT([yes])
10467 else
10468     save_LDFLAGS=$LDFLAGS
10469     LDFLAGS="$LDFLAGS -lm"
10470     AC_MSG_RESULT([yes])
10471     AC_CHECK_LIB([GL], [main],
10472         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10473             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10474              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10475              ENABLE_OPENGL_CANVAS=], [])],
10476         [AC_MSG_ERROR(libGL not installed or functional)], [])
10477     LDFLAGS="$LDFLAGS -lGL"
10478     AC_CHECK_LIB([GLU], [main], [:],
10479               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10480     ENABLE_OPENGL=TRUE
10481     LDFLAGS=$save_LDFLAGS
10483     dnl ===================================================================
10484     dnl Check for system Mesa
10485     dnl ===================================================================
10486     AC_MSG_CHECKING([which Mesa headers to use])
10487     if test "$with_system_mesa_headers" = "yes"; then
10488         AC_MSG_RESULT([external])
10489         SYSTEM_MESA_HEADERS=TRUE
10490         AC_LANG_PUSH(C)
10491         AC_CHECK_HEADER(GL/glxext.h, [],
10492            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10493         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10494         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10495         AC_LANG_POP(C)
10496     else
10497         AC_MSG_RESULT([internal])
10498         SYSTEM_MESA_HEADERS=
10499         BUILD_TYPE="$BUILD_TYPE MESA"
10500     fi
10503 AC_SUBST(SYSTEM_MESA_HEADERS)
10504 AC_SUBST(ENABLE_OPENGL)
10505 AC_SUBST(ENABLE_OPENGL_CANVAS)
10507 dnl =================================================
10508 dnl Check whether to build with OpenCL support.
10509 dnl =================================================
10511 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10512 ENABLE_OPENCL=
10514 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10515     if test $_os = Darwin -a "$with_macosx_sdk" = "10.5"; then
10516         AC_MSG_RESULT([disabled on OS X 10.5])
10517     else
10518         AC_MSG_RESULT([yes])
10519         ENABLE_OPENCL=TRUE
10520         AC_DEFINE(HAVE_FEATURE_OPENCL)
10521     fi
10522 else
10523     AC_MSG_RESULT([no])
10526 AC_SUBST(ENABLE_OPENCL)
10528 dnl ===================================================================
10529 dnl Check whether to enable glTF support
10530 dnl ===================================================================
10531 AC_MSG_CHECKING([whether to enable glTF support])
10532 ENABLE_GLTF=
10533 if test "x$enable_gltf" != "xno" -a $_os != Darwin -a $_os != iOS -a $_os != Android; then
10534     ENABLE_GLTF=TRUE
10535     AC_MSG_RESULT([yes])
10536     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10537     BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10538     # otherwise build fails in collada2gltf external because of std::shared_ptr
10539     if test "$have_std_shared_ptr" = "yes"; then
10540         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10541     fi
10542 else
10543     AC_MSG_RESULT([no])
10545 AC_SUBST(ENABLE_GLTF)
10547 # pdf import?
10548 AC_MSG_CHECKING([whether to build the PDF import feature])
10549 ENABLE_PDFIMPORT=
10550 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10551     AC_MSG_RESULT([yes])
10552     ENABLE_PDFIMPORT=TRUE
10554     dnl ===================================================================
10555     dnl Check for system poppler
10556     dnl ===================================================================
10557     AC_MSG_CHECKING([which PDF import backend to use])
10558     if test "$with_system_poppler" = "yes"; then
10559         AC_MSG_RESULT([external])
10560         SYSTEM_POPPLER=TRUE
10561         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10562         AC_LANG_PUSH([C++])
10563         save_CXXFLAGS=$CXXFLAGS
10564         save_CPPFLAGS=$CPPFLAGS
10565         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10566         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10567         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10568                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10569         CXXFLAGS=$save_CXXFLAGS
10570         CPPFLAGS=$save_CPPFLAGS
10571         AC_LANG_POP([C++])
10572         libo_MINGW_CHECK_DLL([libpoppler])
10573         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10574     else
10575         AC_MSG_RESULT([internal])
10576         SYSTEM_POPPLER=
10577         BUILD_TYPE="$BUILD_TYPE POPPLER"
10578     fi
10579 else
10580     AC_MSG_RESULT([no])
10582 AC_SUBST(ENABLE_PDFIMPORT)
10583 AC_SUBST(SYSTEM_POPPLER)
10584 AC_SUBST(POPPLER_CFLAGS)
10585 AC_SUBST(POPPLER_LIBS)
10587 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10588 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10589     AC_MSG_RESULT([yes])
10590     ENABLE_MEDIAWIKI=TRUE
10591     BUILD_TYPE="$BUILD_TYPE XSLTML"
10592     if test  "x$with_java" = "xno"; then
10593         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10594     fi
10595 else
10596     AC_MSG_RESULT([no])
10597     ENABLE_MEDIAWIKI=
10598     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10600 AC_SUBST(ENABLE_MEDIAWIKI)
10602 AC_MSG_CHECKING([whether to build the Report Builder])
10603 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10604     AC_MSG_RESULT([yes])
10605     ENABLE_REPORTBUILDER=TRUE
10606     AC_MSG_CHECKING([which jfreereport libs to use])
10607     if test "$with_system_jfreereport" = "yes"; then
10608         SYSTEM_JFREEREPORT=TRUE
10609         AC_MSG_RESULT([external])
10610         if test -z $SAC_JAR; then
10611             SAC_JAR=/usr/share/java/sac.jar
10612         fi
10613         AC_CHECK_FILE($SAC_JAR, [],
10614              [AC_MSG_ERROR(sac.jar not found.)], [])
10616         if test -z $LIBXML_JAR; then
10617             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10618                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10619                 [
10620                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10621                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10622                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10623                     )
10624                 ]
10625             )
10626         else
10627             AC_CHECK_FILE($LIBXML_JAR, [],
10628                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10629         fi
10631         if test -z $FLUTE_JAR; then
10632             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10633                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10634                 [
10635                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10636                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10637                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10638                     )
10639                 ]
10640             )
10641         else
10642             AC_CHECK_FILE($FLUTE_JAR, [],
10643                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10644         fi
10646         if test -z $JFREEREPORT_JAR; then
10647             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10648                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10649                 [
10650                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10651                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10652                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10653                     )
10654                 ]
10655             )
10656         else
10657             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10658                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10659         fi
10661         if test -z $LIBLAYOUT_JAR; then
10662             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10663                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10664                 [
10665                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10666                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10667                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10668                     )
10669                 ]
10670             )
10671         else
10672             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10673                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10674         fi
10676         if test -z $LIBLOADER_JAR; then
10677             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10678                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10679                 [
10680                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10681                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10682                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10683                     )
10684                 ]
10685             )
10686         else
10687             AC_CHECK_FILE($LIBLOADER_JAR, [],
10688                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10689         fi
10691         if test -z $LIBFORMULA_JAR; then
10692             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10693                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10694                  [
10695                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10696                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10697                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10698                      )
10699                  ]
10700             )
10701         else
10702             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10703                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10704         fi
10706         if test -z $LIBREPOSITORY_JAR; then
10707             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10708                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10709                 [
10710                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10711                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10712                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10713                     )
10714                 ]
10715             )
10716         else
10717             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10718                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10719         fi
10721         if test -z $LIBFONTS_JAR; then
10722             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10723                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10724                 [
10725                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10726                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10727                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10728                     )
10729                 ]
10730             )
10731         else
10732             AC_CHECK_FILE($LIBFONTS_JAR, [],
10733                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10734         fi
10736         if test -z $LIBSERIALIZER_JAR; then
10737             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10738                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10739                 [
10740                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10741                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10742                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10743                     )
10744                 ]
10745             )
10746         else
10747             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10748                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10749         fi
10751         if test -z $LIBBASE_JAR; then
10752             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10753                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10754                 [
10755                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10756                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10757                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10758                     )
10759                 ]
10760             )
10761         else
10762             AC_CHECK_FILE($LIBBASE_JAR, [],
10763                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10764         fi
10766     else
10767         AC_MSG_RESULT([internal])
10768         SYSTEM_JFREEREPORT=
10769         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10770     fi
10771 else
10772     AC_MSG_RESULT([no])
10773     ENABLE_REPORTBUILDER=
10774     SYSTEM_JFREEREPORT=
10776 AC_SUBST(ENABLE_REPORTBUILDER)
10777 AC_SUBST(SYSTEM_JFREEREPORT)
10778 AC_SUBST(SAC_JAR)
10779 AC_SUBST(LIBXML_JAR)
10780 AC_SUBST(FLUTE_JAR)
10781 AC_SUBST(JFREEREPORT_JAR)
10782 AC_SUBST(LIBBASE_JAR)
10783 AC_SUBST(LIBLAYOUT_JAR)
10784 AC_SUBST(LIBLOADER_JAR)
10785 AC_SUBST(LIBFORMULA_JAR)
10786 AC_SUBST(LIBREPOSITORY_JAR)
10787 AC_SUBST(LIBFONTS_JAR)
10788 AC_SUBST(LIBSERIALIZER_JAR)
10790 # this has to be here because both the Wiki Publisher and the SRB use
10791 # commons-logging
10792 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10793     AC_MSG_CHECKING([which Apache commons-* libs to use])
10794     if test "$with_system_apache_commons" = "yes"; then
10795         SYSTEM_APACHE_COMMONS=TRUE
10796         AC_MSG_RESULT([external])
10797         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10798             if test -z $COMMONS_CODEC_JAR; then
10799                 _commons_codec_path=""
10800                 if test "$HAVE_JAVA6" = "TRUE"; then
10801                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10802                 else
10803                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10804                 fi
10805                 AC_CHECK_FILE($_commons_codec_path,
10806                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10807                     [
10808                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10809                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10810                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10811                         )
10812                     ]
10813                 )
10814             else
10815                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10816                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10817             fi
10819             if test -z $COMMONS_LANG_JAR; then
10820                 _commons_lang_path=""
10821                 if test "$HAVE_JAVA6" = "TRUE"; then
10822                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10823                 else
10824                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10825                 fi
10826                 AC_CHECK_FILE($_commons_lang_path,
10827                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10828                     [
10829                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10830                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10831                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10832                             )
10833                     ]
10834                 )
10835             else
10836                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10837                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10838             fi
10840             if test -z $COMMONS_HTTPCLIENT_JAR; then
10841                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10842                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10843                     [
10844                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10845                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10846                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10847                         )
10848                     ]
10849                 )
10850             else
10851                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10852                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10853             fi
10854         fi
10855         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10856             if test -z $COMMONS_LOGGING_JAR; then
10857                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
10858                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
10859                    [
10860                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10861                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10862                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10863                         )
10864                     ]
10865                 )
10866             else
10867                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10868                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10869             fi
10870         fi
10871     else
10872         AC_MSG_RESULT([internal])
10873         SYSTEM_APACHE_COMMONS=
10874         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10875     fi
10877 AC_SUBST(SYSTEM_APACHE_COMMONS)
10878 AC_SUBST(COMMONS_CODEC_JAR)
10879 AC_SUBST(COMMONS_LANG_JAR)
10880 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10881 AC_SUBST(COMMONS_LOGGING_JAR)
10883 # scripting provider for BeanShell?
10884 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10885 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10886     AC_MSG_RESULT([yes])
10887     ENABLE_SCRIPTING_BEANSHELL=TRUE
10889     dnl ===================================================================
10890     dnl Check for system beanshell
10891     dnl ===================================================================
10892     AC_MSG_CHECKING([which beanshell to use])
10893     if test "$with_system_beanshell" = "yes"; then
10894         AC_MSG_RESULT([external])
10895         SYSTEM_BSH=TRUE
10896         if test -z $BSH_JAR; then
10897             BSH_JAR=/usr/share/java/bsh.jar
10898         fi
10899         AC_CHECK_FILE($BSH_JAR, [],
10900                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10901     else
10902         AC_MSG_RESULT([internal])
10903         SYSTEM_BSH=
10904         BUILD_TYPE="$BUILD_TYPE BSH"
10905     fi
10906 else
10907     AC_MSG_RESULT([no])
10908     ENABLE_SCRIPTING_BEANSHELL=
10909     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10911 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10912 AC_SUBST(SYSTEM_BSH)
10913 AC_SUBST(BSH_JAR)
10915 # scripting provider for JavaScript?
10916 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10917 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10918     AC_MSG_RESULT([yes])
10919     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10921     dnl ===================================================================
10922     dnl Check for system rhino
10923     dnl ===================================================================
10924     AC_MSG_CHECKING([which rhino to use])
10925     if test "$with_system_rhino" = "yes"; then
10926         AC_MSG_RESULT([external])
10927         SYSTEM_RHINO=TRUE
10928         if test -z $RHINO_JAR; then
10929             RHINO_JAR=/usr/share/java/js.jar
10930         fi
10931         AC_CHECK_FILE($RHINO_JAR, [],
10932                    [AC_MSG_ERROR(js.jar not found.)], [])
10933     else
10934         AC_MSG_RESULT([internal])
10935         SYSTEM_RHINO=
10936         BUILD_TYPE="$BUILD_TYPE RHINO"
10937     fi
10938 else
10939     AC_MSG_RESULT([no])
10940     ENABLE_SCRIPTING_JAVASCRIPT=
10941     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10943 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10944 AC_SUBST(SYSTEM_RHINO)
10945 AC_SUBST(RHINO_JAR)
10947 supports_multilib=
10948 case "$host_cpu" in
10949 x86_64 | powerpc64 | s390x)
10950     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10951         supports_multilib="yes"
10952     fi
10953     ;;
10955     ;;
10956 esac
10958 dnl ===================================================================
10959 dnl Check whether the TQt and TDE libraries are available.
10960 dnl ===================================================================
10962 TDE_CFLAGS=""
10963 TDE_LIBS=""
10964 if test "$_os" != "OpenBSD"; then
10965     MOC="moc"
10967 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10968     dnl Search paths for TQt and TDE
10969     if test -z "$supports_multilib"; then
10970         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"
10971         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"
10972     else
10973         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"
10974         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"
10975     fi
10976     if test -n "$TQTDIR"; then
10977         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10978         if test -z "$supports_multilib"; then
10979             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10980         else
10981             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10982         fi
10983     fi
10984     if test -z "$supports_multilib"; then
10985         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"
10986         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"
10987     else
10988         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"
10989         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"
10990     fi
10991     if test -n "$TDEDIR"; then
10992         tde_incdirs="$TDEDIR/include $tde_incdirs"
10993         if test -z "$supports_multilib"; then
10994             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10995         else
10996             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10997         fi
10998     fi
11000     dnl What to test
11001     tqt_test_include="ntqstyle.h"
11002     tde_test_include="kapp.h"
11004     if test "$_os" != "OpenBSD"; then
11005         tqt_test_library="libtqt-mt.so"
11006         tde_test_library="libDCOP.so"
11007     else
11008         tqt_test_library="libtqt-mt.so*"
11009         tde_test_library="libDCOP.so*"
11010     fi
11012     dnl Check for TQt headers
11013     AC_MSG_CHECKING([for TQt headers])
11014     tqt_incdir="no"
11015     for tde_check in $tqt_incdirs; do
11016         if test -r "$tde_check/$tqt_test_include"; then
11017             tqt_incdir="$tde_check"
11018             break
11019         fi
11020     done
11021     AC_MSG_RESULT([$tqt_incdir])
11022     if test "x$tqt_incdir" = "xno"; then
11023         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
11024 your TQt installation by exporting TQTDIR before running "configure".])
11025     fi
11027     dnl Check for TQt libraries
11028     AC_MSG_CHECKING([for TQt libraries])
11029     tqt_libdir="no"
11030     for tqt_check in $tqt_libdirs; do
11031         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11032             tqt_libdir="$tqt_check"
11033             break
11034         fi
11035     done
11036     AC_MSG_RESULT([$tqt_libdir])
11037     if test "x$tqt_libdir" = "xno"; then
11038         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11039 your TQt installation by exporting TQTDIR before running "configure".])
11040     fi
11042     dnl Check for Meta Object Compiler
11043     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11044     if test "$MOC" = "no"; then
11045         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11046 the root of your TQt installation by exporting TQTDIR before running "configure".])
11047     fi
11049     dnl Check for TDE headers
11050     AC_MSG_CHECKING([for TDE headers])
11051     tde_incdir="no"
11052     for tde_check in $tde_incdirs; do
11053         if test -r "$tde_check/$tde_test_include"; then
11054             tde_incdir="$tde_check"
11055             break
11056         fi
11057     done
11058     AC_MSG_RESULT([$tde_incdir])
11059     if test "x$tde_incdir" = "xno"; then
11060         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11061 your TDE installation by exporting TDEDIR before running "configure".])
11062     fi
11064     dnl Check for TDE libraries
11065     AC_MSG_CHECKING([for TDE libraries])
11066     tde_libdir="no"
11067     for tde_check in $tde_libdirs; do
11068         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11069             tde_libdir="$tde_check"
11070             break
11071         fi
11072     done
11073     AC_MSG_RESULT([$tde_libdir])
11074     if test "x$tde_libdir" = "xno"; then
11075         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11076 your TDE installation by exporting TDEDIR before running "configure".])
11077     fi
11079     dnl Set the variables
11080     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11081     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11083 AC_SUBST(TDE_CFLAGS)
11084 AC_SUBST(TDE_LIBS)
11085 AC_SUBST(MOC)
11087 dnl ===================================================================
11088 dnl Check whether the Qt3 and KDE3 libraries are available.
11089 dnl ===================================================================
11091 KDE_CFLAGS=""
11092 KDE_LIBS=""
11093 if test "$_os" != "OpenBSD"; then
11094     MOC="moc"
11096 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
11097     dnl Search paths for Qt3 and KDE3
11098     if test -z "$supports_multilib"; then
11099         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"
11100         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"
11101     else
11102         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"
11103         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"
11104     fi
11105     if test -n "$QTDIR"; then
11106         qt_incdirs="$QTDIR/include $qt_incdirs"
11107         if test -z "$supports_multilib"; then
11108             qt_libdirs="$QTDIR/lib $qt_libdirs"
11109         else
11110             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11111         fi
11112     fi
11113     if test -z "$supports_multilib"; then
11114         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"
11115         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"
11116     else
11117         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"
11118         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"
11119     fi
11120     if test -n "$KDEDIR"; then
11121         kde_incdirs="$KDEDIR/include $kde_incdirs"
11122         if test -z "$supports_multilib"; then
11123             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11124         else
11125             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11126         fi
11127     fi
11129     dnl What to test
11130     qt_test_include="qstyle.h"
11131     kde_test_include="kapp.h"
11133     if test "$_os" != "OpenBSD"; then
11134         qt_test_library="libqt-mt.so"
11135         kde_test_library="libDCOP.so"
11136     else
11137         qt_test_library="libqt-mt.so*"
11138         kde_test_library="libDCOP.so*"
11139     fi
11141     dnl Check for Qt3 headers
11142     AC_MSG_CHECKING([for Qt3 headers])
11143     qt_incdir="no"
11144     for kde_check in $qt_incdirs; do
11145         if test -r "$kde_check/$qt_test_include"; then
11146             qt_incdir="$kde_check"
11147             break
11148         fi
11149     done
11150     AC_MSG_RESULT([$qt_incdir])
11151     if test "x$qt_incdir" = "xno"; then
11152         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11153 your Qt3 installation by exporting QTDIR before running "configure".])
11154     fi
11156     dnl Check for Qt3 libraries
11157     AC_MSG_CHECKING([for Qt3 libraries])
11158     qt_libdir="no"
11159     for qt_check in $qt_libdirs; do
11160         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11161             qt_libdir="$qt_check"
11162             break
11163         fi
11164     done
11165     AC_MSG_RESULT([$qt_libdir])
11166     if test "x$qt_libdir" = "xno"; then
11167         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11168 your Qt3 installation by exporting QTDIR before running "configure".])
11169     fi
11171     dnl Check for Meta Object Compiler
11172     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11173     if test "$MOC" = "no"; then
11174         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11175 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11176     fi
11178     dnl Check for KDE3 headers
11179     AC_MSG_CHECKING([for KDE3 headers])
11180     kde_incdir="no"
11181     for kde_check in $kde_incdirs; do
11182         if test -r "$kde_check/$kde_test_include"; then
11183             kde_incdir="$kde_check"
11184             break
11185         fi
11186     done
11187     AC_MSG_RESULT([$kde_incdir])
11188     if test "x$kde_incdir" = "xno"; then
11189         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11190 your KDE3 installation by exporting KDEDIR before running "configure".])
11191     fi
11193     dnl Check for KDE3 libraries
11194     AC_MSG_CHECKING([for KDE3 libraries])
11195     kde_libdir="no"
11196     for kde_check in $kde_libdirs; do
11197         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11198             kde_libdir="$kde_check"
11199             break
11200         fi
11201     done
11202     AC_MSG_RESULT([$kde_libdir])
11203     if test "x$kde_libdir" = "xno"; then
11204         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11205 your KDE3 installation by exporting KDEDIR before running "configure".])
11206     fi
11208     dnl Set the variables
11209     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11210     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11211     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11213 AC_SUBST(KDE_CFLAGS)
11214 AC_SUBST(KDE_LIBS)
11215 AC_SUBST(MOC)
11217 dnl ===================================================================
11218 dnl KDE4 Integration
11219 dnl ===================================================================
11221 KDE4_CFLAGS=""
11222 KDE4_LIBS=""
11223 QMAKE4="qmake"
11224 MOC4="moc"
11225 KDE_GLIB_CFLAGS=""
11226 KDE_GLIB_LIBS=""
11227 KDE_HAVE_GLIB=""
11228 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11229     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11230     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11232     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11233     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11235     if test -n "$supports_multilib"; then
11236         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11237         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11238     fi
11240     if test -n "$QTDIR"; then
11241         qt_incdirs="$QTDIR/include $qt_incdirs"
11242         if test -z "$supports_multilib"; then
11243             qt_libdirs="$QTDIR/lib $qt_libdirs"
11244         else
11245             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11246         fi
11247     fi
11248     if test -n "$QT4DIR"; then
11249         qt_incdirs="$QT4DIR/include $qt_incdirs"
11250         if test -z "$supports_multilib"; then
11251             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11252         else
11253             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11254         fi
11255     fi
11257     if test -n "$KDEDIR"; then
11258         kde_incdirs="$KDEDIR/include $kde_incdirs"
11259         if test -z "$supports_multilib"; then
11260             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11261         else
11262             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11263         fi
11264     fi
11265     if test -n "$KDE4DIR"; then
11266         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11267         if test -z "$supports_multilib"; then
11268             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11269         else
11270             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11271         fi
11272     fi
11274     qt_test_include="Qt/qobject.h"
11275     qt_test_library="libQtNetwork.so"
11276     kde_test_include="kwindowsystem.h"
11277     kde_test_library="libsolid.so"
11279     AC_MSG_CHECKING([for Qt4 headers])
11280     qt_header_dir="no"
11281     for inc_dir in $qt_incdirs; do
11282         if test -r "$inc_dir/$qt_test_include"; then
11283             qt_header_dir="$inc_dir"
11284             break
11285         fi
11286     done
11288     AC_MSG_RESULT([$qt_header_dir])
11289     if test "x$qt_header_dir" = "xno"; then
11290         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11291     fi
11293     dnl Check for qmake
11294     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11295     QMAKE4="$QMAKEQT4"
11296     if test "$QMAKE4" = "no"; then
11297         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11298         if test "$QMAKE4" = "no"; then
11299             AC_MSG_ERROR([Qmake not found.  Please specify
11300 the root of your Qt installation by exporting QT4DIR before running "configure".])
11301         fi
11302     fi
11304     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11305     AC_MSG_CHECKING([for Qt4 libraries])
11306     qt_lib_dir="no"
11307     for lib_dir in $qt_libdirs; do
11308         if test -r "$lib_dir/$qt_test_library"; then
11309             qt_lib_dir="$lib_dir"
11310             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11311             break
11312         fi
11313     done
11315     AC_MSG_RESULT([$qt_lib_dir])
11317     if test "x$qt_lib_dir" = "xno"; then
11318         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11319     fi
11321     dnl Check for Meta Object Compiler
11323     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11324     MOC4="$MOCQT4"
11325     if test "$MOC4" = "no"; then
11326         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11327         if test "$MOC4" = "no"; then
11328             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11329 the root of your Qt installation by exporting QT4DIR before running "configure".])
11330         fi
11331     fi
11333     dnl Check for KDE4 headers
11334     AC_MSG_CHECKING([for KDE4 headers])
11335     kde_incdir="no"
11336     for kde_check in $kde_incdirs; do
11337         if test -r "$kde_check/$kde_test_include"; then
11338             kde_incdir="$kde_check"
11339             break
11340         fi
11341     done
11342     AC_MSG_RESULT([$kde_incdir])
11343     if test "x$kde_incdir" = "xno"; then
11344         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11345     fi
11347     dnl Check for KDE4 libraries
11348     AC_MSG_CHECKING([for KDE4 libraries])
11349     kde_libdir="no"
11350     for kde_check in $kde_libdirs; do
11351         if test -r "$kde_check/$kde_test_library"; then
11352             kde_libdir="$kde_check"
11353             break
11354         fi
11355     done
11357     AC_MSG_RESULT([$kde_libdir])
11358     if test "x$kde_libdir" = "xno"; then
11359         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11360     fi
11362     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11363     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11364     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11365     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11367     AC_LANG_PUSH([C++])
11368     save_CXXFLAGS=$CXXFLAGS
11369     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11370     AC_MSG_CHECKING([whether KDE is >= 4.2])
11371        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11372 #include <kdeversion.h>
11374 int main(int argc, char **argv) {
11375        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11376        else return 1;
11378        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11379     CXXFLAGS=$save_CXXFLAGS
11380     AC_LANG_POP([C++])
11382     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11383     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11384     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11385         [
11386             KDE_HAVE_GLIB=1
11387             AC_DEFINE(KDE_HAVE_GLIB,1)
11388             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11390             qt4_fix_warning=
11392             AC_LANG_PUSH([C++])
11393             save_CXXFLAGS=$CXXFLAGS
11394             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11395             save_LIBS=$LIBS
11396             LIBS="$LIBS $KDE4_LIBS"
11397             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11399             # Prepare meta object data
11400             TSTBASE="tst_exclude_socket_notifiers"
11401             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11402             ln -fs "${TSTMOC}.hxx"
11403             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11405             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11406 #include "tst_exclude_socket_notifiers.moc"
11408 int main(int argc, char *argv[])
11410     QCoreApplication app(argc, argv);
11411     exit(tst_processEventsExcludeSocket());
11412     return 0;
11414             ]])],[
11415                 AC_MSG_RESULT([yes])
11416             ],[
11417                 AC_MSG_RESULT([no])
11418                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11419                 if test -z "$qt4_fix_warning"; then
11420                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11421                 fi
11422                 qt4_fix_warning=1
11423                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11424             ])
11426             # Remove meta object data
11427             rm -f "${TSTBASE}."*
11429             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11431             # Prepare meta object data
11432             TSTBASE="tst_exclude_posted_events"
11433             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11434             ln -fs "${TSTMOC}.hxx"
11435             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11437             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11438 #include "tst_exclude_posted_events.moc"
11440 int main(int argc, char *argv[])
11442     QCoreApplication app(argc, argv);
11443     exit(tst_excludePostedEvents());
11444     return 0;
11446             ]])],[
11447                 AC_MSG_RESULT([yes])
11448             ],[
11449                 AC_MSG_RESULT([no])
11450                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11451                 if test -z "$qt4_fix_warning"; then
11452                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11453                 fi
11454                 qt4_fix_warning=1
11455                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11456             ])
11458             # Remove meta object data
11459             rm -f "${TSTBASE}."*
11461             if test -n "$qt4_fix_warning"; then
11462                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11463             fi
11465             LIBS=$save_LIBS
11466             CXXFLAGS=$save_CXXFLAGS
11467             AC_LANG_POP([C++])
11468         ],
11469         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11471 AC_SUBST(KDE4_CFLAGS)
11472 AC_SUBST(KDE4_LIBS)
11473 AC_SUBST(MOC4)
11474 AC_SUBST(KDE_GLIB_CFLAGS)
11475 AC_SUBST(KDE_GLIB_LIBS)
11476 AC_SUBST(KDE_HAVE_GLIB)
11478 dnl ===================================================================
11479 dnl Test for the enabling the lockdown pieces
11480 dnl ===================================================================
11481 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11482 ENABLE_LOCKDOWN=
11483 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11484     ENABLE_LOCKDOWN=TRUE
11485     AC_MSG_RESULT([yes])
11486 else
11487     AC_MSG_RESULT([no])
11489 AC_SUBST(ENABLE_LOCKDOWN)
11491 dnl ===================================================================
11492 dnl Test whether to include Evolution 2 support
11493 dnl ===================================================================
11494 AC_MSG_CHECKING([whether to enable evolution 2 support])
11495 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11496     AC_MSG_RESULT([yes])
11497     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11498     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11499     ENABLE_EVOAB2="TRUE"
11500 else
11501     ENABLE_EVOAB2=""
11502     AC_MSG_RESULT([no])
11504 AC_SUBST(ENABLE_EVOAB2)
11505 AC_SUBST(GOBJECT_CFLAGS)
11506 AC_SUBST(GOBJECT_LIBS)
11508 dnl ===================================================================
11509 dnl Test whether to include TDE AB support
11510 dnl ===================================================================
11511 AC_MSG_CHECKING([whether to enable TDE address book support])
11512 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11513     AC_MSG_RESULT([yes])
11514     AC_LANG_PUSH([C++])
11515     save_CXXFLAGS=$CXXFLAGS
11516     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11517     AC_MSG_CHECKING([whether TDE is at least R14.0])
11518        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11519 #include <tdeversion.h>
11521 int main(int argc, char **argv) {
11522        if (TDE_VERSION_MAJOR >= 14) return 0;
11523        else return 1;
11525        ]])],[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])],[])
11526     CXXFLAGS=$save_CXXFLAGS
11527     AC_LANG_POP([C++])
11528     ENABLE_TDEAB=TRUE
11529 else
11530     AC_MSG_RESULT([no])
11531     ENABLE_TDEAB=
11533 AC_SUBST(ENABLE_TDEAB)
11535 dnl ===================================================================
11536 dnl Test whether to include KDE AB support
11537 dnl ===================================================================
11538 AC_MSG_CHECKING([whether to enable KDE address book support])
11539 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11540     AC_MSG_RESULT([yes])
11541     AC_LANG_PUSH([C++])
11542     save_CXXFLAGS=$CXXFLAGS
11543     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11544     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11545        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11546 #include <kdeversion.h>
11548 int main(int argc, char **argv) {
11549        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11550        else return 1;
11552        ]])],[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])],[])
11553     CXXFLAGS=$save_CXXFLAGS
11554     AC_LANG_POP([C++])
11555     ENABLE_KAB=TRUE
11556 else
11557     AC_MSG_RESULT([no])
11558     ENABLE_KAB=
11560 AC_SUBST(ENABLE_KAB)
11562 dnl ===================================================================
11563 dnl Test which themes to include
11564 dnl ===================================================================
11565 AC_MSG_CHECKING([which themes to include])
11566 # if none given use default subset of available themes
11567 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11568     with_theme="crystal default hicontrast oxygen tango sifr"
11569     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11572 WITH_THEMES=""
11573 if test "x$with_theme" != "xno"; then
11574     for theme in $with_theme; do
11575         case $theme in
11576         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11577         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11578         esac
11579         WITH_THEMES="$WITH_THEMES $theme"
11580     done
11582 AC_MSG_RESULT([$WITH_THEMES])
11583 AC_SUBST([WITH_THEMES])
11585 dnl ===================================================================
11586 dnl Test whether to integrate helppacks into the product's installer
11587 dnl ===================================================================
11588 AC_MSG_CHECKING([for helppack integration])
11589 if test "$with_helppack_integration" = "no"; then
11590     WITH_HELPPACK_INTEGRATION=
11591     AC_MSG_RESULT([no integration])
11592 else
11593     WITH_HELPPACK_INTEGRATION=TRUE
11594     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11595     AC_MSG_RESULT([integration])
11597 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11599 ###############################################################################
11600 # Extensions checking
11601 ###############################################################################
11602 AC_MSG_CHECKING([for extensions integration])
11603 if test "x$enable_extension_integration" != "xno"; then
11604     WITH_EXTENSION_INTEGRATION=TRUE
11605     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11606     AC_MSG_RESULT([yes, use integration])
11607 else
11608     WITH_EXTENSION_INTEGRATION=
11609     AC_MSG_RESULT([no, do not integrate])
11611 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11613 dnl Should any extra extensions be included?
11614 dnl There are standalone tests for each of these below.
11615 WITH_EXTRA_EXTENSIONS=
11616 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11618 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11619 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11620 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11621 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11622 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11623 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11624 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11625 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11626 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11627 if test "x$with_java" != "xno"; then
11628     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11629     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11632 dnl ===================================================================
11633 dnl Test whether to include Sun Professional Template Pack
11634 dnl ===================================================================
11635 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11636 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11637     AC_MSG_RESULT([no integration])
11638 else
11639     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11640     sun_supported_langs="en-US de it fr es hu"
11641     if test "$with_sun_templates" = "yes"; then
11642         wanted_sun_templates="$sun_supported_langs"
11643     else
11644         # check whether the langs are supported by Sun
11645         wanted_sun_templates=
11646         for lang in $with_sun_templates; do
11647             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11648                 wanted_sun_templates="$wanted_sun_templates $lang"
11649             fi
11650         done
11651     fi
11652     SUNTEMPLATES_LANG=
11653     SUNTEMPLATES_DE_PACK=
11654     SUNTEMPLATES_EN_US_PACK=
11655     SUNTEMPLATES_ES_PACK=
11656     SUNTEMPLATES_FR_PACK=
11657     SUNTEMPLATES_HU_PACK=
11658     SUNTEMPLATES_IT_PACK=
11659     # check whether the langs are requested at all
11660     for lang in $wanted_sun_templates; do
11661     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11662         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11663         case $lang in
11664         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11665         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11666         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11667         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11668         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11669         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11670         esac
11671     fi
11672     done
11673     WITH_EXTRA_EXTENSIONS=TRUE
11674     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11676 AC_SUBST(SUNTEMPLATES_DE_PACK)
11677 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11678 AC_SUBST(SUNTEMPLATES_ES_PACK)
11679 AC_SUBST(SUNTEMPLATES_FR_PACK)
11680 AC_SUBST(SUNTEMPLATES_HU_PACK)
11681 AC_SUBST(SUNTEMPLATES_IT_PACK)
11683 TEST_FONTS_MISSING=0
11685 # $1  = font family
11686 # $2+ = accepted font mappings
11687 test_font_map()
11689     FONT="$1" ; shift
11690     AC_MSG_CHECKING([font mapping for '$FONT'])
11691     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11692     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11694     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11695     while true ; do
11696         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11697         test -n "$MAPPING" || break
11698         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11699     done
11700     if test $TESTEXPR
11701     then
11702         AC_MSG_RESULT([ok])
11703     else
11704         AC_MSG_RESULT([unknown ($FONTFILE)])
11705         TEST_FONTS_MISSING=1
11706     fi
11709 dnl ===================================================================
11710 dnl Test whether to include fonts
11711 dnl ===================================================================
11712 AC_MSG_CHECKING([whether to include third-party fonts])
11713 if test "$with_fonts" != "no"; then
11714     AC_MSG_RESULT([yes])
11715     WITH_FONTS=TRUE
11716     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11717 else
11718     AC_MSG_RESULT([no])
11719     WITH_FONTS=
11720     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11721     if test "$test_fontconfig" = "yes"; then
11722         AC_PATH_PROG([FCMATCH], [fc-match])
11723         if test -z "$FCMATCH"; then
11724             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11725             TEST_FONTS_MISSING=1
11726         else
11727             test_font_map 'Calibri' 'Carlito'
11728             if test ${TEST_FONTS_MISSING} -eq 1
11729             then
11730                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11731             fi
11732         fi
11733     else
11734         TEST_FONTS_MISSING=0
11735     fi
11737 AC_SUBST(WITH_FONTS)
11738 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11740 dnl ===================================================================
11741 dnl Test whether to include ppds
11742 dnl ===================================================================
11743 AC_MSG_CHECKING([whether to include PPDs])
11744 if test "$with_ppds" != "no"; then
11745     AC_MSG_RESULT([yes])
11746     WITHOUT_PPDS=
11747 else
11748     AC_MSG_RESULT([no])
11749     WITHOUT_PPDS=TRUE
11750     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11752 AC_SUBST(WITHOUT_PPDS)
11754 dnl ===================================================================
11755 dnl Test whether to include extra galleries
11756 dnl ===================================================================
11757 AC_MSG_CHECKING([whether to include extra galleries])
11758 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11759     AC_MSG_RESULT([no])
11760     WITH_EXTRA_GALLERY=
11761     OOOP_GALLERY_PACK=""
11762 else
11763     AC_MSG_RESULT([yes])
11764     WITH_EXTRA_GALLERY=TRUE
11765     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11766     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11767     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11769 AC_SUBST(WITH_EXTRA_GALLERY)
11770 AC_SUBST(OOOP_GALLERY_PACK)
11772 dnl ===================================================================
11773 dnl Test whether to include extra templates
11774 dnl ===================================================================
11775 AC_MSG_CHECKING([whether to include extra templates])
11776 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11777     AC_MSG_RESULT([no])
11778     WITH_EXTRA_TEMPLATE=
11779     OOOP_TEMPLATES_PACK=""
11780 else
11781     AC_MSG_RESULT([yes])
11782     WITH_EXTRA_TEMPLATE=TRUE
11783     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11784     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11785     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11787 AC_SUBST(WITH_EXTRA_TEMPLATE)
11788 AC_SUBST(OOOP_TEMPLATES_PACK)
11790 dnl ===================================================================
11791 dnl Test whether to include extra samples
11792 dnl ===================================================================
11793 AC_MSG_CHECKING([whether to include extra samples])
11794 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11795     AC_MSG_RESULT([no])
11796     WITH_EXTRA_SAMPLE=
11797     OOOP_SAMPLES_PACK=""
11798 else
11799     AC_MSG_RESULT([yes])
11800     WITH_EXTRA_SAMPLE=TRUE
11801     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11802     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11803     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11805 AC_SUBST(WITH_EXTRA_SAMPLE)
11806 AC_SUBST(OOOP_SAMPLES_PACK)
11808 dnl ===================================================================
11809 dnl Test whether to include extra fonts
11810 dnl ===================================================================
11811 AC_MSG_CHECKING([whether to include extra fonts])
11812 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11813     AC_MSG_RESULT([no])
11814     WITH_EXTRA_FONT=
11815     OOOP_FONTS_PACK=""
11816 else
11817     AC_MSG_RESULT([yes])
11818     WITH_EXTRA_FONT=TRUE
11819     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11820     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11821     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11823 AC_SUBST(WITH_EXTRA_FONT)
11824 AC_SUBST(OOOP_FONTS_PACK)
11826 dnl ===================================================================
11827 dnl Test whether to enable online update service
11828 dnl ===================================================================
11829 AC_MSG_CHECKING([whether to enable online update])
11830 ENABLE_ONLINE_UPDATE=
11831 if test "$enable_online_update" = ""; then
11832     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11833         AC_MSG_RESULT([yes])
11834         ENABLE_ONLINE_UPDATE="TRUE"
11835     else
11836         AC_MSG_RESULT([no])
11837     fi
11838 else
11839     if test "$enable_online_update" = "yes"; then
11840         AC_MSG_RESULT([yes])
11841         ENABLE_ONLINE_UPDATE="TRUE"
11842     else
11843         AC_MSG_RESULT([no])
11844     fi
11846 AC_SUBST(ENABLE_ONLINE_UPDATE)
11848 dnl ===================================================================
11849 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11850 dnl ===================================================================
11851 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11852 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11853     AC_MSG_RESULT([no])
11854     ENABLE_SILENT_MSI=
11855 else
11856     AC_MSG_RESULT([yes])
11857     ENABLE_SILENT_MSI=TRUE
11858     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11860 AC_SUBST(ENABLE_SILENT_MSI)
11862 AC_MSG_CHECKING([whether and how to use Xinerama])
11863 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11864     if test "$x_libraries" = "default_x_libraries"; then
11865         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11866         if test "x$XINERAMALIB" = x; then
11867            XINERAMALIB="/usr/lib"
11868         fi
11869     else
11870         XINERAMALIB="$x_libraries"
11871     fi
11872     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11873         # we have both versions, let the user decide but use the dynamic one
11874         # per default
11875         USE_XINERAMA=TRUE
11876         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11877             XINERAMA_LINK=dynamic
11878         else
11879             XINERAMA_LINK=static
11880         fi
11881     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11882         # we have only the dynamic version
11883         USE_XINERAMA=TRUE
11884         XINERAMA_LINK=dynamic
11885     elif test -e "$XINERAMALIB/libXinerama.a"; then
11886         # static version
11887         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11888             USE_XINERAMA=TRUE
11889             XINERAMA_LINK=static
11890         else
11891             USE_XINERAMA=
11892             XINERAMA_LINK=none
11893         fi
11894     else
11895         # no Xinerama
11896         USE_XINERAMA=
11897         XINERAMA_LINK=none
11898     fi
11899     if test "$USE_XINERAMA" = "TRUE"; then
11900         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11901         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11902             [AC_MSG_ERROR(Xinerama header not found.)], [])
11903         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11904         if test "x$XEXTLIB" = x; then
11905            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11906         fi
11907         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11908         if test "$_os" = "FreeBSD"; then
11909             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11910         fi
11911         if test "$_os" = "Linux"; then
11912             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11913         fi
11914         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11915             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11916     else
11917         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11918     fi
11919 else
11920     USE_XINERAMA=
11921     XINERAMA_LINK=none
11922     AC_MSG_RESULT([no])
11924 AC_SUBST(USE_XINERAMA)
11925 AC_SUBST(XINERAMA_LINK)
11927 dnl ===================================================================
11928 dnl Test whether to build cairo or rely on the system version
11929 dnl ===================================================================
11931 if test "$GUIBASE" = "unx"; then
11932     # Used in vcl/Library_vclplug_gen.mk
11933     test_cairo=yes
11936 if test "$test_cairo" = "yes"; then
11937     AC_MSG_CHECKING([whether to use the system cairo])
11939     : ${with_system_cairo:=$with_system_libs}
11940     if test "$with_system_cairo" = "yes"; then
11941         SYSTEM_CAIRO=TRUE
11942         AC_MSG_RESULT([yes])
11944         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11945         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11947         if test "$test_xrender" = "yes"; then
11948             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11949             AC_LANG_PUSH([C])
11950             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11951 #ifdef PictStandardA8
11952 #else
11953       return fail;
11954 #endif
11955 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11957             AC_LANG_POP([C])
11958         fi
11959         libo_MINGW_CHECK_DLL([libcairo])
11960         libo_MINGW_TRY_DLL([libfontconfig])
11961         libo_MINGW_TRY_DLL([libfreetype])
11962         libo_MINGW_TRY_DLL([libpixman])
11963         libo_MINGW_TRY_DLL([libpng15])
11964     else
11965         SYSTEM_CAIRO=
11966         AC_MSG_RESULT([no])
11968         BUILD_TYPE="$BUILD_TYPE CAIRO"
11969         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11970     fi
11973 AC_SUBST(SYSTEM_CAIRO)
11974 AC_SUBST(CAIRO_CFLAGS)
11975 AC_SUBST(CAIRO_LIBS)
11977 dnl ===================================================================
11978 dnl Test whether to use avahi
11979 dnl ===================================================================
11980 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11981     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11982                       [ENABLE_AVAHI="TRUE"])
11983     AC_DEFINE(HAVE_FEATURE_AVAHI)
11984     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11987 AC_SUBST(ENABLE_AVAHI)
11988 AC_SUBST(AVAHI_CFLAGS)
11989 AC_SUBST(AVAHI_LIBS)
11991 dnl ===================================================================
11992 dnl Test whether to use liblangtag
11993 dnl ===================================================================
11994 ENABLE_LIBLANGTAG=
11995 SYSTEM_LIBLANGTAG=
11996 AC_MSG_CHECKING([whether to use liblangtag])
11997 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11998     ENABLE_LIBLANGTAG=TRUE
11999     AC_MSG_RESULT([yes])
12000     AC_MSG_CHECKING([whether to use system liblangtag])
12001     if test "$with_system_liblangtag" = yes; then
12002         SYSTEM_LIBLANGTAG=TRUE
12003         AC_MSG_RESULT([yes])
12004         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12005         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12006         libo_MINGW_CHECK_DLL([liblangtag])
12007     else
12008         SYSTEM_LIBLANGTAG=
12009         AC_MSG_RESULT([no])
12010         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12011         if test "$COM" = "MSC"; then
12012             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
12013         else
12014             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
12015         fi
12016     fi
12017 else
12018     AC_MSG_RESULT([no])
12020 AC_SUBST(ENABLE_LIBLANGTAG)
12021 AC_SUBST(SYSTEM_LIBLANGTAG)
12022 AC_SUBST(LIBLANGTAG_CFLAGS)
12023 AC_SUBST(LIBLANGTAG_LIBS)
12025 dnl ===================================================================
12026 dnl Test whether to build libpng or rely on the system version
12027 dnl ===================================================================
12029 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
12031 dnl ===================================================================
12032 dnl Check for runtime JVM search path
12033 dnl ===================================================================
12034 if test "$ENABLE_JAVA" != ""; then
12035     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12036     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12037         AC_MSG_RESULT([yes])
12038         if ! test -d "$with_jvm_path"; then
12039             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12040         fi
12041         if ! test -d "$with_jvm_path"jvm; then
12042             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12043         fi
12044         JVM_ONE_PATH_CHECK="$with_jvm_path"
12045         AC_SUBST(JVM_ONE_PATH_CHECK)
12046     else
12047         AC_MSG_RESULT([no])
12048     fi
12051 dnl ===================================================================
12052 dnl Test for the presence of Ant and that it works
12053 dnl ===================================================================
12055 if test "$ENABLE_JAVA" != ""; then
12056     ANT_HOME=; export ANT_HOME
12057     WITH_ANT_HOME=; export WITH_ANT_HOME
12058     if test -z "$with_ant_home"; then
12059         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
12060     else
12061         if test "$_os" = "WINNT"; then
12062             with_ant_home=`cygpath -u "$with_ant_home"`
12063         fi
12064         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12065         WITH_ANT_HOME=$with_ant_home
12066         ANT_HOME=$with_ant_home
12067     fi
12069     if test -z "$ANT"; then
12070         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12071     else
12072         # resolve relative or absolute symlink
12073         while test -h "$ANT"; do
12074             a_cwd=`pwd`
12075             a_basename=`basename "$ANT"`
12076             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12077             cd "`dirname "$ANT"`"
12078             cd "`dirname "$a_script"`"
12079             ANT="`pwd`"/"`basename "$a_script"`"
12080             cd "$a_cwd"
12081         done
12083         AC_MSG_CHECKING([if $ANT works])
12084         cat > conftest.java << EOF
12085         public class conftest {
12086             int testmethod(int a, int b) {
12087                     return a + b;
12088             }
12089         }
12092         cat > conftest.xml << EOF
12093         <project name="conftest" default="conftest">
12094         <target name="conftest">
12095             <javac srcdir="." includes="conftest.java">
12096             </javac>
12097         </target>
12098         </project>
12101         oldJAVA_HOME=$JAVA_HOME
12102         if test "$JAVACISGCJ" = "yes"; then
12103             JAVA_HOME=; export JAVA_HOME
12104             ant_gcj="-Dbuild.compiler=gcj"
12105         fi
12106         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12107         if test $? = 0 -a -f ./conftest.class; then
12108             AC_MSG_RESULT([Ant works])
12109             if test -z "$WITH_ANT_HOME"; then
12110                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12111                 if test -z "$ANT_HOME"; then
12112                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12113                 fi
12114             else
12115                 ANT_HOME="$WITH_ANT_HOME"
12116             fi
12117         else
12118             echo "configure: Ant test failed" >&5
12119             cat conftest.java >&5
12120             cat conftest.xml >&5
12121             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12122             ANT_HOME=""
12123             add_warning "Ant does not work - Some Java projects will not build!"
12124         fi
12125         JAVA_HOME=$oldJAVA_HOME
12126         rm -f conftest* core core.* *.core
12127     fi
12128     if test -z "$ANT_HOME"; then
12129         ANT_HOME="NO_ANT_HOME"
12130     else
12131         PathFormat "$ANT_HOME"
12132         ANT_HOME="$formatted_path"
12133         PathFormat "$ANT"
12134         ANT="$ANT"
12135     fi
12136     AC_SUBST(ANT_HOME)
12137     AC_SUBST(ANT)
12139     dnl Checking for ant.jar
12140     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12141         AC_MSG_CHECKING([Ant lib directory])
12142         if test -f $ANT_HOME/lib/ant.jar; then
12143             ANT_LIB="$ANT_HOME/lib"
12144         else
12145             if test -f $ANT_HOME/ant.jar; then
12146                 ANT_LIB="$ANT_HOME"
12147             else
12148                 if test -f /usr/share/java/ant.jar; then
12149                     ANT_LIB=/usr/share/java
12150                 else
12151                     if test -f /usr/share/ant-core/lib/ant.jar; then
12152                         ANT_LIB=/usr/share/ant-core/lib
12153                     else
12154                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12155                             ANT_LIB="$ANT_HOME/lib/ant"
12156                         else
12157                             if test -f /usr/share/lib/ant/ant.jar; then
12158                                 ANT_LIB=/usr/share/lib/ant
12159                             else
12160                                 AC_MSG_ERROR([Ant libraries not found!])
12161                             fi
12162                         fi
12163                     fi
12164                 fi
12165             fi
12166         fi
12167         PathFormat "$ANT_LIB"
12168         ANT_LIB="$formatted_path"
12169         AC_MSG_RESULT([Ant lib directory found.])
12170     fi
12171     AC_SUBST(ANT_LIB)
12173     ant_minver=1.6.0
12174     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12176     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12177     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12178     ant_version_major=`echo $ant_version | cut -d. -f1`
12179     ant_version_minor=`echo $ant_version | cut -d. -f2`
12180     echo "configure: ant_version $ant_version " >&5
12181     echo "configure: ant_version_major $ant_version_major " >&5
12182     echo "configure: ant_version_minor $ant_version_minor " >&5
12183     if test "$ant_version_major" -ge "2"; then
12184         AC_MSG_RESULT([yes, $ant_version])
12185     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12186         AC_MSG_RESULT([yes, $ant_version])
12187     else
12188         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12189     fi
12191     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
12192         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
12193         rm -rf confdir
12194         mkdir confdir
12195         cat > conftest.java << EOF
12196             public class conftest {
12197                 int testmethod(int a, int b) {
12198                     return a + b;
12199                 }
12200             }
12203         cat > conftest.xml << EOF
12204             <project name="conftest" default="conftest">
12205             <target name="conftest" depends="copytest">
12206                 <javac srcdir="." includes="conftest.java">
12207                 </javac>
12208             </target>
12209             <target name="copytest">
12210                  <copy todir="confdir">
12211                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
12212                  <filterset/>
12213                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
12214                  </copy>
12215             </target>
12216             </project>
12219         if test "$JAVACISGCJ" = "yes"; then
12220             JAVA_HOME=; export JAVA_HOME
12221             ant_gcj="-Dbuild.compiler=gcj"
12222         fi
12223         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12224         if test $? = 0 -a -f ./conftest.class; then
12225             AC_MSG_RESULT([yes])
12226             rm -rf confdir
12227         else
12228             echo "configure: Ant test failed" >&5
12229             cat conftest.java >&5
12230             cat conftest.xml >&5
12231             rm -rf confdir
12232             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
12233         fi
12234     fi
12235     rm -f conftest* core core.* *.core
12238 OOO_JUNIT_JAR=
12239 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12240     AC_MSG_CHECKING([for JUnit 4])
12241     if test "$with_junit" = "yes"; then
12242         if test -e /usr/share/java/junit4.jar; then
12243             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12244         else
12245            if test -e /usr/share/lib/java/junit.jar; then
12246               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12247            else
12248               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12249            fi
12250         fi
12251     else
12252         OOO_JUNIT_JAR=$with_junit
12253     fi
12254     if test "$_os" = "WINNT"; then
12255         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12256     fi
12257     printf 'import org.junit.Before; import org.hamcrest.BaseDescription;' \
12258         > conftest.java
12259     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12260         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12261     else
12262         AC_MSG_ERROR(
12263 [cannot find JUnit 4 jar, or JUnit 4 jar does not provide Hamcrest; please
12264 install one in the default location (/usr/share/java), specify its pathname via
12265 --with-junit=..., or disable it via --without-junit])
12266     fi
12267     rm -f conftestj.class conftestj.java
12268     if test $OOO_JUNIT_JAR != ""; then
12269     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12270     fi
12272 AC_SUBST(OOO_JUNIT_JAR)
12275 AC_SUBST(SCPDEFS)
12278 # check for wget and curl
12280 WGET=
12281 CURL=
12283 if test "$enable_fetch_external" != "no"; then
12285 CURL=`which curl 2>/dev/null`
12287 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12288     eval "$i --version" > /dev/null 2>&1
12289     ret=$?
12290     if test $ret -eq 0; then
12291         WGET=$i
12292         break
12293     fi
12294 done
12296 if test -z "$WGET" -a -z "$CURL"; then
12297     AC_MSG_ERROR([neither wget nor curl found!])
12302 AC_SUBST(WGET)
12303 AC_SUBST(CURL)
12306 # check for md5sum
12308 MD5SUM=
12310 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12311     if test "$i" = "md5"; then
12312         eval "$i -x" > /dev/null 2>&1
12313     else
12314         eval "$i --version" > /dev/null 2>&1
12315     fi
12316     ret=$?
12317     if test $ret -eq 0; then
12318         MD5SUM=$i
12319         break
12320     fi
12321 done
12323 if test "$MD5SUM" = "md5"; then
12324     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12325         MD5SUM="$MD5SUM -r"
12326     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12327         MD5SUM="$MD5SUM -n"
12328     fi
12331 if test -z "$MD5SUM"; then
12332     AC_MSG_ERROR([no md5sum: found!])
12335 AC_SUBST(MD5SUM)
12337 dnl ===================================================================
12338 dnl Dealing with l10n options
12339 dnl ===================================================================
12340 AC_MSG_CHECKING([which languages to be built])
12341 # get list of all languages
12342 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12343 # the sed command does the following:
12344 #   + if a line ends with a backslash, append the next line to it
12345 #   + adds " on the beginning of the value (after =)
12346 #   + adds " at the end of the value
12347 #   + removes en-US; we want to put it on the beginning
12348 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12349 [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)]
12350 ALL_LANGS="en-US $completelangiso"
12351 # check the configured localizations
12352 WITH_LANG="$with_lang"
12353 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12354     AC_MSG_RESULT([en-US])
12355 else
12356     AC_MSG_RESULT([$WITH_LANG])
12357     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12359 # check that the list is valid
12360 for lang in $WITH_LANG; do
12361     test "$lang" = "ALL" && continue
12362     # need to check for the exact string, so add space before and after the list of all languages
12363     for vl in $ALL_LANGS; do
12364         if test "$vl" = "$lang"; then
12365            break
12366         fi
12367     done
12368     if test "$vl" != "$lang"; then
12369         # if you're reading this - you prolly quoted your languages remove the quotes ...
12370         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12371     fi
12372 done
12373 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12374     echo $WITH_LANG | grep -q en-US
12375     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12377 # list with substituted ALL
12378 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12379 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12380 test "$WITH_LANG" = "en-US" && WITH_LANG=
12381 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12382     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12383     ALL_LANGS=`echo $ALL_LANGS qtz`
12385 AC_SUBST(ALL_LANGS)
12386 AC_SUBST(WITH_LANG)
12387 AC_SUBST(WITH_LANG_LIST)
12388 AC_SUBST(GIT_NEEDED_SUBMODULES)
12390 WITH_POOR_HELP_LOCALIZATIONS=
12391 if test -d "$SRC_ROOT/translations/source"; then
12392     for l in `ls -1 $SRC_ROOT/translations/source`; do
12393         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12394             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12395         fi
12396     done
12398 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12400 if test -n "$with_locales"; then
12401     WITH_LOCALES="$with_locales"
12403     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12404     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12405     # config_host/config_locales.h.in
12406     for locale in $WITH_LOCALES; do
12407         lang=${locale%_*}
12409         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12411         case $lang in
12412         hi|mr*ne)
12413             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12414             ;;
12415         bg|ru)
12416             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12417             ;;
12418         esac
12419     done
12420 else
12421     AC_DEFINE(WITH_LOCALE_ALL)
12423 AC_SUBST(WITH_LOCALES)
12425 dnl git submodule update --reference
12426 dnl ===================================================================
12427 if test -n "${GIT_REFERENCE_SRC}"; then
12428     for repo in ${GIT_NEEDED_SUBMODULES}; do
12429         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12430             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12431         fi
12432     done
12434 AC_SUBST(GIT_REFERENCE_SRC)
12436 dnl git submodules linked dirs
12437 dnl ===================================================================
12438 if test -n "${GIT_LINK_SRC}"; then
12439     for repo in ${GIT_NEEDED_SUBMODULES}; do
12440         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12441             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12442         fi
12443     done
12445 AC_SUBST(GIT_LINK_SRC)
12447 dnl branding
12448 dnl ===================================================================
12449 AC_MSG_CHECKING([for alternative branding images directory])
12450 # initialize mapped arrays
12451 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12452 brand_files="$BRAND_INTRO_IMAGES about.svg"
12454 if test -z "$with_branding" -o "$with_branding" = "no"; then
12455     AC_MSG_RESULT([none])
12456     DEFAULT_BRAND_IMAGES="$brand_files"
12457 else
12458     if ! test -d $with_branding ; then
12459         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12460     else
12461         AC_MSG_RESULT([$with_branding])
12462         CUSTOM_BRAND_DIR="$with_branding"
12463         for lfile in $brand_files
12464         do
12465             if ! test -f $with_branding/$lfile ; then
12466                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12467                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12468             else
12469                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12470             fi
12471         done
12472         check_for_progress="yes"
12473     fi
12475 AC_SUBST([BRAND_INTRO_IMAGES])
12476 AC_SUBST([CUSTOM_BRAND_DIR])
12477 AC_SUBST([CUSTOM_BRAND_IMAGES])
12478 AC_SUBST([DEFAULT_BRAND_IMAGES])
12481 AC_MSG_CHECKING([for 'intro' progress settings])
12482 PROGRESSBARCOLOR=
12483 PROGRESSSIZE=
12484 PROGRESSPOSITION=
12485 PROGRESSFRAMECOLOR=
12486 PROGRESSTEXTCOLOR=
12487 PROGRESSTEXTBASELINE=
12489 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12490     source "$with_branding/progress.conf"
12491     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12492 else
12493     AC_MSG_RESULT([none])
12496 AC_SUBST(PROGRESSBARCOLOR)
12497 AC_SUBST(PROGRESSSIZE)
12498 AC_SUBST(PROGRESSPOSITION)
12499 AC_SUBST(PROGRESSFRAMECOLOR)
12500 AC_SUBST(PROGRESSTEXTCOLOR)
12501 AC_SUBST(PROGRESSTEXTBASELINE)
12504 AC_MSG_CHECKING([for extra build ID])
12505 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12506     EXTRA_BUILDID="$with_extra_buildid"
12508 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12509 if test -n "$EXTRA_BUILDID" ; then
12510     AC_MSG_RESULT([$EXTRA_BUILDID])
12511 else
12512     AC_MSG_RESULT([not set])
12514 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12516 OOO_VENDOR=
12517 AC_MSG_CHECKING([for vendor])
12518 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12519     OOO_VENDOR="$USERNAME"
12521     if test -z "$OOO_VENDOR"; then
12522         OOO_VENDOR="$USER"
12523     fi
12525     if test -z "$OOO_VENDOR"; then
12526         OOO_VENDOR="`id -u -n`"
12527     fi
12529     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12530 else
12531     OOO_VENDOR="$with_vendor"
12532     AC_MSG_RESULT([$OOO_VENDOR])
12534 AC_SUBST(OOO_VENDOR)
12536 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12537 if test "$with_compat_oowrappers" = "yes"; then
12538     WITH_COMPAT_OOWRAPPERS=TRUE
12539     AC_MSG_RESULT(yes)
12540 else
12541     WITH_COMPAT_OOWRAPPERS=
12542     AC_MSG_RESULT(no)
12544 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12546 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12547 AC_MSG_CHECKING([for install dirname])
12548 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12549     INSTALLDIRNAME="$with_install_dirname"
12551 AC_MSG_RESULT([$INSTALLDIRNAME])
12552 AC_SUBST(INSTALLDIRNAME)
12554 AC_MSG_CHECKING([for prefix])
12555 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12556 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12557 PREFIXDIR="$prefix"
12558 AC_MSG_RESULT([$PREFIXDIR])
12559 AC_SUBST(PREFIXDIR)
12561 LIBDIR=[$(eval echo $(eval echo $libdir))]
12562 AC_SUBST(LIBDIR)
12564 DATADIR=[$(eval echo $(eval echo $datadir))]
12565 AC_SUBST(DATADIR)
12567 MANDIR=[$(eval echo $(eval echo $mandir))]
12568 AC_SUBST(MANDIR)
12570 DOCDIR=[$(eval echo $(eval echo $docdir))]
12571 AC_SUBST(DOCDIR)
12573 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12574 AC_SUBST(INSTALLDIR)
12576 TESTINSTALLDIR="${BUILDDIR}/test-install"
12577 AC_SUBST(TESTINSTALLDIR)
12580 # ===================================================================
12581 # OAuth2 id and secrets
12582 # ===================================================================
12584 AC_MSG_CHECKING([for Google Drive client id and secret])
12585 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12586 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12587 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12588     GDRIVE_CLIENT_ID="\"\""
12591 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12592     GDRIVE_CLIENT_SECRET="\"\""
12595 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12596     AC_MSG_RESULT([not set])
12597 else
12598     AC_MSG_RESULT([set])
12601 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12602 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12604 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12605 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12606 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12607 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12608     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12611 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12612     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12615 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12616     AC_MSG_RESULT([not set])
12617 else
12618     AC_MSG_RESULT([set])
12620 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12621 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12623 # ===================================================================
12624 # De- or increase default verbosity of build process
12625 # ===================================================================
12626 AC_MSG_CHECKING([build verbosity])
12627 if test -n "$enable_verbose"; then
12628     if test "$enable_verbose" = "yes"; then
12629         VERBOSE="TRUE"
12630         AC_MSG_RESULT([high])
12631     fi
12632     if test "$enable_verbose" = "no"; then
12633         VERBOSE="FALSE"
12634         AC_MSG_RESULT([low])
12635     fi
12636 else
12637     AC_MSG_RESULT([not set])
12639 AC_SUBST(VERBOSE)
12641 dnl ===================================================================
12642 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12643 dnl --enable-dependency-tracking configure option
12644 dnl ===================================================================
12645 AC_MSG_CHECKING([whether to enable dependency tracking])
12646 if test "$enable_dependency_tracking" = "no"; then
12647     nodep=TRUE
12648     AC_MSG_RESULT([no])
12649 else
12650     AC_MSG_RESULT([yes])
12652 AC_SUBST(nodep)
12654 dnl ===================================================================
12655 dnl Number of CPUs to use during the build
12656 dnl ===================================================================
12657 AC_MSG_CHECKING([for number of processors to use])
12658 # plain --with-parallelism is just the default
12659 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12660     if test "$with_parallelism" = "no"; then
12661         PARALLELISM=0
12662     else
12663         PARALLELISM=$with_parallelism
12664     fi
12665 else
12666     if test "$enable_icecream" = "yes"; then
12667         PARALLELISM="10"
12668     else
12669         case `uname -s` in
12671         Darwin|FreeBSD|NetBSD|OpenBSD)
12672             PARALLELISM=`sysctl -n hw.ncpu`
12673             ;;
12675         Linux)
12676             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12677         ;;
12678         # what else than above does profit here *and* has /proc?
12679         *)
12680             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12681             ;;
12682         esac
12684         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12685         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12686     fi
12689 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12690     if test -z "$with_parallelism"; then
12691             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12692             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12693             PARALLELISM="1"
12694     else
12695         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."
12696     fi
12699 if test $PARALLELISM -eq 0; then
12700     AC_MSG_RESULT([explicit make -j option needed])
12701 else
12702     AC_MSG_RESULT([$PARALLELISM])
12704 AC_SUBST(PARALLELISM)
12707 # Set up ILIB for MSVC build
12709 if test "$build_os" = "cygwin"; then
12710     ILIB="."
12711     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12712         ILIB="$ILIB;$JAVA_HOME/lib"
12713     fi
12714     if test "$BITNESS_OVERRIDE" = 64; then
12715         ILIB="$ILIB;$COMPATH/lib/amd64"
12716         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12717         if test "$WINDOWS_SDK_VERSION" = "80"; then
12718             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12719         fi
12720     else
12721         ILIB="$ILIB;$COMPATH/lib"
12722         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12723         if test "$WINDOWS_SDK_VERSION" = "80"; then
12724             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12725         fi
12726     fi
12727     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12729     if test "$ENABLE_DIRECTX" = "TRUE"; then
12730         ILIB="$ILIB;$DIRECTXSDK_LIB"
12731     fi
12732     AC_SUBST(ILIB)
12736 # ===================================================================
12737 # Creating bigger shared library to link against
12738 # ===================================================================
12739 AC_MSG_CHECKING([whether to create huge library])
12740 MERGELIBS=
12742 if test $_os = iOS -o $_os = Android; then
12743     # Never any point in mergelibs for these as we build just static
12744     # libraries anyway...
12745     enable_mergelibs=no
12748 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12749     if test $_os != Linux -a $_os != WINNT; then
12750         add_warning "--enable-mergelibs is not tested for this platform"
12751     fi
12752     if test "$enable_mergelibs" = "all"; then
12753         MERGELIBS="ALL"
12754         URELIBS="TRUE"
12755         AC_DEFINE(STATIC_LINKING)
12756     else
12757         MERGELIBS="CORE"
12758     fi
12759     AC_MSG_RESULT([yes])
12760 else
12761     AC_MSG_RESULT([no])
12763 AC_SUBST([MERGELIBS])
12764 AC_SUBST([URELIBS])
12766 # ===================================================================
12767 # Create hardlinks on deliver instead of copying for smaller size and speed up
12768 # ===================================================================
12769 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12770 HARDLINKDELIVER=
12771 if test "$enable_hardlink_deliver" = "yes"; then
12772     HARDLINKDELIVER="TRUE"
12773     AC_MSG_RESULT([yes])
12774 else
12775     AC_MSG_RESULT([no])
12777 AC_SUBST(HARDLINKDELIVER)
12779 dnl ===================================================================
12780 dnl icerun is a wrapper that stops us spawning tens of processes
12781 dnl locally - for tools that can't be executed on the compile cluster
12782 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12783 dnl ===================================================================
12784 AC_MSG_CHECKING([whether to use icerun wrapper])
12785 ICECREAM_RUN=
12786 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12787     ICECREAM_RUN=icerun
12788     AC_MSG_RESULT([yes])
12789 else
12790     AC_MSG_RESULT([no])
12792 AC_SUBST(ICECREAM_RUN)
12794 dnl ===================================================================
12796 AC_MSG_CHECKING([MPL subset])
12797 MPL_SUBSET=
12799 if test "$enable_mpl_subset" = "yes"; then
12800     warn_report=false
12801     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12802         warn_report=true
12803     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12804         warn_report=true
12805     fi
12806     if test "$warn_report" = "true"; then
12807         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12808     fi
12809     if test "x$enable_postgresql_sdbc" != "xno"; then
12810         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12811     fi
12812     if test "$enable_lotuswordpro" = "yes"; then
12813         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12814     fi
12815     if test "$WITH_WEBDAV" = "neon"; then
12816         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12817     fi
12818     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12819         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12820     fi
12821     if test -n "$ENABLE_PDFIMPORT"; then
12822         if test "x$SYSTEM_POPPLER" != "x"; then
12823             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12824         fi
12825     fi
12826     # cf. m4/libo_check_extension.m4
12827     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12828         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12829     fi
12830     for theme in $WITH_THEMES; do
12831         case $theme in
12832         crystal|default|hicontrast|human|oxygen|sifr)
12833             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12834         *) : ;;
12835         esac
12836     done
12837     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12838         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12839     fi
12840     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12841         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12842     fi
12844     MPL_SUBSET="TRUE"
12845     AC_DEFINE(MPL_HAVE_SUBSET)
12846     AC_MSG_RESULT([only])
12847 else
12848     AC_MSG_RESULT([no restrictions])
12850 AC_SUBST(MPL_SUBSET)
12853 dnl ===================================================================
12854 dnl Setting up the environment.
12855 dnl ===================================================================
12856 echo "setting up the build environment variables..."
12858 AC_SUBST(COMPATH)
12860 if test "$build_os" = "cygwin"; then
12861     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12862         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12863         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12864     else
12865         ATL_LIB="$COMPATH/atlmfc/lib"
12866         ATL_INCLUDE="$COMPATH/atlmfc/include"
12867     fi
12868     if test "$BITNESS_OVERRIDE" = 64; then
12869         ATL_LIB="$ATL_LIB/amd64"
12870     fi
12871     PathFormat "/usr/bin/grep.exe"
12872     WIN_GREP="$formatted_path"
12873     PathFormat "/usr/bin/find.exe"
12874     WIN_FIND="$formatted_path"
12875     PathFormat "/usr/bin/ls.exe"
12876     WIN_LS="$formatted_path"
12877     PathFormat "/usr/bin/touch.exe"
12878     WIN_TOUCH="$formatted_path"
12881 AC_SUBST(ATL_INCLUDE)
12882 AC_SUBST(ATL_LIB)
12883 AC_SUBST(WIN_FIND)
12884 AC_SUBST(WIN_GREP)
12885 AC_SUBST(WIN_LS)
12886 AC_SUBST(WIN_TOUCH)
12888 AC_SUBST(BUILD_TYPE)
12890 AC_SUBST(SOLARINC)
12892 PathFormat "$PERL"
12893 PERL="$formatted_path"
12894 AC_SUBST(PERL)
12896 if test -n "$TMPDIR"; then
12897     TEMP_DIRECTORY="$TMPDIR"
12898 else
12899     TEMP_DIRECTORY="/tmp"
12901 if test "$build_os" = "cygwin"; then
12902     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12904 AC_SUBST(TEMP_DIRECTORY)
12906 # setup the PATH for the environment
12907 if test -n "$LO_PATH_FOR_BUILD"; then
12908     LO_PATH="$LO_PATH_FOR_BUILD"
12909 else
12910     LO_PATH="$PATH"
12912     case "$host_os" in
12914     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12915         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12916             pathmunge "$JAVA_HOME/bin" "after"
12917         fi
12918         ;;
12920     cygwin*)
12921         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12922         pathmunge "$ASM_HOME" "before"
12923         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12924         pathmunge "$CSC_PATH" "before"
12925         pathmunge "$MIDL_PATH" "before"
12926         pathmunge "$AL_PATH" "before"
12927         pathmunge "$MSPDB_PATH" "before"
12928         if test "$BITNESS_OVERRIDE" = 64; then
12929             pathmunge "$COMPATH/bin/amd64" "before"
12930             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12931         else
12932             pathmunge "$COMPATH/bin" "before"
12933             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12934         fi
12935         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12936             if test -d "$JAVA_HOME/jre/bin/client"; then
12937                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12938             fi
12939             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12940                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12941             fi
12942             pathmunge "$JAVA_HOME/bin" "before"
12943         fi
12944         ;;
12946     solaris*)
12947         pathmunge "/usr/css/bin" "before"
12948         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12949             pathmunge "$JAVA_HOME/bin" "after"
12950         fi
12951         ;;
12952     esac
12954     pathmunge "$SRC_ROOT/solenv/bin" "before"
12955     pathmunge "." "before"
12958 AC_SUBST(LO_PATH)
12960 # Generate a configuration md5 we can use for deps
12961 if test -f config_host.mk; then
12962     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12965 AC_CONFIG_FILES([config_host.mk
12966                  Makefile
12967                  lo.xcent
12968                  instsetoo_native/util/openoffice.lst
12969                  sysui/desktop/macosx/Info.plist
12970                  ios/lo.xcconfig])
12971 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12972 AC_CONFIG_HEADERS([config_host/config_clang.h])
12973 AC_CONFIG_HEADERS([config_host/config_eot.h])
12974 AC_CONFIG_HEADERS([config_host/config_features.h])
12975 AC_CONFIG_HEADERS([config_host/config_folders.h])
12976 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12977 AC_CONFIG_HEADERS([config_host/config_global.h])
12978 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12979 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12980 AC_CONFIG_HEADERS([config_host/config_locales.h])
12981 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12982 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12983 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12984 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12985 AC_CONFIG_HEADERS([config_host/config_oox.h])
12986 AC_CONFIG_HEADERS([config_host/config_options.h])
12987 AC_CONFIG_HEADERS([config_host/config_test.h])
12988 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12989 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12990 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12991 AC_CONFIG_HEADERS([config_host/config_version.h])
12992 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12993 AC_OUTPUT
12995 if test "$CROSS_COMPILING" = TRUE; then
12996     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12999 # touch the config timestamp file
13000 if test ! -f config_host.mk.stamp; then
13001     echo > config_host.mk.stamp
13002 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
13003     echo "Configuration unchanged - avoiding scp2 stamp update"
13004 else
13005     echo > config_host.mk.stamp
13009 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13010 cat << _EOS
13011 ****************************************************************************
13012 WARNING:
13013 Your make version is known to be horribly slow, and hard to debug
13014 problems with. To get a reasonably functional make please do:
13016 to install a pre-compiled binary make for cygwin
13018 mkdir -p /opt/lo/bin
13019 cd /opt/lo/bin
13020 wget http://dev-www.libreoffice.org/bin/cygwin/make
13021 chmod +x make
13023 to install from source:
13024 place yourself in a working directory of you choice.
13026 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
13027 cd dev-tools/make-3.82-gbuild
13028 ./configure --prefix=/opt/lo
13029 make
13030 make install
13032 Then re-run autogen.sh
13034 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13035 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13037 _EOS
13040 cat << _EOF
13041 ****************************************************************************
13043 To build, issue:
13044 $GNUMAKE
13046 For details, run:
13047 $GNUMAKE help
13049 _EOF
13051 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13052     cat << _EOF
13053 After the build has finished, you can immediately run it using:
13054 instdir/program/soffice
13056 If you want to run the smoketest, issue:
13057 $GNUMAKE check
13059 _EOF
13062 if test -f warn; then
13063     cat warn
13064     rm warn
13067 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: