libreofficekit_tiledrendering test: force lock file removal
[LibreOffice.git] / configure.ac
blobb1befc2739ff9faef0aa9f19a67eb9f6fcb4b71b
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             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
43                 formatted_path=`cygpath -sm "$formatted_path"`
44             else
45                 formatted_path=`cygpath -d "$formatted_path"`
46             fi
47             if test $? -ne 0;  then
48                 AC_MSG_ERROR([path conversion failed for "$1".])
49             fi
50         fi
51         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
52         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
53         if test "$fp_count_slash$fp_count_colon" != "00"; then
54             if test "$fp_count_colon" = "0"; then
55                 new_formatted_path=`realpath "$formatted_path"`
56                 if test $? -ne 0;  then
57                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
58                 else
59                     formatted_path="$new_formatted_path"
60                 fi
61             fi
62             formatted_path=`cygpath -m "$formatted_path"`
63             if test $? -ne 0;  then
64                 AC_MSG_ERROR([path conversion failed for "$1".])
65             fi
66         fi
67     fi
70 AbsolutePath()
72     # There appears to be no simple and portable method to get an absolute and
73     # canonical path, so we try creating the directory if does not exist and
74     # utilizing the shell and pwd.
75     rel="$1"
76     absolute_path=""
77     test ! -e "$rel" && mkdir -p "$rel"
78     if test -d "$rel" ; then
79         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
80         absolute_path="$(pwd)"
81         cd - &> /dev/null
82     else
83         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
84     fi
87 rm -f warn
88 have_WARNINGS="no"
89 add_warning()
91     if test "$have_WARNINGS" = "no"; then
92         echo "*************************************" > warn
93         have_WARNINGS="yes"
94         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
95             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
96             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
97         else
98             COLORWARN="* WARNING :"
99         fi
100     fi
101     echo "$COLORWARN $@" >> warn
104 echo "********************************************************************"
105 echo "*"
106 echo "*   Running ${PACKAGE_NAME} build configuration."
107 echo "*"
108 echo "********************************************************************"
109 echo ""
111 dnl ===================================================================
112 dnl checks build and host OSes
113 dnl do this before argument processing to allow for platform dependent defaults
114 dnl ===================================================================
115 AC_CANONICAL_HOST
117 AC_MSG_CHECKING([for product name])
118 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
119     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
120 else
121     PRODUCTNAME=AC_PACKAGE_NAME
123 AC_MSG_RESULT([$PRODUCTNAME])
124 AC_SUBST(PRODUCTNAME)
126 dnl ===================================================================
127 dnl Our version is defined by the AC_INIT() at the top of this script.
128 dnl ===================================================================
130 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
132 LIBO_VERSION_MAJOR=$1
133 LIBO_VERSION_MINOR=$2
134 LIBO_VERSION_MICRO=$3
135 LIBO_VERSION_PATCH=$4
137 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
138 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
139 # no way to encode that into an integer in general.
140 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
142 LIBO_VERSION_SUFFIX=$5
143 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
144 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
145 # they get undoubled before actually passed to sed.
146 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
147 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
148 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
149 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
151 AC_SUBST(LIBO_VERSION_MAJOR)
152 AC_SUBST(LIBO_VERSION_MINOR)
153 AC_SUBST(LIBO_VERSION_MICRO)
154 AC_SUBST(LIBO_VERSION_PATCH)
155 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
156 AC_SUBST(LIBO_VERSION_SUFFIX)
157 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
159 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
160 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
161 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
162 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
164 LIBO_THIS_YEAR=`date +%Y`
165 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
167 dnl ===================================================================
168 dnl Product version
169 dnl ===================================================================
170 AC_MSG_CHECKING([for product version])
171 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
172 AC_MSG_RESULT([$PRODUCTVERSION])
173 AC_SUBST(PRODUCTVERSION)
175 AC_PROG_EGREP
176 # AC_PROG_EGREP doesn't set GREP on all systems as well
177 AC_PATH_PROG(GREP, grep)
179 BUILDDIR=`pwd`
180 cd $srcdir
181 SRC_ROOT=`pwd`
182 cd $BUILDDIR
183 x_Cygwin=[\#]
185 dnl ===================================================================
186 dnl Search all the common names for GNU make
187 dnl ===================================================================
188 AC_MSG_CHECKING([for GNU make])
190 # try to use our own make if it is available and GNUMAKE was not already defined
191 if test -z "$GNUMAKE"; then
192     if test -x "/opt/lo/bin/make"; then
193         GNUMAKE="/opt/lo/bin/make"
194     fi
197 GNUMAKE_WIN_NATIVE=
198 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
199     if test -n "$a"; then
200         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
201         if test $? -eq 0;  then
202             if test "$build_os" = "cygwin"; then
203                 if test -n "$($a -v | grep 'Built for Windows')" ; then
204                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
205                     GNUMAKE_WIN_NATIVE="TRUE"
206                 else
207                     GNUMAKE=`which $a`
208                 fi
209             else
210                 GNUMAKE=`which $a`
211             fi
212             break
213         fi
214     fi
215 done
216 AC_MSG_RESULT($GNUMAKE)
217 if test -z "$GNUMAKE"; then
218     AC_MSG_ERROR([not found. install GNU make.])
219 else
220     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
221         AC_MSG_NOTICE([Using a native Win32 gnumake version.])
222     fi
225 win_short_path_for_make()
227     local_short_path="$1"
228     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
229         cygpath -sm "$local_short_path"
230     else
231         cygpath -u "$(cygpath -d "$local_short_path")"
232     fi
236 if test "$build_os" = "cygwin"; then
237     PathFormat "$SRC_ROOT"
238     SRC_ROOT="$formatted_path"
239     PathFormat "$BUILDDIR"
240     BUILDDIR="$formatted_path"
241     x_Cygwin=
244 AC_SUBST(SRC_ROOT)
245 AC_SUBST(BUILDDIR)
246 AC_SUBST(x_Cygwin)
247 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
248 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
250 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
251     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
254 # need sed in os checks...
255 AC_PATH_PROGS(SED, sed)
256 if test -z "$SED"; then
257     AC_MSG_ERROR([install sed to run this script])
260 # Set the ENABLE_LTO variable
261 # ===================================================================
262 AC_MSG_CHECKING([whether to use link-time optimization])
263 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
264     ENABLE_LTO="TRUE"
265     AC_MSG_RESULT([yes])
266     AC_DEFINE(STATIC_LINKING)
267 else
268     ENABLE_LTO=""
269     AC_MSG_RESULT([no])
271 AC_SUBST(ENABLE_LTO)
273 dnl ===================================================================
274 dnl When building for Android, --with-android-ndk,
275 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
276 dnl mandatory
277 dnl ===================================================================
279 AC_ARG_WITH(android-ndk,
280     AS_HELP_STRING([--with-android-ndk],
281         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
284 AC_ARG_WITH(android-ndk-toolchain-version,
285     AS_HELP_STRING([--with-android-ndk-toolchain-version],
286         [Specify which toolchain version to use, of those present in the
287         Android NDK you are using. Mandatory if the NDK used has several
288         toolchain versions for the host architecture you are building for.
289         Possible values are 4.6, 4.8, clang3.3 and clang3.4. Only 4.8 has been
290         tested for real...]), ,)
292 AC_ARG_WITH(android-sdk,
293     AS_HELP_STRING([--with-android-sdk],
294         [Specify location of the Android SDK. Mandatory when building for Android,
295         or when building the Impress Remote Android app.]),
298 ANDROID_NDK_HOME=
299 if test -n "$with_android_ndk"; then
300     ANDROID_NDK_HOME=$with_android_ndk
302     # Set up a lot of pre-canned defaults
304     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
305         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
306     fi
307     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
309     case $ANDROID_NDK_VERSION in
310     r8*|r9*)
311         ;;
312     *)
313         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* and r9* versions are supported])
314         ;;
315     esac
317     if test $host_cpu = arm; then
318         android_cpu=arm
319         android_platform_prefix=$android_cpu-linux-androideabi
320     elif test $host_cpu = mips; then
321         android_cpu=mips
322         android_platform_prefix=$android_cpu-linux-androideabi
323     else
324         # host_cpu is something like "i386" or "i686" I guess, NDK uses
325         # "x86" in some contexts
326         android_cpu=x86
327         android_platform_prefix=$android_cpu
328     fi
330     case "$with_android_ndk_toolchain_version" in
331     4.6|4.7|4.8)
332         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
333         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
334         ;;
335     clang3.3|clang3.4)
336         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
337         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
338         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
339         ANDROID_USING_CLANG=true
340         ;;
341     *)
342         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
343     esac
345     if test ! -d $ANDROID_BINUTILS_DIR; then
346         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
347     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
348         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
349     fi
351     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
352     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
353     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
354     # manage to link the (app-specific) single huge .so that is built for the apps in
355     # android/experimental/* if there is debug information in a significant part of the object files.
356     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
357     # all objects have been built with debug information.)
358     toolchain_system='*'
359     if test $build_os = linux-gnu; then
360         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
361         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
362         if test $build_cpu = x86_64; then
363             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
364                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
365             fi
366             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
367                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
368             fi
369         fi
370         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
371     fi
373     # This stays empty if there is just one version of the toolchain in the NDK
374     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
375     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
376     */bin\ */bin*)
377         # Trailing slash intentional and necessary, compare to how this is used
378         if test -n "$ANDROID_USING_CLANG"; then
379             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
380         else
381             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
382         fi
383         ;;
384     esac
386     if test $host_cpu = arm; then
387         android_gnu_prefix=arm-linux-androideabi
388     elif test $host_cpu = mips; then
389         android_gnu_prefix=mipsel-linux-android
390     elif test $ANDROID_NDK_VERSION = r8; then
391         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
392         android_gnu_prefix=i686-android-linux
393     else
394         android_gnu_prefix=i686-linux-android
395     fi
397     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu
398     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
399     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
400     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
401     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
402     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
404     if test $host_cpu = arm; then
405         ANDROID_APP_ABI=armeabi-v7a
406         if test -n "$ANDROID_USING_CLANG"; then
407             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
408             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
409             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
410         else
411             :
412         fi
413         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
414         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
415     elif test $host_cpu = mips; then
416         ANDROID_APP_ABI=mips
417         ANDROIDCFLAGS=""
418     else # x86
419         ANDROID_APP_ABI=x86
420         ANDROIDCFLAGS="-march=atom"
421     fi
422     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
423     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
424     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu"
425     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
427     if test -n "$ANDROID_USING_CLANG"; then
428         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
429     else
430         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
431     fi
433     # When using the 4.6 or newer toolchain, use the gold linker
434     case "$with_android_ndk_toolchain_version" in
435     4.[[6789]]*|[[56789]].*|clang*)
436         # The NDK doesn't have ld.gold for MIPS for some reason
437         if test "$host_cpu" != mips -a "$ENABLE_LTO" != TRUE; then
438             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
439         fi
440         ;;
441     esac
443     if test "$ENABLE_LTO" = TRUE; then
444         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
445         # $CC and $CXX when building external libraries
446         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
447     fi
449     # gdbserver can be in different locations
450     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
451         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
452     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
453         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
454     else
455         AC_MSG_ERROR([Can't find gdbserver for your Android target])
456     fi
458     if test $host_cpu = arm; then
459         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"
460     elif test $host_cpu = mips; then
461         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"
462     else # x86
463         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"
464     fi
466     if test -z "$CC"; then
467         case "$with_android_ndk_toolchain_version" in
468         4.*)
469             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
470             ;;
471         clang*)
472             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
473         esac
474     fi
475     if test -z "$CXX"; then
476         case "$with_android_ndk_toolchain_version" in
477         4.*)
478             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
479             ;;
480         clang*)
481             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
482             ;;
483         esac
484     fi
486 AC_SUBST(ANDROID_NDK_GDBSERVER)
487 AC_SUBST(ANDROID_APP_ABI)
489 dnl ===================================================================
490 dnl Also --with-android-sdk is mandatory
491 dnl ===================================================================
492 ANDROID_SDK_HOME=
493 if test -n "$with_android_sdk"; then
494     ANDROID_SDK_HOME=$with_android_sdk
495     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
497 AC_SUBST(ANDROID_SDK_HOME)
499 dnl ===================================================================
500 dnl The following is a list of supported systems.
501 dnl Sequential to keep the logic very simple
502 dnl These values may be checked and reset later.
503 dnl ===================================================================
504 #defaults unless the os test overrides this:
505 test_randr=yes
506 test_xrender=yes
507 test_cups=yes
508 test_dbus=yes
509 test_fontconfig=yes
510 test_cairo=no
512 # Default values, as such probably valid just for Linux, set
513 # differently below just for Mac OSX,but at least better than
514 # hardcoding these as we used to do. Much of this is duplicated also
515 # in solenv for old build system and for gbuild, ideally we should
516 # perhaps define stuff like this only here in configure.ac?
518 LINKFLAGSSHL="-shared"
519 PICSWITCH="-fpic"
520 DLLPOST=".so"
522 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
524 INSTROOTSUFFIX=
525 SDKDIRNAME=sdk
527 case "$host_os" in
529 solaris*)
530     test_gtk=yes
531     build_gstreamer=yes
532     build_gstreamer_0_10=yes
533     test_tde=yes
534     test_kde=yes
535     test_freetype=yes
536     test_gstreamer=yes
537     _os=SunOS
539     dnl ===========================================================
540     dnl Check whether we're using Solaris 10 - SPARC or Intel.
541     dnl ===========================================================
542     AC_MSG_CHECKING([the Solaris operating system release])
543     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
544     if test "$_os_release" -lt "10"; then
545         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
546     else
547         AC_MSG_RESULT([ok ($_os_release)])
548     fi
550     dnl Check whether we're using a SPARC or i386 processor
551     AC_MSG_CHECKING([the processor type])
552     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
553         AC_MSG_RESULT([ok ($host_cpu)])
554     else
555         AC_MSG_ERROR([only SPARC and i386 processors are supported])
556     fi
557     ;;
559 linux-gnu*|k*bsd*-gnu*)
560     test_gtk=yes
561     build_gstreamer=yes
562     build_gstreamer_0_10=yes
563     test_tde=yes
564     test_kde=yes
565     test_kde4=yes
566     test_freetype=yes
567     _os=Linux
568     ;;
570 gnu)
571     test_randr=no
572     test_xrender=no
573     _os=GNU
574      ;;
576 cygwin*|interix*|mingw32*)
578     # When building on Windows normally with MSVC under Cygwin,
579     # configure thinks that the host platform (the platform the
580     # built code will run on) is Cygwin, even if it obviously is
581     # Windows, which in Autoconf terminology is called
582     # "mingw32". (Which is misleading as MinGW is the name of the
583     # tool-chain, not an operating system.)
585     # Somewhat confusing, yes. But this configure script doesn't
586     # look at $host etc that much, it mostly uses its own $_os
587     # variable, set here in this case statement.
589     # When cross-compiling to Windows from Unix, the host platform
590     # is "mingw32" (because in that case it is the MinGW
591     # tool-chain that is used).
593     test_cups=no
594     test_dbus=no
595     test_randr=no
596     test_xrender=no
597     test_freetype=no
598     test_fontconfig=no
599     _os=WINNT
601     DLLPOST=".dll"
602     LINKFLAGSNOUNDEFS=
604     # If the host OS matches "mingw32*", that means we are using the
605     # MinGW cross-compiler, because we don't see the point in building
606     # LibreOffice using MinGW on Windows. If you want to build on
607     # Windows, use MSVC. If you want to use MinGW, surely you want to
608     # cross-compile (from Linux or some other Unix).
610     case "$host_os" in
611     mingw32*)
612         WITH_MINGW=yes
613         if test -z "$CC"; then
614             CC="$host_cpu-$host_vendor-$host_os-gcc"
615         fi
616         if test -z "$CXX"; then
617             CXX="$host_cpu-$host_vendor-$host_os-g++"
618         fi
619         ;;
620     esac
621     ;;
623 darwin*) # Mac OS X or iOS
624     test_gtk=yes
625     test_randr=no
626     test_xrender=no
627     test_freetype=no
628     test_fontconfig=no
629     test_dbus=no
630     if test "$host_cpu" = "arm"; then
631         _os=iOS
632         test_gtk=no
633         test_cups=no
634     else
635         _os=Darwin
636         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
637         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
638     fi
639     enable_systray=no
640     # See comment above the case "$host_os"
641     LINKFLAGSSHL="-dynamiclib -single_module"
643     # -fPIC is default
644     PICSWITCH=""
646     DLLPOST=".dylib"
648     # -undefined error is the default
649     LINKFLAGSNOUNDEFS=""
652 freebsd*)
653     test_gtk=yes
654     build_gstreamer=yes
655     build_gstreamer_0_10=yes
656     test_tde=yes
657     test_kde=yes
658     test_kde4=yes
659     test_freetype=yes
660     AC_MSG_CHECKING([the FreeBSD operating system release])
661     if test -n "$with_os_version"; then
662         OSVERSION="$with_os_version"
663     else
664         OSVERSION=`/sbin/sysctl -n kern.osreldate`
665     fi
666     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
667     AC_MSG_CHECKING([which thread library to use])
668     if test "$OSVERSION" -lt "500016"; then
669         PTHREAD_CFLAGS="-D_THREAD_SAFE"
670         PTHREAD_LIBS="-pthread"
671     elif test "$OSVERSION" -lt "502102"; then
672         PTHREAD_CFLAGS="-D_THREAD_SAFE"
673         PTHREAD_LIBS="-lc_r"
674     else
675         PTHREAD_CFLAGS=""
676         PTHREAD_LIBS="-pthread"
677     fi
678     AC_MSG_RESULT([$PTHREAD_LIBS])
679     _os=FreeBSD
680     ;;
682 *netbsd*)
683     test_gtk=yes
684     build_gstreamer=yes
685     build_gstreamer_0_10=yes
686     test_tde=no
687     test_kde=no
688     test_kde4=yes
689     test_freetype=yes
690     PTHREAD_LIBS="-pthread -lpthread"
691     _os=NetBSD
692     ;;
694 aix*)
695     test_randr=no
696     test_freetype=yes
697     PTHREAD_LIBS=-pthread
698     _os=AIX
699     ;;
701 openbsd*)
702     test_gtk=yes
703     test_tde=yes
704     test_kde=yes
705     test_freetype=yes
706     PTHREAD_CFLAGS="-D_THREAD_SAFE"
707     PTHREAD_LIBS="-pthread"
708     _os=OpenBSD
709     ;;
711 dragonfly*)
712     test_gtk=yes
713     build_gstreamer=yes
714     build_gstreamer_0_10=yes
715     test_tde=yes
716     test_kde=yes
717     test_kde4=yes
718     test_freetype=yes
719     PTHREAD_LIBS="-pthread"
720     _os=DragonFly
721     ;;
723 linux-android*)
724     build_gstreamer=no
725     build_gstreamer_0_10=no
726     enable_lotuswordpro=no
727     enable_mpl_subset=yes
728     enable_opengl=no
729     enable_coinmp=yes
730     enable_lpsolve=no
731     enable_report_builder=no
732     with_theme="tango"
733     test_cups=no
734     test_dbus=no
735     test_fontconfig=no
736     test_freetype=no
737     test_gtk=no
738     test_tde=no
739     test_kde=no
740     test_kde4=no
741     test_randr=no
742     test_xrender=no
743     _os=Android
745     if test -z "$with_android_ndk"; then
746         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
747     fi
749     if test -z "$with_android_ndk_toolchain_version"; then
750         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
751     fi
753     # Verify that the NDK and SDK options are proper
754     if test ! -f "$ANDROID_NDK_HOME/platforms/android-15/arch-arm/usr/lib/libc.a"; then
755         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
756     fi
758     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
759     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
760     ;;
763     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
764     ;;
765 esac
767 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
768     if test -z "$with_android_sdk"; then
769         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
770     fi
772     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
773         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
774     fi
777 if test "$_os" = "AIX"; then
778     AC_PATH_PROG(GAWK, gawk)
779     if test -z "$GAWK"; then
780         AC_MSG_ERROR([gawk not found in \$PATH])
781     fi
784 AC_SUBST(SDKDIRNAME)
786 AC_SUBST(WITH_MINGW)
787 AC_SUBST(PTHREAD_CFLAGS)
788 AC_SUBST(PTHREAD_LIBS)
790 ###############################################################################
791 # Extensions switches --enable/--disable
792 ###############################################################################
793 # By default these should be enabled unless having extra dependencies.
794 # If there is extra dependency over configure options then the enable should
795 # be automagic based on whether the requiring feature is enabled or not.
796 # All this options change anything only with --enable-extension-integration.
798 # The name of this option and its help string makes it sound as if
799 # extensions are built anyway, just not integrated in the installer,
800 # if you use --disable-extension-integration. Is that really the
801 # case?
803 AC_ARG_ENABLE(extension-integration,
804     AS_HELP_STRING([--disable-extension-integration],
805         [Disable integration of the built extensions in the installer of the
806          product. Use this switch to disable the integration.])
809 AC_ARG_ENABLE(export,
810     AS_HELP_STRING([--disable-export],
811         [Disable (some) code for document export. Useful when building viewer-only apps that lack
812          save/export functionality, to avoid having an excessive amount of code and data used
813          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
816 AC_ARG_ENABLE(avmedia,
817     AS_HELP_STRING([--disable-avmedia],
818         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
821 AC_ARG_ENABLE(database-connectivity,
822     AS_HELP_STRING([--disable-database-connectivity],
823         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
826 # This doesn't mean not building (or "integrating") extensions
827 # (although it probably should; i.e. it should imply
828 # --disable-extension-integration I guess), it means not supporting
829 # any extension mechanism at all
830 AC_ARG_ENABLE(extensions,
831     AS_HELP_STRING([--disable-extensions],
832         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
835 AC_ARG_ENABLE(scripting,
836     AS_HELP_STRING([--disable-scripting],
837         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
840 # This is mainly for Android and iOS, but could potentially be used in some
841 # special case otherwise, too, so factored out as a separate setting
843 AC_ARG_ENABLE(dynamic-loading,
844     AS_HELP_STRING([--disable-dynamic-loading],
845         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
848 AC_ARG_ENABLE(ext-mariadb-connector,
849     AS_HELP_STRING([--enable-ext-mariadb-connector],
850         [Enable the build of the MariaDB/MySQL Connector extension.])
853 AC_ARG_ENABLE(report-builder,
854     AS_HELP_STRING([--disable-report-builder],
855         [Disable the Report Builder.])
858 AC_ARG_ENABLE(ext-wiki-publisher,
859     AS_HELP_STRING([--enable-ext-wiki-publisher],
860         [Enable the Wiki Publisher extension.])
863 AC_ARG_ENABLE(lpsolve,
864     AS_HELP_STRING([--disable-lpsolve],
865         [Disable compilation of the lp solve solver ])
867 AC_ARG_ENABLE(coinmp,
868     AS_HELP_STRING([--disable-coinmp],
869         [Disable compilation of the CoinMP solver ])
872 AC_ARG_ENABLE(pdfimport,
873     AS_HELP_STRING([--disable-pdfimport],
874         [Disable building the PDF import feature.])
877 ###############################################################################
879 dnl ---------- *** ----------
881 AC_ARG_ENABLE([hardlink-deliver],
882     AS_HELP_STRING([--enable-hardlink-deliver],
883         [Put files into deliver folder as hardlinks instead of copying them
884         over. Saves space and speeds up build.])
887 AC_ARG_ENABLE(mergelibs,
888     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
889         [Enables linking of big, merged, library. Experimental feature, tested
890         only for Linux at some stage in history, but possibly does not work even
891         for Linux any more. 'all' will link a lot of libraries into libmerged
892         while 'yes' will do it for just a core set of libraries.])
895 AC_ARG_ENABLE(graphite,
896     AS_HELP_STRING([--enable-graphite],
897         [Enables the compilation of Graphite smart font rendering.])
900 AC_ARG_ENABLE(orcus,
901     AS_HELP_STRING([--enable-orcus],
902         [Enables orcus for extra file import filters for Calc.])
905 AC_ARG_ENABLE(fetch-external,
906     AS_HELP_STRING([--disable-fetch-external],
907         [Disables fetching external tarballs from web sources.])
910 AC_ARG_ENABLE(lockdown,
911     AS_HELP_STRING([--disable-lockdown],
912         [Disables the gconf integration work in LibreOffice.]),
915 AC_ARG_ENABLE(vba,
916     AS_HELP_STRING([--disable-vba],
917         [Disables the vba compatibility feature.])
920 AC_ARG_ENABLE(pch,
921     AS_HELP_STRING([--enable-pch],
922         [Enables precompiled header support for C++.])
925 AC_ARG_ENABLE(win-mozab-driver,
926     AS_HELP_STRING([--enable-win-mozab-driver],
927         [LibreOffice includes a driver to connect to Mozilla
928          address books under Windows, to build with this version, use this option.])
931 AC_ARG_ENABLE(epm,
932     AS_HELP_STRING([--enable-epm],
933         [LibreOffice includes self-packaging code, that requires epm, however epm is
934          useless for large scale package building.])
937 AC_ARG_ENABLE(odk,
938     AS_HELP_STRING([--disable-odk],
939         [LibreOffice includes an ODK, office development kit which some packagers may
940          wish to build without.])
943 AC_ARG_ENABLE(mpl-subset,
944     AS_HELP_STRING([--enable-mpl-subset],
945         [Don't compile any pieces which are not MPL or more liberally licensed])
948 AC_ARG_ENABLE(evolution2,
949     AS_HELP_STRING([--enable-evolution2],
950         [Allows the built-in evolution 2 addressbook connectivity build to be
951          enabled.])
954 AC_ARG_ENABLE(directx,
955     AS_HELP_STRING([--disable-directx],
956         [Remove DirectX implementation for the new XCanvas interface.
957          The DirectX support requires more stuff installed on Windows to
958          compile. (DirectX SDK, GDI+ libs)])
961 AC_ARG_ENABLE(activex,
962     AS_HELP_STRING([--disable-activex],
963         [Disable the use of ActiveX for a Windows build.
964         This switch is mandatory when using an Express edition of Visual Studio.])
967 AC_ARG_ENABLE(atl,
968     AS_HELP_STRING([--disable-atl],
969         [Disable the use of ATL for a Windows build.])
970     [
971         This switch is mandatory when using an Express edition of Visual Studio.
972     ],
975 AC_ARG_ENABLE(avahi,
976     AS_HELP_STRING([--enable-avahi],
977         [Determines whether to use Avahi to advertise Impress to remote controls.]),
980 AC_ARG_ENABLE(werror,
981     AS_HELP_STRING([--enable-werror],
982         [Turn warnings to errors. (Has no effect in modules where the treating
983          of warnings as errors is disabled explicitly.)]),
986 AC_ARG_ENABLE(assert-always-abort,
987     AS_HELP_STRING([--enable-assert-always-abort],
988         [make assert() abort even in release code.]),
991 AC_ARG_ENABLE(dbgutil,
992     AS_HELP_STRING([--enable-dbgutil],
993         [Provide debugging support from --enable-debug and include additional debugging
994          utilities such as object counting or more expensive checks.
995          This is the recommended option for developers.
996          Note that this makes the build ABI incompatible, it is not possible to mix object
997          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
999 AC_ARG_ENABLE(debug,
1000     AS_HELP_STRING([--enable-debug],
1001         [Include debugging information, disable compiler optimization and inlining plus
1002          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1004 AC_ARG_ENABLE(selective-debuginfo,
1005     AS_HELP_STRING([--enable-selective-debuginfo],
1006         [If --enable-debug or --enable-dbgutil is used, build debugging information
1007          (-g compiler flag) only for the specified gbuild build targets
1008          (where all means everything, - prepended means not to enable, / appended means
1009          everything in the directory; there is no ordering, more specific overrides
1010          more general, and disabling takes precedence).
1011          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1013 AC_ARG_ENABLE(symbols,
1014     AS_HELP_STRING([--enable-symbols],
1015         [Include debugging symbols in output while preserve optimization.
1016          This enables -g compiler flag for GCC or equivalent,
1017          without changing anything else compared to productive code.]))
1019 AC_ARG_ENABLE(runtime-optimizations,
1020     AS_HELP_STRING([--disable-runtime-optimizations],
1021         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1022          JVM JIT) that are known to interact badly with certain dynamic analysis
1023          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1024          CC contains "-fsanitize=address".  (For Valgrind, those runtime
1025          optimizations are typcially disabled dynamically via
1026          RUNNING_ON_VALGRIND.)]))
1028 AC_ARG_ENABLE(compiler-plugins,
1029     AS_HELP_STRING([--enable-compiler-plugins],
1030         [Enable compiler plugins that will perform additional checks during
1031          building. Enabled automatically by --enable-dbgutil.]))
1033 AC_ARG_ENABLE(ooenv,
1034     AS_HELP_STRING([--disable-ooenv],
1035         [Disable ooenv for the instdir installation.]))
1037 AC_ARG_ENABLE(lto,
1038     AS_HELP_STRING([--enable-lto],
1039         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1040          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
1041          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
1042          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
1043          are working on it.)]))
1045 AC_ARG_ENABLE(crashdump,
1046     AS_HELP_STRING([--enable-crashdump],
1047         [Enable the crashdump feature.]))
1049 AC_ARG_ENABLE(python,
1050     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1051         [Enables or disables Python support at run-time and build-time.
1052          Also specifies what Python to use. 'auto' is the default.
1053          'fully-internal' even forces the internal version for uses of Python
1054          during the build.]))
1056 AC_ARG_ENABLE(gtk,
1057     AS_HELP_STRING([--disable-gtk],
1058         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1059 ,enable_gtk=yes)
1061 AC_ARG_ENABLE(gtk3,
1062     AS_HELP_STRING([--enable-gtk3],
1063         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1064 ,enable_gtk3=no)
1066 AC_ARG_ENABLE(systray,
1067     AS_HELP_STRING([--disable-systray],
1068         [Determines whether to build the systray quickstarter.]),
1069 ,enable_systray=yes)
1071 AC_ARG_ENABLE(split-app-modules,
1072     AS_HELP_STRING([--enable-split-app-modules],
1073         [Split file lists for app modules, e.g. base, calc.
1074          Has effect only with make distro-pack-install]),
1077 AC_ARG_ENABLE(split-opt-features,
1078     AS_HELP_STRING([--enable-split-opt-features],
1079         [Split file lists for some optional features, .e.g. pyuno, testtool.
1080          Has effect only with make distro-pack-install]),
1083 AC_ARG_ENABLE(cairo-canvas,
1084 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1085                           platforms where Cairo is available.
1088 AC_ARG_ENABLE(opengl,
1089     AS_HELP_STRING([--disable-opengl],
1090         [Determines whether to build the OpenGL 3D slide transitions and canvas component.]))
1092 AC_ARG_ENABLE(opencl,
1093     AS_HELP_STRING([--disable-opencl],
1094         [Determines whether to build with OpenCL support.]))
1096 AC_ARG_ENABLE(dbus,
1097     AS_HELP_STRING([--disable-dbus],
1098         [Determines whether to enable features that depend on dbus.
1099          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1100 ,enable_dbus=yes)
1102 AC_ARG_ENABLE(packagekit,
1103     AS_HELP_STRING([--enable-packagekit],
1104         [Determines whether to enable features using packagekit.
1105          Right now that is auto font install]),
1108 AC_ARG_ENABLE(sdremote,
1109     AS_HELP_STRING([--disable-sdremote],
1110         [Determines whether to enable Impress remote control (i.e. the server component).]),
1111 ,enable_sdremote=yes)
1113 AC_ARG_ENABLE(sdremote-bluetooth,
1114     AS_HELP_STRING([--disable-sdremote-bluetooth],
1115         [Determines whether to build sdremote with bluetooth support.
1116          Requires dbus on Linux.]))
1118 AC_ARG_ENABLE(sdremote-android,
1119     AS_HELP_STRING([--enable-sdremote-android],
1120         [Determines whether to build the Impress Remote Android app -- requires
1121         a correctly configured android sdk.]),
1122 ,enable_sdremote_android=no)
1124 AC_ARG_ENABLE(gconf,
1125     AS_HELP_STRING([--disable-gconf],
1126         [Determines whether to use the GConf support.]),
1127 ,enable_gconf=yes)
1129 AC_ARG_ENABLE(gnome-vfs,
1130     AS_HELP_STRING([--enable-gnome-vfs],
1131         [Determines whether to use the Gnome Virtual Filing System on platforms
1132          where that VFS is available.]),
1133 ,enable_gnome_vfs=no)
1135 AC_ARG_ENABLE(gio,
1136     AS_HELP_STRING([--disable-gio],
1137         [Determines whether to use the GIO support.]),
1138 ,enable_gio=yes)
1140 AC_ARG_ENABLE(telepathy,
1141     AS_HELP_STRING([--enable-telepathy],
1142         [Determines whether to enable Telepathy for collaboration.]),
1143 ,enable_telepathy=no)
1145 AC_ARG_ENABLE(tde,
1146     AS_HELP_STRING([--enable-tde],
1147         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1148          TDE are available.]),
1151 AC_ARG_ENABLE(tdeab,
1152     AS_HELP_STRING([--disable-tdeab],
1153         [Disable the TDE address book support.]),
1155     if test "$enable_tde" = "yes"; then
1156         enable_tdeab=yes
1157     fi
1160 AC_ARG_ENABLE(kde,
1161     AS_HELP_STRING([--enable-kde],
1162         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1163          KDE3 are available.]),
1166 AC_ARG_ENABLE(kdeab,
1167     AS_HELP_STRING([--disable-kdeab],
1168         [Disable the KDE3 address book support.]),
1170     if test "$enable_kde" = "yes"; then
1171         enable_kdeab=yes
1172     fi
1175 AC_ARG_ENABLE(kde4,
1176     AS_HELP_STRING([--enable-kde4],
1177         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1178          KDE4 are available. May be used with --enable-kde if you want to support
1179          both KDE3 and KDE4.]),
1182 AC_ARG_ENABLE(headless,
1183     AS_HELP_STRING([--enable-headless],
1184         [Disable building of GUIs to reduce dependencies. Useful for
1185         server usage. Work in progress, use only if you are hacking on
1186         it. Not related to the --headless option.]), ,)
1188 AC_ARG_ENABLE(randr,
1189     AS_HELP_STRING([--disable-randr],
1190         [Disable RandR support in the vcl project.]),
1191 ,enable_randr=yes)
1193 AC_ARG_ENABLE(randr-link,
1194     AS_HELP_STRING([--disable-randr-link],
1195         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1196 ,enable_randr_link=yes)
1198 AC_ARG_ENABLE(gstreamer,
1199     AS_HELP_STRING([--enable-gstreamer],
1200         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1201 ,enable_gstreamer=no)
1203 AC_ARG_ENABLE(gstreamer-0-10,
1204     AS_HELP_STRING([--disable-gstreamer-0-10],
1205         [Disable building the gstreamer avmedia backend.]),
1206 ,enable_gstreamer_0_10=yes)
1208 AC_ARG_ENABLE(vlc,
1209     AS_HELP_STRING([--enable-vlc],
1210         [Enable building with the VLC avmedia backend.]),
1211 ,enable_vlc=no)
1213 AC_ARG_ENABLE(neon,
1214     AS_HELP_STRING([--disable-neon],
1215         [Disable neon and the compilation of webdav binding.]),
1218 AC_ARG_ENABLE([eot],
1219     [AS_HELP_STRING([--enable-eot],
1220         [Enable support for Embedded OpenType fonts.])],
1221 , [enable_eot=no])
1223 AC_ARG_ENABLE(cve-tests,
1224     AS_HELP_STRING([--disable-cve-tests],
1225         [Prevent CVE tests to be executed]),
1228 AC_ARG_ENABLE(chart-tests,
1229     AS_HELP_STRING([--enable-chart-tests],
1230         [Executes chart XShape tests]),
1233 AC_ARG_ENABLE(build-unowinreg,
1234     AS_HELP_STRING([--enable-build-unowinreg],
1235         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1236          compiler is needed on Linux.])
1237     [
1238                           Usage:     --enable-build-unowinreg
1239     ],
1242 AC_ARG_ENABLE(verbose,
1243     AS_HELP_STRING([--enable-verbose],
1244         [Increase build verbosity.])[
1245   --disable-verbose       Decrease build verbosity.],
1248 AC_ARG_ENABLE(dependency-tracking,
1249     AS_HELP_STRING([--enable-dependency-tracking],
1250         [Do not reject slow dependency extractors.])[
1251   --disable-dependency-tracking
1252                           Disables generation of dependency information.
1253                           Speed up one-time builds.],
1256 AC_ARG_ENABLE(icecream,
1257     AS_HELP_STRING([--enable-icecream],
1258         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1259          It defaults to /opt/icecream for the location of the icecream gcc/g++
1260          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1263 AC_ARG_ENABLE(cups,
1264     AS_HELP_STRING([--disable-cups],
1265         [Do not build cups support.])
1268 AC_ARG_ENABLE(ccache,
1269     AS_HELP_STRING([--disable-ccache],
1270         [Do not try to use ccache automatically.
1271          By default, we will try to detect if ccache is available; in that case if
1272          CC/CXX are not yet set, and --enable-icecream is not given, we
1273          attempt to use ccache. --disable-ccache disables ccache completely.
1277 AC_ARG_ENABLE(64-bit,
1278     AS_HELP_STRING([--enable-64-bit],
1279         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit. Works fine for OS
1280          X. In other cases this option is experimental and possibly quite broken, use only if you are
1281          hacking on 64-bit support.]), ,)
1283 AC_ARG_ENABLE(extra-gallery,
1284     AS_HELP_STRING([--enable-extra-gallery],
1285         [Add extra gallery content.]),
1288 AC_ARG_ENABLE(extra-template,
1289     AS_HELP_STRING([--enable-extra-template],
1290         [Add extra template content.]),
1293 AC_ARG_ENABLE(extra-sample,
1294     AS_HELP_STRING([--enable-extra-sample],
1295         [Add extra sample content.]),
1298 AC_ARG_ENABLE(extra-font,
1299     AS_HELP_STRING([--enable-extra-font],
1300         [Add extra font content.]),
1303 AC_ARG_ENABLE(online-update,
1304     AS_HELP_STRING([--enable-online-update],
1305         [Enable the online update service that will check for new versions of
1306          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1309 AC_ARG_ENABLE(release-build,
1310     AS_HELP_STRING([--enable-release-build],
1311         [Enable release build.
1312          See http://wiki.documentfoundation.org/DevBuild]),
1315 AC_ARG_ENABLE(windows-build-signing,
1316     AS_HELP_STRING([--enable-windows-build-signing],
1317         [Enable signing of windows binaries (*.exe, *.dll)]),
1320 AC_ARG_ENABLE(silent-msi,
1321     AS_HELP_STRING([--enable-silent-msi],
1322         [Enable MSI with LIMITUI=1 (silent install).]),
1325 AC_ARG_ENABLE(macosx-retina,
1326     AS_HELP_STRING([--enable-macosx-retina],
1327         [Declare the application as High Resolution Capable. (retina display)
1328          ]),
1331 AC_ARG_ENABLE(macosx-code-signing,
1332     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1333         [Sign executables, dylibs, frameworks and the app bundle. If you
1334          don't provide an identity the first suitable certificate
1335          in your keychain is used.]),
1338 AC_ARG_ENABLE(macosx-package-signing,
1339     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1340         [Create a .pkg suitable for uploading to the Mac App Store and sign
1341          it. If you don't provide an identity the first suitable certificate
1342          in your keychain is used.]),
1345 AC_ARG_ENABLE(macosx-sandbox,
1346     AS_HELP_STRING([--enable-macosx-sandbox],
1347         [Make the app bundle run in a sandbox. Requires code signing.
1348          Is required by apps distributed in the Mac App Store, and implies
1349          adherence to App Store rules.]),
1352 AC_ARG_ENABLE(canonical-installation-tree-structure,
1353     AS_HELP_STRING([--enable-canonical-installation-tree-structure],
1354         [Make the installation tree structure be more canonical for
1355          the platform. Implemented only for OS X. Experimental and currently broken.]),
1359 AC_ARG_WITH(macosx-bundle-identifier,
1360     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1361         [Define the OS X bundle identifier. Default is the somewhat weird
1362          org.libreoffice.script ("script", huh?).]),
1363 ,with_macosx_bundle_identifier=org.libreoffice.script)
1365 AC_ARG_WITH(macosx-app-name,
1366     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1367         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1368 ,with_macosx_app_name=$PRODUCTNAME)
1370 AC_ARG_ENABLE(ios-simulator,
1371     AS_HELP_STRING([--enable-ios-simulator],
1372         [Build for the iOS Simulator, not iOS device.]),
1375 AC_ARG_ENABLE(readonly-installset,
1376     AS_HELP_STRING([--enable-readonly-installset],
1377         [Prevents any attempts by LibreOffice to write into its installation. That means
1378          at least that no "system-wide" extensions can be added. Experimental work in
1379          progress.]),
1382 AC_ARG_ENABLE(postgresql-sdbc,
1383     AS_HELP_STRING([--disable-postgresql-sdbc],
1384         [Disable the build of the PostgreSQL-SDBC driver.])
1387 AC_ARG_ENABLE(lotuswordpro,
1388     AS_HELP_STRING([--disable-lotuswordpro],
1389         [Disable the build of the Lotus Word Pro filter.]),
1390 ,enable_lotuswordpro=yes)
1392 AC_ARG_ENABLE(firebird-sdbc,
1393     AS_HELP_STRING([--disable-firebird-sdbc],
1394         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1395 ,enable_firebird_sdbc=yes)
1397 AC_ARG_ENABLE(winegcc,
1398     AS_HELP_STRING([--enable-winegcc],
1399         [Enable use of winegcc during the build, in order to create msi* tools
1400          needed for MinGW cross-compilation.]),
1403 AC_ARG_ENABLE(liblangtag,
1404     AS_HELP_STRING([--disable-liblangtag],
1405         [Disable use of liblangtag, and instead use an own simple
1406          implementation.]),
1409 AC_ARG_ENABLE(bogus-pkg-config,
1410     AS_HELP_STRING([--enable-bogus-pkg-config],
1411         [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.]),
1414 AC_ARG_ENABLE(openssl,
1415     AS_HELP_STRING([--disable-openssl],
1416         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1417          components will either use GNUTLS or NSS. Work in progress,
1418          use only if you are hacking on it.]),
1419 ,enable_openssl=yes)
1421 AC_ARG_ENABLE(library-bin-tar,
1422     AS_HELP_STRING([--enable-library-bin-tar],
1423         [Enable the building and reused of tarball of binary build for some 'external' libraries
1424         Some libraries can save their build result in a tarball
1425         stored in TARFILE_LOCATION. that binary tarball is
1426         uniquely identified by the source tarbal,
1427         the content of the config_host.mk file and the content
1428         of the top-level directory in core for that library
1429         If this option is enabled, then if such a tarfile exist, it will be untarred
1430         isntead of the source tarfile, and the build step will be skipped for that
1431         library.
1432         If a proper tarfile does not exist, then the normal source-based
1433         build is done for taht library and a proper binary tarfile is created
1434         for the next time.]),
1437 AC_ARG_ENABLE(gltf,
1438     AS_HELP_STRING([--disable-gltf],
1439         [Determines whether to build libraries related to glTF 3D model rendering.]))
1441 dnl ===================================================================
1442 dnl Optional Packages (--with/without-)
1443 dnl ===================================================================
1445 AC_ARG_WITH(gnu-patch,
1446     AS_HELP_STRING([--with-gnu-patch],
1447         [Specify location of GNU patch on Solaris or FreeBSD.]),
1450 AC_ARG_WITH(build-platform-configure-options,
1451         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1453 AC_ARG_WITH(gnu-cp,
1454     AS_HELP_STRING([--with-gnu-cp],
1455         [Specify location of GNU cp on Solaris or FreeBSD.]),
1458 AC_ARG_WITH(external-tar,
1459     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1460         [Specify an absolute path of where to find (and store) tarfiles.]),
1461     TARFILE_LOCATION=$withval ,
1464 AC_ARG_WITH(referenced-git,
1465     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1466         [Specify another checkout directory to reference. This makes use of
1467                  git submodule update --reference, and saves a lot of diskspace
1468                  when having multiple trees side-by-side.]),
1469     GIT_REFERENCE_SRC=$withval ,
1472 AC_ARG_WITH(linked-git,
1473     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1474         [Specify a directory where the repositories of submodules are located.
1475          This uses a method similar to git-new-workdir to get submodules.]),
1476     GIT_LINK_SRC=$withval ,
1479 AC_ARG_WITH(galleries,
1480     AS_HELP_STRING([--with-galleries],
1481         [Specify how galleries should be built. It is possible either to
1482          build these internally from source ("build"),
1483          or to disable them ("no")]),
1486 AC_ARG_WITH(theme,
1487     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1488         [Choose which themes to include. By default those themes with an '*' are included.
1489          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1492 AC_ARG_WITH(helppack-integration,
1494   --without-helppack-integration      It will not integrate the helppacks to the installer
1495                           of the product.
1496                           Please use this switch to use the online help or separate help packages.],
1499 AC_ARG_WITH(fonts,
1500     AS_HELP_STRING([--without-fonts],
1501         [LibreOffice includes some third-party fonts to provide a reliable basis for
1502          help content, templates, samples, etc. When these fonts are already
1503          known to be available on the system then you should use this option.]),
1506 AC_ARG_WITH(ppds,
1507     AS_HELP_STRING([--without-ppds],
1508         [Removes Postscript Printer definition files from LibreOffice
1509          installation set, for people building for specific distributions where
1510          PPDs are known to be already available (every recent distro with CUPS backend).]),
1513 AC_ARG_WITH(epm,
1514     AS_HELP_STRING([--with-epm],
1515         [Decides which epm to use. Default is to use the one from the system if
1516          one is built. When either this is not there or you say =internal epm
1517          will be built.]),
1520 AC_ARG_WITH(package-format,
1521     AS_HELP_STRING([--with-package-format],
1522         [Specify package format(s) for LibreOffice installation sets. The
1523          implicit --without-package-format leads to no installation sets being
1524          generated. Possible values: aix, archive, bsd, deb, dmg,
1525          installed, msi, native, pkg, portable, and rpm.
1526          Example: --with-package-format='deb rpm']),
1529 AC_ARG_WITH(tls,
1530     AS_HELP_STRING([--with-tls],
1531         [Decides which TLS/SSL and cryptographic implementations to use for
1532          LibreOffice's code. Notice that this doesn't apply for depending
1533          libraries like "neon", for example. Default is to use OpenSSL
1534          although NSS is also possible. Notice that selecting NSS restricts
1535          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1536          restrict by now the usage of NSS in LO's code. Possible values:
1537          openssl, nss. Example: --with-tls="nss"]),
1540 AC_ARG_WITH(system-libs,
1541     AS_HELP_STRING([--with-system-libs],
1542         [Use libraries already on system -- enables all --with-system-* flags.]),
1545 AC_ARG_WITH(system-headers,
1546     AS_HELP_STRING([--with-system-headers],
1547         [Use headers already on system -- enables all --with-system-* flags for
1548          external packages whose headers are the only entities used i.e.
1549          boost/vigra/odbc/sane-header(s).]),,
1550     [with_system_headers="$with_system_libs"])
1552 AC_ARG_WITH(system-jars,
1553     AS_HELP_STRING([--without-system-jars],
1554         [When building with --with-system-libs, also the needed jars are expected
1555          on the system. Use this to disable that]),,
1556     [with_system_jars="$with_system_libs"])
1558 AC_ARG_WITH(system-cairo,
1559     AS_HELP_STRING([--with-system-cairo],
1560         [Use cairo libraries already on system.  Happens automatically for
1561          (implicit) --enable-gtk and for --enable-gtk3.]))
1563 AC_ARG_WITH(myspell-dicts,
1564     AS_HELP_STRING([--with-myspell-dicts],
1565         [Adds myspell dictionaries to the LibreOffice installation set]),
1568 AC_ARG_WITH(system-dicts,
1569     AS_HELP_STRING([--without-system-dicts],
1570         [Do not use dictionaries from system paths.]),
1573 AC_ARG_WITH(external-dict-dir,
1574     AS_HELP_STRING([--with-external-dict-dir],
1575         [Specify external dictionary dir.]),
1578 AC_ARG_WITH(external-hyph-dir,
1579     AS_HELP_STRING([--with-external-hyph-dir],
1580         [Specify external hyphenation pattern dir.]),
1583 AC_ARG_WITH(external-thes-dir,
1584     AS_HELP_STRING([--with-external-thes-dir],
1585         [Specify external thesaurus dir.]),
1588 AC_ARG_WITH(system-zlib,
1589     AS_HELP_STRING([--with-system-zlib],
1590         [Use zlib already on system.]),,
1591     [with_system_zlib=auto])
1593 AC_ARG_WITH(system-jpeg,
1594     AS_HELP_STRING([--with-system-jpeg],
1595         [Use jpeg already on system.]),,
1596     [with_system_jpeg=auto])
1598 AC_ARG_WITH(system-clucene,
1599     AS_HELP_STRING([--with-system-clucene],
1600         [Use clucene already on system.]),,
1601     [with_system_clucene="$with_system_libs"])
1603 AC_ARG_WITH(system-expat,
1604     AS_HELP_STRING([--with-system-expat],
1605         [Use expat already on system.]),,
1606     [with_system_expat="$with_system_libs"])
1608 AC_ARG_WITH(system-libxml,
1609     AS_HELP_STRING([--with-system-libxml],
1610         [Use libxml/libxslt already on system.]),,
1611     [with_system_libxml=auto])
1613 AC_ARG_WITH(system-icu,
1614     AS_HELP_STRING([--with-system-icu],
1615         [Use icu already on system.]),,
1616     [with_system_icu="$with_system_libs"])
1618 AC_ARG_WITH(system-ucpp,
1619     AS_HELP_STRING([--with-system-ucpp],
1620         [Use ucpp already on system.]),,
1621     [])
1623 AC_ARG_WITH(system-openldap,
1624     AS_HELP_STRING([--with-system-openldap],
1625         [Use the OpenLDAP LDAP SDK already on system.]),,
1626     [with_system_openldap="$with_system_libs"])
1628 AC_ARG_WITH(system-poppler,
1629     AS_HELP_STRING([--with-system-poppler],
1630         [Use system poppler (only needed for PDF import).]),,
1631     [with_system_poppler="$with_system_libs"])
1633 AC_ARG_WITH(system-apache-commons,
1634     AS_HELP_STRING([--with-system-apache-commons],
1635         [Use Apache commons libraries already on system.]),,
1636     [with_system_apache_commons="$with_system_jars"])
1638 AC_ARG_WITH(system-mariadb,
1639     AS_HELP_STRING([--with-system-mariadb],
1640         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1641          extension.]),,
1642     [with_system_mariadb="$with_system_libs"])
1644 AC_ARG_ENABLE(bundle-mariadb,
1645     AS_HELP_STRING([--enable-bundle-mariadb],
1646         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1649 AC_ARG_WITH(system-mysql-cppconn,
1650     AS_HELP_STRING([--with-system-mysql-cppconn],
1651         [Use MySQL C++ Connector libraries already on system.]),,
1652     [with_system_mysql_cppconn="$with_system_libs"])
1654 AC_ARG_WITH(system-postgresql,
1655     AS_HELP_STRING([--with-system-postgresql],
1656         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1657          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1658     [with_system_postgresql="$with_system_libs"])
1660 AC_ARG_WITH(libpq-path,
1661     AS_HELP_STRING([--with-libpq-path],
1662         [Use this PostgreSQL C interface (libpq) installation for building
1663          the PostgreSQL-SDBC extension.])
1664     [
1665                           Usage:     --with-libpq-path=<absolute path to
1666                                                   your libpq installation>
1667     ],
1670 AC_ARG_WITH(system-firebird,
1671     AS_HELP_STRING([--with-system-firebird],
1672         [Use Firebird libraries already on system, for building the Firebird-SDBC
1673          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1674     [with_system_firebird="$with_system_libs"])
1676 AC_ARG_WITH(system-hsqldb,
1677     AS_HELP_STRING([--with-system-hsqldb],
1678         [Use hsqldb already on system.]))
1680 AC_ARG_WITH(hsqldb-jar,
1681     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1682         [Specify path to jarfile manually.]),
1683     HSQLDB_JAR=$withval)
1685 AC_ARG_ENABLE(scripting-beanshell,
1686     AS_HELP_STRING([--disable-scripting-beanshell],
1687         [Disable support for scripts in BeanShell.]),
1691 AC_ARG_WITH(system-beanshell,
1692     AS_HELP_STRING([--with-system-beanshell],
1693         [Use beanshell already on system.]),,
1694     [with_system_beanshell="$with_system_jars"])
1696 AC_ARG_WITH(beanshell-jar,
1697     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1698         [Specify path to jarfile manually.]),
1699     BSH_JAR=$withval)
1701 AC_ARG_ENABLE(scripting-javascript,
1702     AS_HELP_STRING([--disable-scripting-javascript],
1703         [Disable support for scripts in JavaScript.]),
1707 AC_ARG_WITH(system-rhino,
1708     AS_HELP_STRING([--with-system-rhino],
1709         [Use rhino already on system.]),,)
1710 #    [with_system_rhino="$with_system_jars"])
1711 # Above is not used as we have different debug interface
1712 # patched into internal rhino. This code needs to be fixed
1713 # before we can enable it by default.
1715 AC_ARG_WITH(rhino-jar,
1716     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1717         [Specify path to jarfile manually.]),
1718     RHINO_JAR=$withval)
1720 AC_ARG_WITH(commons-codec-jar,
1721     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1722         [Specify path to jarfile manually.]),
1723     COMMONS_CODEC_JAR=$withval)
1725 AC_ARG_WITH(commons-lang-jar,
1726     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1727         [Specify path to jarfile manually.]),
1728     COMMONS_LANG_JAR=$withval)
1730 AC_ARG_WITH(commons-httpclient-jar,
1731     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1732         [Specify path to jarfile manually.]),
1733     COMMONS_HTTPCLIENT_JAR=$withval)
1735 AC_ARG_WITH(commons-logging-jar,
1736     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1737         [Specify path to jarfile manually.]),
1738     COMMONS_LOGGING_JAR=$withval)
1740 AC_ARG_WITH(system-jfreereport,
1741     AS_HELP_STRING([--with-system-jfreereport],
1742         [Use JFreeReport already on system.]),,
1743     [with_system_jfreereport="$with_system_jars"])
1745 AC_ARG_WITH(sac-jar,
1746     AS_HELP_STRING([--with-sac-jar=JARFILE],
1747         [Specify path to jarfile manually.]),
1748     SAC_JAR=$withval)
1750 AC_ARG_WITH(libxml-jar,
1751     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1752         [Specify path to jarfile manually.]),
1753     LIBXML_JAR=$withval)
1755 AC_ARG_WITH(flute-jar,
1756     AS_HELP_STRING([--with-flute-jar=JARFILE],
1757         [Specify path to jarfile manually.]),
1758     FLUTE_JAR=$withval)
1760 AC_ARG_WITH(jfreereport-jar,
1761     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1762         [Specify path to jarfile manually.]),
1763     JFREEREPORT_JAR=$withval)
1765 AC_ARG_WITH(liblayout-jar,
1766     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1767         [Specify path to jarfile manually.]),
1768     LIBLAYOUT_JAR=$withval)
1770 AC_ARG_WITH(libloader-jar,
1771     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1772         [Specify path to jarfile manually.]),
1773     LIBLOADER_JAR=$withval)
1775 AC_ARG_WITH(libloader-jar,
1776     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1777         [Specify path to jarfile manually.]),
1778     LIBLOADER_JAR=$withval)
1780 AC_ARG_WITH(libformula-jar,
1781     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1782         [Specify path to jarfile manually.]),
1783     LIBFORMULA_JAR=$withval)
1785 AC_ARG_WITH(librepository-jar,
1786     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1787         [Specify path to jarfile manually.]),
1788     LIBREPOSITORY_JAR=$withval)
1790 AC_ARG_WITH(libfonts-jar,
1791     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1792         [Specify path to jarfile manually.]),
1793     LIBFONTS_JAR=$withval)
1795 AC_ARG_WITH(libserializer-jar,
1796     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1797         [Specify path to jarfile manually.]),
1798     LIBSERIALIZER_JAR=$withval)
1800 AC_ARG_WITH(libbase-jar,
1801     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1802         [Specify path to jarfile manually.]),
1803     LIBBASE_JAR=$withval)
1805 AC_ARG_WITH(system-odbc,
1806     AS_HELP_STRING([--with-system-odbc],
1807         [Use the odbc headers already on system.]),,
1808     [with_system_odbc="$with_system_headers"])
1810 AC_ARG_WITH(system-sane,
1811     AS_HELP_STRING([--with-system-sane],
1812         [Use sane.h already on system.]),,
1813     [with_system_sane="$with_system_headers"])
1815 AC_ARG_WITH(system-bluez,
1816     AS_HELP_STRING([--with-system-bluez],
1817         [Use bluetooth.h already on system.]),,
1818     [with_system_bluez="$with_system_headers"])
1820 AC_ARG_WITH(system-mesa-headers,
1821     AS_HELP_STRING([--with-system-mesa-headers],
1822         [Use Mesa headers already on system.]),,
1823     [with_system_mesa_headers="$with_system_headers"])
1825 AC_ARG_WITH(system-curl,
1826     AS_HELP_STRING([--with-system-curl],
1827         [Use curl already on system.]),,
1828     [with_system_curl=auto])
1830 AC_ARG_WITH(system-boost,
1831     AS_HELP_STRING([--with-system-boost],
1832         [Use boost already on system.]),,
1833     [with_system_boost="$with_system_headers"])
1835 AC_ARG_WITH(system-glm,
1836     AS_HELP_STRING([--with-system-glm],
1837         [Use glm already on system.]),,
1838     [with_system_glm="$with_system_headers"])
1840 AC_ARG_WITH(system-vigra,
1841     AS_HELP_STRING([--with-system-vigra],
1842         [Use vigra already on system.]),,
1843     [with_system_vigra="$with_system_headers"])
1845 AC_ARG_WITH(system-hunspell,
1846     AS_HELP_STRING([--with-system-hunspell],
1847         [Use libhunspell already on system.]),,
1848     [with_system_hunspell="$with_system_libs"])
1850 AC_ARG_WITH(system-mythes,
1851     AS_HELP_STRING([--with-system-mythes],
1852         [Use mythes already on system.]),,
1853     [with_system_mythes="$with_system_libs"])
1855 AC_ARG_WITH(system-altlinuxhyph,
1856     AS_HELP_STRING([--with-system-altlinuxhyph],
1857         [Use ALTLinuxhyph already on system.]),,
1858     [with_system_altlinuxhyph="$with_system_libs"])
1860 AC_ARG_WITH(system-lpsolve,
1861     AS_HELP_STRING([--with-system-lpsolve],
1862         [Use lpsolve already on system.]),,
1863     [with_system_lpsolve="$with_system_libs"])
1865 AC_ARG_WITH(system-liblangtag,
1866     AS_HELP_STRING([--with-system-liblangtag],
1867         [Use liblangtag library already on system.]),,
1868     [with_system_liblangtag="$with_system_libs"])
1870 AC_ARG_WITH(system-npapi-headers,
1871     AS_HELP_STRING([--with-system-npapi-headers],
1872         [Use NPAPI headers provided by system instead of bundled ones. Used in
1873          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=TRUE) and
1874          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1875     [with_system_npapi_headers="$with_system_headers"]
1878 AC_ARG_WITH(webdav,
1879     AS_HELP_STRING([--with-webdav],
1880         [Specify which library to use for webdav implementation.
1881          Possible values: "neon", "serf", "no". The default value is "neon".
1882          Example: --with-webdav="serf"]),
1883     WITH_WEBDAV=$withval,
1884     WITH_WEBDAV="neon")
1886 AC_ARG_WITH(linker-hash-style,
1887     AS_HELP_STRING([--with-linker-hash-style],
1888         [Use linker with --hash-style=<style> when linking shared objects.
1889          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1890          if supported on the build system, and "sysv" otherwise.]))
1892 AC_ARG_WITH(jdk-home,
1893     AS_HELP_STRING([--with-jdk-home],
1894         [If you have installed JDK 1.3 or later on your system please supply the
1895          path here. Note that this is not the location of the java command but the
1896          location of the entire distribution.])
1897     [
1898                           Usage:     --with-jdk-home=<absolute path to JDK home>
1899     ],
1902 AC_ARG_WITH(help,
1903     AS_HELP_STRING([--with-help],
1904         [Enable the build of help. There is a special parameter "common" that
1905          can be used to bundle only the common part, .e.g help-specific icons.
1906          This is useful when you build the helpcontent separately.])
1907     [
1908                           Usage:     --with-help    build the entire local help
1909                                  --without-help     no local help (default)
1910                                  --with-help=common bundle common files for the local
1911                                                     help but do not build the whole help
1912     ],
1915 AC_ARG_WITH(java,
1916     AS_HELP_STRING([--with-java],
1917         [Specify the name of the Java interpreter command. Typically "java"
1918          which is the default.
1920          To build without support for Java components, applets, accessibility
1921          or the XML filters written in Java, use --without-java or --with-java=no.])
1922     [
1923                           Usage:     --with-java==<java command>
1924                                      --without-java
1925     ],
1926     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1927     [ with_java=java ]
1930 AC_ARG_WITH(jvm-path,
1931     AS_HELP_STRING([--with-jvm-path],
1932         [Use a specific JVM search path at runtime.])
1933     [
1934                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1936                           e. g.: --with-jvm-path=/usr/lib/
1937                                  to find JRE/JDK in /usr/lib/jvm/
1938     ],
1941 AC_ARG_WITH(ant-home,
1942     AS_HELP_STRING([--with-ant-home],
1943         [If you have installed Jakarta Ant on your system, please supply the path here.
1944          Note that this is not the location of the Ant binary but the location
1945          of the entire distribution.])
1946     [
1947                           Usage:     --with-ant-home=<absolute path to Ant home>
1948     ],
1951 AC_ARG_WITH(export-validation,
1952     AS_HELP_STRING([--with-export-validation],
1953         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1954          Note: You need an executable script officeotron that takes the path to the file.])
1955     [
1956                             Usage: --with-export-validation
1957     ],
1960 AC_ARG_WITH(junit,
1961     AS_HELP_STRING([--with-junit],
1962         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1963          --without-junit disables those tests. Not relevant in the --without-java case.])
1964     [
1965                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1966     ],
1967 ,with_junit=yes)
1969 AC_ARG_WITH(perl-home,
1970     AS_HELP_STRING([--with-perl-home],
1971         [If you have installed Perl 5 Distribution, on your system, please
1972          supply the path here. Note that this is not the location of the Perl
1973          binary but the location of the entire distribution.])
1974     [
1975                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1976     ],
1979 AC_ARG_WITH(
1980     [doxygen],
1981     AS_HELP_STRING(
1982         [--with-doxygen],
1983         [Specifies the doxygen executable to use when generating ODK C/C++
1984          documentation. --without-doxygen disables generation of ODK C/C++
1985          documentation. Not relevant in the --disable-odk case.])
1986     [
1987                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1988     ],,
1989     [with_doxygen=yes])
1991 AC_ARG_WITH(visual-studio,
1992     AS_HELP_STRING([--with-visual-studio=<2012/2010/2013>],
1993         [Specify which Visual Studio version to use in case several are
1994          are installed. If not specified, the order of preference is
1995          2012, 2010, 2013 (including Express editions).])
1996     [
1997                           Usage:     --with-visual-studio=<2012/2010/2013>
1998     ],
2001 AC_ARG_WITH(windows-sdk,
2002     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
2003         [Specify which Windows SDK, or "Windows Kit", version to use
2004          in case the one that came with the selected Visual Studio
2005          is not what you want for some reason. Note that not all compiler/SDK
2006          combinations are supported. The intent is that this option should not
2007          be needed.])
2008     [
2009                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
2010     ],
2013 AC_ARG_WITH(lang,
2014     AS_HELP_STRING([--with-lang],
2015         [Use this option to build LibreOffice with additional UI language support.
2016          English (US) is always included by default.
2017          Separate multiple languages with space.
2018          For all languages, use --with-lang=ALL.])
2019     [
2020                           Usage:     --with-lang="es sw tu cs sk"
2021     ],
2024 AC_ARG_WITH(locales,
2025     AS_HELP_STRING([--with-locales],
2026         [Use this option to limit the locale information built in.
2027          Separate multiple locales with space.
2028          Very experimental and might well break stuff.
2029          Just a desperate measure to shrink code and data size.
2030          By default all the locales available is included.
2031          This option is completely unrelated to --with-lang.])
2032     [
2033                           Affects also our character encoding conversion
2034                           tables for encodings mainly targeted for a
2035                           particular locale, like EUC-CN and EUC-TW for
2036                           zh, ISO-2022-JP for ja.
2038                           Affects also our add-on break iterator data for
2039                           some languages.
2041                           For the default, all locales, don't use this switch at all.
2042                           Specifying just the language part of a locale means all matching
2043                           locales will be included.
2045                           Usage:     --with-locales="en es pt fr zh kr ja"
2046     ],
2049 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2050 AC_ARG_WITH(krb5,
2051     AS_HELP_STRING([--with-krb5],
2052         [Enable MIT Kerberos 5 support in modules that support it.
2053          By default automatically enabled on platforms
2054          where a good system Kerberos 5 is available.]),
2057 AC_ARG_WITH(gssapi,
2058     AS_HELP_STRING([--with-gssapi],
2059         [Enable GSSAPI support in modules that support it.
2060          By default automatically enabled on platforms
2061          where a good system GSSAPI is available.]),
2064 dnl ===================================================================
2065 dnl Branding
2066 dnl ===================================================================
2068 AC_ARG_WITH(branding,
2069     AS_HELP_STRING([--with-branding],
2070         [Use given path to retrieve branding images set.])
2071     [
2072                           Search for intro.png about.svg and flat_logo.svg.
2073                           If any is missing, default ones will be used instead.
2075                           Search also progress.conf for progress
2076                           settings on intro screen :
2078                           PROGRESSBARCOLOR="255,255,255" Set color of
2079                           progress bar. Comma separated RGB decimal values.
2080                           PROGRESSSIZE="407,6" Set size of progress bar.
2081                           Comma separated decimal values (width, height).
2082                           PROGRESSPOSITION="61,317" Set position of progress
2083                           bar from left,top. Comma separated decimal values.
2084                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2085                           bar frame. Comma separated RGB decimal values.
2086                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2087                           bar text. Comma separated RGB decimal values.
2088                           PROGRESSTEXTBASELINE="287" Set vertical position of
2089                           progress bar text from top. Decimal value.
2091                           Default values will be used if not found.
2093                           Usage:     --with-branding=/path/to/images
2094     ],
2098 AC_ARG_WITH(extra-buildid,
2099     AS_HELP_STRING([--with-extra-buildid],
2100         [Show addition build identification in about dialog.])
2101     [
2102                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2103     ],
2107 AC_ARG_WITH(vendor,
2108     AS_HELP_STRING([--with-vendor],
2109         [Set vendor of the build.])
2110     [
2111                           Usage:     --with-vendor="John the Builder"
2112     ],
2115 AC_ARG_WITH(compat-oowrappers,
2116     AS_HELP_STRING([--with-compat-oowrappers],
2117         [Install oo* wrappers in parallel with
2118          lo* ones to keep backward compatibility.
2119          Has effect only with make distro-pack-install]),
2122 AC_ARG_WITH(os-version,
2123     AS_HELP_STRING([--with-os-version],
2124         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2125     [
2126                           Usage:     --with-os-version=<OSVERSION>
2127     ],
2130 AC_ARG_WITH(mingw-cross-compiler,
2131     AS_HELP_STRING([--with-mingw-cross-compiler],
2132         [Specify the MinGW cross-compiler to use.])
2133     [
2134                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2136                           When building on the ODK on Unix and building unowinreg.dll,
2137                           specify the MinGW C++ cross-compiler.
2138     ],
2141 AC_ARG_WITH(idlc-cpp,
2142     AS_HELP_STRING([--with-idlc-cpp],
2143         [Specify the C Preprocessor to use for idlc.])
2144     [
2145                           Usage:     --with-idlc-cpp=cpp
2147                           Default is ucpp.
2148     ]
2151 AC_ARG_WITH(build-version,
2152     AS_HELP_STRING([--with-build-version],
2153         [Allows the builder to add a custom version tag that will appear in the
2154          Help/About box for QA purposes.])
2155     [
2156                           Usage:     --with-build-version="Built by Jim"
2157     ],
2158     with_build_version=$withval ,
2161 AC_ARG_WITH(alloc,
2162     AS_HELP_STRING([--with-alloc],
2163         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2164          Note that on FreeBSD/NetBSD system==jemalloc]),
2167 AC_ARG_WITH(sun-templates,
2168     AS_HELP_STRING([--with-sun-templates],
2169         [Integrate Sun template packages.]),
2172 AC_ARG_WITH(parallelism,
2173     AS_HELP_STRING([--with-parallelism],
2174         [Number of jobs to run simultaneously during build. Parallel builds can
2175         save a lot of time on multi-cpu machines. Defaults to the number of
2176         CPUs on the machine, unless you configure --enable-icecream - then to
2177         10.]),
2180 AC_ARG_WITH(all-tarballs,
2181     AS_HELP_STRING([--with-all-tarballs],
2182         [Download all external tarballs unconditionally]))
2184 AC_ARG_WITH(gdrive-client-id,
2185     AS_HELP_STRING([--with-gdrive-client-id],
2186         [Provides the client id of the application for OAuth2 authentication
2187         on Google Drive. If either this or --with-gdrive-client-secret is
2188         empty, the feature will be disabled]),
2191 AC_ARG_WITH(gdrive-client-secret,
2192     AS_HELP_STRING([--with-gdrive-client-secret],
2193         [Provides the client secret of the application for OAuth2
2194         authentication on Google Drive. If either this or
2195         --with-gdrive-client-id is empty, the feature will be disabled]),
2198 AC_ARG_WITH(alfresco-cloud-client-id,
2199     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2200         [Provides the client id of the application for OAuth2 authentication
2201         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2202         empty, the feature will be disabled]),
2205 AC_ARG_WITH(alfresco-cloud-client-secret,
2206     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2207         [Provides the client secret of the application for OAuth2
2208         authentication on Alfresco Cloud. If either this or
2209         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2212 dnl ===================================================================
2213 dnl Do we want to use pre-build binary tarball for recompile
2214 dnl ===================================================================
2216 if test "$enable_library_bin_tar" = "yes" ; then
2217     USE_LIBRARY_BIN_TAR=TRUE
2218 else
2219     USE_LIBRARY_BIN_TAR=
2221 AC_SUBST(USE_LIBRARY_BIN_TAR)
2223 dnl ===================================================================
2224 dnl Test whether build target is Release Build
2225 dnl ===================================================================
2226 AC_MSG_CHECKING([whether build target is Release Build])
2227 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2228     AC_MSG_RESULT([no])
2229     ENABLE_RELEASE_BUILD=
2230 else
2231     AC_MSG_RESULT([yes])
2232     ENABLE_RELEASE_BUILD=TRUE
2234 AC_SUBST(ENABLE_RELEASE_BUILD)
2236 dnl ===================================================================
2237 dnl Test whether to sign Windows Build
2238 dnl ===================================================================
2239 AC_MSG_CHECKING([whether to sign windows build])
2240 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2241     AC_MSG_RESULT([yes])
2242     WINDOWS_BUILD_SIGNING="TRUE"
2243 else
2244     AC_MSG_RESULT([no])
2245     WINDOWS_BUILD_SIGNING="FALSE"
2247 AC_SUBST(WINDOWS_BUILD_SIGNING)
2249 dnl ===================================================================
2250 dnl MacOSX build and runtime environment options
2251 dnl ===================================================================
2253 AC_ARG_WITH(macosx-sdk,
2254     AS_HELP_STRING([--with-macosx-sdk],
2255         [Use a specific SDK for building.])
2256     [
2257                           Usage:     --with-macosx-sdk=<version>
2259                           e. g.: --with-macosx-sdk=10.6
2261                           there are 3 options to control the MacOSX build:
2262                           --with-macosx-sdk (refered as 'sdk' below)
2263                           --with-macosx-version-min-required (refered as 'min' below)
2264                           --with-macosx-version-max-allowed (refered as 'max' below)
2266                           the connection between these value and the default they take is as follow:
2267                           ( ? means not specified on the command line, s means the SDK version found,
2268                           constraint: x <= y <= z)
2270                           ==========================================
2271                            command line      || config result
2272                           ==========================================
2273                           min  | max  | sdk  || min  | max  | sdk  |
2274                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
2275                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
2276                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
2277                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
2278                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2279                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2280                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2281                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2284                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2285                           for a detailled technical explanation of these variables
2287                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2289                           Note that even if in theory using a --with-macosx-version-max-allowed
2290                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2291                           should work, in practice Apple doesn't seem to test that, and at least
2292                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2293                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2294                           headers, but still.
2295     ],
2298 AC_ARG_WITH(macosx-version-min-required,
2299     AS_HELP_STRING([--with-macosx-version-min-required],
2300         [set the minimum OS version needed to run the built LibreOffice])
2301     [
2302                           Usage:     --with-macosx-version-min-required=<version>
2304                           e. g.: --with-macos-version-min-required=10.6
2305                           see --with-macosx-sdk for more info
2306     ],
2309 AC_ARG_WITH(macosx-version-max-allowed,
2310     AS_HELP_STRING([--with-macosx-version-max-allowed],
2311         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2312     [
2313                           Usage:     --with-macosx-version-max-allowed=<version>
2315                           e. g.: --with-macos-version-max-allowed=10.6
2316                           see --with-macosx-sdk for more info
2317     ],
2321 dnl ===================================================================
2322 dnl options for stuff used during cross-compilation build
2323 dnl These are superseded by --with-build-platform-configure-options.
2324 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2325 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2326 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2327 dnl ===================================================================
2329 AC_ARG_WITH(system-boost-for-build,
2330     AS_HELP_STRING([--with-system-boost-for-build],
2331         [Use boost already on system for build tools (cross-compilation only).]))
2333 AC_ARG_WITH(system-cppunit-for-build,
2334     AS_HELP_STRING([--with-system-cppunit-for-build],
2335         [Use cppunit already on system for build tools (cross-compilation only).]))
2337 AC_ARG_WITH(system-expat-for-build,
2338     AS_HELP_STRING([--with-system-expat-for-build],
2339         [Use expat already on system for build tools (cross-compilation only).]))
2341 AC_ARG_WITH(system-icu-for-build,
2342     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2343         [Use icu already on system for build tools (cross-compilation only).]))
2345 AC_ARG_WITH(system-libxml-for-build,
2346     AS_HELP_STRING([--with-system-libxml-for-build],
2347         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2350 dnl ===================================================================
2351 dnl check for required programs (grep, awk, sed, bash)
2352 dnl ===================================================================
2354 pathmunge ()
2356     if test -n "$1"; then
2357         if test "$build_os" = "cygwin"; then
2358             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2359                 PathFormat "$1"
2360                 new_path=`cygpath -sm "$formatted_path"`
2361             else
2362                 PathFormat "$1"
2363                 new_path=`cygpath -u "$formatted_path"`
2364             fi
2365         else
2366             new_path="$1"
2367         fi
2368         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2369             if test "$2" = "after"; then
2370                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2371             else
2372                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2373             fi
2374         fi
2375         unset new_path
2376     fi
2379 AC_PROG_AWK
2380 AC_PATH_PROG( AWK, $AWK)
2381 if test -z "$AWK"; then
2382     AC_MSG_ERROR([install awk to run this script])
2385 AC_PATH_PROG(BASH, bash)
2386 if test -z "$BASH"; then
2387     AC_MSG_ERROR([bash not found in \$PATH])
2389 AC_SUBST(BASH)
2391 AC_MSG_CHECKING([for GNU or BSD tar])
2392 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2393     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2394     if test $? -eq 0;  then
2395         GNUTAR=$a
2396         break
2397     fi
2398 done
2399 AC_MSG_RESULT($GNUTAR)
2400 if test -z "$GNUTAR"; then
2401     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2403 AC_SUBST(GNUTAR)
2405 AC_MSG_CHECKING([for tar's option to strip components])
2406 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2407 if test $? -eq 0; then
2408     STRIP_COMPONENTS="--strip-components"
2409 else
2410     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2411     if test $? -eq 0; then
2412         STRIP_COMPONENTS="--strip-path"
2413     else
2414         STRIP_COMPONENTS="unsupported"
2415     fi
2417 AC_MSG_RESULT($STRIP_COMPONENTS)
2418 if test x$STRIP_COMPONENTS = xunsupported; then
2419     AC_MSG_ERROR([you need a tar that is able to strip components.])
2421 AC_SUBST(STRIP_COMPONENTS)
2423 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2424 dnl desktop OSes from "mobile" ones.
2426 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2427 dnl In other words, that when building for an OS that is not a
2428 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2430 dnl Note the direction of the implication; there is no assumption that
2431 dnl cross-compiling would imply a non-desktop OS.
2433 if test $_os != iOS -a $_os != Android; then
2434     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2435     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2436     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2439 DISABLE_EXPORT=''
2440 if test "$enable_export" != no; then
2441     BUILD_TYPE="$BUILD_TYPE EXPORT"
2442 else
2443     DISABLE_EXPORT='TRUE'
2444     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2446 AC_SUBST(DISABLE_EXPORT)
2448 # Whether to build "avmedia" functionality or not.
2449 # We probably don't want it for non-desktop.
2451 if test -z "$enable_avmedia"; then
2452     if test $_os != iOS -a $_os != Android; then
2453         enable_avmedia=yes
2454     fi
2457 if test "$enable_avmedia" = yes; then
2458     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2459     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2460 else
2461     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2464 # Decide whether to build database connectivity stuff (including
2465 # Base) or not. We probably don't want to on non-desktop OSes.
2467 if test -z "$enable_database_connectivity"; then
2468     # --disable-database-connectivity is unfinished work in progress
2469     # and the iOS test app doesn't link if we actually try to use it.
2470     # if test $_os != iOS -a $_os != Android; then
2471         enable_database_connectivity=yes
2472     # fi
2475 if test "$enable_database_connectivity" = yes; then
2476     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2477     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2480 if test -z "$enable_extensions"; then
2481     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2482     if test $_os != iOS -a $_os != Android; then
2483         enable_extensions=yes
2484     fi
2487 if test "$enable_extensions" = yes; then
2488     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2489     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2492 if test -z "$enable_scripting"; then
2493     # Disable scripting for iOS unless specifically overridden
2494     # with --enable-scripting.
2495     if test $_os != iOS; then
2496         enable_scripting=yes
2497     fi
2500 DISABLE_SCRIPTING=''
2501 if test "$enable_scripting" = yes; then
2502     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2503 else
2504     DISABLE_SCRIPTING='TRUE'
2505     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2507 AC_SUBST(DISABLE_SCRIPTING)
2509 if test $_os = iOS -o $_os = Android; then
2510     # Disable dynamic_loading always for iOS and Android
2511     enable_dynamic_loading=no
2512 elif test -z "$enable_dynamic_loading"; then
2513     # Otherwise enable it unless speficically disabled
2514     enable_dynamic_loading=yes
2517 DISABLE_DYNLOADING=''
2518 if test "$enable_dynamic_loading" = yes; then
2519     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2520 else
2521     DISABLE_DYNLOADING='TRUE'
2522     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2524 AC_SUBST(DISABLE_DYNLOADING)
2526 # remenber SYSBASE value
2527 AC_SUBST(SYSBASE)
2529 dnl ===================================================================
2530 dnl  Sort out various gallery compilation options
2531 dnl ===================================================================
2532 AC_MSG_CHECKING([how to build and package galleries])
2533 if test -n "${with_galleries}"; then
2534     if test "$with_galleries" = "build"; then
2535         WITH_GALLERY_BUILD=TRUE
2536         AC_MSG_RESULT([build from source images internally])
2537     elif test "$with_galleries" = "no"; then
2538         WITH_GALLERY_BUILD=
2539         AC_MSG_RESULT([disable non-internal gallery build])
2540     else
2541         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2542     fi
2543 else
2544     if test $_os != iOS -a $_os != Android; then
2545         WITH_GALLERY_BUILD=TRUE
2546         AC_MSG_RESULT([internal src images for desktop])
2547     else
2548         WITH_GALLERY_BUILD=
2549         AC_MSG_RESULT([disable src imgage build])
2550     fi
2552 AC_SUBST(WITH_GALLERY_BUILD)
2554 dnl ===================================================================
2555 dnl  Checks if ccache is available
2556 dnl ===================================================================
2557 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2558     case "%$CC%$CXX%" in
2559     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2560     # assume that's good then
2561     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2562         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2563         ;;
2564     *)
2565         AC_PATH_PROG([CCACHE],[ccache],[not found])
2566         if test "$CCACHE" = "not found"; then
2567             CCACHE=""
2568         else
2569             # Need to check for ccache version: otherwise prevents
2570             # caching of the results (like "-x objective-c++" for Mac)
2571             if test $_os = Darwin -o $_os = iOS; then
2572                 # Check ccache version
2573                 AC_MSG_CHECKING([whether version of ccache is suitable])
2574                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2575                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2576                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2577                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2578                 else
2579                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2580                     CCACHE=""
2581                 fi
2582             fi
2583         fi
2584         ;;
2585     esac
2586 else
2587     CCACHE=""
2590 if test "$CCACHE" != ""; then
2591     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2592     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2593     if test "$ccache_size" = ""; then
2594         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2595         if test "$ccache_size" = ""; then
2596             ccache_size=0
2597         fi
2598         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2599         if test $ccache_size -lt 1024; then
2600             CCACHE=""
2601             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2602             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2603         else
2604             # warn that ccache may be too small for debug build
2605             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2606             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2607         fi
2608     else
2609         if test $ccache_size -lt 5; then
2610             #warn that ccache may be too small for debug build
2611             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2612             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2613         fi
2614     fi
2617 dnl ===================================================================
2618 dnl  Checks for C compiler,
2619 dnl  The check for the C++ compiler is later on.
2620 dnl ===================================================================
2621 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2622     GCC_HOME_SET="true"
2623     AC_MSG_CHECKING([gcc home])
2624     if test -z "$with_gcc_home"; then
2625         if test "$enable_icecream" = "yes"; then
2626             if test -d "/usr/lib/icecc/bin"; then
2627                 GCC_HOME="/usr/lib/icecc/"
2628             else
2629                 GCC_HOME="/opt/icecream/"
2630             fi
2631         else
2632             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2633             GCC_HOME_SET="false"
2634         fi
2635     else
2636         GCC_HOME="$with_gcc_home"
2637     fi
2638     AC_MSG_RESULT($GCC_HOME)
2639     AC_SUBST(GCC_HOME)
2641     if test "$GCC_HOME_SET" = "true"; then
2642         if test -z "$CC"; then
2643             CC="$GCC_HOME/bin/gcc"
2644         fi
2645         if test -z "$CXX"; then
2646             CXX="$GCC_HOME/bin/g++"
2647         fi
2648     fi
2651 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2652 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2653     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2654     save_CFLAGS=$CFLAGS
2655     AC_PROG_CC
2656     CFLAGS=$save_CFLAGS
2659 COMPATH=`dirname "$CC"`
2660 if test "$COMPATH" = "."; then
2661     AC_PATH_PROGS(COMPATH, $CC)
2662     dnl double square bracket to get single because of M4 quote...
2663     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2665 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2667 dnl ===================================================================
2668 dnl Java support
2669 dnl ===================================================================
2670 AC_MSG_CHECKING([whether to build with Java support])
2671 if test "$with_java" != "no"; then
2672     if test "$DISABLE_SCRIPTING" = TRUE; then
2673         AC_MSG_RESULT([no, overridden by --disable-scripting])
2674         ENABLE_JAVA=""
2675         with_java=no
2676     else
2677         AC_MSG_RESULT([yes])
2678         ENABLE_JAVA="TRUE"
2679         AC_DEFINE(HAVE_FEATURE_JAVA)
2680     fi
2681 else
2682     AC_MSG_RESULT([no])
2683     ENABLE_JAVA=""
2686 AC_SUBST(ENABLE_JAVA)
2688 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2690 dnl ENABLE_JAVA="" indicate no Java support at all
2692 dnl ===================================================================
2693 dnl Export file validation
2694 dnl ===================================================================
2695 AC_MSG_CHECKING([whether to enable export file validation])
2696 if test "$with_export_validation" = yes; then
2697     AC_MSG_RESULT([yes])
2698     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2699 else
2700     AC_MSG_RESULT([no])
2703 dnl ===================================================================
2704 dnl  Test the Solaris compiler version
2705 dnl ===================================================================
2706 if test "$_os" = "SunOS"; then
2707     if test "$CC" = "cc"; then
2708         AC_PATH_PROGS(_cc, cc)
2709         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2710         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2711         dnl cc -V outputs to standard error!!!!
2712         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2713         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2714         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2715         if test "$_sunstudio_major" != "5"; then
2716             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2717         else
2718             _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" }'`
2719             if test "$_sunstudio_minor" = "false"; then
2720                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2721             else
2722                 dnl compiler will do
2723                 AC_MSG_RESULT([checked])
2724             fi
2725         fi
2726     fi
2730 dnl ===================================================================
2731 dnl Check OS X SDK and compiler
2732 dnl ===================================================================
2734 if test $_os = Darwin; then
2736     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2737         bitness=-m32
2738     else
2739         bitness=-m64
2740         BITNESS_OVERRIDE=64
2741     fi
2743     # If no --with-macosx-sdk option is given, look for 10.6,
2744     # 10.7, 10.8 and 10.9 SDKs, in that order. If not found
2745     # in some default locations, try the xcode-select tool.
2746     # 10.5 must be specified explicitely to be considered
2748     # The intent is that for "most" Mac-based developers, a suitable
2749     # SDK will be found automatically without any configure options.
2751     # For developers still using old Xcode in /Developer, either
2752     # because it is the only Xcode they have, or they have that in
2753     # addition to Xcode 4 in /Applications/Xcode.app, the 10.5 SDK
2754     # or 10.6 SDK should be found.
2756     # For developers with a current Xcode, the lowest-numbered SDK
2757     # should be found.
2759     AC_MSG_CHECKING([what Mac OS X SDK to use])
2761     if test -z "$with_macosx_sdk"; then
2762         for MACOSX_SDK_PATH in /Developer/SDKs/MacOSX10.6.sdk /Developer-old/SDKs/MacOSX10.6.sdk /Xcode3/SDKs/MacOSX10.6.sdk; do
2763             if test -d "$MACOSX_SDK_PATH"; then
2764                 with_macosx_sdk=10.6
2765                 break
2766             fi
2767         done
2768         if test -z "$with_macosx_sdk"; then
2769             MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.7.sdk"
2770             if test -d "$MACOSX_SDK_PATH"; then
2771                 with_macosx_sdk=10.7
2772             else
2773                 for with_macosx_sdk in 10.6 10.7 10.8 10.9 10.10; do
2774                     MACOSX_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk"
2775                     if test -d "$MACOSX_SDK_PATH"; then
2776                         break
2777                     fi
2778                 done
2779                 if test ! -d "$MACOSX_SDK_PATH"; then
2780                     for with_macosx_sdk in 10.6 10.7 10.8 10.9 10.10; do
2781                         MACOSX_SDK_PATH=`xcrun --sdk macosx${with_macosx_sdk} --show-sdk-path 2> /dev/null`
2782                         if test -d "$MACOSX_SDK_PATH"; then
2783                             break
2784                         else
2785                             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk"
2786                             if test -d "$MACOSX_SDK_PATH"; then
2787                                 break
2788                             fi
2789                         fi
2790                     done
2791                     if test ! -d "$MACOSX_SDK_PATH"; then
2792                         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2793                     fi
2794                 fi
2795             fi
2796         fi
2797     else
2798         # with --with-macosx-sdk=something
2799         case $with_macosx_sdk in
2800         10.5|10.6)
2801             if test -d /Developer-old/SDKs/MacOSX${with_macosx_sdk}.sdk; then
2802                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX${with_macosx_sdk}.sdk
2803             elif test -d /Xcode3/SDKs/MacOSX${with_macosx_sdk}.sdk; then
2804                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX${with_macosx_sdk}.sdk
2805             fi
2806             ;;
2807         esac
2808         if test -z "$MACOSX_SDK_PATH"; then
2809             case $with_macosx_sdk in
2810             10.5|10.6|10.7)
2811                 if test -d /Developer/SDKs/MacOSX${with_macosx_sdk}.sdk; then
2812                     MACOSX_SDK_PATH=/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk
2813                 fi
2814                 ;;
2815             esac
2816             if test -z "$MACOSX_SDK_PATH"; then
2817                 case $with_macosx_sdk in
2818                 10.6|10.7|10.8|10.9|10.10)
2819                     MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk
2820                     if test ! -d "$MACOSX_SDK_PATH"; then
2821                         MACOSX_SDK_PATH=`xcrun --sdk macosx${with_macosx_sdk} --show-sdk-path 2> /dev/null`
2822                         if test ! -d "$MACOSX_SDK_PATH"; then
2823                             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk"
2824                             if test ! -d "$MACOSX_SDK_PATH"; then
2825                                 AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2826                             fi
2827                         fi
2828                     fi
2829                     ;;
2830                 *)
2831                     AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.5--10])
2832                     ;;
2833                 esac
2834             fi
2835         fi
2836     fi
2838     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2840     case $with_macosx_sdk in
2841     10.5)
2842         MACOSX_SDK_VERSION=1050
2843         ;;
2844     10.6)
2845         MACOSX_SDK_VERSION=1060
2846         ;;
2847     10.7)
2848         MACOSX_SDK_VERSION=1070
2849         ;;
2850     10.8)
2851         MACOSX_SDK_VERSION=1080
2852         ;;
2853     10.9)
2854         MACOSX_SDK_VERSION=1090
2855         ;;
2856     10.10)
2857         MACOSX_SDK_VERSION=101000
2858         ;;
2859     *)
2860         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.5--10])
2861         ;;
2862     esac
2864     if test "$with_macosx_version_min_required" = ""; then
2865         case $with_macosx_sdk in
2866         10.5)
2867             with_macosx_version_min_required="10.5";;
2868         *)
2869             with_macosx_version_min_required="10.6";;
2870         esac
2871     fi
2873     if test "$with_macosx_version_max_allowed" = ""; then
2874         with_macosx_version_max_allowed="$with_macosx_sdk"
2875     fi
2877     # export this so that "xcrun" invocations later return matching values
2878     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2879     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2880     export DEVELOPER_DIR
2881     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2882     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2884     case "$with_macosx_version_min_required" in
2885     10.5)
2886         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2887         ;;
2888     10.6)
2889         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2890         ;;
2891     10.7)
2892         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2893         ;;
2894     10.8)
2895         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2896         ;;
2897     10.9)
2898         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2899         ;;
2900     10.10)
2901         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2902         ;;
2903     *)
2904         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.5--10])
2905         ;;
2906     esac
2908     if test "$BITNESS_OVERRIDE" = ""; then
2909         case "$with_macosx_version_min_required" in
2910         10.5)
2911             case "$with_macosx_sdk" in
2912             10.5)
2913                 ;;
2914             *)
2915                 AC_MSG_WARN([Building with a SDK > 10.5 possibly breaks 10.5 compatibility.])
2916                 add_warning "Building with a SDK > 10.5 possibly breaks 10.5 compatibility."
2917                 ;;
2918             esac
2919             ;;
2920         esac
2921     fi
2923     # If no CC and CXX environment vars, try to guess where the compiler is
2924     LIBTOOL=libtool
2925     INSTALL_NAME_TOOL=install_name_tool
2926     if test -z "$save_CC"; then
2927         AC_MSG_CHECKING([what compiler to use])
2928         case $with_macosx_sdk in
2929         10.5)
2930             _gcc_version=`gcc -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
2931             _gcc42_version=`gcc-4.2 -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
2932             if test "$_gcc_version" -gt "$_gcc42_version"; then
2933                 CC="gcc -mmacosx-version-min=$with_macosx_version_min_required"
2934                 CXX="g++ -mmacosx-version-min=$with_macosx_version_min_required"
2935             else
2936                 CC="gcc-4.2 -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2937                 CXX="g++-4.2 -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2938             fi
2939             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2940             ;;
2941         10.6)
2942             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2943             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2944                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2945                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2946             else
2947                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2948                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2949             fi
2950             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2951             LIBTOOL=libtool
2952             ;;
2953         10.7|10.8|10.9|10.10)
2954             if test "$with_macosx_version_min_required" != 10.6; then
2955                 # Use libc++ instead of libstdc++ when possible
2956                 stdlib=-stdlib=libc++
2957             fi
2958             if test "$ENABLE_LTO" = TRUE; then
2959                 lto=-flto
2960             fi
2961             CC="`xcrun -find clang` $bitness $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2962             CXX="`xcrun -find clang++` $bitness $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2963             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2964             AR=`xcrun -find ar`
2965             NM=`xcrun -find nm`
2966             STRIP=`xcrun -find strip`
2967             LIBTOOL=`xcrun -find libtool`
2968             RANLIB=`xcrun -find ranlib`
2969             ;;
2970         esac
2971         AC_MSG_RESULT([$CC and $CXX])
2972     fi
2974     case "$with_macosx_version_max_allowed" in
2975     10.5)
2976         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2977         ;;
2978     10.6)
2979         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2980         ;;
2981     10.7)
2982         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2983         ;;
2984     10.8)
2985         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2986         ;;
2987     10.9)
2988         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2989         ;;
2990     10.10)
2991         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2992         ;;
2993     *)
2994         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.5--10])
2995         ;;
2996     esac
2998     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2999     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3000         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
3001     else
3002         AC_MSG_RESULT([ok])
3003     fi
3005     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3006     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3007         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
3008     else
3009         AC_MSG_RESULT([ok])
3010     fi
3011     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3012     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3014     AC_MSG_CHECKING([whether to do code signing])
3016     if test "$enable_macosx_code_signing" = yes; then
3017         # By default use the first suitable certificate (?).
3019         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3020         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3021         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3022         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
3023         # "Developer ID Application" one.
3025         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3026         if test -n "$identity"; then
3027             MACOSX_CODESIGNING_IDENTITY=$identity
3028             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3029             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3030         fi
3031     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3032         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3033         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3034         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3035     else
3036         AC_MSG_RESULT([no])
3037     fi
3039     AC_MSG_CHECKING([whether to create a Mac App Store package])
3041     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3042         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3043     elif test "$enable_macosx_package_signing" = yes; then
3044         # By default use the first suitable certificate.
3045         # It should be a "3rd Party Mac Developer Installer" one
3047         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3048         if test -n "$identity"; then
3049             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3050             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3051             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3052         else
3053             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3054         fi
3055     elif test -n "$enable_macosx_package_signing"; then
3056         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3057         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3058         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3059     else
3060         AC_MSG_RESULT([no])
3061     fi
3063     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3064         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3065     fi
3067     AC_MSG_CHECKING([whether to sandbox the application])
3069     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3070         AC_MSG_ERROR([OS X sandboxing requires code signing])
3071     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3072         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
3073     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3074         ENABLE_MACOSX_SANDBOX=TRUE
3075         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3076         AC_MSG_RESULT([yes])
3077     else
3078         AC_MSG_RESULT([no])
3079     fi
3081     AC_MSG_CHECKING([what OS X app bundle identifier to use])
3082     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3083     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3085     AC_MSG_CHECKING([what OS X app name to use])
3086     MACOSX_APP_NAME="$with_macosx_app_name"
3087     AC_MSG_RESULT([$MACOSX_APP_NAME])
3089     AC_MSG_CHECKING([build with mac retina support])
3090     if test "$enable_macosx_retina" = yes ; then
3091         MACOSX_HIGH_RESOLUTION_VALUE=true
3092     else
3093         MACOSX_HIGH_RESOLUTION_VALUE=false
3094     fi
3095     AC_MSG_RESULT([$MACOSX_HIGH_RESOLUTION_VALUE])
3097 AC_SUBST(MACOSX_SDK_PATH)
3098 AC_SUBST(MACOSX_SDK_VERSION)
3099 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3100 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3101 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3102 AC_SUBST(INSTALL_NAME_TOOL)
3103 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
3104 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3105 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3106 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3107 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3108 AC_SUBST(MACOSX_APP_NAME)
3109 AC_SUBST(MACOSX_HIGH_RESOLUTION_VALUE)
3111 dnl ===================================================================
3112 dnl Check iOS SDK and compiler
3113 dnl ===================================================================
3115 if test $_os = iOS; then
3117     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3118         :
3119     else
3120         BITNESS_OVERRIDE=64
3121     fi
3123     AC_MSG_CHECKING([what iOS SDK to use])
3125     if test "$enable_ios_simulator" = yes; then
3126         platform=iPhoneSimulator
3127     else
3128         platform=iPhoneOS
3129     fi
3131     xcode_developer=`xcode-select -print-path`
3133     pref_sdk_ver=7.0
3134     for sdkver in 7.1 7.0 6.1 6.0; do
3135         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3136         if test -d $t; then
3137             ios_sdk=$sdkver
3138             sysroot=$t
3139             break
3140         fi
3141     done
3143     if test -z "$sysroot"; then
3144         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
3145     fi
3147     AC_MSG_RESULT($sysroot)
3149     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3151     if test "$enable_ios_simulator" = yes; then
3152         if test "$BITNESS_OVERRIDE" = 64; then
3153             XCODE_ARCHS=x86_64
3154             versionmin=-mios-simulator-version-min=7.0
3155         else
3156             XCODE_ARCHS=i386
3157             case $sdkver in
3158             7.*)
3159                 versionmin=-mios-simulator-version-min=6.1
3160                 ;;
3161             *)
3162                 versionmin=-mmacosx-version-min=10.7
3163                 ;;
3164             esac
3165         fi
3166     else
3167         platform=iPhoneOS
3168         if test "$BITNESS_OVERRIDE" = 64; then
3169             XCODE_ARCHS=arm64
3170             versionmin=-miphoneos-version-min=7.0
3171         else
3172             XCODE_ARCHS=armv7
3173             versionmin=-miphoneos-version-min=6.1
3174         fi
3175     fi
3177     # LTO is not really recommended for iOS builds,
3178     # the link time will be astronomical
3179     if test "$ENABLE_LTO" = TRUE; then
3180         lto=-flto
3181     fi
3182     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3183     # get compiled with it, to avoid ld warnings when linking all that together into one
3184     # executable.
3186     # Use libc++ for iOS 7 SDK and libstdc++ for earlier (but we don't really expect anybody to
3187     # be be using an earlier SDK)
3189     XCODE_CLANG_CXX_LIBRARY=libstdc++
3190     case $ios_sdk in
3191     6.*)
3192         ;;
3193     *)
3194         XCODE_CLANG_CXX_LIBRARY=libc++
3195         ;;
3196     esac
3198     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3200     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3201     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3203     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3204     AR=`xcrun -find ar`
3205     NM=`xcrun -find nm`
3206     STRIP=`xcrun -find strip`
3207     LIBTOOL=`xcrun -find libtool`
3208     RANLIB=`xcrun -find ranlib`
3211 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3212 AC_SUBST(XCODE_ARCHS)
3213 AC_SUBST(XCODEBUILD_SDK)
3215 AC_MSG_CHECKING([whether to treat the installation as read-only])
3217 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3218         "$enable_extensions" != yes; then
3219     enable_readonly_installset=yes
3221 if test "$enable_readonly_installset" = yes; then
3222     AC_MSG_RESULT([yes])
3223     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3224 else
3225     AC_MSG_RESULT([no])
3228 dnl ===================================================================
3229 dnl Structure of install set
3230 dnl ===================================================================
3232 if test $_os = Darwin -a "$enable_canonical_installation_tree_structure" = yes; then
3233     LIBO_BIN_FOLDER=MacOS
3234     LIBO_ETC_FOLDER=Resources
3235     LIBO_LIBEXEC_FOLDER=MacOS
3236     LIBO_LIB_FOLDER=Frameworks
3237     LIBO_SHARE_FOLDER=Resources
3238     LIBO_SHARE_HELP_FOLDER=Resources/help
3239     LIBO_SHARE_JAVA_FOLDER=Resources/java
3240     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3241     LIBO_LIB_PYUNO_FOLDER=Resources
3242     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3243     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3244     LIBO_URE_BIN_FOLDER=MacOS
3245     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3246     LIBO_URE_LIB_FOLDER=Frameworks
3247     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3248     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3249     ENABLE_MACOSX_MACLIKE_APP_STRUCTURE=TRUE
3250     AC_DEFINE(HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE)
3251 elif test $_os = Darwin; then
3252     LIBO_BIN_FOLDER=MacOS
3253     LIBO_ETC_FOLDER=MacOS
3254     LIBO_LIBEXEC_FOLDER=MacOS
3255     LIBO_LIB_FOLDER=MacOS
3256     LIBO_LIB_PYUNO_FOLDER=MacOS
3257     LIBO_SHARE_FOLDER=share
3258     LIBO_SHARE_HELP_FOLDER=help
3259     LIBO_SHARE_JAVA_FOLDER=MacOS/classes
3260     LIBO_SHARE_PRESETS_FOLDER=presets
3261     LIBO_SHARE_RESOURCE_FOLDER=MacOS/resource
3262     LIBO_SHARE_SHELL_FOLDER=MacOS/shell
3263     LIBO_URE_BIN_FOLDER=ure-link/bin
3264     LIBO_URE_ETC_FOLDER=ure-link/lib
3265     LIBO_URE_LIB_FOLDER=ure-link/lib
3266     LIBO_URE_SHARE_FOLDER=ure-link/share
3267     LIBO_URE_SHARE_JAVA_FOLDER=ure-link/share/java
3268 elif test $_os = WINNT; then
3269     LIBO_BIN_FOLDER=program
3270     LIBO_ETC_FOLDER=program
3271     LIBO_LIBEXEC_FOLDER=program
3272     LIBO_LIB_FOLDER=program
3273     LIBO_LIB_PYUNO_FOLDER=program
3274     LIBO_SHARE_FOLDER=share
3275     LIBO_SHARE_HELP_FOLDER=help
3276     LIBO_SHARE_JAVA_FOLDER=program/classes
3277     LIBO_SHARE_PRESETS_FOLDER=presets
3278     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3279     LIBO_SHARE_SHELL_FOLDER=program/shell
3280     LIBO_URE_BIN_FOLDER=URE/bin
3281     LIBO_URE_ETC_FOLDER=URE/bin
3282     LIBO_URE_LIB_FOLDER=URE/bin
3283     LIBO_URE_SHARE_FOLDER=URE
3284     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3285 else
3286     LIBO_BIN_FOLDER=program
3287     LIBO_ETC_FOLDER=program
3288     LIBO_LIBEXEC_FOLDER=program
3289     LIBO_LIB_FOLDER=program
3290     LIBO_LIB_PYUNO_FOLDER=program
3291     LIBO_SHARE_FOLDER=share
3292     LIBO_SHARE_HELP_FOLDER=help
3293     LIBO_SHARE_JAVA_FOLDER=program/classes
3294     LIBO_SHARE_PRESETS_FOLDER=presets
3295     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3296     LIBO_SHARE_SHELL_FOLDER=program/shell
3297     LIBO_URE_BIN_FOLDER=ure/bin
3298     LIBO_URE_ETC_FOLDER=ure/lib
3299     LIBO_URE_LIB_FOLDER=ure/lib
3300     LIBO_URE_SHARE_FOLDER=ure/share
3301     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3303 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3304 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3305 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3306 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3307 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3308 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3309 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3310 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3311 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3312 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3313 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3314 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3315 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3316 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3317 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3318 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3320 # Not all of them needed in config_host.mk, add more if need arises
3321 AC_SUBST(LIBO_BIN_FOLDER)
3322 AC_SUBST(LIBO_ETC_FOLDER)
3323 AC_SUBST(LIBO_LIB_FOLDER)
3324 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3325 AC_SUBST(LIBO_SHARE_FOLDER)
3326 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3327 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3328 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3329 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3330 AC_SUBST(LIBO_URE_BIN_FOLDER)
3331 AC_SUBST(LIBO_URE_ETC_FOLDER)
3332 AC_SUBST(LIBO_URE_LIB_FOLDER)
3333 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3334 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3335 AC_SUBST(ENABLE_MACOSX_MACLIKE_APP_STRUCTURE)
3337 dnl ===================================================================
3338 dnl Windows specific tests and stuff
3339 dnl ===================================================================
3341 # Get a value from the 32-bit side of the Registry
3342 reg_get_value_32()
3344     # Return value: $regvalue
3345     unset regvalue
3346     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3348     if test $? -eq 0; then
3349         regvalue=$_regvalue
3350     fi
3353 # Get a value from the 64-bit side of the Registry
3354 reg_get_value_64()
3356     # Return value: $regvalue
3357     unset regvalue
3358     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3360     if test $? -eq 0; then
3361         regvalue=$_regvalue
3362     fi
3365 if test "$_os" = "WINNT"; then
3366     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3367     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3368         AC_MSG_RESULT([no])
3369         WINDOWS_SDK_ARCH="x86"
3370     else
3371         AC_MSG_RESULT([yes])
3372         WINDOWS_SDK_ARCH="x64"
3373         BITNESS_OVERRIDE=64
3374     fi
3377 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3378     AC_MSG_CHECKING([whether to use DirectX])
3379     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3380         ENABLE_DIRECTX="TRUE"
3381         AC_MSG_RESULT([yes])
3382     else
3383         ENABLE_DIRECTX=""
3384         AC_MSG_RESULT([no])
3385     fi
3387     AC_MSG_CHECKING([whether to use ActiveX])
3388     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
3389         DISABLE_ACTIVEX=""
3390         AC_MSG_RESULT([yes])
3391     else
3392         DISABLE_ACTIVEX="TRUE"
3393         AC_MSG_RESULT([no])
3394     fi
3396     AC_MSG_CHECKING([whether to use ATL])
3397     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
3398         DISABLE_ATL=""
3399         AC_MSG_RESULT([yes])
3400     else
3401         DISABLE_ATL="TRUE"
3402         AC_MSG_RESULT([no])
3403     fi
3404 else
3405     ENABLE_DIRECTX=""
3406     DISABLE_ACTIVEX="TRUE"
3407     DISABLE_ATL="TRUE"
3410 AC_SUBST(ENABLE_DIRECTX)
3411 AC_SUBST(DISABLE_ACTIVEX)
3412 AC_SUBST(DISABLE_ATL)
3414 if test "$cross_compiling" = "yes"; then
3415     export CROSS_COMPILING=TRUE
3416     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3417 else
3418     CROSS_COMPILING=
3419     BUILD_TYPE="$BUILD_TYPE NATIVE"
3421 AC_SUBST(CROSS_COMPILING)
3423 dnl ===================================================================
3424 dnl  Is GCC actually Clang?
3425 dnl ===================================================================
3427 COM_GCC_IS_CLANG=
3428 if test "$GCC" = "yes"; then
3429     AC_MSG_CHECKING([whether GCC is actually Clang])
3430     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3431         #ifndef __clang__
3432         you lose
3433         #endif
3434         int foo=42;
3435         ]])],
3436         [AC_MSG_RESULT([yes])
3437          COM_GCC_IS_CLANG=TRUE],
3438         [AC_MSG_RESULT([no])])
3440     if test "$COM_GCC_IS_CLANG" = TRUE; then
3441         AC_MSG_CHECKING([the Clang version])
3442         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3443         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3444         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3445         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3446         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3447     fi
3449 AC_SUBST(COM_GCC_IS_CLANG)
3451 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3452     if test -z "$CCACHE_CPP2"; then
3453         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3454         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3455     fi
3458 dnl ===================================================================
3459 dnl  Test the gcc version
3460 dnl ===================================================================
3461 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3462     AC_MSG_CHECKING([the GCC version])
3463     _gcc_version=`$CC -dumpversion`
3464     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3466     if test "$_os" = "Darwin"; then
3467         if test "$with_macosx_sdk" = "10.5"; then
3468             # use gcc-4.2 for OS X SDK 10.5 when "plain" gcc is not more recent
3469             if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.2"; then
3470                 _gcc42_version=`$GCC_HOME/bin/gcc-4.2 -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
3471                 if test "$GCC_VERSION" -le "$_gcc42_version"; then
3472                     export CC=$GCC_HOME/bin/gcc-4.2
3473                 fi
3474             fi
3475             AC_MSG_RESULT([using CC=$CC])
3476         fi
3477     else
3478         AC_MSG_RESULT([gcc $_gcc_version])
3479     fi
3481     if test "$GCC_VERSION" -lt 0401; then
3482         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.1.0])
3483     fi
3484 else
3485     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3486     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3487     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3488     # (which reports itself as GCC 4.2.1).
3489     GCC_VERSION=
3491 AC_SUBST(GCC_VERSION)
3493 # ===================================================================
3494 # check various GCC options that Clang does not support now but maybe
3495 # will somewhen in the future, check them even for GCC, so that the
3496 # flags are set
3497 # ===================================================================
3499 HAVE_GCC_GGDB2=
3500 HAVE_GCC_FINLINE_LIMIT=
3501 HAVE_GCC_FNO_INLINE=
3502 if test "$GCC" = "yes"; then
3503     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3504     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3505         # Option just ignored and silly warning that isn't a real
3506         # warning printed
3507         :
3508     else
3509         save_CFLAGS=$CFLAGS
3510         CFLAGS="$CFLAGS -Werror -ggdb2"
3511         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3512         CFLAGS=$save_CFLAGS
3513     fi
3514     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3515         AC_MSG_RESULT([yes])
3516     else
3517         AC_MSG_RESULT([no])
3518     fi
3520     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3521     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3522         # As above
3523         :
3524     else
3525         save_CFLAGS=$CFLAGS
3526         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3527         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3528         CFLAGS=$save_CFLAGS
3529     fi
3530     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3531         AC_MSG_RESULT([yes])
3532     else
3533         AC_MSG_RESULT([no])
3534     fi
3536     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3537     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3538         # Ditto
3539         :
3540     else
3541         save_CFLAGS=$CFLAGS
3542         CFLAGS="$CFLAGS -Werror -fno-inline"
3543         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3544         CFLAGS=$save_CFLAGS
3545     fi
3546     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3547         AC_MSG_RESULT([yes])
3548     else
3549         AC_MSG_RESULT([no])
3550     fi
3552 AC_SUBST(HAVE_GCC_GGDB2)
3553 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3554 AC_SUBST(HAVE_GCC_FNO_INLINE)
3556 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3557 if test "$GCC" = "yes"; then
3558     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3559     bsymbolic_functions_ldflags_save=$LDFLAGS
3560     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3561     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3562 #include <stdio.h>
3563         ],[
3564 printf ("hello world\n");
3565         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3566     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3567         AC_MSG_RESULT( found )
3568     else
3569         AC_MSG_RESULT( not found )
3570     fi
3571     LDFLAGS=$bsymbolic_functions_ldflags_save
3573 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3575 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3576 # NOTE: must _not_ be used for bundled external libraries!
3577 ISYSTEM=
3578 if test "$GCC" = "yes"; then
3579     AC_MSG_CHECKING( for -isystem )
3580     save_CFLAGS=$CFLAGS
3581     CFLAGS="$CFLAGS -Werror"
3582     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3583     CFLAGS=$save_CFLAGS
3584     if test -n "$ISYSTEM"; then
3585         AC_MSG_RESULT(yes)
3586     else
3587         AC_MSG_RESULT(no)
3588     fi
3590 if test -z "$ISYSTEM"; then
3591     # fall back to using -I
3592     ISYSTEM=-I
3594 AC_SUBST(ISYSTEM)
3596 dnl ===================================================================
3597 dnl  Check which Visual Studio or MinGW compiler is used
3598 dnl ===================================================================
3600 map_vs_year_to_version()
3602     # Return value: $vsversion
3604     unset vsversion
3606     case $1 in
3607     2010)
3608         vsversion=10.0;;
3609     2012)
3610         vsversion=11.0;;
3611     2013)
3612         vsversion=12.0;;
3613     *)
3614         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3615     esac
3618 vs_versions_to_check()
3620     # Args: $1 (optional) : versions to check, in the order of preference
3621     # Return value: $vsversions
3623     unset vsversions
3625     if test -n "$1"; then
3626         map_vs_year_to_version "$1"
3627         vsversions=$vsversion
3628     else
3629         # By default we prefer 2012, then 2010, then 2013
3630         vsversions="11.0 10.0 12.0"
3631     fi
3634 find_msvs()
3636     # Find Visual Studio 2012/2010/2013
3637     # Args: $1 (optional) : versions to check, in the order of preference
3638     # Return value: $vstest
3640     unset vstest
3642     vs_versions_to_check "$1"
3644     for ver in $vsversions; do
3645         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3646         if test -n "$regvalue"; then
3647             vstest=$regvalue
3648             break
3649         fi
3650         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3651         if test -n "$regvalue"; then
3652             vstest=$regvalue
3653             break
3654         fi
3655     done
3658 find_msvc()
3660     # Find Visual C++ 2012/2010/2013
3661     # Args: $1 (optional) : The VS version year
3662     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3664     unset vctest vcnum vcnumwithdot
3666     vs_versions_to_check "$1"
3668     for ver in $vsversions; do
3669         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3670         if test -n "$regvalue"; then
3671             vctest=$regvalue
3672             break
3673         fi
3674         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3675         if test -n "$regvalue"; then
3676             vctest=$regvalue
3677             break
3678         fi
3679     done
3680     if test -n "$vctest"; then
3681         vcnumwithdot=$ver
3682         case "$vcnumwithdot" in
3683         10.0)
3684             vcyear=2010
3685             vcnum=100
3686             ;;
3687         11.0)
3688             vcyear=2012
3689             vcnum=110
3690             ;;
3691         12.0)
3692             vcyear=2013
3693             vcnum=120
3694             ;;
3695         esac
3696     fi
3699 SHOWINCLUDES_PREFIX=
3700 if test "$_os" = "WINNT"; then
3701     if test "$WITH_MINGW" != "yes"; then
3702         AC_MSG_CHECKING([Visual C++])
3704         find_msvc "$with_visual_studio"
3706         if test -z "$vctest"; then
3707             if test -n "$with_visual_studio"; then
3708                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3709             else
3710                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2013 installation found])
3711             fi
3712         fi
3714         if test "$BITNESS_OVERRIDE" = ""; then
3715             if test -f "$vctest/bin/cl.exe"; then
3716                 VC_PRODUCT_DIR=$vctest
3717             else
3718                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3719             fi
3720         else
3721             if test -f "$vctest/bin/amd64/cl.exe"; then
3722                 VC_PRODUCT_DIR=$vctest
3723             else
3724                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3725             fi
3726         fi
3728         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3729         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3731         dnl ===========================================================
3732         dnl  Check for the corresponding mspdb*.dll
3733         dnl ===========================================================
3735         MSPDB_PATH=
3737         if test "$BITNESS_OVERRIDE" = ""; then
3738             if test "$vcnum" = "120"; then
3739                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3740             else
3741                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3742             fi
3743         else
3744             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3745         fi
3747         mspdbnum=$vcnum
3749         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3750             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3751         fi
3753         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3754         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3756         dnl The path needs to be added before cl is called
3757         PATH="$MSPDB_PATH:$PATH"
3759         AC_MSG_CHECKING([cl.exe])
3761         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3762         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3763         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3764         # is not enough?
3766         if test -z "$CC"; then
3767             if test "$BITNESS_OVERRIDE" = ""; then
3768                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3769                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3770                 fi
3771             else
3772                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3773                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3774                 fi
3775             fi
3777             # This gives us a posix path with 8.3 filename restrictions
3778             CC=`win_short_path_for_make "$CC"`
3779         fi
3781         if test -n "$CC"; then
3782             # Remove /cl.exe from CC case insensitive
3783             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3784             if test "$BITNESS_OVERRIDE" = ""; then
3785                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3786             else
3787                 if test -n "$VC_PRODUCT_DIR"; then
3788                     # Huh, why not just an assignment?
3789                     COMPATH=`echo $VC_PRODUCT_DIR`
3790                 fi
3791             fi
3792             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3794             PathFormat "$COMPATH"
3795             COMPATH="$formatted_path"
3797             VCVER=$vcnum
3798             MSVSVER=$vcyear
3800             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3801             # are always "better", we list them in reverse chronological order.
3803             case $vcnum in
3804             100)
3805                 COMEX=13
3806                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3807                 if test "$ENABLE_LTO" = TRUE; then
3808                     AC_MSG_WARN([LTO is known to cause problems with MSVC 2010])
3809                     add_warning "LTO is known to cause problems with MSVC 2010"
3810                 fi
3811                 ;;
3812             110)
3813                 COMEX=14
3814                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3815                 ;;
3816             120)
3817                 COMEX=15
3818                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3819                 ;;
3820             esac
3822             # The expectation is that --with-windows-sdk should not need to be used
3823             if test -n "$with_windows_sdk"; then
3824                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3825                 *" "$with_windows_sdk" "*)
3826                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3827                     ;;
3828                 *)
3829                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3830                     ;;
3831                 esac
3832             fi
3834             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3835             ac_objext=obj
3836             ac_exeext=exe
3838         else
3839             AC_MSG_ERROR([Visual C++ not found after all, huh])
3840         fi
3842         dnl We need to guess the prefix of the -showIncludes output, it can be
3843         dnl localized
3844         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3845         echo "#include <stdlib.h>" > conftest.c
3846         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3847             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3848         rm -f conftest.c conftest.obj
3849         if test -z "$SHOWINCLUDES_PREFIX"; then
3850             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3851         else
3852             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3853         fi
3855         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3856         # version of the Explorer extension (and maybe other small
3857         # bits, too) needed when installing a 32-bit LibreOffice on a
3858         # 64-bit OS. The 64-bit Explorer extension is a feature that
3859         # has been present since long in OOo. Don't confuse it with
3860         # building LibreOffice itself as 64-bit code, which is
3861         # unfinished work and highly experimental.
3863         BUILD_X64=
3864         CXX_X64_BINARY=
3865         LINK_X64_BINARY=
3867         if test "$BITNESS_OVERRIDE" = ""; then
3868             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3869             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3870                 # Prefer native x64 compiler to cross-compiler, in case we are running
3871                 # the build on a 64-bit OS.
3872                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3873                     BUILD_X64=TRUE
3874                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3875                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3876                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3877                     BUILD_X64=TRUE
3878                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3879                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3880                 fi
3881             fi
3882             if test "$BUILD_X64" = TRUE; then
3883                 AC_MSG_RESULT([found])
3884             else
3885                 AC_MSG_RESULT([not found])
3886                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3887             fi
3888         fi
3889         AC_SUBST(BUILD_X64)
3891         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3892         AC_SUBST(CXX_X64_BINARY)
3893         AC_SUBST(LINK_X64_BINARY)
3894     else
3895         AC_MSG_CHECKING([the compiler is MinGW])
3896         MACHINE_PREFIX=`$CC -dumpmachine`
3897         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3898             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3899             AC_MSG_RESULT([yes])
3900         else
3901             AC_MSG_ERROR([Compiler is not MinGW.])
3902         fi
3903     fi
3905 AC_SUBST(VCVER)
3906 PathFormat "$MSPDB_PATH"
3907 MSPDB_PATH="$formatted_path"
3908 AC_SUBST(SHOWINCLUDES_PREFIX)
3911 # dbghelp.dll
3913 if test "$_os" = "WINNT"; then
3914     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3918 # unowinreg.dll
3920 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3921 AC_SUBST(UNOWINREG_DLL)
3924 # prefix C with ccache if needed
3926 if test "$CCACHE" != ""; then
3927     AC_MSG_CHECKING([whether $CC is already ccached])
3929     AC_LANG_PUSH([C])
3930     save_CFLAGS=$CFLAGS
3931     CFLAGS="$CFLAGS --ccache-skip -O2"
3932     dnl an empty program will do, we're checking the compiler flags
3933     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3934                       [use_ccache=yes], [use_ccache=no])
3935     if test $use_ccache = yes; then
3936         AC_MSG_RESULT([yes])
3937     else
3938         CC="$CCACHE $CC"
3939         AC_MSG_RESULT([no])
3940     fi
3941     CFLAGS=$save_CFLAGS
3942     AC_LANG_POP([C])
3945 dnl Set the ENABLE_DBGUTIL variable
3946 dnl ===================================================================
3947 AC_MSG_CHECKING([whether to build with additional debug utilities])
3948 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3949     ENABLE_DBGUTIL="TRUE"
3950     # this is an extra var so it can have different default on different MSVC
3951     # versions (in case there are version specific problems with it)
3952     MSVC_USE_DEBUG_RUNTIME="TRUE"
3954     AC_MSG_RESULT([yes])
3955     # cppunit and graphite expose STL in public headers
3956     if test "$with_system_cppunit" = "yes"; then
3957         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3958     else
3959         with_system_cppunit=no
3960     fi
3961     if test "$with_system_graphite" = "yes"; then
3962         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3963     else
3964         with_system_graphite=no
3965     fi
3966     if test "$with_system_mysql_cppconn" = "yes"; then
3967         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3968     else
3969         with_system_mysql_cppconn=no
3970     fi
3971     if test "$with_system_orcus" = "yes"; then
3972         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3973     else
3974         with_system_orcus=no
3975     fi
3976     if test "$with_system_libcmis" = "yes"; then
3977         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3978     else
3979         with_system_libcmis=no
3980     fi
3981     if test "$enable_win_mozab_driver" = "yes"; then
3982         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3983     fi
3984 else
3985     ENABLE_DBGUTIL=""
3986     MSVC_USE_DEBUG_RUNTIME=""
3987     AC_MSG_RESULT([no])
3989 AC_SUBST(ENABLE_DBGUTIL)
3990 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3992 dnl Set the ENABLE_DEBUG variable.
3993 dnl ===================================================================
3994 AC_MSG_CHECKING([whether to do a debug build])
3995 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3996     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3998 if test -n "$ENABLE_DBGUTIL"; then
3999     if test "$enable_debug" = "no"; then
4000         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4001     fi
4002     ENABLE_DEBUG="TRUE"
4003     AC_MSG_RESULT([yes (dbgutil)])
4004 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
4005     ENABLE_DEBUG="TRUE"
4006     AC_MSG_RESULT([yes])
4007 else
4008     ENABLE_DEBUG=""
4009     AC_MSG_RESULT([no])
4011 AC_SUBST(ENABLE_DEBUG)
4013 dnl Selective debuginfo
4014 ENABLE_DEBUGINFO_FOR=
4015 if test -n "$ENABLE_DEBUG"; then
4016     AC_MSG_CHECKING([whether to use selective debuginfo])
4017     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
4018         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
4019         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
4020     else
4021         ENABLE_DEBUGINFO_FOR=all
4022         AC_MSG_RESULT([no, for all])
4023     fi
4025 AC_SUBST(ENABLE_DEBUGINFO_FOR)
4027 dnl Check for enable symbols option
4028 dnl ===================================================================
4029 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
4030 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
4031     ENABLE_SYMBOLS="TRUE"
4032     if test -n "$ENABLE_DBGUTIL"; then
4033         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
4034     elif test -n "$ENABLE_DEBUG"; then
4035         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
4036     fi
4037     AC_MSG_RESULT([yes])
4038 else
4039     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
4040         ENABLE_SYMBOLS="FALSE"
4041     else
4042         ENABLE_SYMBOLS=
4043     fi
4044     AC_MSG_RESULT([no])
4046 AC_SUBST(ENABLE_SYMBOLS)
4048 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
4049 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
4050 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
4051 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
4052 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
4053     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4055 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4057 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4058 # By default use the ones specified by our build system,
4059 # but explicit override is possible.
4060 AC_MSG_CHECKING(for explicit AFLAGS)
4061 if test -n "$AFLAGS"; then
4062     AC_MSG_RESULT([$AFLAGS])
4063     x_AFLAGS=
4064 else
4065     AC_MSG_RESULT(no)
4066     x_AFLAGS=[\#]
4068 AC_MSG_CHECKING(for explicit CFLAGS)
4069 if test -n "$CFLAGS"; then
4070     AC_MSG_RESULT([$CFLAGS])
4071     x_CFLAGS=
4072 else
4073     AC_MSG_RESULT(no)
4074     x_CFLAGS=[\#]
4076 AC_MSG_CHECKING(for explicit CXXFLAGS)
4077 if test -n "$CXXFLAGS"; then
4078     AC_MSG_RESULT([$CXXFLAGS])
4079     x_CXXFLAGS=
4080 else
4081     AC_MSG_RESULT(no)
4082     x_CXXFLAGS=[\#]
4084 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4085 if test -n "$OBJCFLAGS"; then
4086     AC_MSG_RESULT([$OBJCFLAGS])
4087     x_OBJCFLAGS=
4088 else
4089     AC_MSG_RESULT(no)
4090     x_OBJCFLAGS=[\#]
4092 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4093 if test -n "$OBJCXXFLAGS"; then
4094     AC_MSG_RESULT([$OBJCXXFLAGS])
4095     x_OBJCXXFLAGS=
4096 else
4097     AC_MSG_RESULT(no)
4098     x_OBJCXXFLAGS=[\#]
4100 AC_MSG_CHECKING(for explicit LDFLAGS)
4101 if test -n "$LDFLAGS"; then
4102     AC_MSG_RESULT([$LDFLAGS])
4103     x_LDFLAGS=
4104 else
4105     AC_MSG_RESULT(no)
4106     x_LDFLAGS=[\#]
4108 AC_SUBST(AFLAGS)
4109 AC_SUBST(CFLAGS)
4110 AC_SUBST(CXXFLAGS)
4111 AC_SUBST(OBJCFLAGS)
4112 AC_SUBST(OBJCXXFLAGS)
4113 AC_SUBST(LDFLAGS)
4114 AC_SUBST(x_AFLAGS)
4115 AC_SUBST(x_CFLAGS)
4116 AC_SUBST(x_CXXFLAGS)
4117 AC_SUBST(x_OBJCFLAGS)
4118 AC_SUBST(x_OBJCXXFLAGS)
4119 AC_SUBST(x_LDFLAGS)
4122 # determine CPUNAME, GUIBASE, ...
4124 LIB64="lib"
4125 SOLARINC=
4127 case "$host_os" in
4129 aix*)
4130     COM=GCC
4131     CPUNAME=POWERPC
4132     GUIBASE=unx
4133     OS=AIX
4134     RTL_OS=AIX
4135     RTL_ARCH=PowerPC
4136     PLATFORMID=aix_powerpc
4137     OUTPATH=unxaigppc
4138     P_SEP=:
4139     ;;
4141 cygwin*)
4142     COM=MSC
4143     GUIBASE=not-used
4144     OS=WNT
4145     RTL_OS=Windows
4146     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4147         P_SEP=";"
4148     else
4149         P_SEP=:
4150     fi
4151     case "$host_cpu" in
4152     i*86|x86_64)
4153         if test "$BITNESS_OVERRIDE" = 64; then
4154             CPUNAME=X86_64
4155             RTL_ARCH=X86_64
4156             LIB64="lib/x64"
4157             PLATFORMID=windows_x86_64
4158             OUTPATH=wntmscx$COMEX
4159         else
4160             CPUNAME=INTEL
4161             RTL_ARCH=x86
4162             PLATFORMID=windows_x86
4163             OUTPATH=wntmsci$COMEX
4164         fi
4165         ;;
4166     *)
4167         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4168         ;;
4169     esac
4170     SCPDEFS="$SCPDEFS -D_MSC_VER"
4171     ;;
4173 darwin*)
4174     COM=GCC
4175     GUIBASE=not-used
4176     OS=MACOSX
4177     RTL_OS=MacOSX
4178     P_SEP=:
4180     case "$host_cpu" in
4181     arm*)
4182         CPUNAME=ARM
4183         RTL_ARCH=ARM_EABI
4184         PLATFORMID=ios_arm
4185         OUTPATH=unxiosr
4186         OS=IOS
4187         SDKDIR=sdk
4188         ;;
4189     powerpc*)
4190         CPUNAME=POWERPC
4191         RTL_ARCH=PowerPC
4192         PLATFORMID=macosx_powerpc
4193         OUTPATH=unxmacxp
4194         ;;
4195     i*86)
4196         if test "$BITNESS_OVERRIDE" = 64; then
4197             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4198         fi
4199         CPUNAME=INTEL
4200         RTL_ARCH=x86
4201         PLATFORMID=macosx_x86
4202         OUTPATH=unxmacxi
4203         ;;
4204     x86_64)
4205         if test "$BITNESS_OVERRIDE" = 64; then
4206             CPUNAME=X86_64
4207             RTL_ARCH=X86_64
4208             PLATFORMID=macosx_x86_64
4209             OUTPATH=unxmacxx
4210         else
4211             CPUNAME=INTEL
4212             RTL_ARCH=x86
4213             PLATFORMID=macosx_x86
4214             OUTPATH=unxmacxi
4215         fi
4216         ;;
4217     *)
4218         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4219         ;;
4220     esac
4221     ;;
4223 dragonfly*)
4224     COM=GCC
4225     GUIBASE=unx
4226     OS=DRAGONFLY
4227     RTL_OS=DragonFly
4228     OUTPATH=unxdfly
4229     P_SEP=:
4231     case "$host_cpu" in
4232     i*86)
4233         CPUNAME=INTEL
4234         RTL_ARCH=x86
4235         PLATFORMID=dragonfly_x86
4236         ;;
4237     x86_64)
4238         CPUNAME=X86_64
4239         RTL_ARCH=X86_64
4240         PLATFORMID=dragonfly_x86_64
4241         ;;
4242     *)
4243         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4244         ;;
4245     esac
4246     ;;
4248 freebsd*)
4249     COM=GCC
4250     GUIBASE=unx
4251     RTL_OS=FreeBSD
4252     OS=FREEBSD
4253     OUTPATH=unxfbsd
4254     P_SEP=:
4256     case "$host_cpu" in
4257     i*86)
4258         CPUNAME=INTEL
4259         RTL_ARCH=x86
4260         PLATFORMID=freebsd_x86
4261         OUTPATH=unxfbsdi
4262         ;;
4263     x86_64|amd64)
4264         CPUNAME=X86_64
4265         RTL_ARCH=X86_64
4266         PLATFORMID=freebsd_x86_64
4267         ;;
4268     *)
4269         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4270         ;;
4271     esac
4272     ;;
4274 kfreebsd*)
4275     COM=GCC
4276     GUIBASE=unx
4277     OS=LINUX
4278     RTL_OS=kFreeBSD
4279     P_SEP=:
4281     case "$host_cpu" in
4283     i*86)
4284         CPUNAME=INTEL
4285         RTL_ARCH=x86
4286         PLATFORMID=kfreebsd_x86
4287         OUTPATH=unxkfgi6
4288         ;;
4289     x86_64)
4290         CPUNAME=X86_64
4291         RTL_ARCH=X86_64
4292         LIB64="lib64"
4293         PLATFORMID=kfreebsd_x86_64
4294         OUTPATH=unxkfgx6
4295         ;;
4296     *)
4297         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4298         ;;
4299     esac
4300     ;;
4302 linux-gnu*)
4303     COM=GCC
4304     GUIBASE=unx
4305     OS=LINUX
4306     RTL_OS=Linux
4307     P_SEP=:
4309     case "$host_cpu" in
4311     alpha)
4312         CPUNAME=AXP
4313         RTL_ARCH=ALPHA
4314         PLATFORMID=linux_alpha
4315         OUTPATH=unxlngaxp
4316         ;;
4317     arm*)
4318         CPUNAME=ARM
4319         EPM_FLAGS="-a arm"
4320         OUTPATH=unxlngr
4321         RTL_ARCH=ARM_EABI
4322         PLATFORMID=linux_arm_eabi
4323         case "$host_cpu" in
4324         arm*-linux)
4325             RTL_ARCH=ARM_OABI
4326             PLATFORMID=linux_arm_oabi
4327             ;;
4328         esac
4329         ;;
4330     hppa)
4331         CPUNAME=HPPA
4332         RTL_ARCH=HPPA
4333         EPM_FLAGS="-a hppa"
4334         PLATFORMID=linux_hppa
4335         OUTPATH=unxlnghppa
4336         ;;
4337     i*86)
4338         CPUNAME=INTEL
4339         RTL_ARCH=x86
4340         PLATFORMID=linux_x86
4341         OUTPATH=unxlngi6
4342         ;;
4343     ia64)
4344         CPUNAME=IA64
4345         RTL_ARCH=IA64
4346         PLATFORMID=linux_ia64
4347         OUTPATH=unxlnga
4348         ;;
4349     mips)
4350         CPUNAME=GODSON
4351         RTL_ARCH=MIPS_EB
4352         EPM_FLAGS="-a mips"
4353         PLATFORMID=linux_mips_eb
4354         OUTPATH=unxlngmips
4355         ;;
4356     mips64)
4357         CPUNAME=GODSON
4358         RTL_ARCH=MIPS_EB
4359         EPM_FLAGS="-a mips64"
4360         PLATFORMID=linux_mips_eb
4361         OUTPATH=unxlngmips
4362         ;;
4363     mips64el)
4364         CPUNAME=GODSON
4365         RTL_ARCH=MIPS_EL
4366         EPM_FLAGS="-a mips64el"
4367         PLATFORMID=linux_mips_el
4368         OUTPATH=unxlngmips
4369         ;;
4370     mipsel)
4371         CPUNAME=GODSON
4372         RTL_ARCH=MIPS_EL
4373         EPM_FLAGS="-a mipsel"
4374         PLATFORMID=linux_mips_el
4375         OUTPATH=unxlngmips
4376         ;;
4377     m68k)
4378         CPUNAME=M68K
4379         RTL_ARCH=M68K
4380         PLATFORMID=linux_m68k
4381         OUTPATH=unxlngm68k
4382         ;;
4383     powerpc)
4384         CPUNAME=POWERPC
4385         RTL_ARCH=PowerPC
4386         PLATFORMID=linux_powerpc
4387         OUTPATH=unxlngppc
4388         ;;
4389     powerpc64)
4390         CPUNAME=POWERPC64
4391         RTL_ARCH=PowerPC_64
4392         LIB64="lib64"
4393         PLATFORMID=linux_powerpc64
4394         OUTPATH=unxlngppc64
4395         ;;
4396     sparc)
4397         CPUNAME=SPARC
4398         RTL_ARCH=SPARC
4399         PLATFORMID=linux_sparc
4400         OUTPATH=unxlngs
4401         ;;
4402     s390)
4403         CPUNAME=S390
4404         RTL_ARCH=S390
4405         PLATFORMID=linux_s390
4406         OUTPATH=unxlngs390
4407         ;;
4408     s390x)
4409         CPUNAME=S390X
4410         RTL_ARCH=S390x
4411         LIB64="lib64"
4412         PLATFORMID=linux_s390x
4413         OUTPATH=unxlngs390x
4414         ;;
4415     x86_64)
4416         CPUNAME=X86_64
4417         RTL_ARCH=X86_64
4418         LIB64="lib64"
4419         PLATFORMID=linux_x86_64
4420         OUTPATH=unxlngx6
4421         ;;
4422     *)
4423         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4424         ;;
4425     esac
4426     ;;
4428 linux-android*)
4429     COM=GCC
4430     GUIBASE=not-used
4431     OS=ANDROID
4432     RTL_OS=Android
4433     P_SEP=:
4435     case "$host_cpu" in
4437     arm|armel)
4438         CPUNAME=ARM
4439         RTL_ARCH=ARM_EABI
4440         PLATFORMID=android_arm_eabi
4441         OUTPATH=unxandr
4442         ;;
4443     mips|mipsel)
4444         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4445         RTL_ARCH=MIPS_EL
4446         PLATFORMID=android_mips_el
4447         OUTPATH=unxandm
4448         ;;
4449     i*86)
4450         CPUNAME=INTEL
4451         RTL_ARCH=x86
4452         PLATFORMID=android_x86
4453         OUTPATH=unxandi
4454         ;;
4455     *)
4456         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4457         ;;
4458     esac
4459     ;;
4461 mingw*)
4462     COM=GCC
4463     GUIBASE=not-used
4464     OS=WNT
4465     RTL_OS=Windows
4466     P_SEP=:
4468     case "$host_cpu" in
4469     i*86|x86_64)
4470         if test "$BITNESS_OVERRIDE" = 64; then
4471             CPUNAME=X86_64
4472             RTL_ARCH=X86_84
4473             PLATFORMID=windows_x86_64
4474             OUTPATH=wntgccx$COMEX
4475             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4476         else
4477             CPUNAME=INTEL
4478             RTL_ARCH=x86
4479             PLATFORMID=windows_x86
4480             OUTPATH=wntgcci$COMEX
4481             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4482         fi
4483         ;;
4484     *)
4485         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4486         ;;
4487     esac
4488     ;;
4490 *netbsd*)
4492     COM=GCC
4493     GUIBASE=unx
4494     OS=NETBSD
4495     RTL_OS=NetBSD
4496     OUTPATH=unxnbsd
4497     P_SEP=:
4499     case "$host_cpu" in
4500     i*86)
4501         CPUNAME=INTEL
4502         RTL_ARCH=x86
4503         PLATFORMID=netbsd_x86
4504         ;;
4505     powerpc)
4506         CPUNAME=POWERPC
4507         RTL_ARCH=PowerPC
4508         PLATFORMID=netbsd_powerpc
4509         ;;
4510     sparc)
4511         CPUNAME=SPARC
4512         RTL_ARCH=SPARC
4513         PLATFORMID=netbsd_sparc
4514         ;;
4515     x86_64)
4516         CPUNAME=X86_64
4517         RTL_ARCH=X86_64
4518         PLATFORMID=netbsd_x86_64
4519         ;;
4520     *)
4521         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4522         ;;
4523     esac
4524     ;;
4526 openbsd*)
4527     COM=GCC
4528     GUIBASE=unx
4529     OS=OPENBSD
4530     RTL_OS=OpenBSD
4531     OUTPATH=unxobsd
4532     P_SEP=:
4534     case "$host_cpu" in
4535     i*86)
4536         CPUNAME=INTEL
4537         RTL_ARCH=x86
4538         PLATFORMID=openbsd_x86
4539         ;;
4540     x86_64)
4541         CPUNAME=X86_64
4542         RTL_ARCH=X86_64
4543         PLATFORMID=openbsd_x86_64
4544         ;;
4545     *)
4546         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4547         ;;
4548     esac
4549     SOLARINC="$SOLARINC -I/usr/local/include"
4550     ;;
4552 solaris*)
4554     COM=GCC
4555     GUIBASE=unx
4556     OS=SOLARIS
4557     RTL_OS=Solaris
4558     P_SEP=:
4560     case "$host_cpu" in
4561     i*86)
4562         CPUNAME=INTEL
4563         RTL_ARCH=x86
4564         PLATFORMID=solaris_x86
4565         OUTPATH=unxsogi
4566         ;;
4567     sparc)
4568         CPUNAME=SPARC
4569         RTL_ARCH=SPARC
4570         PLATFORMID=solaris_sparc
4571         OUTPATH=unxsogs
4572         ;;
4573     sparc64)
4574         CPUNAME=SPARC64
4575         RTL_ARCH=SPARC64
4576         PLATFORMID=solaris_sparc64
4577         OUTPATH=unxsogu
4578         ;;
4579     *)
4580         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4581         ;;
4582     esac
4583     SOLARINC="$SOLARINC -I/usr/local/include"
4584     ;;
4587     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4588     ;;
4589 esac
4591 if test "$enable_headless" = "yes"; then
4592     if test "$GUIBASE" != "unx"; then
4593         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
4594     fi
4595     GUIBASE=not-used
4598 WORKDIR="${BUILDDIR}/workdir"
4599 INSTDIR="${BUILDDIR}/instdir"
4600 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4601 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4602 AC_SUBST(COM)
4603 AC_SUBST(CPUNAME)
4604 AC_SUBST(RTL_OS)
4605 AC_SUBST(RTL_ARCH)
4606 AC_SUBST(EPM_FLAGS)
4607 AC_SUBST(GUIBASE)
4608 AC_SUBST([INSTDIR])
4609 AC_SUBST([INSTROOT])
4610 AC_SUBST(OS)
4611 AC_SUBST(OUTPATH)
4612 AC_SUBST(P_SEP)
4613 AC_SUBST(WORKDIR)
4614 AC_SUBST(PLATFORMID)
4615 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4617 dnl ===================================================================
4618 dnl Test which package format to use
4619 dnl ===================================================================
4620 AC_MSG_CHECKING([which package format to use])
4621 if test -n "$with_package_format" -a "$with_package_format" != no; then
4622     for i in $with_package_format; do
4623         case "$i" in
4624         aix | bsd | deb | pkg | rpm | native | portable | archive | dmg | installed | msi)
4625             ;;
4626         *)
4627             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4628 aix - AIX software distribution
4629 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4630 deb - Debian software distribution
4631 pkg - Solaris software distribution
4632 rpm - RedHat software distribution
4633 native - "Native" software distribution for the platform
4634 portable - Portable software distribution
4636 LibreOffice additionally supports:
4637 archive - .tar.gz or .zip
4638 dmg - Mac OS X .dmg
4639 installed - installation tree
4640 msi - Windows .msi
4641         ])
4642             ;;
4643         esac
4644     done
4645     PKGFORMAT="$with_package_format"
4646     AC_MSG_RESULT([$PKGFORMAT])
4647 else
4648     PKGFORMAT=
4649     AC_MSG_RESULT([none])
4651 AC_SUBST(PKGFORMAT)
4653 dnl ===================================================================
4654 dnl Set up a different compiler to produce tools to run on the build
4655 dnl machine when doing cross-compilation
4656 dnl ===================================================================
4658 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4659 if test "$cross_compiling" = "yes"; then
4660     AC_MSG_CHECKING([for BUILD platform configuration])
4661     echo
4662     rm -rf CONF-FOR-BUILD config_build.mk
4663     mkdir CONF-FOR-BUILD
4664     # Here must be listed all files needed when running the configure script. In particular, also
4665     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4666     # keep them in the same order as there.
4667     (cd $SRC_ROOT && tar cf - \
4668         config.guess \
4669         bin/get_config_variables \
4670         solenv/bin/getcompver.awk \
4671         solenv/inc/langlist.mk \
4672         config_host.mk.in \
4673         Makefile.in \
4674         lo.xcent.in \
4675         instsetoo_native/util/openoffice.lst.in \
4676         config_host/*.in \
4677         sysui/desktop/macosx/Info.plist.in \
4678         ios/lo.xcconfig.in) \
4679     | (cd CONF-FOR-BUILD && tar xf -)
4680     cp configure CONF-FOR-BUILD
4681     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4682     (
4683     unset COM GUIBASE OS CPUNAME
4684     unset CC CXX SYSBASE CFLAGS
4685     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4686     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4687     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4688     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4689     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4690     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4691     cd CONF-FOR-BUILD
4692     sub_conf_opts=""
4693     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4694     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4695     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4696     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4697     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4698     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4699     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4700     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4701     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4702     # we need the msi build tools on mingw if we are creating the
4703     # installation set
4704     if test "$WITH_MINGW" = "yes"; then
4705         enable_winegcc_for_build=
4706         for pkgformat in $PKGFORMAT; do
4707             case "$pkgformat" in
4708             msi|native) enable_winegcc_for_build=yes ;;
4709             esac
4710         done
4711         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4712     fi
4713     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4714     # Don't bother having configure look for stuff not needed for the build platform anyway
4715     ./configure \
4716         --disable-cups \
4717         --disable-graphite \
4718         --disable-pdfimport \
4719         --disable-postgresql-sdbc \
4720         --with-parallelism="$with_parallelism" \
4721         --without-doxygen \
4722         --without-java \
4723         $sub_conf_opts \
4724         --srcdir=$srcdir \
4725         2>&1 | sed -e 's/^/    /'
4726     test -f ./config_host.mk 2>/dev/null || exit
4727     cp config_host.mk ../config_build.mk
4728     mv config.log ../config.Build.log
4729     mkdir -p ../config_build
4730     mv config_host/*.h ../config_build
4731     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXSLT WORKDIR
4733     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXSLT; do
4734         VV='$'$V
4735         VV=`eval "echo $VV"`
4736         if test -n "$VV"; then
4737             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4738             echo "$line" >>build-config
4739         fi
4740     done
4742     for V in INSTDIR INSTROOT WORKDIR; do
4743         VV='$'$V
4744         VV=`eval "echo $VV"`
4745         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4746         if test -n "$VV"; then
4747             line="${V}_FOR_BUILD='$VV'"
4748             echo "$line" >>build-config
4749         fi
4750     done
4752     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4753     echo "$line" >>build-config
4755     )
4756     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4757     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])
4758     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4759              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4761     eval `cat CONF-FOR-BUILD/build-config`
4763     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4765     rm -rf CONF-FOR-BUILD
4766 else
4767     OS_FOR_BUILD="$OS"
4768     CC_FOR_BUILD="$CC"
4769     CXX_FOR_BUILD="$CXX"
4770     INSTDIR_FOR_BUILD="$INSTDIR"
4771     INSTROOT_FOR_BUILD="$INSTROOT"
4772     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4773     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4774     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4775     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4776     WORKDIR_FOR_BUILD="$WORKDIR"
4778 AC_SUBST(OS_FOR_BUILD)
4779 AC_SUBST(INSTDIR_FOR_BUILD)
4780 AC_SUBST(INSTROOT_FOR_BUILD)
4781 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4782 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4783 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4784 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4785 AC_SUBST(WORKDIR_FOR_BUILD)
4787 dnl ===================================================================
4788 dnl Check for syslog header
4789 dnl ===================================================================
4790 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4792 dnl ===================================================================
4793 dnl Set the ENABLE_CRASHDUMP variable.
4794 dnl ===================================================================
4795 AC_MSG_CHECKING([whether to enable crashdump feature])
4796 if test "$enable_crashdump" = "yes"; then
4797     ENABLE_CRASHDUMP="TRUE"
4798     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4799     AC_MSG_RESULT([yes])
4800 else
4801     ENABLE_CRASHDUMP=""
4802     AC_MSG_RESULT([no])
4804 AC_SUBST(ENABLE_CRASHDUMP)
4807 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4808 dnl ===================================================================
4809 AC_MSG_CHECKING([whether to turn warnings to errors])
4810 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4811     ENABLE_WERROR="TRUE"
4812     AC_MSG_RESULT([yes])
4813 else
4814     AC_MSG_RESULT([no])
4816 AC_SUBST(ENABLE_WERROR)
4818 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4819 dnl ===================================================================
4820 AC_MSG_CHECKING([whether to have assert to abort in release code])
4821 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4822     ASSERT_ALWAYS_ABORT="TRUE"
4823     AC_MSG_RESULT([yes])
4824 else
4825     ASSERT_ALWAYS_ABORT="FALSE"
4826     AC_MSG_RESULT([no])
4828 AC_SUBST(ASSERT_ALWAYS_ABORT)
4830 # Determine whether to use ooenv for the instdir installation
4831 # ===================================================================
4832 if test $_os != "WINNT" -a $_os != "Darwin"; then
4833     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4834     if test "$enable_ooenv" = "no"; then
4835         AC_MSG_RESULT([no])
4836     else
4837         ENABLE_OOENV="TRUE"
4838         AC_MSG_RESULT([yes])
4839     fi
4841 AC_SUBST(ENABLE_OOENV)
4843 if test "$enable_headless" = "yes"; then
4844     # be sure to do not mess with uneeded stuff
4845     test_randr=no
4846     test_xrender=no
4847     test_cups=no
4848     test_dbus=no
4849     test_fontconfig=yes
4850     test_gtk=no
4851     build_gstreamer=no
4852     build_gstreamer_0_10=no
4853     test_tde=no
4854     test_kde=no
4855     test_kde4=no
4856     enable_cairo_canvas=no
4857     enable_gnome_vfs=no
4860 dnl ===================================================================
4861 dnl check for cups support
4862 dnl ===================================================================
4863 ENABLE_CUPS=""
4865 if test "$enable_cups" = "no"; then
4866     test_cups=no
4869 AC_MSG_CHECKING([whether to enable CUPS support])
4870 if test "$test_cups" = "yes"; then
4871     ENABLE_CUPS="TRUE"
4872     AC_MSG_RESULT([yes])
4874     AC_MSG_CHECKING([whether cups support is present])
4875     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4876     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4877     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4878         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4879     fi
4881 else
4882     AC_MSG_RESULT([no])
4885 AC_SUBST(ENABLE_CUPS)
4887 # fontconfig checks
4888 if test "$test_fontconfig" = "yes"; then
4889     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4890     SYSTEM_FONTCONFIG=TRUE
4892 AC_SUBST(FONTCONFIG_CFLAGS)
4893 AC_SUBST(FONTCONFIG_LIBS)
4894 AC_SUBST([SYSTEM_FONTCONFIG])
4896 dnl whether to find & fetch external tarballs?
4897 dnl ===================================================================
4898 if test -z "$TARFILE_LOCATION"; then
4899     if test -d "$SRC_ROOT/src" ; then
4900         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4901         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4902     fi
4903     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4904 else
4905     AbsolutePath "$TARFILE_LOCATION"
4906     PathFormat "${absolute_path}"
4907     TARFILE_LOCATION="${formatted_path}"
4909 AC_SUBST(TARFILE_LOCATION)
4911 AC_MSG_CHECKING([whether we want to fetch tarballs])
4912 if test "$enable_fetch_external" != "no"; then
4913     if test "$with_all_tarballs" = "yes"; then
4914         AC_MSG_RESULT(["yes, all of them"])
4915         DO_FETCH_TARBALLS="ALL"
4916     else
4917         AC_MSG_RESULT(["yes, if we use them"])
4918         DO_FETCH_TARBALLS="TRUE"
4919     fi
4920 else
4921     AC_MSG_RESULT([no])
4922     DO_FETCH_TARBALLS=
4924 AC_SUBST(DO_FETCH_TARBALLS)
4926 AC_MSG_CHECKING([whether to build help])
4927 HELP_COMMON_ONLY=FALSE
4928 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4929     BUILD_TYPE="$BUILD_TYPE HELP"
4930     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4931     if test "$with_help" = "common" ; then
4932         HELP_COMMON_ONLY=TRUE
4933         AC_MSG_RESULT([common only])
4934     else
4935         SCPDEFS="$SCPDEFS -DWITH_HELP"
4936         AC_MSG_RESULT([yes])
4937     fi
4938 else
4939     AC_MSG_RESULT([no])
4941 AC_SUBST(HELP_COMMON_ONLY)
4943 dnl Test whether to include MySpell dictionaries
4944 dnl ===================================================================
4945 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4946 if test "$with_myspell_dicts" = "yes"; then
4947     AC_MSG_RESULT([yes])
4948     WITH_MYSPELL_DICTS=TRUE
4949     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4950     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4951 else
4952     AC_MSG_RESULT([no])
4953     WITH_MYSPELL_DICTS=
4955 AC_SUBST(WITH_MYSPELL_DICTS)
4957 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4958 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4959     if test "$with_system_dicts" = yes; then
4960         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4961     fi
4962     with_system_dicts=no
4965 AC_MSG_CHECKING([whether to use dicts from external paths])
4966 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4967     AC_MSG_RESULT([yes])
4968     SYSTEM_DICTS=TRUE
4969     AC_MSG_CHECKING([for spelling dictionary directory])
4970     if test -n "$with_external_dict_dir"; then
4971         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4972     else
4973         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4974         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4975             DICT_SYSTEM_DIR=file:///usr/share/myspell
4976         fi
4977     fi
4978     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4979     AC_MSG_CHECKING([for hyphenation patterns directory])
4980     if test -n "$with_external_hyph_dir"; then
4981         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4982     else
4983         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4984     fi
4985     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4986     AC_MSG_CHECKING([for thesaurus directory])
4987     if test -n "$with_external_thes_dir"; then
4988         THES_SYSTEM_DIR=file://$with_external_thes_dir
4989     else
4990         THES_SYSTEM_DIR=file:///usr/share/mythes
4991     fi
4992     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4993 else
4994     AC_MSG_RESULT([no])
4995     SYSTEM_DICTS=
4997 AC_SUBST(SYSTEM_DICTS)
4998 AC_SUBST(DICT_SYSTEM_DIR)
4999 AC_SUBST(HYPH_SYSTEM_DIR)
5000 AC_SUBST(THES_SYSTEM_DIR)
5002 dnl ===================================================================
5003 AC_MSG_CHECKING([whether to enable pch feature])
5004 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
5005     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5006         ENABLE_PCH="TRUE"
5007         AC_MSG_RESULT([yes])
5008     elif test "$GCC" = "yes"; then
5009         ENABLE_PCH="TRUE"
5010         AC_MSG_RESULT([yes])
5011     else
5012         ENABLE_PCH=""
5013         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5014     fi
5015 else
5016     ENABLE_PCH=""
5017     AC_MSG_RESULT([no])
5019 AC_SUBST(ENABLE_PCH)
5021 TAB=`printf '\t'`
5023 AC_MSG_CHECKING([the GNU make version])
5024 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5025 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5026 if test "$_make_longver" -ge "038200"; then
5027     AC_MSG_RESULT([$GNUMAKE $_make_version])
5029 elif test "$_make_longver" -ge "038100"; then
5030     if test "$build_os" = "cygwin"; then
5031         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5032     fi
5033     AC_MSG_RESULT([$GNUMAKE $_make_version])
5035     dnl ===================================================================
5036     dnl Search all the common names for sha1sum
5037     dnl ===================================================================
5038     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5039     if test -z "$SHA1SUM"; then
5040         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
5041     elif test "$SHA1SUM" = "openssl"; then
5042         SHA1SUM="openssl sha1"
5043     fi
5044     AC_MSG_CHECKING([for GNU make bug 20033])
5045     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5046     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5047 A := \$(wildcard *.a)
5049 .PHONY: all
5050 all: \$(A:.a=.b)
5051 <TAB>@echo survived bug20033.
5053 .PHONY: setup
5054 setup:
5055 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5057 define d1
5058 @echo lala \$(1)
5059 @sleep 1
5060 endef
5062 define d2
5063 @echo tyty \$(1)
5064 @sleep 1
5065 endef
5067 %.b : %.a
5068 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5069 <TAB>\$(call d1,\$(CHECKSUM)),\
5070 <TAB>\$(call d2,\$(CHECKSUM)))
5072     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5073         no_parallelism_make="YES"
5074         AC_MSG_RESULT([yes, disable parallelism])
5075     else
5076         AC_MSG_RESULT([no, keep parallelism enabled])
5077     fi
5078     rm -rf $TESTGMAKEBUG20033
5079 else
5080     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5083 # find if gnumake support file function
5084 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
5085 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5086 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5087     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5089 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5090 \$(file >test.txt,Success )
5092 .PHONY: all
5093 all:
5094 <TAB>@cat test.txt
5097 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5098 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5099     HAVE_GNUMAKE_FILE_FUNC=TRUE
5100     AC_MSG_RESULT([yes])
5101 else
5102     AC_MSG_RESULT([no])
5104 rm -rf $TESTGMAKEFILEFUNC
5105 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5106 AC_SUBST(GNUMAKE)
5107 AC_SUBST(GNUMAKE_WIN_NATIVE)
5109 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
5110 STALE_MAKE=
5111 make_warning=
5112 if test "$_make_ver_check" = ""; then
5113    STALE_MAKE=TRUE
5116 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5117     SHELL_BASH=$(cygpath -m $(which bash))
5118 else
5119     SHELL_BASH=`which bash`
5121 AC_SUBST(SHELL_BASH)
5123 HAVE_LD_HASH_STYLE=FALSE
5124 WITH_LINKER_HASH_STYLE=
5125 AC_MSG_CHECKING( for --hash-style gcc linker support )
5126 if test "$GCC" = "yes"; then
5127     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5128         hash_styles="gnu sysv"
5129     elif test "$with_linker_hash_style" = "no"; then
5130         hash_styles=
5131     else
5132         hash_styles="$with_linker_hash_style"
5133     fi
5135     for hash_style in $hash_styles; do
5136         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5137         hash_style_ldflags_save=$LDFLAGS
5138         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5140         AC_LINK_IFELSE([AC_LANG_PROGRAM(
5141             [
5142 #include <stdio.h>
5143             ],[
5144 printf ("");
5145             ])],
5146             [ if ./conftest$EXEEXT; then
5147                   HAVE_LD_HASH_STYLE=TRUE
5148                   WITH_LINKER_HASH_STYLE=$hash_style
5149               fi],
5150             [HAVE_LD_HASH_STYLE=FALSE])
5151         LDFLAGS=$hash_style_ldflags_save
5152     done
5154     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5155         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5156     else
5157         AC_MSG_RESULT( no )
5158     fi
5159     LDFLAGS=$hash_style_ldflags_save
5160 else
5161     AC_MSG_RESULT( no )
5163 AC_SUBST(HAVE_LD_HASH_STYLE)
5164 AC_SUBST(WITH_LINKER_HASH_STYLE)
5166 dnl ===================================================================
5167 dnl Check whether there's a Perl version available.
5168 dnl ===================================================================
5169 if test -z "$with_perl_home"; then
5170     AC_PATH_PROG(PERL, perl)
5171 else
5172     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5173     _perl_path="$with_perl_home/bin/perl"
5174     if test -x "$_perl_path"; then
5175         PERL=$_perl_path
5176     else
5177         AC_MSG_ERROR([$_perl_path not found])
5178     fi
5181 dnl ===================================================================
5182 dnl Testing for Perl version 5 or greater.
5183 dnl $] is the Perl version variable, it is returned as an integer
5184 dnl ===================================================================
5185 if test "$PERL"; then
5186     AC_MSG_CHECKING([the Perl version])
5187     ${PERL} -e "exit($]);"
5188     _perl_version=$?
5189     if test "$_perl_version" -lt 5; then
5190         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5191     fi
5192     AC_MSG_RESULT([checked (perl $_perl_version)])
5193 else
5194     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5197 dnl ===================================================================
5198 dnl Testing for required Perl modules
5199 dnl ===================================================================
5201 AC_MSG_CHECKING([for required Perl modules])
5202 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5203     AC_MSG_RESULT([all modules found])
5204 else
5205     AC_MSG_RESULT([failed to find some modules])
5206     # Find out which modules are missing.
5207     missing_perl_modules=
5208     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5209         missing_perl_modules=Archive::Zip
5210     fi
5211     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5212         missing_perl_modules="$missing_perl_modules Cwd"
5213     fi
5214     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5215         missing_perl_modules="$missing_perl_modules Digest::MD5"
5216     fi
5217        AC_MSG_ERROR([
5218     The missing Perl modules are: $missing_perl_modules
5219     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5222 dnl ===================================================================
5223 dnl Check for pkg-config
5224 dnl ===================================================================
5225 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5226     PKG_PROG_PKG_CONFIG
5229 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5231     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5232     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5233     # explicitly. Or put /path/to/compiler in PATH yourself.
5235     AC_CHECK_TOOL(AR,ar)
5236     AC_CHECK_TOOL(NM,nm)
5237     AC_CHECK_TOOL(OBJDUMP,objdump)
5238     AC_CHECK_TOOL(RANLIB,ranlib)
5239     AC_CHECK_TOOL(STRIP,strip)
5240     if test "$_os" = "WINNT"; then
5241         AC_CHECK_TOOL(DLLTOOL,dlltool)
5242         AC_CHECK_TOOL(WINDRES,windres)
5243     fi
5245 AC_SUBST(AR)
5246 AC_SUBST(DLLTOOL)
5247 AC_SUBST(NM)
5248 AC_SUBST(OBJDUMP)
5249 AC_SUBST(PKG_CONFIG)
5250 AC_SUBST(RANLIB)
5251 AC_SUBST(STRIP)
5252 AC_SUBST(WINDRES)
5254 dnl ===================================================================
5255 dnl pkg-config checks on Mac OS X
5256 dnl ===================================================================
5258 if test $_os = Darwin; then
5259     AC_MSG_CHECKING([for bogus pkg-config])
5260     if test -n "$PKG_CONFIG"; then
5261         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5262             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5263         else
5264             if test "$enable_bogus_pkg_config" = "yes"; then
5265                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5266             else
5267                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5268             fi
5269         fi
5270     else
5271         AC_MSG_RESULT([no, good])
5272     fi
5275 find_csc()
5277     # Return value: $csctest
5279     unset csctest
5281     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5282     if test -n "$regvalue"; then
5283         csctest=$regvalue
5284         return
5285     fi
5288 find_al()
5290     # Return value: $altest
5292     unset altest
5294     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5295         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5296         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5297             altest=$regvalue
5298             return
5299         fi
5300     done
5303 find_dotnetsdk()
5305     # Return value: $frametest (that's a silly name...)
5307     unset frametest
5309     for ver in 1.1 2.0; do
5310         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5311         if test -n "$regvalue"; then
5312             frametest=$regvalue
5313             return
5314         fi
5315     done
5318 find_winsdk_version()
5320     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5321     # Return value: $winsdktest
5323     unset winsdktest
5325     # Why we look for them in this particular order I don't know. But OTOH I
5326     case "$1" in
5327     6.0*|7.*)
5328         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5329         if test -n "$regvalue"; then
5330             winsdktest=$regvalue
5331             return
5332         fi
5333         ;;
5334     8.*)
5335         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5336         if test -n "$regvalue"; then
5337             winsdktest=$regvalue
5338             return
5339         fi
5340         ;;
5341     esac
5344 find_winsdk()
5346     # Args: $1 (optional) : list of acceptable SDK versions
5347     # Return value: $winsdktest
5349     unset winsdktest
5351     if test -n "$1"; then
5352         sdkversions=$1
5353     else
5354         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5355     fi
5357     for ver in $sdkversions; do
5358         find_winsdk_version $ver
5359         if test -n "$winsdktest"; then
5360             return
5361         fi
5362     done
5365 find_msms()
5367     for ver in 10.0 11.0; do
5368         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5369         if test -n "$regvalue"; then
5370             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5371                 msmdir=$regvalue
5372                 break
5373             fi
5374         fi
5375     done
5376     if test -z "$msmdir"; then
5377         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "${COMMONPROGRAMFILES}/Merge Modules/"])
5378         msmdir="${COMMONPROGRAMFILES}/Merge Modules/"
5379     fi
5380     msmdir=`cygpath -m "$msmdir"`
5381     if test -z "$msmdir"; then
5382         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5383             AC_MSG_ERROR([Merge modules not found in $msmdir])
5384         else
5385             AC_MSG_WARN([Merge modules not found in $msmdir])
5386             msmdir=""
5387         fi
5388     fi
5391 find_msvc_x64_dlls()
5393     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5394     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5395     for dll in $msvcdlls; do
5396         if ! test -f "$msvcdllpath/$dll"; then
5397             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5398         fi
5399     done
5402 if test "$build_os" = "cygwin"; then
5403     dnl Check midl.exe
5404     AC_MSG_CHECKING([for midl.exe])
5406     find_winsdk
5407     if test -f "$winsdktest/Bin/midl.exe"; then
5408         MIDL_PATH="$winsdktest/Bin"
5409     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5410         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5411     fi
5412     if test ! -f "$MIDL_PATH/midl.exe"; then
5413         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5414     else
5415         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5416     fi
5418     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5419     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5421     dnl Check csc.exe
5422     AC_MSG_CHECKING([for csc.exe])
5423     find_csc
5424     if test -f "$csctest/csc.exe"; then
5425         CSC_PATH="$csctest"
5426     fi
5427     if test ! -f "$CSC_PATH/csc.exe"; then
5428         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5429     else
5430         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5431     fi
5433     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5435     dnl Check al.exe
5436     AC_MSG_CHECKING([for al.exe])
5437     find_winsdk
5438     if test -f "$winsdktest/Bin/al.exe"; then
5439         AL_PATH="$winsdktest/Bin"
5440     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5441         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5442     fi
5444     if test -z "$AL_PATH"; then
5445         find_al
5446         if test -f "$altest/bin/al.exe"; then
5447             AL_PATH="$altest/bin"
5448         elif test -f "$altest/al.exe"; then
5449             AL_PATH="$altest"
5450         fi
5451     fi
5452     if test ! -f "$AL_PATH/al.exe"; then
5453         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5454     else
5455         AC_MSG_RESULT([$AL_PATH/al.exe])
5456     fi
5458     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5460     dnl Check mscoree.lib / .NET Framework dir
5461     AC_MSG_CHECKING(.NET Framework)
5462     find_dotnetsdk
5463     if test -f "$frametest/lib/mscoree.lib"; then
5464         DOTNET_FRAMEWORK_HOME="$frametest"
5465     else
5466         find_winsdk
5467         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5468             DOTNET_FRAMEWORK_HOME="$winsdktest"
5469         fi
5470     fi
5472     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5473         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5474     fi
5475     AC_MSG_RESULT(found)
5477     PathFormat "$MIDL_PATH"
5478     MIDL_PATH="$formatted_path"
5480     PathFormat "$AL_PATH"
5481     AL_PATH="$formatted_path"
5483     PathFormat "$DOTNET_FRAMEWORK_HOME"
5484     DOTNET_FRAMEWORK_HOME="$formatted_path"
5486     PathFormat "$CSC_PATH"
5487     CSC_PATH="$formatted_path"
5490 dnl ===================================================================
5491 dnl Check if stdc headers are available excluding MSVC.
5492 dnl ===================================================================
5493 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5494     AC_HEADER_STDC
5497 dnl ===================================================================
5498 dnl Testing for C++ compiler and version...
5499 dnl ===================================================================
5501 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5502     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5503     save_CXXFLAGS=$CXXFLAGS
5504     AC_PROG_CXX
5505     CXXFLAGS=$save_CXXFLAGS
5506 else
5507     if test -n "$CC" -a -z "$CXX"; then
5508         CXX="$CC"
5509     fi
5512 dnl check for GNU C++ compiler version
5513 if test "$GXX" = "yes"; then
5514     AC_MSG_CHECKING([the GNU C++ compiler version])
5516     _gpp_version=`$CXX -dumpversion`
5517     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5519     if test "$_gpp_majmin" -lt "401"; then
5520         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5521     else
5522         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5523     fi
5525     dnl see https://code.google.com/p/android/issues/detail?id=41770
5526     if test "$_gpp_majmin" -ge "401"; then
5527         glibcxx_threads=no
5528         AC_LANG_PUSH([C++])
5529         AC_REQUIRE_CPP
5530         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5531         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5532             #include <bits/c++config.h>]],[[
5533             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5534             && !defined(_GLIBCXX__PTHREADS) \
5535             && !defined(_GLIBCXX_HAS_GTHREADS)
5536             choke me
5537             #endif
5538         ]])],[AC_MSG_RESULT([yes])
5539         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5540         AC_LANG_POP([C++])
5541         if test $glibcxx_threads = yes; then
5542             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5543         fi
5544      fi
5546 AC_SUBST(BOOST_CXXFLAGS)
5549 # prefx CXX with ccache if needed
5551 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5552     if test "$CCACHE" != ""; then
5553         AC_MSG_CHECKING([whether $CXX is already ccached])
5554         AC_LANG_PUSH([C++])
5555         save_CXXFLAGS=$CXXFLAGS
5556         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5557         dnl an empty program will do, we're checking the compiler flags
5558         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5559                           [use_ccache=yes], [use_ccache=no])
5560         if test $use_ccache = yes; then
5561             AC_MSG_RESULT([yes])
5562         else
5563             CXX="$CCACHE $CXX"
5564             AC_MSG_RESULT([no])
5565         fi
5566         CXXFLAGS=$save_CXXFLAGS
5567         AC_LANG_POP([C++])
5568     fi
5571 dnl ===================================================================
5572 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5573 dnl ===================================================================
5575 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5576     AC_PROG_CXXCPP
5578     dnl Check whether there's a C pre-processor.
5579     dnl ===================================================================
5580     dnl When using SunStudio compiler, there is a bug with the cc
5581     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5582     dnl See Issuezilla #445.
5583     dnl ===================================================================
5584     if test "$_os" = "SunOS"; then
5585         CPP=$CXXCPP
5586     else
5587         AC_PROG_CPP
5588     fi
5592 dnl ===================================================================
5593 dnl Find integral type sizes and alignments
5594 dnl ===================================================================
5596 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5598     AC_CHECK_SIZEOF(long)
5599     AC_CHECK_SIZEOF(short)
5600     AC_CHECK_SIZEOF(int)
5601     AC_CHECK_SIZEOF(long long)
5602     AC_CHECK_SIZEOF(double)
5603     AC_CHECK_SIZEOF(void*)
5605     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5606     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5607     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5608     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5609     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5611     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5612     m4_pattern_allow([AC_CHECK_ALIGNOF])
5613     m4_ifdef([AC_CHECK_ALIGNOF],
5614         [
5615             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5616             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5617             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5618             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5619         ],
5620         [
5621             case "$_os-$host_cpu" in
5622             Linux-i686)
5623                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5624                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5625                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5626                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5627                 ;;
5628             Linux-x86_64)
5629                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5630                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5631                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5632                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5633                 ;;
5634             *)
5635                 if test -z "$ac_cv_alignof_short" -o \
5636                         -z "$ac_cv_alignof_int" -o \
5637                         -z "$ac_cv_alignof_long" -o \
5638                         -z "$ac_cv_alignof_double"; then
5639                    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.])
5640                 fi
5641                 ;;
5642             esac
5643         ])
5645     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5646     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5647     if test $ac_cv_sizeof_long -eq 8; then
5648         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5649     elif test $ac_cv_sizeof_double -eq 8; then
5650         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5651     else
5652         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5653     fi
5655     dnl Check for large file support
5656     AC_SYS_LARGEFILE
5657     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5658         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5659     fi
5660     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5661         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5662     fi
5663 else
5664     # Hardcode for MSVC
5665     SAL_TYPES_SIZEOFSHORT=2
5666     SAL_TYPES_SIZEOFINT=4
5667     SAL_TYPES_SIZEOFLONG=4
5668     SAL_TYPES_SIZEOFLONGLONG=8
5669     if test "$BITNESS_OVERRIDE" = ""; then
5670         SAL_TYPES_SIZEOFPOINTER=4
5671     else
5672         SAL_TYPES_SIZEOFPOINTER=8
5673     fi
5674     SAL_TYPES_ALIGNMENT2=2
5675     SAL_TYPES_ALIGNMENT4=4
5676     SAL_TYPES_ALIGNMENT8=8
5677     LFS_CFLAGS=''
5679 AC_SUBST(LFS_CFLAGS)
5681 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5682 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5683 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5684 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5685 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5686 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5687 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5688 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5690 dnl ===================================================================
5691 dnl Check whether to enable runtime optimizations
5692 dnl ===================================================================
5693 ENABLE_RUNTIME_OPTIMIZATIONS=
5694 AC_MSG_CHECKING([whether to enable runtime optimizations])
5695 if test -z "$enable_runtime_optimizations"; then
5696     for i in $CC; do
5697         case $i in
5698         -fsanitize=address)
5699             enable_runtime_optimizations=no
5700             break
5701             ;;
5702         esac
5703     done
5705 if test "$enable_runtime_optimizations" != no; then
5706     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5707     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5708     AC_MSG_RESULT([yes])
5709 else
5710     AC_MSG_RESULT([no])
5712 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5714 dnl ===================================================================
5715 dnl Check if valgrind headers are available
5716 dnl ===================================================================
5717 ENABLE_VALGRIND=
5718 if test "$cross_compiling" != yes; then
5719     prev_cppflags=$CPPFLAGS
5720     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5721     # or where does it come from?
5722     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5723     AC_CHECK_HEADER([valgrind/valgrind.h],
5724         [ENABLE_VALGRIND=TRUE])
5725     CPPFLAGS=$prev_cppflags
5727 AC_SUBST([ENABLE_VALGRIND])
5728 if test -z "$ENABLE_VALGRIND"; then
5729     VALGRIND_CFLAGS=
5731 AC_SUBST([VALGRIND_CFLAGS])
5734 dnl ===================================================================
5735 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5736 dnl ===================================================================
5738 # We need at least the sys/sdt.h include header.
5739 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5740 if test "$SDT_H_FOUND" = "TRUE"; then
5741     # Found sys/sdt.h header, now make sure the c++ compiler works.
5742     # Old g++ versions had problems with probes in constructors/destructors.
5743     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5744     AC_LANG_PUSH([C++])
5745     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5746     #include <sys/sdt.h>
5747     class ProbeClass
5748     {
5749     private:
5750       int& ref;
5751       const char *name;
5753     public:
5754       ProbeClass(int& v, const char *n) : ref(v), name(n)
5755       {
5756         DTRACE_PROBE2(_test_, cons, name, ref);
5757       }
5759       void method(int min)
5760       {
5761         DTRACE_PROBE3(_test_, meth, name, ref, min);
5762         ref -= min;
5763       }
5765       ~ProbeClass()
5766       {
5767         DTRACE_PROBE2(_test_, dest, name, ref);
5768       }
5769     };
5770     ]],[[
5771     int i = 64;
5772     DTRACE_PROBE1(_test_, call, i);
5773     ProbeClass inst = ProbeClass(i, "call");
5774     inst.method(24);
5775     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5776           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5777     AC_LANG_POP([C++])
5779 AC_CONFIG_HEADERS([config_host/config_probes.h])
5781 dnl ===================================================================
5782 dnl Set the MinGW sys-root
5783 dnl ===================================================================
5784 if test "$WITH_MINGW" = "yes"; then
5785     AC_MSG_CHECKING([for MinGW sysroot])
5786     sysroot=`$CC -print-sysroot`
5787     AS_IF([test -d "$sysroot"/mingw],
5788           [MINGW_SYSROOT="$sysroot"/mingw
5789            AC_MSG_RESULT([$MINGW_SYSROOT])],
5790           [AC_MSG_RESULT([not found])
5791            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5793 AC_SUBST([MINGW_DLLS])
5794 AC_SUBST([MINGW_SYSROOT])
5796 dnl ===================================================================
5797 dnl Set the MinGW include directories
5798 dnl ===================================================================
5799 if test "$WITH_MINGW" = "yes"; then
5800     AC_MSG_CHECKING([for MinGW include path])
5801     cat >conftest.$ac_ext <<_ACEOF
5802 #include <stddef.h>
5803 #include <bits/c++config.h>
5804 _ACEOF
5805     _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`
5806     rm conftest.$ac_ext
5807     if test -z "$_mingw_lib_include_path"; then
5808         _mingw_lib_include_path="NO_LIB_INCLUDE"
5809         AC_MSG_RESULT([no MinGW include path])
5810     else
5811         AC_MSG_RESULT([$_mingw_lib_include_path])
5812     fi
5813     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5814     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5816     AC_LANG_PUSH([C++])
5818     AC_MSG_CHECKING([for dynamic libgcc])
5819     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5820 #include <iostream>
5821 using namespace std;
5822 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5823             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5824             if test -n "$MINGW_GCCDLL"; then
5825                 MINGW_SHARED_GCCLIB=TRUE
5826                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5827             else
5828                 MINGW_SHARED_GCCLIB=
5829                 AC_MSG_RESULT([no])
5830             fi
5831        ],[ AC_MSG_RESULT([no])
5833     ])
5835     AC_MSG_CHECKING([for dynamic libstdc++])
5836     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5837 #include <iostream>
5838 using namespace std;
5839 ]], [[ cout << "Hello there." << endl; ]])],[
5840             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5841             if test -n "$MINGW_GXXDLL"; then
5842                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5843                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5844                 if test "$CROSS_COMPILING" = "TRUE"; then
5845                     dnl m4 escaping!
5846                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5847                 fi
5848                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5849                 MINGW_SHARED_GXXLIB=TRUE
5850                 AC_MSG_RESULT([$MINGW_GXXDLL])
5851             else
5852                 MINGW_SHARED_GXXLIB=
5853                 AC_MSG_RESULT([no])
5854             fi
5855        ],[ AC_MSG_RESULT([no])
5857     ])
5859     AC_LANG_POP([C++])
5861     AC_SUBST(MINGW_SHARED_GCCLIB)
5862     AC_SUBST(MINGW_SHARED_GXXLIB)
5863     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5864     AC_SUBST(MINGW_GCCDLL)
5865     AC_SUBST(MINGW_GXXDLL)
5868 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5869     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5872 if test "$WITH_MINGW" = "yes"; then
5873     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5874     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5875     [
5876     #include <usp10.h>
5877     ],
5878     [
5879     SCRIPT_CONTROL c;
5880     c.fMergeNeutralItems = 1;
5881     ])],
5882     [
5883     AC_MSG_RESULT(yes)
5884     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5885     ],
5886     [AC_MSG_RESULT(no)])
5889 dnl ===================================================================
5890 dnl Extra checking for the SunOS compiler
5891 dnl ===================================================================
5892 if test "$_os" = "SunOS"; then
5893     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5894     if test "$CC" = "cc"; then
5895     AC_MSG_CHECKING([SunStudio C++ Compiler])
5896         if test "$CXX" != "CC"; then
5897             AC_MSG_WARN([SunStudio C++ was not found])
5898             add_warning "SunStudio C++ was not found"
5899         else
5900             AC_MSG_RESULT([checked])
5901         fi
5902     fi
5905 dnl *************************************************************
5906 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5907 dnl *************************************************************
5908 if test "$WITH_MINGW" = "yes"; then
5909     AC_MSG_CHECKING([exception type])
5910     AC_LANG_PUSH([C++])
5911     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5913         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5915         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5916     ])
5917     AC_MSG_RESULT($exceptions_type)
5918     AC_LANG_POP([C++])
5921 EXCEPTIONS="$exceptions_type"
5922 AC_SUBST(EXCEPTIONS)
5924 dnl ===================================================================
5925 dnl thread-safe statics
5926 dnl ===================================================================
5927 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5928 unset HAVE_THREADSAFE_STATICS
5929 if test "$GCC" = "yes"; then
5930     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5931     dnl us.  However, some C++ runtimes use a single lock for all static
5932     dnl variables, which can cause deadlock in multi-threaded applications.
5933     dnl This is not easily tested here; for POSIX-based systems, if executing
5934     dnl the following C++ program does not terminate then the tool chain
5935     dnl apparently has this problem:
5936     dnl
5937     dnl   #include <pthread.h>
5938     dnl   int h() { return 0; }
5939     dnl   void * g(void * unused) {
5940     dnl     static int n = h();
5941     dnl     return &n;
5942     dnl   }
5943     dnl   int f() {
5944     dnl     pthread_t t;
5945     dnl     pthread_create(&t, 0, g, 0);
5946     dnl     pthread_join(t, 0);
5947     dnl     return 0;
5948     dnl   }
5949     dnl   int main() {
5950     dnl     static int n = f();
5951     dnl     return n;
5952     dnl   }
5953     dnl
5954     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5955     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5956     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5957     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5958     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5959     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5960     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5961     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5962     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5963     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5964     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5965     dnl "too old"):
5966     if test "$_os" != Darwin -a "$_os" != Android; then
5967         if test "$COM_GCC_IS_CLANG" = TRUE; then
5968             AC_LANG_PUSH([C++])
5969             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5970 #include <list>
5971 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5972 #error
5973 #endif
5974                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5975             AC_LANG_POP([C++])
5976         elif test "${GCC_VERSION?}" -ge 0403; then
5977             HAVE_THREADSAFE_STATICS=TRUE
5978         fi
5979     fi
5980     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5981         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5982         AC_MSG_RESULT([yes])
5983     else
5984         AC_MSG_RESULT([broken (i.e., no)])
5985     fi
5986 else
5987     AC_MSG_RESULT([unknown (assuming no)])
5989 AC_SUBST(HAVE_THREADSAFE_STATICS)
5991 dnl ===================================================================
5992 dnl visibility and other gcc features
5993 dnl ===================================================================
5994 if test "$GCC" = "yes"; then
5995     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5996     save_CFLAGS=$CFLAGS
5997     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5998     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5999     CFLAGS=$save_CFLAGS
6001     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6002         AC_MSG_RESULT([yes])
6003     else
6004         AC_MSG_RESULT([no])
6005     fi
6007     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
6008     save_CFLAGS=$CFLAGS
6009     CFLAGS="$CFLAGS -Werror -Wno-long-double"
6010     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
6011     CFLAGS=$save_CFLAGS
6012     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
6013         AC_MSG_RESULT([yes])
6014     else
6015         AC_MSG_RESULT([no])
6016     fi
6018     AC_MSG_CHECKING([whether $CC supports -mno-avx])
6019     save_CFLAGS=$CFLAGS
6020     CFLAGS="$CFLAGS -Werror -mno-avx"
6021     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6022     CFLAGS=$save_CFLAGS
6023     if test "$HAVE_GCC_AVX" = "TRUE"; then
6024         AC_MSG_RESULT([yes])
6025     else
6026         AC_MSG_RESULT([no])
6027     fi
6029     AC_MSG_CHECKING([whether $CC supports atomic functions])
6030     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6031     int v = 0;
6032     if (__sync_add_and_fetch(&v, 1) != 1 ||
6033         __sync_sub_and_fetch(&v, 1) != 0)
6034         return 1;
6035     __sync_synchronize();
6036     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6037         v != 1)
6038         return 1;
6039     return 0;
6040 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6041     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6042         AC_MSG_RESULT([yes])
6043         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6044     else
6045         AC_MSG_RESULT([no])
6046     fi
6048     AC_MSG_CHECKING(
6049         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
6050     save_CFLAGS=$CFLAGS
6051     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6052     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6053             #pragma GCC diagnostic ignored "-Wunused-parameter"
6054             void dummy(int n) {}
6055         ])], [
6056             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
6057             AC_MSG_RESULT([yes])
6058         ], [AC_MSG_RESULT([no])])
6059     CFLAGS=$save_CFLAGS
6061     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
6062     save_CFLAGS=$CFLAGS
6063     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6064     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6065             #pragma GCC diagnostic push
6066             #pragma GCC diagnostic ignored "-Wunused-parameter"
6067             void dummy(int n) {}
6068             #pragma GCC diagnostic pop
6069         ])], [
6070             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
6071             AC_MSG_RESULT([yes])
6072         ], [AC_MSG_RESULT([no])])
6073     CFLAGS=$save_CFLAGS
6075     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6076     save_CFLAGS=$CFLAGS
6077     CFLAGS="$CFLAGS -Werror"
6078     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6079             __attribute__((deprecated("test"))) void f();
6080         ])], [
6081             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6082             AC_MSG_RESULT([yes])
6083         ], [AC_MSG_RESULT([no])])
6084     CFLAGS=$save_CFLAGS
6086     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6087     AC_LANG_PUSH([C++])
6088     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6089             #include <cxxabi.h>
6090             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6091         ])], [
6092             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6093             AC_MSG_RESULT([yes])
6094         ], [AC_MSG_RESULT([no])])
6095     AC_LANG_POP([C++])
6097     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6098     AC_LANG_PUSH([C++])
6099     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6100             #include <cxxabi.h>
6101             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6102         ])], [
6103             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6104             AC_MSG_RESULT([yes])
6105         ], [AC_MSG_RESULT([no])])
6106     AC_LANG_POP([C++])
6108     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6109     AC_LANG_PUSH([C++])
6110     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6111             #include <cxxabi.h>
6112             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6113         ])], [
6114             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6115             AC_MSG_RESULT([yes])
6116         ], [AC_MSG_RESULT([no])])
6117     AC_LANG_POP([C++])
6119     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6120     AC_LANG_PUSH([C++])
6121     save_CXXFLAGS=$CXXFLAGS
6122     CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
6123     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6124             struct __attribute__((warn_unused)) dummy {};
6125         ])], [
6126             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6127             AC_MSG_RESULT([yes])
6128         ], [AC_MSG_RESULT([no])])
6129     CXXFLAGS=$save_CXXFLAGS
6130     AC_LANG_POP([C++])
6132     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6133     AC_LANG_PUSH([C++])
6134     save_CXXFLAGS=$CXXFLAGS
6135     CXXFLAGS="$CFLAGS -Werror -Wunused"
6136     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6137             #include <string>
6138             void f() { std::string s; }
6139         ])], [
6140             AC_MSG_RESULT([no])
6141         ], [
6142             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6143             AC_MSG_RESULT([yes])])
6144     CXXFLAGS=$save_CXXFLAGS
6145     AC_LANG_POP([C++])
6148 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
6149 AC_SUBST(HAVE_GCC_AVX)
6150 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6152 dnl ===================================================================
6153 dnl Identify the C++ library
6154 dnl ===================================================================
6156 AC_MSG_CHECKING([What the C++ library is])
6157 AC_LANG_PUSH([C++])
6158 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6159 #include <utility>
6160 #ifndef __GLIBCXX__
6161 foo bar
6162 #endif
6163 ]])],
6164     [CPP_LIBRARY=GLIBCXX
6165      cpp_library_name="GNU libstdc++"
6166     ],
6167     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6168 #include <utility>
6169 #ifndef _LIBCPP_VERSION
6170 foo bar
6171 #endif
6172 ]])],
6173     [CPP_LIBRARY=LIBCPP
6174      cpp_library_name="LLVM libc++"
6175     ],
6176     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6177 #include <utility>
6178 #ifndef _MSC_VER
6179 foo bar
6180 #endif
6181 ]])],
6182     [CPP_LIBRARY=MSVCRT
6183      cpp_library_name="Microsoft"
6184     ],
6185     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6186 AC_MSG_RESULT([$cpp_library_name])
6187 AC_LANG_POP([C++])
6188 AC_SUBST(CPP_LIBRARY)
6190 dnl ===================================================================
6191 dnl C++11
6192 dnl ===================================================================
6194 CXXFLAGS_CXX11=
6195 HAVE_CXX11=
6196 if test "$COM" = MSC; then
6197     AC_MSG_CHECKING([whether $CXX supports C++11])
6198     AC_MSG_RESULT(yes)
6199     # MSVC supports (a subset of) CXX11 without any switch
6200     HAVE_CXX11=TRUE
6201     CXXFLAGS_CXX11=
6202 elif test "$GCC" = "yes"; then
6203     CXXFLAGS_CXX11=
6204     AC_MSG_CHECKING([whether $CXX supports C++11])
6205     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6206         save_CXXFLAGS=$CXXFLAGS
6207         CXXFLAGS="$CXXFLAGS $flag -Werror"
6208         AC_LANG_PUSH([C++])
6209         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6210         AC_LANG_POP([C++])
6211         CXXFLAGS=$save_CXXFLAGS
6212         if test -n "$CXXFLAGS_CXX11"; then
6213             HAVE_CXX11=TRUE
6214             break
6215         fi
6216     done
6217     if test "$HAVE_CXX11" = TRUE; then
6218         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6219     else
6220         AC_MSG_RESULT(no)
6221     fi
6224 if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then
6225     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6226     AC_LANG_PUSH([C++])
6227     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6228 #include <list>
6229 #if !defined(__GLIBCXX__)
6230 /* ok */
6231 #elif __GLIBCXX__ < 20111004
6232 /* before breakage */
6233 #elif __GLIBCXX__ > 20120703
6234 /* after breakage */
6235 #else
6236 abi broken
6237 #endif
6238         ]])], [AC_MSG_RESULT(no, ok)],
6239         [AC_MSG_RESULT(yes, disabling C++11)
6240          HAVE_CXX11=])
6241     AC_LANG_POP([C++])
6244 if test "$HAVE_CXX11" = TRUE; then
6245     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6246     save_CXXFLAGS=$CXXFLAGS
6247     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6248     AC_LANG_PUSH([C++])
6250     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6251 #include <stddef.h>
6253 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6255 namespace
6257         struct b
6258         {
6259                 int i;
6260                 int j;
6261         };
6263 ]], [[
6264 struct a
6266         int i;
6267         int j;
6269 a thinga[]={{0,0}, {1,1}};
6270 b thingb[]={{0,0}, {1,1}};
6271 size_t i = sizeof(sal_n_array_size(thinga));
6272 size_t j = sizeof(sal_n_array_size(thingb));
6273 return !(i != 0 && j != 0);
6275         ], [ AC_MSG_RESULT(yes) ],
6276         [ AC_MSG_RESULT(no)
6277           HAVE_CXX11=
6278         ])
6279     AC_LANG_POP([C++])
6280     CXXFLAGS=$save_CXXFLAGS
6283 if test "$HAVE_CXX11" = TRUE; then
6284     AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6285     save_CXXFLAGS=$CXXFLAGS
6286     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6287     AC_LANG_PUSH([C++])
6289     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6290 #include <vector>
6291     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6292     // (__float128)
6294     ],[ AC_MSG_RESULT(yes) ],
6295     [
6296         AC_MSG_RESULT(no)
6297         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6298         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6299         # __float128 is available during its build, but it's usually built using GCC,
6300         # and so c++config.h hardcodes __float128 being supported). As the only place
6301         # where __float128 is actually used is in a template specialization,
6302         # -D__float128=void will avoid the problem there while still causing a problem
6303         # if somebody actually uses the type.
6304         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6305         CXXFLAGS="$CXXFLAGS -D__float128=void"
6306         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6307 #include <vector>
6308     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6309     // (__float128)
6311         ],
6312         [
6313          AC_MSG_RESULT(yes)
6314          CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6315         ],
6316         [
6317          AC_MSG_RESULT(no)
6318          HAVE_CXX11=
6319         ])
6320     ])
6322     AC_LANG_POP([C++])
6323     CXXFLAGS=$save_CXXFLAGS
6326 if test "$HAVE_CXX11" = "TRUE"; then
6327     AC_DEFINE(HAVE_CXX11)
6328 elif test -n "$CXXFLAGS_CXX11"; then
6329     AC_MSG_NOTICE([Disabling C++11 support])
6330     CXXFLAGS_CXX11=
6331 elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
6332     AC_MSG_ERROR([Selected libc++ but C++11 support broken])
6335 AC_SUBST(CXXFLAGS_CXX11)
6336 AC_SUBST(HAVE_CXX11)
6338 AC_MSG_CHECKING([for std::shared_ptr])
6339 if test "$HAVE_CXX11" = "TRUE" -a "$GCC" = "yes"; then
6340     save_CXXFLAGS=$CXXFLAGS
6341     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6342     AC_LANG_PUSH([C++])
6343     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
6344         #include <memory>
6345         using std::shared_ptr;
6346         ])],
6347       [ have_std_shared_ptr=yes ],
6348       [ have_std_shared_ptr=no ]
6349     )
6350     AC_LANG_POP([C++])
6351     CXXFLAGS=$save_CXXFLAGS
6352 elif test "$COM" = "MSC"; then
6353     have_std_shared_ptr=yes
6354 else
6355     have_std_shared_ptr=no
6357 AC_MSG_RESULT([$have_std_shared_ptr])
6359 dnl ==================================
6360 dnl Check for C++11 "= delete" support
6361 dnl ==================================
6363 if test "$HAVE_CXX11" = "TRUE"; then
6364     AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6365     save_CXXFLAGS=$CXXFLAGS
6366     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6367     AC_LANG_PUSH([C++])
6368     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6369 struct A
6370     {
6371     void test() = delete;
6372     };
6373 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6375     AC_LANG_POP([C++])
6376     CXXFLAGS=$save_CXXFLAGS
6377     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6378         AC_MSG_RESULT([yes])
6379         AC_DEFINE([HAVE_CXX11_DELETE])
6380     else
6381         AC_MSG_RESULT([no])
6382     fi
6385 dnl ==================================
6386 dnl Check for C++11 "override" support
6387 dnl ==================================
6389 if test "$HAVE_CXX11" = "TRUE"; then
6390     AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6391     save_CXXFLAGS=$CXXFLAGS
6392     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6393     AC_LANG_PUSH([C++])
6394     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6395 struct A
6397         virtual void test();
6400 struct B : A
6402         virtual void test() override;
6404 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6406     AC_LANG_POP([C++])
6407     CXXFLAGS=$save_CXXFLAGS
6408     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6409         AC_MSG_RESULT([yes])
6410         AC_DEFINE([HAVE_CXX11_OVERRIDE])
6411     else
6412         AC_MSG_RESULT([no])
6413     fi
6416 dnl ==================================
6417 dnl Check for C++11 "final" support
6418 dnl ==================================
6420 if test "$HAVE_CXX11" = "TRUE"; then
6421     AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6422     save_CXXFLAGS=$CXXFLAGS
6423     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6424     AC_LANG_PUSH([C++])
6425     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6426 // First check that this correct program that uses "final" compiles
6427 struct A final
6431 struct B
6433         virtual void test();
6436 struct C : B
6438         void test() final;
6440 ]])],[have_final=yes],[])
6442     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6443 // Then check that the "final" works as expected,
6444 // that this program fails to compile
6445 struct A final
6449 struct B : A
6452 ]])],[],[final_class_works=yes])
6454     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6455 // Also this should fail to compile
6456 struct B
6458         virtual void test();
6461 struct C : B
6463         void test() final;
6466 struct D : C
6468         void test();
6470 ]])],[],[final_method_works=yes])
6471     AC_LANG_POP([C++])
6473     CXXFLAGS=$save_CXXFLAGS
6475     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6476         AC_MSG_RESULT([yes])
6477         AC_DEFINE([HAVE_CXX11_FINAL])
6478     else
6479         AC_MSG_RESULT([no])
6480     fi
6483 dnl ===================================================================
6484 dnl Check for C++11 perfect forwarding support
6485 dnl ===================================================================
6486 if test "$HAVE_CXX11" = "TRUE"; then
6487     AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6488     save_CXXFLAGS=$CXXFLAGS
6489     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6490     AC_LANG_PUSH([C++])
6491     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6492         #include <utility>
6493         template<typename T, typename... Args> T * f(Args &&... v) {
6494             return new T(std::forward<Args>(v)...);
6495         }
6496         ]], [[
6497         f<int>(0);
6498         ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6499     AC_LANG_POP([C++])
6500     CXXFLAGS=$save_CXXFLAGS
6501     AC_MSG_RESULT([$perfect_forwarding])
6502     if test "$perfect_forwarding" = yes; then
6503         AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6504     fi
6507 HAVE_GCC_PRAGMA_OPERATOR=
6508 dnl _Pragma support (may require C++11)
6509 if test "$GCC" = "yes"; then
6510     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6511     AC_LANG_PUSH([C++])
6512     save_CXXFLAGS=$CXXFLAGS
6513     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6514     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6515             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6516         ])], [
6517             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6518             HAVE_GCC_PRAGMA_OPERATOR=1
6519             AC_MSG_RESULT([yes])
6520         ], [AC_MSG_RESULT([no])])
6521     AC_LANG_POP([C++])
6522     CXXFLAGS=$save_CXXFLAGS
6524 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6526 dnl ===================================================================
6527 dnl system stl sanity tests
6528 dnl ===================================================================
6529 HAVE_GCC_VISIBILITY_BROKEN=
6530 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6532     AC_LANG_PUSH([C++])
6534     save_CPPFLAGS="$CPPFLAGS"
6535     if test -n "$MACOSX_SDK_PATH"; then
6536         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6537     fi
6539     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6540     # only.
6541     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6542         dnl gcc#19664, gcc#22482, rhbz#162935
6543         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6544         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6545         AC_MSG_RESULT([$stlvisok])
6546         if test "$stlvisok" = "no"; then
6547             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6548             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6549             unset HAVE_GCC_VISIBILITY_FEATURE
6550         fi
6551     fi
6553     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6554         sharedlink_ldflags_save=$LDFLAGS
6555         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6557         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6558         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6559 #include <sstream>
6560 using namespace std;
6561             ]], [[
6562 istringstream strm( "test" ); return 0;
6563             ]])],
6564             # Ugh, surely bad to assume an error message will contain
6565             # the word "unresolvable", a problem with
6566             # -fvisibility-inlines-hidden and STL headers might cause
6567             # some more obscure message on some platform, and anway,
6568             # the error message could be localised.
6569             [$EGREP -q unresolvable conftest.err;
6570             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6571         ])
6572         AC_MSG_RESULT([$gccvisok])
6573         if test "$gccvisok" = "no"; then
6574             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6575             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6576             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6577         fi
6579         LDFLAGS=$sharedlink_ldflags_save
6580     fi
6582     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6583     # when we don't make any dynamic libraries?
6584     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6585         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6586         cat > conftestlib1.cc <<_ACEOF
6587 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6588 struct S2: S1<int> { virtual ~S2(); };
6589 S2::~S2() {}
6590 _ACEOF
6591         cat > conftestlib2.cc <<_ACEOF
6592 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6593 struct S2: S1<int> { virtual ~S2(); };
6594 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6595 _ACEOF
6596         gccvisinlineshiddenok=yes
6597         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6598             gccvisinlineshiddenok=no
6599         else
6600             dnl At least Clang -fsanitize=address is known to not work with
6601             dnl -z defs (unsetting which makes the test moot, though):
6602             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6603             if test "$COM_GCC_IS_CLANG" = TRUE; then
6604                 for i in $CXX; do
6605                     case $i in
6606                     -fsanitize=address)
6607                         my_linkflagsnoundefs=
6608                         break
6609                         ;;
6610                     esac
6611                 done
6612             fi
6613             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6614                 gccvisinlineshiddenok=no
6615             fi
6616         fi
6618         rm -fr libconftest*
6619         AC_MSG_RESULT([$gccvisinlineshiddenok])
6620         if test "$gccvisinlineshiddenok" = "no"; then
6621             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6622             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6623             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6624         fi
6625     fi
6627     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6628         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6629         cat >visibility.cxx <<_ACEOF
6630 #pragma GCC visibility push(hidden)
6631 struct __attribute__ ((visibility ("default"))) TestStruct {
6632   static void Init();
6634 __attribute__ ((visibility ("default"))) void TestFunc() {
6635   TestStruct::Init();
6637 _ACEOF
6638         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6639             gccvisbroken=yes
6640         else
6641             case "$host_cpu" in
6642             i?86|x86_64)
6643                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6644                     gccvisbroken=no
6645                 else
6646                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6647                         gccvisbroken=no
6648                     else
6649                         gccvisbroken=yes
6650                     fi
6651                 fi
6652                 ;;
6653             *)
6654                 gccvisbroken=no
6655                 ;;
6656             esac
6657         fi
6658         rm -f visibility.s visibility.cxx
6660         AC_MSG_RESULT([$gccvisbroken])
6661         if test "$gccvisbroken" = "yes"; then
6662             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6663             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6664             unset HAVE_GCC_VISIBILITY_FEATURE
6665         fi
6666     fi
6668     CPPFLAGS="$save_CPPFLAGS"
6670     AC_LANG_POP([C++])
6673 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6674 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6676 dnl ===================================================================
6677 dnl  Clang++ tests
6678 dnl ===================================================================
6680 HAVE_GCC_FNO_DEFAULT_INLINE=
6681 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6682 if test "$GCC" = "yes"; then
6683     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6684     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6685         # Option just ignored and silly warning that isn't a real
6686         # warning printed
6687         :
6688     else
6689         AC_LANG_PUSH([C++])
6690         save_CXXFLAGS=$CXXFLAGS
6691         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6692         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6693         CXXFLAGS=$save_CXXFLAGS
6694         AC_LANG_POP([C++])
6695     fi
6696     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6697         AC_MSG_RESULT([yes])
6698     else
6699         AC_MSG_RESULT([no])
6700     fi
6702     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6703     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6704         # As above
6705         :
6706     else
6707         AC_LANG_PUSH([C++])
6708         save_CXXFLAGS=$CXXFLAGS
6709         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6710         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6711         CXXFLAGS=$save_CXXFLAGS
6712         AC_LANG_POP([C++])
6713     fi
6714     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6715         AC_MSG_RESULT([yes])
6716     else
6717         AC_MSG_RESULT([no])
6718     fi
6720 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6721 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6723 dnl ===================================================================
6724 dnl Compiler plugins
6725 dnl ===================================================================
6727 COMPILER_PLUGINS=
6728 # currently only Clang
6729 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6730     if test -n "$enable_compiler_plugins"; then
6731         compiler_plugins="$enable_compiler_plugins"
6732     elif test -n "$ENABLE_DBGUTIL"; then
6733         compiler_plugins=test
6734     else
6735         compiler_plugins=no
6736     fi
6737     if test "$compiler_plugins" != "no"; then
6738         dnl The prefix where Clang resides, override to where Clang resides if
6739         dnl using a source build:
6740         if test -z "$CLANGDIR"; then
6741             CLANGDIR=/usr
6742         fi
6743         AC_LANG_PUSH([C++])
6744         save_CPPFLAGS=$CPPFLAGS
6745         save_CXX=$CXX
6746         # compiler plugins must be built with "native" bitness of clang
6747         # because they link against clang libraries
6748         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6749         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6750         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6751             [COMPILER_PLUGINS=TRUE],
6752             [
6753             if test "$compiler_plugins" = "yes"; then
6754                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6755             else
6756                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6757                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6758             fi
6759             ])
6760         CXX=$save_CXX
6761         CPPFLAGS=$save_CPPFLAGS
6762         AC_LANG_POP([C++])
6763     fi
6764 else
6765     if test "$enable_compiler_plugins" = "yes"; then
6766         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6767     fi
6769 AC_SUBST(COMPILER_PLUGINS)
6770 AC_SUBST(CLANGDIR)
6772 # Plugin to help linker.
6773 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6774 # This makes --enable-lto build with clang work.
6775 AC_SUBST(LD_PLUGIN)
6777 dnl ===================================================================
6778 dnl allocator
6779 dnl ===================================================================
6780 AC_MSG_CHECKING([which memory allocator to use])
6781 if test "$with_alloc" = "system"; then
6782     AC_MSG_RESULT([system])
6783     ALLOC="SYS_ALLOC"
6785 if test "$with_alloc" = "tcmalloc"; then
6786     AC_MSG_RESULT(tcmalloc)
6787     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6788         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6789     fi
6790     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6791         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6792     ALLOC="TCMALLOC"
6794 if test "$with_alloc" = "jemalloc"; then
6795     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6796         AC_MSG_RESULT(jemalloc)
6797         save_CFLAGS=$CFLAGS
6798         CFLAGS="$CFLAGS -pthread"
6799         AC_CHECK_LIB([jemalloc], [malloc], [:],
6800             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6801         ALLOC="JEMALLOC"
6802         CFLAGS=$save_CFLAGS
6803     else
6804         AC_MSG_RESULT([system])
6805         ALLOC="SYS_ALLOC"
6806     fi
6808 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6809     AC_MSG_RESULT([internal])
6811 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6812 AC_SUBST(HAVE_POSIX_FALLOCATE)
6813 AC_SUBST(ALLOC)
6815 dnl ===================================================================
6816 dnl Custom build version
6817 dnl ===================================================================
6819 AC_MSG_CHECKING([whether to add custom build version])
6820 if test "$with_build_version" != ""; then
6821     BUILD_VER_STRING=$with_build_version
6822     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6823 else
6824     BUILD_VER_STRING=
6825     AC_MSG_RESULT([no])
6827 AC_SUBST(BUILD_VER_STRING)
6829 JITC_PROCESSOR_TYPE=""
6830 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6831     # IBMs JDK needs this...
6832     JITC_PROCESSOR_TYPE=6
6833     export JITC_PROCESSOR_TYPE
6835 AC_SUBST([JITC_PROCESSOR_TYPE])
6837 # Misc Windows Stuff
6838 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6839     find_msvc_x64_dlls
6840     find_msms
6841     MSVC_DLL_PATH="$msvcdllpath"
6842     MSVC_DLLS="$msvcdlls"
6843     MSM_PATH="$msmdir"
6844     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6847 AC_SUBST(MSVC_DLL_PATH)
6848 AC_SUBST(MSVC_DLLS)
6849 AC_SUBST(MSM_PATH)
6851 dnl ===================================================================
6852 dnl Checks for Java
6853 dnl ===================================================================
6854 if test "$ENABLE_JAVA" != ""; then
6856     # Windows-specific tests
6857     if test "$build_os" = "cygwin"; then
6858         if test "$BITNESS_OVERRIDE" = 64; then
6859             bitness=64
6860         else
6861             bitness=32
6862         fi
6864         if test -z "$with_jdk_home"; then
6865             for ver in 1.8 1.7 1.6; do
6866                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6867                 if test -n "$regvalue"; then
6868                     _jdk_home=$regvalue
6869                     break
6870                 fi
6871             done
6872             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6873                 with_jdk_home="$_jdk_home"
6874                 howfound="found automatically"
6875             else
6876                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6877             fi
6878         else
6879             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6880             howfound="you passed"
6881         fi
6882     fi
6884     # 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.
6885     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6886     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6887         with_jdk_home=`/usr/libexec/java_home`
6888     fi
6890     JAVA_HOME=; export JAVA_HOME
6891     if test -z "$with_jdk_home"; then
6892         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6893     else
6894         _java_path="$with_jdk_home/bin/$with_java"
6895         dnl Check if there is a Java interpreter at all.
6896         if test -x "$_java_path"; then
6897             JAVAINTERPRETER=$_java_path
6898         else
6899             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6900         fi
6901     fi
6903     if test "$build_os" = "cygwin"; then
6904         # Check that the JDK found is correct architecture
6905         # Why is this necessary, we don't link with any library from the JDK I think,
6907         shortjdkhome=`cygpath -d "$with_jdk_home"`
6908         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
6909             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6910             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6911         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
6912             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6913             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6914         fi
6916         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6917             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6918         fi
6919         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6920     elif test $_os = Darwin -a "$BITNESS_OVERRIDE" = ""; then
6921         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6922         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6923         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6924         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6925         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6926             AC_MSG_RESULT([yes])
6927             JAVAIFLAGS=-d32
6928         else
6929             AC_MSG_RESULT([no])
6930         fi
6931     elif test "$cross_compiling" != "yes"; then
6932         # at least 2 reasons to check: officebean needs to link -ljawt,
6933         # and libjpipe.so needs to be loaded by java to run JunitTests.
6934         case $CPUNAME in
6935             AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64)
6936                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6937                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6938                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6939                 fi
6940                 ;;
6941             *) # assumption: everything else 32-bit
6942                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6943                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6944                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6945                 fi
6946                 ;;
6947         esac
6948     fi
6951 HAVE_JAVA6=
6952 dnl ===================================================================
6953 dnl Checks for JDK.
6954 dnl ===================================================================
6956 # Note that JAVA_HOME as for now always means the *build* platform's
6957 # JAVA_HOME. Whether all the complexity here actually is needed any
6958 # more or not, no idea.
6960 if test "$ENABLE_JAVA" != ""; then
6961     _gij_longver=0
6962     AC_MSG_CHECKING([the installed JDK])
6963     if test -n "$JAVAINTERPRETER"; then
6964         dnl java -version sends output to stderr!
6965         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6966             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6967         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6968             JDK=gcj
6969             AC_MSG_RESULT([checked (gcj)])
6970             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6971             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6973         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6974             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6975         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6976             JDK=ibm
6978             dnl IBM JDK specific tests
6979             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6980             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6982             if test "$_jdk_ver" -lt 10500; then
6983                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6984             fi
6985             if test "$_jdk_ver" -ge 10600; then
6986                 HAVE_JAVA6=TRUE
6987             fi
6989             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6991             if test "$with_jdk_home" = ""; then
6992                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6993 you must use the "--with-jdk-home" configure option explicitly])
6994             fi
6996             JAVA_HOME=$with_jdk_home
6997         else
6998             JDK=sun
7000             dnl Sun JDK specific tests
7001             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7002             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7004             if test "$_jdk_ver" -lt 10500; then
7005                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
7006             fi
7007             if test "$_jdk_ver" -gt 10600; then
7008                 JAVA_CLASSPATH_NOT_SET="1"
7009             fi
7010             if test "$_jdk_ver" -ge 10600; then
7011                 HAVE_JAVA6=TRUE
7012             fi
7014             AC_MSG_RESULT([checked (JDK $_jdk)])
7015             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7016             if test "$_os" = "WINNT"; then
7017                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7018             fi
7019         fi
7020     else
7021         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
7022     fi
7023 else
7024     dnl Java disabled
7025     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
7027 AC_SUBST([HAVE_JAVA6])
7029 dnl ===================================================================
7030 dnl Set target Java bytecode version
7031 dnl ===================================================================
7032 if test "$ENABLE_JAVA" != ""; then
7033     _java_target_ver="1.5"
7035     JAVA_SOURCE_VER="$_java_target_ver"
7036     JAVA_TARGET_VER="$_java_target_ver"
7039 dnl ===================================================================
7040 dnl Checks for javac
7041 dnl ===================================================================
7042 if test "$ENABLE_JAVA" != ""; then
7043     if test "$JDK" = "gcj"; then
7044         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
7045     else
7046         javacompiler="javac"
7047     fi
7048     if test -z "$with_jdk_home"; then
7049         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7050     else
7051         _javac_path="$with_jdk_home/bin/$javacompiler"
7052         dnl Check if there is a Java compiler at all.
7053         if test -x "$_javac_path"; then
7054             JAVACOMPILER=$_javac_path
7055         fi
7056     fi
7057     if test -z "$JAVACOMPILER"; then
7058         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7059     fi
7060     if test "$build_os" = "cygwin"; then
7061         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7062             JAVACOMPILER="${JAVACOMPILER}.exe"
7063         fi
7064         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7065     fi
7067     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
7068         AC_MSG_CHECKING([re-checking JDK])
7069         JDK=gcj
7070         AC_MSG_RESULT([checked (ecj)])
7071         _gij_longver="40200"
7072     fi
7075 JAVACISGCJ=""
7076 dnl ===================================================================
7077 dnl Checks that javac is gcj
7078 dnl ===================================================================
7079 if test "$ENABLE_JAVA" != ""; then
7080     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
7081         JAVACISGCJ="yes"
7082     fi
7084 AC_SUBST(JAVACISGCJ)
7086 dnl ===================================================================
7087 dnl Checks for javadoc
7088 dnl ===================================================================
7089 if test "$ENABLE_JAVA" != ""; then
7090     if test -z "$with_jdk_home"; then
7091         AC_PATH_PROG(JAVADOC, javadoc)
7092     else
7093         _javadoc_path="$with_jdk_home/bin/javadoc"
7094         dnl Check if there is a javadoc at all.
7095         if test -x "$_javadoc_path"; then
7096             JAVADOC=$_javadoc_path
7097         else
7098             AC_PATH_PROG(JAVADOC, javadoc)
7099         fi
7100     fi
7101     if test -z "$JAVADOC"; then
7102         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7103     fi
7104     if test "$build_os" = "cygwin"; then
7105         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7106             JAVADOC="${JAVADOC}.exe"
7107         fi
7108         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7109     fi
7111     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7112     JAVADOCISGJDOC="yes"
7113     fi
7115 AC_SUBST(JAVADOCISGJDOC)
7117 if test "$ENABLE_JAVA" != ""; then
7118     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7119     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7120         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7121            # try to recover first by looking whether we have a alternatives
7122            # system as in Debian or newer SuSEs where following /usr/bin/javac
7123            # over /etc/alternatives/javac leads to the right bindir where we
7124            # just need to strip a bit away to get a valid JAVA_HOME
7125            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7126         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7127             # maybe only one level of symlink (e.g. on Mac)
7128             JAVA_HOME=$(readlink $JAVACOMPILER)
7129             if test "$(dirname $JAVA_HOME)" = "."; then
7130                 # we've got no path to trim back
7131                 JAVA_HOME=""
7132             fi
7133         else
7134             # else warn
7135             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7136             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7137             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7138             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7139         fi
7140         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
7141         if test "$JAVA_HOME" != "/usr"; then
7142             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7143                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7144                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7145                 dnl Tiger already returns a JDK path..
7146                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7147             else
7148                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7149             fi
7150         fi
7151     fi
7152     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7154     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7155     if test -z "$JAVA_HOME"; then
7156         if test "x$with_jdk_home" = "x"; then
7157             cat > findhome.java <<_ACEOF
7158 [import java.io.File;
7160 class findhome
7162     public static void main(String args[])
7163     {
7164         String jrelocation = System.getProperty("java.home");
7165         File jre = new File(jrelocation);
7166         System.out.println(jre.getParent());
7167     }
7169 _ACEOF
7170             AC_MSG_CHECKING([if javac works])
7171             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7172             AC_TRY_EVAL(javac_cmd)
7173             if test $? = 0 -a -f ./findhome.class; then
7174                 AC_MSG_RESULT([javac works])
7175             else
7176                 echo "configure: javac test failed" >&5
7177                 cat findhome.java >&5
7178                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7179             fi
7180             AC_MSG_CHECKING([if gij knows its java.home])
7181             JAVA_HOME=`$JAVAINTERPRETER findhome`
7182             if test $? = 0 -a "$JAVA_HOME" != ""; then
7183                 AC_MSG_RESULT([$JAVA_HOME])
7184             else
7185                 echo "configure: java test failed" >&5
7186                 cat findhome.java >&5
7187                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7188             fi
7189             # clean-up after ourselves
7190             rm -f ./findhome.java ./findhome.class
7191         else
7192             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7193         fi
7194     fi
7196     dnl second sanity check JAVA_HOME if possible
7197     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
7198         # now check if $JAVA_HOME is really valid
7199         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7200             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7201                 JAVA_HOME_OK="NO"
7202             fi
7203         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7204             JAVA_HOME_OK="NO"
7205         fi
7206         if test "$JAVA_HOME_OK" = "NO"; then
7207             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7208             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7209             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7210             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7211             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7212             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7213         fi
7214     fi
7215     PathFormat "$JAVA_HOME"
7216     JAVA_HOME="$formatted_path"
7219 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7220     "$_os" != Darwin
7221 then
7222     AC_MSG_CHECKING([for JAWT lib])
7223     if test "$_os" = WINNT; then
7224         if test "$WITH_MINGW" = yes; then
7225             # The path is taken care of in gb_LinkTarget__use_jawt
7226             # in RepositoryExternal.mk:
7227             JAWTLIB=-ljawt
7228         else
7229             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7230             JAWTLIB=jawt.lib
7231         fi
7232     else
7233         case "$host_cpu" in
7234         arm*)
7235             my_java_arch=arm
7236             ;;
7237         i*86)
7238             my_java_arch=i386
7239             ;;
7240         m68k)
7241             my_java_arch=mk68
7242             ;;
7243         powerpc)
7244             my_java_arch=ppc
7245             ;;
7246         powerpc64)
7247             my_java_arch=ppc64
7248             ;;
7249         x86_64)
7250             my_java_arch=amd64
7251             ;;
7252         *)
7253             my_java_arch=$host_cpu
7254             ;;
7255         esac
7256         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7257     fi
7258     AC_MSG_RESULT([$JAWTLIB])
7260 AC_SUBST(JAWTLIB)
7262 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7263     case "$host_os" in
7265     aix*)
7266         JAVAINC="-I$JAVA_HOME/include"
7267         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7268         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7269         ;;
7271     cygwin*)
7272         JAVAINC="-I$JAVA_HOME/include/win32"
7273         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7274         ;;
7276     darwin*)
7277         if test -d "$JAVA_HOME/include/darwin"; then
7278             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7279         else
7280             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7281         fi
7282         ;;
7284     dragonfly*)
7285         JAVAINC="-I$JAVA_HOME/include"
7286         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7287         ;;
7289     freebsd*)
7290         JAVAINC="-I$JAVA_HOME/include"
7291         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7292         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7293         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7294         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7295         ;;
7297     k*bsd*-gnu*)
7298         JAVAINC="-I$JAVA_HOME/include"
7299         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7300         ;;
7302     linux-gnu*)
7303         JAVAINC="-I$JAVA_HOME/include"
7304         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7305         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7306         ;;
7308     mingw*)
7309         JAVAINC="-I$JAVA_HOME/include"
7310         ;;
7312     *netbsd*)
7313         JAVAINC="-I$JAVA_HOME/include"
7314         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7315         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7316        ;;
7318     openbsd*)
7319         JAVAINC="-I$JAVA_HOME/include"
7320         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7321         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7322         ;;
7324     solaris*)
7325         JAVAINC="-I$JAVA_HOME/include"
7326         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7327         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7328         ;;
7329     esac
7331 SOLARINC="$SOLARINC $JAVAINC"
7333 AC_SUBST(JAVACOMPILER)
7334 AC_SUBST(JAVADOC)
7335 AC_SUBST(JAVAINTERPRETER)
7336 AC_SUBST(JAVAIFLAGS)
7337 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7338 AC_SUBST(JAVA_HOME)
7339 AC_SUBST(JAVA_SOURCE_VER)
7340 AC_SUBST(JAVA_TARGET_VER)
7341 AC_SUBST(JDK)
7343 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7344 if test -n "$with_idlc_cpp"; then
7345     AC_MSG_RESULT([$with_idlc_cpp])
7346     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7347 else
7348     AC_MSG_RESULT([ucpp])
7349     AC_MSG_CHECKING([which ucpp tp use])
7350     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7351         AC_MSG_RESULT([external])
7352         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7353     else
7354         AC_MSG_RESULT([internal])
7355         BUILD_TYPE="$BUILD_TYPE UCPP"
7356     fi
7358 AC_SUBST(SYSTEM_UCPP)
7360 dnl ===================================================================
7361 dnl Check for epm (not needed for Windows)
7362 dnl ===================================================================
7363 AC_MSG_CHECKING([whether to enable EPM for packing])
7364 if test "$enable_epm" = "yes"; then
7365     AC_MSG_RESULT([yes])
7366     if test "$_os" != "WINNT"; then
7367         if test $_os = Darwin; then
7368             EPM=internal
7369         elif test -n "$with_epm"; then
7370             EPM=$with_epm
7371         else
7372             AC_PATH_PROG(EPM, epm, no)
7373         fi
7374         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7375             echo "EPM will be built."
7376             BUILD_TYPE="$BUILD_TYPE EPM"
7377             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7378         else
7379             # Gentoo has some epm which is something different...
7380             AC_MSG_CHECKING([whether the found epm is the right epm])
7381             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7382                 AC_MSG_RESULT([yes])
7383             else
7384                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7385             fi
7386             AC_MSG_CHECKING([epm version])
7387             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7388             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7389                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7390                 AC_MSG_RESULT([OK, >= 3.7])
7391             else
7392                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7393                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7394             fi
7395         fi
7396     fi
7398     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7399         AC_MSG_CHECKING([for rpm])
7400         for a in "$RPM" rpmbuild rpm; do
7401             $a --usage >/dev/null 2> /dev/null
7402             if test $? -eq 0; then
7403                 RPM=$a
7404                 break
7405             else
7406                 $a --version >/dev/null 2> /dev/null
7407                 if test $? -eq 0; then
7408                     RPM=$a
7409                     break
7410                 fi
7411             fi
7412         done
7413         if test -z "$RPM"; then
7414             AC_MSG_ERROR([not found])
7415         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7416             RPM_PATH=`which $RPM`
7417             AC_MSG_RESULT([$RPM_PATH])
7418             SCPDEFS="$SCPDEFS -DWITH_RPM"
7419         else
7420             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7421         fi
7422     fi
7423     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7424         AC_PATH_PROG(DPKG, dpkg, no)
7425         if test "$DPKG" = "no"; then
7426             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7427         fi
7428     fi
7429     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7430        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7431         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7432             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7433                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7434                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7435                     AC_MSG_RESULT([yes])
7436                 else
7437                     AC_MSG_RESULT([no])
7438                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7439                         _pt="rpm"
7440                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7441                         add_warning "the rpms will need to be installed with --nodeps"
7442                     else
7443                         _pt="pkg"
7444                     fi
7445                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7446                     add_warning "the ${_pt}s will not be relocateable"
7447                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7448                                  relocation will work, you need to patch your epm with the
7449                                  patch in epm/epm-3.7.patch or build with
7450                                  --with-epm=internal which will build a suitable epm])
7451                 fi
7452             fi
7453         fi
7454     fi
7455     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7456         AC_PATH_PROG(PKGMK, pkgmk, no)
7457         if test "$PKGMK" = "no"; then
7458             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7459         fi
7460     fi
7461     AC_SUBST(RPM)
7462     AC_SUBST(DPKG)
7463     AC_SUBST(PKGMK)
7464 else
7465     for i in $PKGFORMAT; do
7466         case "$i" in
7467         aix | bsd | deb | pkg | rpm | native | portable)
7468             AC_MSG_ERROR(
7469                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7470             ;;
7471         esac
7472     done
7473     AC_MSG_RESULT([no])
7474     EPM=NO
7476 AC_SUBST(EPM)
7478 dnl ===================================================================
7479 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7480 dnl ===================================================================
7481 WINEGCC=
7482 if test "$enable_winegcc" = "yes"; then
7483     AC_PATH_PROG(WINEGCC, winegcc)
7484     if test "$WINEGCC" = ""; then
7485         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7486     fi
7487     CC_save="$CC"
7488     ac_exeext_save="$ac_exeext"
7489     CC="$WINEGCC -m32"
7490     ac_exeext=".exe"
7491     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7492 #include <stdio.h>
7493         ],[
7494 printf ("hello world\n");
7495         ])],,
7496         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7497     )
7498     CC="$CC_save"
7499     ac_exeext="$ac_exeext_save"
7501 AC_SUBST(WINEGCC)
7503 if test $_os = iOS; then
7504     enable_mpl_subset=yes
7505     enable_opengl=no
7506     enable_lotuswordpro=no
7507     enable_coinmp=yes
7508     enable_lpsolve=no
7509     enable_postgresql_sdbc=no
7510     enable_extension_integration=no
7511     enable_report_builder=no
7512     with_theme="tango"
7513     with_ppds=no
7516 ENABLE_LWP=
7517 if test "$enable_lotuswordpro" = "yes"; then
7518     ENABLE_LWP="TRUE"
7519     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7521 AC_SUBST(ENABLE_LWP)
7523 dnl ===================================================================
7524 dnl Check for gperf
7525 dnl ===================================================================
7526 AC_PATH_PROG(GPERF, gperf)
7527 if test -z "$GPERF"; then
7528     AC_MSG_ERROR([gperf not found but needed. Install it.])
7530 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7531     GPERF=`cygpath -m $GPERF`
7533 AC_MSG_CHECKING([gperf version])
7534 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7535     AC_MSG_RESULT([OK])
7536 else
7537     AC_MSG_ERROR([too old, you need at least 3.0.0])
7539 AC_SUBST(GPERF)
7541 dnl ===================================================================
7542 dnl Check for building ODK
7543 dnl ===================================================================
7544 if test "$enable_odk" = no; then
7545     unset DOXYGEN
7546 else
7547     if test "$with_doxygen" = no; then
7548         AC_MSG_CHECKING([for doxygen])
7549         unset DOXYGEN
7550         AC_MSG_RESULT([no])
7551     else
7552         if test "$with_doxygen" = yes; then
7553             AC_PATH_PROG([DOXYGEN], [doxygen])
7554             if test -z "$DOXYGEN"; then
7555                 if test "$enable_odk" = "" ; then
7556                     enable_odk="no"
7557                 else
7558                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7559                 fi
7560             fi
7561         else
7562             AC_MSG_CHECKING([for doxygen])
7563             DOXYGEN=$with_doxygen
7564             AC_MSG_RESULT([$DOXYGEN])
7565         fi
7566         if test -n "$DOXYGEN"; then
7567             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7568             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7569             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7570                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7571             fi
7572         fi
7573     fi
7575 AC_SUBST([DOXYGEN])
7577 AC_MSG_CHECKING([whether to build the ODK])
7578 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7579     AC_MSG_RESULT([yes])
7581     if test "$with_java" != "no"; then
7582         AC_MSG_CHECKING([whether to build unowinreg.dll])
7583         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7584             # build on Win by default
7585             enable_build_unowinreg=yes
7586         fi
7587         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7588             AC_MSG_RESULT([no])
7589             BUILD_UNOWINREG=
7590         else
7591             AC_MSG_RESULT([yes])
7592             BUILD_UNOWINREG=TRUE
7593         fi
7594         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7595             if test -z "$with_mingw_cross_compiler"; then
7596                 dnl Guess...
7597                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7598             elif test -x "$with_mingw_cross_compiler"; then
7599                  MINGWCXX="$with_mingw_cross_compiler"
7600             else
7601                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7602             fi
7604             if test "$MINGWCXX" = "false"; then
7605                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7606             fi
7608             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7609             if test -x "$mingwstrip_test"; then
7610                 MINGWSTRIP="$mingwstrip_test"
7611             else
7612                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7613             fi
7615             if test "$MINGWSTRIP" = "false"; then
7616                 AC_MSG_ERROR(MinGW32 binutils not found.)
7617             fi
7618         fi
7619     fi
7620     BUILD_TYPE="$BUILD_TYPE ODK"
7621 else
7622     AC_MSG_RESULT([no])
7623     BUILD_UNOWINREG=
7625 AC_SUBST(BUILD_UNOWINREG)
7626 AC_SUBST(MINGWCXX)
7627 AC_SUBST(MINGWSTRIP)
7629 dnl ===================================================================
7630 dnl Check for system zlib
7631 dnl ===================================================================
7632 if test "$with_system_zlib" = "auto"; then
7633     case "$_os" in
7634     WINNT)
7635         with_system_zlib="$with_system_libs"
7636         ;;
7637     *)
7638         with_system_zlib=yes
7639         ;;
7640     esac
7643 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7644 dnl and has no pkg-config for it at least on some tinderboxes,
7645 dnl so leaving that out for now
7646 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7647 AC_MSG_CHECKING([which zlib to use])
7648 if test "$with_system_zlib" = "yes"; then
7649     AC_MSG_RESULT([external])
7650     SYSTEM_ZLIB=TRUE
7651     AC_CHECK_HEADER(zlib.h, [],
7652         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7653     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7654         [AC_MSG_ERROR(zlib not found or functional)], [])
7655 else
7656     AC_MSG_RESULT([internal])
7657     SYSTEM_ZLIB=
7658     BUILD_TYPE="$BUILD_TYPE ZLIB"
7659     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7660     ZLIB_LIBS="-lzlib"
7662 AC_SUBST(ZLIB_CFLAGS)
7663 AC_SUBST(ZLIB_LIBS)
7664 AC_SUBST(SYSTEM_ZLIB)
7666 dnl ===================================================================
7667 dnl Check for system jpeg
7668 dnl ===================================================================
7669 AC_MSG_CHECKING([which jpeg to use])
7670 if test "$with_system_jpeg" = "auto"; then
7671     case "$_os" in
7672     WINNT|Darwin|iOS|Android)
7673         with_system_jpeg="$with_system_libs"
7674         ;;
7675     *)
7676         with_system_jpeg=yes
7677         ;;
7678     esac
7681 if test "$with_system_jpeg" = "yes"; then
7682     AC_MSG_RESULT([external])
7683     SYSTEM_JPEG=TRUE
7684     AC_CHECK_HEADER(jpeglib.h, [],
7685         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7686     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7687     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7688     libo_MINGW_CHECK_DLL([libjpeg])
7689 else
7690     AC_MSG_RESULT([internal])
7691     SYSTEM_JPEG=
7692     BUILD_TYPE="$BUILD_TYPE JPEG"
7694 AC_SUBST(SYSTEM_JPEG)
7697 dnl ===================================================================
7698 dnl Check for system clucene
7699 dnl ===================================================================
7700 dnl we should rather be using
7701 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7702 dnl but the contribs-lib check seems tricky
7703 AC_MSG_CHECKING([which clucene to use])
7704 if test "$with_system_clucene" = "yes"; then
7705     AC_MSG_RESULT([external])
7706     SYSTEM_CLUCENE=TRUE
7707     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7708     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7709     AC_LANG_PUSH([C++])
7710     save_CXXFLAGS=$CXXFLAGS
7711     save_CPPFLAGS=$CPPFLAGS
7712     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7713     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7714     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7715     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7716     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7717                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7718     CXXFLAGS=$save_CXXFLAGS
7719     CPPFLAGS=$save_CPPFLAGS
7720     AC_LANG_POP([C++])
7722     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7723 else
7724     AC_MSG_RESULT([internal])
7725     SYSTEM_CLUCENE=
7726     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7728 AC_SUBST(SYSTEM_CLUCENE)
7729 AC_SUBST(CLUCENE_CFLAGS)
7730 AC_SUBST(CLUCENE_LIBS)
7732 dnl ===================================================================
7733 dnl Check for system expat
7734 dnl ===================================================================
7735 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7736 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7737 AC_MSG_CHECKING([which expat to use])
7738 if test "$with_system_expat" = "yes"; then
7739     AC_MSG_RESULT([external])
7740     SYSTEM_EXPAT=TRUE
7741     AC_CHECK_HEADER(expat.h, [],
7742         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7743     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7744         [AC_MSG_RESULT(expat library not found or functional.)], [])
7745     libo_MINGW_CHECK_DLL([libexpat])
7746 else
7747     AC_MSG_RESULT([internal])
7748     SYSTEM_EXPAT=
7749     BUILD_TYPE="$BUILD_TYPE EXPAT"
7751 AC_SUBST(SYSTEM_EXPAT)
7753 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7754 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7755     ENABLE_EOT="TRUE"
7756     AC_DEFINE([ENABLE_EOT])
7757     AC_MSG_RESULT([yes])
7759     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7760 else
7761     ENABLE_EOT=
7762     AC_MSG_RESULT([no])
7764 AC_SUBST([ENABLE_EOT])
7766 dnl ===================================================================
7767 dnl Check for system librevenge
7768 dnl ===================================================================
7769 AS_IF([test "$COM" = "MSC"],
7770       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7771       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7773 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7775 dnl ===================================================================
7776 dnl Check for system libe-book
7777 dnl ===================================================================
7778 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7780 dnl ===================================================================
7781 dnl Check for system libetonyek
7782 dnl ===================================================================
7783 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.1])
7785 dnl ===================================================================
7786 dnl Check for system libfreehand
7787 dnl ===================================================================
7788 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7790 dnl ===================================================================
7791 dnl Check for system libodfgen
7792 dnl ===================================================================
7793 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7795 dnl ===================================================================
7796 dnl Check for system libcdr
7797 dnl ===================================================================
7798 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7800 dnl ===================================================================
7801 dnl Check for system libmspub
7802 dnl ===================================================================
7803 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7805 dnl ===================================================================
7806 dnl Check for system libmwaw
7807 dnl ===================================================================
7808 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7810 dnl ===================================================================
7811 dnl Check for system libpagemaker
7812 dnl ===================================================================
7813 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7815 dnl ===================================================================
7816 dnl Check for system libvisio
7817 dnl ===================================================================
7818 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7820 dnl ===================================================================
7821 dnl Check for system libcmis
7822 dnl ===================================================================
7823 # libcmis requires curl and we can't build curl for iOS
7824 if test $_os != iOS; then
7825     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.4 >= 0.4.0])
7826     ENABLE_CMIS=TRUE
7827 else
7828     ENABLE_CMIS=
7830 AC_SUBST(ENABLE_CMIS)
7832 dnl ===================================================================
7833 dnl Check for system libwpd
7834 dnl ===================================================================
7835 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs -lwpd-0.10"])
7837 dnl ===================================================================
7838 dnl Check for system lcms2
7839 dnl ===================================================================
7840 if test "$with_system_lcms2" = "yes"; then
7841     libo_MINGW_CHECK_DLL([liblcms2])
7842 else
7843     SYSTEM_LCMS2=
7845 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7846 if test "$GCC" = "yes"; then
7847     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7849 if test "$COM" = "MSC"; then # override the above
7850     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7853 dnl ===================================================================
7854 dnl Check for system cppunit
7855 dnl ===================================================================
7856 if test "$cross_compiling" != "yes"; then
7857     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7860 dnl ===================================================================
7861 dnl Check whether freetype is available
7862 dnl ===================================================================
7863 if test  "$test_freetype" = "yes"; then
7864     AC_MSG_CHECKING([whether freetype is available])
7865     # FreeType has 3 different kinds of versions
7866     # * release, like 2.4.10
7867     # * libtool, like 13.0.7 (this what pkg-config returns)
7868     # * soname
7869     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7870     #
7871     # 9.9.3 is 2.2.0
7872     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7873     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7874     SYSTEM_FREETYPE=TRUE
7875     _save_libs="$LIBS"
7876     _save_cflags="$CFLAGS"
7877     LIBS="$LIBS $FREETYPE_LIBS"
7878     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7879     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7880     LIBS="$_save_libs"
7881     CFLAGS="$_save_cflags"
7883 AC_SUBST(FREETYPE_CFLAGS)
7884 AC_SUBST(FREETYPE_LIBS)
7885 AC_SUBST([SYSTEM_FREETYPE])
7887 dnl ===================================================================
7888 dnl Check for system libabw
7889 dnl ===================================================================
7890 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7892 dnl ===================================================================
7893 dnl Check for system libwps
7894 dnl ===================================================================
7895 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.3])
7897 dnl ===================================================================
7898 dnl Check for system libwpg
7899 dnl ===================================================================
7900 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7902 # ===================================================================
7903 # Check for system libxslt
7904 # to prevent incompatibilities between internal libxml2 and external libxslt,
7905 # or vice versa, use with_system_libxml here
7906 # ===================================================================
7907 if test "$with_system_libxml" = "auto"; then
7908     case "$_os" in
7909     WINNT|iOS|Android)
7910         with_system_libxml="$with_system_libs"
7911         ;;
7912     *)
7913         with_system_libxml=yes
7914         ;;
7915     esac
7918 AC_MSG_CHECKING([which libxslt to use])
7919 if test "$with_system_libxml" = "yes"; then
7920     AC_MSG_RESULT([external])
7921     SYSTEM_LIBXSLT=TRUE
7922     if test "$_os" = "Darwin"; then
7923         dnl make sure to use SDK path
7924         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7925         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7926         dnl omit -L/usr/lib
7927         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7928         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7929     else
7930         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7931         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7932         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7933         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7934     fi
7936     dnl Check for xsltproc
7937     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7938     if test "$XSLTPROC" = "no"; then
7939         AC_MSG_ERROR([xsltproc is required])
7940     fi
7942     libo_MINGW_CHECK_DLL([libxslt])
7943     libo_MINGW_CHECK_DLL([libexslt])
7944     libo_MINGW_TRY_DLL([iconv])
7945 else
7946     AC_MSG_RESULT([internal])
7947     SYSTEM_LIBXSLT=
7948     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7950     if test "$cross_compiling" = "yes"; then
7951         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7952         if test "$XSLTPROC" = "no"; then
7953             AC_MSG_ERROR([xsltproc is required])
7954         fi
7955     fi
7957 AC_SUBST(SYSTEM_LIBXSLT)
7958 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7959     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7961 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7963 AC_SUBST(LIBEXSLT_CFLAGS)
7964 AC_SUBST(LIBEXSLT_LIBS)
7965 AC_SUBST(LIBXSLT_CFLAGS)
7966 AC_SUBST(LIBXSLT_LIBS)
7967 AC_SUBST(XSLTPROC)
7969 # ===================================================================
7970 # Check for system libxml
7971 # ===================================================================
7972 AC_MSG_CHECKING([which libxml to use])
7973 if test "$with_system_libxml" = "yes"; then
7974     AC_MSG_RESULT([external])
7975     SYSTEM_LIBXML=TRUE
7976     if test "$_os" = "Darwin"; then
7977         dnl make sure to use SDK path
7978         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7979         dnl omit -L/usr/lib
7980         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7981     elif test $_os = iOS; then
7982         dnl make sure to use SDK path
7983         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7984         LIBXML_CFLAGS="-I$usr/include/libxml2"
7985         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7986     else
7987         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7988         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7989     fi
7991     dnl Check for xmllint
7992     AC_PATH_PROG(XMLLINT, xmllint, no)
7993     if test "$XMLLINT" = "no"; then
7994         AC_MSG_ERROR([xmllint is required])
7995     fi
7997     libo_MINGW_CHECK_DLL([libxml2])
7998     libo_MINGW_TRY_DLL([zlib1])
7999 else
8000     AC_MSG_RESULT([internal])
8001     SYSTEM_LIBXML=
8002     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8004 AC_SUBST(SYSTEM_LIBXML)
8005 AC_SUBST(LIBXML_CFLAGS)
8006 AC_SUBST(LIBXML_LIBS)
8007 AC_SUBST(XMLLINT)
8009 # =====================================================================
8010 # Checking for a Python interpreter with version >= 2.6.
8011 # Build and runtime requires Python 3 compatible version (>= 2.6).
8012 # Optionally user can pass an option to configure, i. e.
8013 # ./configure PYTHON=/usr/bin/python
8014 # =====================================================================
8015 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8016     # This allows a lack of system python with no error, we use internal one in that case.
8017     AM_PATH_PYTHON([2.6],, [:])
8018     # Clean PYTHON_VERSION checked below if cross-compiling
8019     PYTHON_VERSION=""
8020     if test "$PYTHON" != ":"; then
8021         PYTHON_FOR_BUILD=$PYTHON
8022     fi
8024 AC_SUBST(PYTHON_FOR_BUILD)
8026 # Checks for Python to use for Pyuno
8027 AC_MSG_CHECKING([which Python to use for Pyuno])
8028 case "$enable_python" in
8029 no|disable)
8030     if test -z $PYTHON_FOR_BUILD; then
8031         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8032         # requirement from the choice whether to include Python stuff in the installer, but why
8033         # bother?
8034         AC_MSG_ERROR([Python is required at build time.])
8035     fi
8036     enable_python=no
8037     AC_MSG_RESULT([none])
8038     ;;
8039 ""|yes|auto)
8040     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8041         AC_MSG_RESULT([no, overridden by --disable-scripting])
8042         enable_python=no
8043     elif test $build_os = cygwin; then
8044         dnl When building on Windows we don't attempt to use any installed
8045         dnl "system"  Python.
8046         dnl
8047         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8048         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8049         dnl MinGW cross-compilation setups.)
8050         AC_MSG_RESULT([fully internal])
8051         enable_python=internal
8052     elif test "$cross_compiling" = yes; then
8053         AC_MSG_RESULT([system])
8054         enable_python=system
8055     else
8056         # Unset variables set by the above AM_PATH_PYTHON so that
8057         # we actually do check anew.
8058         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
8059         AM_PATH_PYTHON([3.3],, [:])
8060         if test "$PYTHON" = ":"; then
8061             if test -z "$PYTHON_FOR_BUILD"; then
8062                 AC_MSG_RESULT([fully internal])
8063             else
8064                 AC_MSG_RESULT([internal])
8065             fi
8066             enable_python=internal
8067         else
8068             AC_MSG_RESULT([system])
8069             enable_python=system
8070         fi
8071     fi
8072     ;;
8073 internal)
8074     AC_MSG_RESULT([internal])
8075     ;;
8076 fully-internal)
8077     AC_MSG_RESULT([fully internal])
8078     enable_python=internal
8079     ;;
8080 system)
8081     AC_MSG_RESULT([system])
8082     ;;
8084     AC_MSG_ERROR([Incorrect --enable-python option])
8085     ;;
8086 esac
8088 if test $enable_python != no; then
8089     BUILD_TYPE="$BUILD_TYPE PYUNO"
8092 if test $enable_python = system; then
8093     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8094         # Make sure we use the 2.6 Python when building against the
8095         # 10.6 SDK.
8096         case $with_macosx_sdk in
8097         10.6)
8098             python_version=2.6;;
8099         10.7|10.8)
8100             python_version=2.7;;
8101         *)
8102             # 10.9 etc.
8103             python_version=2.7;;
8104         esac
8105         PYTHON=python$python_version
8106         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8107             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8108             PYTHON_LIBS="-framework Python"
8109         else
8110             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8111             PYTHON_LIBS="`$PYTHON-config --libs`"
8112         fi
8113     fi
8114     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8115         # Fallback: Accept these in the environment, or as set above
8116         # for MacOSX.
8117         :
8118     elif test "$cross_compiling" != yes; then
8119         # Unset variables set by the above AM_PATH_PYTHON so that
8120         # we actually do check anew.
8121         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
8122         # This causes an error if no python command is found
8123         AM_PATH_PYTHON([3.3])
8124         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8125         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8126         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8127         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8128         if test -z "$PKG_CONFIG"; then
8129             PYTHON_CFLAGS="-I$python_include"
8130             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8131         elif $PKG_CONFIG --exists python-$python_version; then
8132             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8133             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8134         else
8135             PYTHON_CFLAGS="-I$python_include"
8136             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8137         fi
8138     else
8139         dnl How to find out the cross-compilation Python installation path?
8140         dnl Let's hardocode what we know for different distributions for now...
8141         for python_version in 2.6; do
8142             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8143                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8144                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8145                 AC_MSG_CHECKING([for python.exe])
8146                 libo_MINGW_CHECK_DLL([libpython$python_version])
8147                 libo_MINGW_CHECK_DLL([libreadline6])
8148                 libo_MINGW_CHECK_DLL([libtermcap])
8149                 # could we somehow extract the really mingw python version from
8150                 # actual distro package?
8151                 # 2.6.2 currently on OpenSUSE 12.1?
8152                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8153                 PYTHON_VERSION=$python_version.2
8154                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8155                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8156                 break
8157             fi
8158         done
8159         AC_MSG_CHECKING([for python version])
8160         AS_IF([test -n "$PYTHON_VERSION"],
8161               [AC_MSG_RESULT([$PYTHON_VERSION])],
8162               [AC_MSG_RESULT([not found])
8163                AC_MSG_ERROR([no usable python found])])
8164         test -n "$PYTHON_CFLAGS" && break
8165     fi
8166     # let the PYTHON_FOR_BUILD match the same python installation that
8167     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8168     # better for PythonTests.
8169     PYTHON_FOR_BUILD=$PYTHON
8172 dnl By now enable_python should be "system", "internal" or "no"
8173 case $enable_python in
8174 system)
8175     SYSTEM_PYTHON=TRUE
8177     if test "$CROSS_COMPILING" != TRUE; then
8178         dnl Check if the headers really work
8179         save_CPPFLAGS="$CPPFLAGS"
8180         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8181         AC_CHECK_HEADER(Python.h, [],
8182            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8183            [])
8184         CPPFLAGS="$save_CPPFLAGS"
8186         AC_LANG_PUSH(C)
8187         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8188         AC_MSG_CHECKING([for correct python library version])
8189            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8190 #include <Python.h>
8192 int main(int argc, char **argv) {
8193        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8194            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8195        else return 1;
8197            ]])],[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])],[])
8198         CFLAGS=$save_CFLAGS
8199         AC_LANG_POP(C)
8201         dnl FIXME Check if the Python library can be linked with, too?
8202     fi
8203     ;;
8205 internal)
8206     SYSTEM_PYTHON=
8207     PYTHON_VERSION_MAJOR=3
8208     PYTHON_VERSION_MINOR=3
8209     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8210     BUILD_TYPE="$BUILD_TYPE PYTHON"
8211     # Embedded Python dies without Home set
8212     if test "$HOME" = ""; then
8213         export HOME=""
8214     fi
8215     # bz2 tarball and bzip2 is not standard
8216     if test -z "$BZIP2"; then
8217         AC_PATH_PROG( BZIP2, bzip2)
8218         if test -z "$BZIP2"; then
8219             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8220         fi
8221     fi
8222     ;;
8224     DISABLE_PYTHON=TRUE
8225     SYSTEM_PYTHON=
8226     ;;
8228     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8229     ;;
8230 esac
8232 AC_SUBST(DISABLE_PYTHON)
8233 AC_SUBST(SYSTEM_PYTHON)
8234 AC_SUBST(PYTHON_CFLAGS)
8235 AC_SUBST(PYTHON_LIBS)
8236 AC_SUBST(PYTHON_VERSION)
8237 AC_SUBST(PYTHON_VERSION_MAJOR)
8238 AC_SUBST(PYTHON_VERSION_MINOR)
8240 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8241 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8242     AC_MSG_RESULT([yes])
8243     ENABLE_MARIADBC=TRUE
8244     MARIADBC_MAJOR=1
8245     MARIADBC_MINOR=0
8246     MARIADBC_MICRO=2
8247     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8248 else
8249     AC_MSG_RESULT([no])
8250     ENABLE_MARIADBC=
8252 AC_SUBST(ENABLE_MARIADBC)
8253 AC_SUBST(MARIADBC_MAJOR)
8254 AC_SUBST(MARIADBC_MINOR)
8255 AC_SUBST(MARIADBC_MICRO)
8257 if test "$ENABLE_MARIADBC" = "TRUE"; then
8259     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8261     dnl ===================================================================
8262     dnl Check for system MariaDB
8263     dnl ===================================================================
8264     AC_MSG_CHECKING([which MariaDB to use])
8265     if test "$with_system_mariadb" = "yes"; then
8266         AC_MSG_RESULT([external])
8267         SYSTEM_MARIADB=TRUE
8268         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8269         if test -z "$MARIADBCONFIG"; then
8270             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8271             if test -z "$MARIADBCONFIG"; then
8272                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8273                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8274             fi
8275         fi
8276         AC_MSG_CHECKING([MariaDB version])
8277         MARIADB_VERSION=`$MARIADBCONFIG --version`
8278         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8279         if test "$MARIADB_MAJOR" -ge "5"; then
8280             AC_MSG_RESULT([OK])
8281         else
8282             AC_MSG_ERROR([too old, use 5.0.x or later])
8283         fi
8284         AC_MSG_CHECKING([for MariaDB Client library])
8285         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8286         if test "$COM_GCC_IS_CLANG" = TRUE; then
8287             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8288         fi
8289         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8290         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8291         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8292         dnl linux32:
8293         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8294             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8295             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8296                 | sed -e 's|/lib64/|/lib/|')
8297         fi
8298         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8299         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8300         if test "$enable_bundle_mariadb" = "yes"; then
8301             AC_MSG_RESULT([yes])
8302             BUNDLE_MARIADB=TRUE
8303             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8304             if test "$_os" = "Darwin"; then
8305                 LIBMARIADB=${LIBMARIADB}.dylib
8306             elif test "$_os" = "WINNT"; then
8307                 LIBMARIADB=${LIBMARIADB}.dll
8308             else
8309                 LIBMARIADB=${LIBMARIADB}.so
8310             fi
8311             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8312             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8313             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8314                 AC_MSG_RESULT([found.])
8315                 PathFormat "$LIBMARIADB_PATH"
8316                 LIBMARIADB_PATH="$formatted_path"
8317             else
8318                 AC_MSG_ERROR([not found.])
8319             fi
8320         else
8321             AC_MSG_RESULT([no])
8322             BUNDLE_MARIADB=
8323         fi
8324     else
8325         AC_MSG_RESULT([internal])
8326         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8327         SYSTEM_MARIADB=
8328         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8329         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8330         BUILD_TYPE="$BUILD_TYPE MARIADB"
8331     fi
8333     AC_SUBST(SYSTEM_MARIADB)
8334     AC_SUBST(MARIADB_CFLAGS)
8335     AC_SUBST(MARIADB_LIBS)
8336     AC_SUBST(LIBMARIADB)
8337     AC_SUBST(LIBMARIADB_PATH)
8338     AC_SUBST(BUNDLE_MARIADB)
8340     AC_LANG_PUSH([C++])
8341     dnl ===================================================================
8342     dnl Check for system MySQL C++ Connector
8343     dnl ===================================================================
8344     # FIXME!
8345     # who thought this too-generic cppconn dir was a good idea?
8346     AC_MSG_CHECKING([MySQL Connector/C++])
8347     if test "$with_system_mysql_cppconn" = "yes"; then
8348         AC_MSG_RESULT([external])
8349         SYSTEM_MYSQL_CPPCONN=TRUE
8350         AC_LANG_PUSH([C++])
8351         AC_CHECK_HEADER(mysql_driver.h, [],
8352                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8353         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8354                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8355         save_LIBS=$LIBS
8356         LIBS="$LIBS -lmysqlcppconn"
8357         AC_MSG_CHECKING([version])
8358         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8359 #include <mysql_driver.h>
8361 int main(int argc, char **argv) {
8362     sql::Driver *driver;
8363     driver = get_driver_instance();
8364     if (driver->getMajorVersion() > 1 || \
8365        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8366        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8367         return 0;
8368       else
8369         return 1;
8371       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8373         AC_LANG_POP([C++])
8374         LIBS=$save_LIBS
8375     else
8376         AC_MSG_RESULT([internal])
8377         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8378         SYSTEM_MYSQL_CPPCONN=
8379     fi
8380     AC_LANG_POP([C++])
8382 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8384 dnl ===================================================================
8385 dnl Check for system hsqldb
8386 dnl ===================================================================
8387 if test "$with_java" != "no"; then
8388     HSQLDB_USE_JDBC_4_1=
8389     AC_MSG_CHECKING([which hsqldb to use])
8390     if test "$with_system_hsqldb" = "yes"; then
8391         AC_MSG_RESULT([external])
8392         SYSTEM_HSQLDB=TRUE
8393         if test -z $HSQLDB_JAR; then
8394             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8395         fi
8396         AC_CHECK_FILE($HSQLDB_JAR, [],
8397                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8398         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8399         export HSQLDB_JAR
8400         if $PERL -e \
8401            'use Archive::Zip;
8402             my $file = "$ENV{'HSQLDB_JAR'}";
8403             my $zip = Archive::Zip->new( $file );
8404             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8405             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8406             {
8407                 push @l, split(/\n/, $mf);
8408                 foreach my $line (@l)
8409                 {
8410                     if ($line =~ m/Specification-Version:/)
8411                     {
8412                         ($t, $version) = split (/:/,$line);
8413                         $version =~ s/^\s//;
8414                         ($a, $b, $c, $d) = split (/\./,$version);
8415                         if ($c == "0" && $d > "8")
8416                         {
8417                             exit 0;
8418                         }
8419                         else
8420                         {
8421                             exit 1;
8422                         }
8423                     }
8424                 }
8425             }
8426             else
8427             {
8428                 exit 1;
8429             }'; then
8430             AC_MSG_RESULT([yes])
8431         else
8432             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8433         fi
8434     else
8435         AC_MSG_RESULT([internal])
8436         SYSTEM_HSQLDB=
8437         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8438         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8439         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8440         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8441             AC_MSG_RESULT([yes])
8442             HSQLDB_USE_JDBC_4_1=TRUE
8443         else
8444             AC_MSG_RESULT([no])
8445         fi
8446     fi
8447     AC_SUBST(SYSTEM_HSQLDB)
8448     AC_SUBST(HSQLDB_JAR)
8449     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8452 dnl ===================================================================
8453 dnl Check for PostgreSQL stuff
8454 dnl ===================================================================
8455 if test "x$enable_postgresql_sdbc" != "xno"; then
8456     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8458     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8459         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8460     fi
8461     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8462         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8463     fi
8465     AC_MSG_CHECKING([PostgreSQL C interface])
8466     if test "$with_system_postgresql" = "yes"; then
8467         AC_MSG_RESULT([external PostgreSQL])
8468         SYSTEM_POSTGRESQL=TRUE
8469         if test "$_os" = Darwin; then
8470             supp_path=''
8471             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8472                 pg_supp_path="$P_SEP$d$pg_supp_path"
8473             done
8474         fi
8475         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8476         if test -z "$PGCONFIG"; then
8477             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8478         fi
8479         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8480         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8481     else
8482         # if/when anything else than PostgreSQL uses Kerberos,
8483         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8484         WITH_KRB5=
8485         WITH_GSSAPI=
8486         case "$_os" in
8487         Darwin)
8488             # MacOS X has system MIT Kerberos 5 since 10.4
8489             if test "$with_krb5" != "no"; then
8490                 WITH_KRB5=TRUE
8491                 save_LIBS=$LIBS
8492                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8493                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8494                 KRB5_LIBS=$LIBS
8495                 LIBS=$save_LIBS
8496                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8497                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8498                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8499                 LIBS=$save_LIBS
8500             fi
8501             if test "$with_gssapi" != "no"; then
8502                 WITH_GSSAPI=TRUE
8503                 save_LIBS=$LIBS
8504                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8505                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8506                 GSSAPI_LIBS=$LIBS
8507                 LIBS=$save_LIBS
8508             fi
8509             ;;
8510         WINNT)
8511             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8512                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8513             fi
8514             ;;
8515         Linux|GNU|*BSD|DragonFly)
8516             if test "$with_krb5" != "no"; then
8517                 WITH_KRB5=TRUE
8518                 save_LIBS=$LIBS
8519                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8520                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8521                 KRB5_LIBS=$LIBS
8522                 LIBS=$save_LIBS
8523                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8524                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8525                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8526                 LIBS=$save_LIBS
8527             fi
8528             if test "$with_gssapi" != "no"; then
8529                 WITH_GSSAPI=TRUE
8530                 save_LIBS=$LIBS
8531                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8532                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8533                 GSSAPI_LIBS=$LIBS
8534                 LIBS=$save_LIBS
8535             fi
8536             ;;
8537         *)
8538             if test "$with_krb5" = "yes"; then
8539                 WITH_KRB5=TRUE
8540                 save_LIBS=$LIBS
8541                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8542                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8543                 KRB5_LIBS=$LIBS
8544                 LIBS=$save_LIBS
8545                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8546                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8547                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8548                 LIBS=$save_LIBS
8549             fi
8550             if test "$with_gssapi" = "yes"; then
8551                 WITH_GSSAPI=TRUE
8552                 save_LIBS=$LIBS
8553                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8554                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8555                 LIBS=$save_LIBS
8556                 GSSAPI_LIBS=$LIBS
8557             fi
8558         esac
8560         if test -n "$with_libpq_path"; then
8561             SYSTEM_POSTGRESQL=TRUE
8562             AC_MSG_RESULT([external libpq])
8563             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8564             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8565         else
8566             SYSTEM_POSTGRESQL=
8567             AC_MSG_RESULT([internal])
8568             POSTGRESQL_LIB=""
8569             POSTGRESQL_INC="%OVERRIDE_ME%"
8570             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8571         fi
8572     fi
8573     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8574         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8575         save_CFLAGS=$CFLAGS
8576         save_CPPFLAGS=$CPPFLAGS
8577         save_LIBS=$LIBS
8578         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8579         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8580         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8581         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8582             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8583         CFLAGS=$save_CFLAGS
8584         CPPFLAGS=$save_CPPFLAGS
8585         LIBS=$save_LIBS
8586     fi
8587     BUILD_POSTGRESQL_SDBC=TRUE
8589 AC_SUBST(WITH_KRB5)
8590 AC_SUBST(WITH_GSSAPI)
8591 AC_SUBST(GSSAPI_LIBS)
8592 AC_SUBST(KRB5_LIBS)
8593 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8594 AC_SUBST(SYSTEM_POSTGRESQL)
8595 AC_SUBST(POSTGRESQL_INC)
8596 AC_SUBST(POSTGRESQL_LIB)
8598 dnl ===================================================================
8599 dnl Check for Firebird stuff
8600 dnl ===================================================================
8601 ENABLE_FIREBIRD_SDBC=""
8602 if test "x$enable_firebird_sdbc" = "xyes"; then
8603     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8605     dnl ===================================================================
8606     dnl Check for system Firebird
8607     dnl ===================================================================
8608     AC_MSG_CHECKING([which Firebird to use])
8609     if test "$with_system_firebird" = "yes"; then
8610         AC_MSG_RESULT([external])
8611         SYSTEM_FIREBIRD=TRUE
8612         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8613         if test -z "$FIREBIRDCONFIG"; then
8614             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8615             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8616             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8617         else
8618             AC_MSG_NOTICE([fb_config found])
8619             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8620             AC_MSG_CHECKING([for Firebird Client library])
8621             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8622             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8623         fi
8624         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8625         AC_MSG_CHECKING([Firebird version])
8626         if test -n "${FIREBIRD_VERSION}"; then
8627             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8628             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8629             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8630                 AC_MSG_RESULT([OK])
8631             else
8632                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8633             fi
8634         else
8635             __save_CFLAGS="${CFLAGS}"
8636             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8637             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8638 #if defined(FB_API_VER) && FB_API_VER == 25
8639 #else
8640 #error "Wrong Firebird API version"
8641 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8642             CFLAGS="${__save_CFLAGS}"
8643         fi
8644         ENABLE_FIREBIRD_SDBC="TRUE"
8645     elif test "$enable_database_connectivity" != yes; then
8646         AC_MSG_RESULT([none])
8647     elif test "$cross_compiling" = "yes"; then
8648         AC_MSG_RESULT([none])
8649     else
8650         dnl We need libatomic-ops for any non X86/X64 system
8651         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8652             dnl ===================================================================
8653             dnl Check for system libatomic-ops
8654             dnl ===================================================================
8655             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8656             if test "$with_system_libatomic_ops" = "yes"; then
8657                 SYSTEM_LIBATOMIC_OPS=TRUE
8658                 AC_CHECK_HEADERS(atomic_ops.h, [],
8659                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8660             else
8661                 SYSTEM_LIBATOMIC_OPS=
8662                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8663                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8664                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8665             fi
8666         fi
8668         AC_MSG_RESULT([internal])
8669         SYSTEM_FIREBIRD=
8670         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8671         FIREBIRD_LIBS="-lfbembed"
8673         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8674         ENABLE_FIREBIRD_SDBC="TRUE"
8675     fi
8677 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8678 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8679 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8680 AC_SUBST(LIBATOMIC_OPS_LIBS)
8681 AC_SUBST(SYSTEM_FIREBIRD)
8682 AC_SUBST(FIREBIRD_CFLAGS)
8683 AC_SUBST(FIREBIRD_LIBS)
8684 dnl AC_SUBST([TOMMATH_CFLAGS])
8685 dnl AC_SUBST([TOMMATH_LIBS])
8687 dnl ===================================================================
8688 dnl Check for system curl
8689 dnl ===================================================================
8690 AC_MSG_CHECKING([which libcurl to use])
8691 if test "$with_system_curl" = "auto"; then
8692     with_system_curl="$with_system_libs"
8695 if test "$with_system_curl" = "yes"; then
8696     AC_MSG_RESULT([external])
8697     SYSTEM_CURL=TRUE
8699     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8701     # First try PKGCONFIG and then fall back
8702     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8704     if test -n "$CURL_PKG_ERRORS"; then
8705         AC_PATH_PROG(CURLCONFIG, curl-config)
8706         if test -z "$CURLCONFIG"; then
8707             AC_MSG_ERROR([curl developement files not found])
8708         fi
8709         CURL_LIBS=`$CURLCONFIG --libs`
8710         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8711         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8713         case $curl_version in
8714         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8715         dnl so they need to be doubled to end up in the configure script
8716         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8717             ;;
8718         *)
8719             AC_MSG_ERROR([no, you have $curl_version])
8720             ;;
8721         esac
8722     fi
8723     AC_MSG_RESULT([yes])
8725     libo_MINGW_CHECK_DLL([libcurl])
8726     libo_MINGW_TRY_DLL([libintl])
8727     libo_MINGW_TRY_DLL([libidn])
8728     libo_MINGW_TRY_DLL([libnspr4])
8729     libo_MINGW_TRY_DLL([nssutil3])
8730     libo_MINGW_TRY_DLL([libplc4])
8731     libo_MINGW_TRY_DLL([libplds4])
8732     libo_MINGW_TRY_DLL([nss3])
8733     libo_MINGW_TRY_DLL([ssl3])
8734     libo_MINGW_TRY_DLL([libgpg-error])
8735     libo_MINGW_TRY_DLL([libgcrypt])
8736     libo_MINGW_TRY_DLL([libssh2])
8737     ENABLE_CURL=TRUE
8738 elif test $_os = iOS; then
8739     # Let's see if we need curl, I think not?
8740     AC_MSG_RESULT([none])
8741     ENABLE_CURL=
8742 else
8743     AC_MSG_RESULT([internal])
8744     SYSTEM_CURL=
8745     BUILD_TYPE="$BUILD_TYPE CURL"
8746     ENABLE_CURL=TRUE
8748 AC_SUBST(SYSTEM_CURL)
8749 AC_SUBST(CURL_CFLAGS)
8750 AC_SUBST(CURL_LIBS)
8751 AC_SUBST(ENABLE_CURL)
8753 dnl ===================================================================
8754 dnl Check for system boost
8755 dnl ===================================================================
8756 AC_MSG_CHECKING([which boost to use])
8757 if test "$with_system_boost" = "yes"; then
8758     AC_MSG_RESULT([external])
8759     SYSTEM_BOOST=TRUE
8760     AX_BOOST_BASE(1.47)
8761     AX_BOOST_DATE_TIME
8762     AX_BOOST_IOSTREAMS
8763     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8764     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8765     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8766         # if not found, try again with 'lib' prefix
8767         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8768     fi
8769     AC_LANG_PUSH([C++])
8770     save_CXXFLAGS=$CXXFLAGS
8771     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8772     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8773        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8774     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8775        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8776     AC_CHECK_HEADER(boost/function.hpp, [],
8777        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8778     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8779     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8780     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8781 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8782     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8783         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8784     else
8785         AC_MSG_RESULT([yes])
8786     fi
8787     CXXFLAGS=$save_CXXFLAGS
8788     AC_LANG_POP([C++])
8789 else
8790     AC_MSG_RESULT([internal])
8791     BUILD_TYPE="$BUILD_TYPE BOOST"
8792     SYSTEM_BOOST=
8794 AC_SUBST(SYSTEM_BOOST)
8796 dnl ===================================================================
8797 dnl Check for system mdds
8798 dnl ===================================================================
8799 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.10.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8801 dnl ===================================================================
8802 dnl Check for system glm
8803 dnl ===================================================================
8804 AC_MSG_CHECKING([which glm to use])
8805 if test "$with_system_glm" = "yes"; then
8806     AC_MSG_RESULT([external])
8807     SYSTEM_GLM=TRUE
8808     AC_LANG_PUSH([C++])
8809     AC_CHECK_HEADER([glm/glm.hpp], [],
8810        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8811     AC_LANG_POP([C++])
8812 else
8813     AC_MSG_RESULT([internal])
8814     BUILD_TYPE="$BUILD_TYPE GLM"
8815     SYSTEM_GLM=
8817 AC_SUBST([SYSTEM_GLM])
8819 dnl ===================================================================
8820 dnl Check for system glew
8821 dnl ===================================================================
8822 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8824 dnl ===================================================================
8825 dnl Check for system vigra
8826 dnl ===================================================================
8827 AC_MSG_CHECKING([which vigra to use])
8828 if test "$with_system_vigra" = "yes"; then
8829     AC_MSG_RESULT([external])
8830     SYSTEM_VIGRA=TRUE
8831     AC_LANG_PUSH([C++])
8832     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8833        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8834     AC_LANG_POP([C++])
8835 else
8836     AC_MSG_RESULT([internal])
8837     BUILD_TYPE="$BUILD_TYPE VIGRA"
8838     SYSTEM_VIGRA=
8840 AC_SUBST(SYSTEM_VIGRA)
8842 dnl ===================================================================
8843 dnl Check for system odbc
8844 dnl ===================================================================
8845 AC_MSG_CHECKING([which odbc headers to use])
8846 if test "$with_system_odbc" = "yes" ; then
8847     AC_MSG_RESULT([external])
8848     SYSTEM_ODBC_HEADERS=TRUE
8850     AC_CHECK_HEADER(sqlext.h, [],
8851       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8852 elif test "$enable_database_connectivity" != yes; then
8853     AC_MSG_RESULT([none])
8854 else
8855     AC_MSG_RESULT([internal])
8856     SYSTEM_ODBC_HEADERS=
8858 AC_SUBST(SYSTEM_ODBC_HEADERS)
8861 dnl ===================================================================
8862 dnl Check for system openldap
8863 dnl ===================================================================
8865 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8866 AC_MSG_CHECKING([which openldap library to use])
8867 if test "$with_system_openldap" = "yes"; then
8868     AC_MSG_RESULT([external])
8869     SYSTEM_OPENLDAP=TRUE
8870     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8871     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8872     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8873 else
8874     AC_MSG_RESULT([internal])
8875     SYSTEM_OPENLDAP=
8876     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8879 AC_SUBST(SYSTEM_OPENLDAP)
8881 dnl ===================================================================
8882 dnl Check for mozilla ab connectivity for windows
8883 dnl ===================================================================
8885 if test "$_os" = "WINNT"; then
8886     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8887     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8888         WITH_MOZAB4WIN=TRUE
8889         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8890         BUILD_TYPE="$BUILD_TYPE MOZ"
8891         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8892         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8893         for dll in $MSVC80_DLLS; do
8894             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8895                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8896             fi
8897         done
8898     else
8899         AC_MSG_RESULT([no])
8900         WITH_MOZAB4WIN=
8901     fi
8903 AC_SUBST(WITH_MOZAB4WIN)
8904 AC_SUBST(MSVC80_DLLS)
8905 AC_SUBST(MSVC80_DLL_PATH)
8907 dnl ===================================================================
8908 dnl Check for TLS/SSL and cryptographic implementation to use
8909 dnl ===================================================================
8910 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8911 if test -n "$with_tls"; then
8912     case $with_tls in
8913     openssl)
8914         AC_DEFINE(USE_TLS_OPENSSL)
8915         TLS=OPENSSL
8917         if test "$enable_openssl" != "yes"; then
8918             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8919         fi
8921         # warn that OpenSSL has been selected but not all TLS code has this option
8922         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8923         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8924         ;;
8925     nss)
8926         AC_DEFINE(USE_TLS_NSS)
8927         TLS=NSS
8928         ;;
8929     *)
8930         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8931 openssl - OpenSSL
8932 nss - Mozilla's Network Security Services (NSS)
8933     ])
8934         ;;
8935     esac
8936 elif test $_os = iOS -o $_os = Android; then
8937     # We don't build NSS for iOS and Android
8938     AC_DEFINE(USE_TLS_OPENSSL)
8939     TLS=OPENSSL
8940 else
8941     # default to using NSS, it results in smaller oox lib
8942     AC_DEFINE(USE_TLS_NSS)
8943     TLS=NSS
8945 AC_MSG_RESULT([$TLS])
8946 AC_SUBST(TLS)
8948 dnl ===================================================================
8949 dnl Check for system NSS
8950 dnl ===================================================================
8951 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8952 if test "$with_system_nss" = "yes"; then
8953     libo_MINGW_CHECK_DLL([libnspr4])
8954     libo_MINGW_CHECK_DLL([libplc4])
8955     libo_MINGW_CHECK_DLL([libplds4])
8956     libo_MINGW_CHECK_DLL([nss3])
8957     libo_MINGW_CHECK_DLL([nssutil3])
8958     libo_MINGW_CHECK_DLL([smime3])
8959     libo_MINGW_CHECK_DLL([ssl3])
8962 dnl ===================================================================
8963 dnl Check for system mozilla headers
8964 dnl ===================================================================
8965 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8966 AC_MSG_CHECKING([which NPAPI headers to use])
8968 if test "$with_system_npapi_headers" = "yes"; then
8969     AC_MSG_RESULT([external])
8970     SYSTEM_NPAPI_HEADERS=TRUE
8971     # First try npapi-sdk:
8972     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8973     # Then go with libxul:
8974     if test "x$LOCATED" != "xyes"; then
8975         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8976     fi
8977     if test "x$LOCATED" != "xyes"; then
8978         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8979     fi
8980     # if still not found bail out
8981     if test "x$LOCATED" != "xyes"; then
8982         AC_MSG_ERROR([npapi.h header file not found])
8983     fi
8985     AC_LANG_PUSH([C])
8986     save_CFLAGS=$CFLAGS
8987     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8988     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8989     AC_COMPILE_IFELSE(
8990         [AC_LANG_SOURCE([[
8991             #define XP_UNIX
8992             #include <npapi.h>
8993             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8994             ]])],
8995         [AC_MSG_RESULT([const char*])],
8996         [
8997         AC_MSG_RESULT([char*])
8998         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8999         ])
9000     CFLAGS=$save_CFLAGS
9001     AC_LANG_POP([C])
9002     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9003 else
9004     AC_MSG_RESULT([internal])
9005         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
9006         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
9007     SYSTEM_NPAPI_HEADERS=
9009 AC_SUBST(NPAPI_HEADERS_CFLAGS)
9010 AC_SUBST(SYSTEM_NPAPI_HEADERS)
9011 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
9013 dnl ===================================================================
9014 dnl Check for system sane
9015 dnl ===================================================================
9016 AC_MSG_CHECKING([which sane header to use])
9017 if test "$with_system_sane" = "yes"; then
9018     AC_MSG_RESULT([external])
9019     AC_CHECK_HEADER(sane/sane.h, [],
9020       [AC_MSG_ERROR(sane not found. install sane)], [])
9021 else
9022     AC_MSG_RESULT([internal])
9023     BUILD_TYPE="$BUILD_TYPE SANE"
9026 dnl ===================================================================
9027 dnl Check for system icu
9028 dnl ===================================================================
9029 SYSTEM_GENBRK=
9030 SYSTEM_GENCCODE=
9031 SYSTEM_GENCMN=
9033 ICU_MAJOR=53
9034 ICU_MINOR=1
9035 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
9036 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9037 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9038 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9039 AC_MSG_CHECKING([which icu to use])
9040 if test "$with_system_icu" = "yes"; then
9041     AC_MSG_RESULT([external])
9042     SYSTEM_ICU=TRUE
9043     AC_LANG_PUSH([C++])
9044     AC_MSG_CHECKING([for unicode/rbbi.h])
9045     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9046     AC_LANG_POP([C++])
9048     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9049         ICUPATH="$PATH"
9050         if test "$WITH_MINGW" = "yes"; then
9051             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9052         fi
9053         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9055         AC_MSG_CHECKING([ICU version])
9056         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9057         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9058         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9060         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
9061             AC_MSG_RESULT([OK, $ICU_VERSION])
9062         else
9063             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
9064         fi
9065     fi
9067     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9068         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9069         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9070         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9071         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9072         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9073         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9074             AC_MSG_RESULT([yes])
9075         else
9076             AC_MSG_RESULT([no])
9077             if test "$with_system_icu_for_build" != "force"; then
9078                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9079 You can use --with-system-icu-for-build=force to use it anyway.])
9080             fi
9081         fi
9082     fi
9084     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9085         # using the system icu tools can lead to version confusion, use the
9086         # ones from the build environment when cross-compiling
9087         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9088         if test -z "$SYSTEM_GENBRK"; then
9089             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9090         fi
9091         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9092         if test -z "$SYSTEM_GENCCODE"; then
9093             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9094         fi
9095         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9096         if test -z "$SYSTEM_GENCMN"; then
9097             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9098         fi
9099         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
9100             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
9101         else
9102             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
9103         fi
9104         if test "$ICU_MAJOR" -ge "49"; then
9105             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9106             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9107             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9108         else
9109             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9110             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9111             ICU_RECLASSIFIED_HEBREW_LETTER=
9112         fi
9113     fi
9115     if test "$cross_compiling" = "yes"; then
9116         if test "$ICU_MAJOR" -ge "50"; then
9117             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9118             ICU_MINOR=""
9119         fi
9120     fi
9122     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9123     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9124     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9125 else
9126     AC_MSG_RESULT([internal])
9127     SYSTEM_ICU=
9128     BUILD_TYPE="$BUILD_TYPE ICU"
9129     # surprisingly set these only for "internal" (to be used by various other
9130     # external libs): the system icu-config is quite unhelpful and spits out
9131     # dozens of weird flags and also default path -I/usr/include
9132     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9133     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9135 AC_SUBST(SYSTEM_ICU)
9136 AC_SUBST(SYSTEM_GENBRK)
9137 AC_SUBST(SYSTEM_GENCCODE)
9138 AC_SUBST(SYSTEM_GENCMN)
9139 AC_SUBST(ICU_MAJOR)
9140 AC_SUBST(ICU_MINOR)
9141 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9142 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9143 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9144 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9145 AC_SUBST(ICU_CFLAGS)
9146 AC_SUBST(ICU_LIBS)
9148 dnl ===================================================================
9149 dnl Graphite
9150 dnl ===================================================================
9152 AC_MSG_CHECKING([whether to enable graphite support])
9153 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9154     AC_MSG_RESULT([yes])
9155     ENABLE_GRAPHITE="TRUE"
9156     AC_DEFINE(ENABLE_GRAPHITE)
9157     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9158     if test "$with_system_graphite" = "yes"; then
9159         libo_MINGW_CHECK_DLL([libgraphite2])
9160     fi
9161 else
9162     AC_MSG_RESULT([no])
9164 AC_SUBST(ENABLE_GRAPHITE)
9166 dnl ===================================================================
9167 dnl Orcus
9168 dnl ===================================================================
9170 AC_MSG_CHECKING([whether to enable orcus])
9171 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9172     AC_MSG_RESULT([yes])
9173     ENABLE_ORCUS="TRUE"
9174     AC_DEFINE(ENABLE_ORCUS)
9176     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
9177     if test "$with_system_orcus" != "yes"; then
9178         if test "$SYSTEM_BOOST" = "TRUE"; then
9179             # ===========================================================
9180             # Determine if we are going to need to link with Boost.System
9181             # ===========================================================
9182             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9183             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9184             dnl in documentation has no effect.
9185             AC_MSG_CHECKING([if we need to link with Boost.System])
9186             AC_LANG_PUSH([C++])
9187             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9188                     @%:@include <boost/version.hpp>
9189                 ]],[[
9190                     #if BOOST_VERSION >= 105000
9191                     #   error yes, we need to link with Boost.System
9192                     #endif
9193                 ]])],[
9194                     AC_MSG_RESULT([no])
9195                 ],[
9196                     AC_MSG_RESULT([yes])
9197                     AX_BOOST_SYSTEM
9198             ])
9199             AC_LANG_POP([C++])
9200         fi
9201     fi
9202     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9203     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9204     AC_SUBST([BOOST_SYSTEM_LIB])
9205     AC_SUBST(SYSTEM_LIBORCUS)
9207 else
9208     AC_MSG_RESULT([no])
9210 AC_SUBST(ENABLE_ORCUS)
9212 dnl ===================================================================
9213 dnl HarfBuzz
9214 dnl ===================================================================
9215 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9216 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9217     AC_MSG_RESULT([yes])
9218     ENABLE_HARFBUZZ="TRUE"
9219     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9220         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"])
9221     else
9222         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9223     fi
9224 else
9225     AC_MSG_RESULT([no])
9227 AC_SUBST(ENABLE_HARFBUZZ)
9229 dnl ===================================================================
9230 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9231 dnl ===================================================================
9232 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9233 # Obviously no such thing on iOS or Android. Also not possible when building
9234 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9235 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9236         "$enable_headless" != yes -a "$enable_mpl_subset" != yes
9237 then
9238     AC_MSG_RESULT([yes])
9239     ENABLE_NPAPI_FROM_BROWSER=TRUE
9240 else
9241     AC_MSG_RESULT([no])
9242     ENABLE_NPAPI_FROM_BROWSER=
9244 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9246 dnl ===================================================================
9247 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9248 dnl ===================================================================
9249 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9250 if test "$enable_mpl_subset" != yes -a \( "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9251         "$enable_headless" != yes -a "$enable_gtk" != no \)
9252 then
9253     AC_MSG_RESULT([yes])
9254     ENABLE_NPAPI_INTO_BROWSER=TRUE
9255 else
9256     AC_MSG_RESULT([no])
9257     ENABLE_NPAPI_INTO_BROWSER=
9259 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9261 AC_MSG_CHECKING([whether to use X11])
9262 dnl ***************************************
9263 dnl testing for X libraries and includes...
9264 dnl ***************************************
9265 WANT_X11="no"
9266 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9267     WANT_X11="yes"
9268     AC_DEFINE(HAVE_FEATURE_X11)
9270 AC_MSG_RESULT([$WANT_X11])
9272 if test "$WANT_X11" = "yes"; then
9273     AC_PATH_X
9274     AC_PATH_XTRA
9275     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9277     if test -z "$x_includes"; then
9278         x_includes="default_x_includes"
9279     fi
9280     if test -z "$x_libraries"; then
9281         x_libraries="default_x_libraries"
9282     fi
9283     CFLAGS="$CFLAGS $X_CFLAGS"
9284     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9285     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9286 else
9287     x_includes="no_x_includes"
9288     x_libraries="no_x_libraries"
9291 if test "$WANT_X11" = "yes"; then
9292     dnl ===================================================================
9293     dnl Check for Composite.h for Mozilla plugin
9294     dnl ===================================================================
9295     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9296      [#include <X11/Intrinsic.h>])
9298     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9299     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9300         [AC_MSG_ERROR(Xt library not found)])
9302     dnl ===================================================================
9303     dnl Check for extension headers
9304     dnl ===================================================================
9305     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9306      [#include <X11/extensions/shape.h>])
9308     # vcl needs ICE and SM
9309     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9310     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9311         [AC_MSG_ERROR(ICE library not found)])
9312     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9313     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9314         [AC_MSG_ERROR(SM library not found)])
9317 dnl ===================================================================
9318 dnl Check for system Xrender
9319 dnl ===================================================================
9320 AC_MSG_CHECKING([whether to use Xrender])
9321 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9322     AC_MSG_RESULT([yes])
9323     PKG_CHECK_MODULES(XRENDER, xrender)
9324     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9325     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9326       [AC_MSG_ERROR(libXrender not found or functional)], [])
9327     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9328       [AC_MSG_ERROR(Xrender not found. install X)], [])
9329 else
9330     AC_MSG_RESULT([no])
9332 AC_SUBST(XRENDER_CFLAGS)
9333 AC_SUBST(XRENDER_LIBS)
9335 dnl ===================================================================
9336 dnl Check for XRandr
9337 dnl ===================================================================
9338 AC_MSG_CHECKING([whether to enable RandR support])
9339 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9340     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9341         XRANDR_DLOPEN="TRUE"
9342         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9343     else
9344         AC_MSG_RESULT([yes])
9345         XRANDR_DLOPEN="FALSE"
9346         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9347         if test "$ENABLE_RANDR" != "TRUE"; then
9348             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9349                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9350             XRANDR_CFLAGS=" "
9351             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9352               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9353             XRANDR_LIBS="-lXrandr "
9354             ENABLE_RANDR="TRUE"
9355         fi
9356         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9357     fi
9358 else
9359     ENABLE_RANDR=""
9360     AC_MSG_RESULT([no])
9362 AC_SUBST(XRANDR_DLOPEN)
9363 AC_SUBST(XRANDR_CFLAGS)
9364 AC_SUBST(XRANDR_LIBS)
9365 AC_SUBST(ENABLE_RANDR)
9367 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9368     WITH_WEBDAV="serf"
9370 if test $_os = iOS -o $_os = Android; then
9371     WITH_WEBDAV="no"
9373 AC_MSG_CHECKING([for webdav library])
9374 case "$WITH_WEBDAV" in
9375 serf)
9376     AC_MSG_RESULT([serf])
9377     # Check for system apr-util
9378     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9379                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9380                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9381     if test "$COM" = "MSC"; then
9382         APR_LIB_DIR="LibR"
9383         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9384         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9385     fi
9387     # Check for system serf
9388     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9389                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9390     if test "$COM" = "MSC"; then
9391         SERF_LIB_DIR="Release"
9392         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9393         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9394     fi
9395     ;;
9396 neon)
9397     AC_MSG_RESULT([neon])
9398     # Check for system neon
9399     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9400     if test "$with_system_neon" = "yes"; then
9401         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9402         libo_MINGW_CHECK_DLL([libneon])
9403         libo_MINGW_TRY_DLL([libtasn1])
9404         libo_MINGW_TRY_DLL([libgnutls])
9405     else
9406         NEON_VERSION=0295
9407     fi
9408     AC_SUBST(NEON_VERSION)
9409     ;;
9411     AC_MSG_RESULT([none, disabled])
9412     WITH_WEBDAV=""
9413     ;;
9414 esac
9415 AC_SUBST(WITH_WEBDAV)
9417 dnl ===================================================================
9418 dnl Check for disabling cve_tests
9419 dnl ===================================================================
9420 AC_MSG_CHECKING([whether to execute CVE tests])
9421 if test "$enable_cve_tests" = "no"; then
9422     AC_MSG_RESULT([no])
9423     DISABLE_CVE_TESTS=TRUE
9424     AC_SUBST(DISABLE_CVE_TESTS)
9425 else
9426     AC_MSG_RESULT([yes])
9429 dnl ===================================================================
9430 dnl Check for enabling chart XShape tests
9431 dnl ===================================================================
9432 AC_MSG_CHECKING([whether to execute chart XShape tests])
9433 if test "$enable_chart_tests" = "yes"; then
9434     AC_MSG_RESULT([yes])
9435     ENABLE_CHART_TESTS=TRUE
9436     AC_SUBST(ENABLE_CHART_TESTS)
9437 else
9438     AC_MSG_RESULT([no])
9441 dnl ===================================================================
9442 dnl Check for system openssl
9443 dnl ===================================================================
9444 DISABLE_OPENSSL=
9445 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9446 if test "$enable_openssl" = "yes"; then
9447     AC_MSG_RESULT([no])
9448     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9449         # OpenSSL is deprecated when building for 10.7 or later.
9450         #
9451         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9452         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9454         with_system_openssl=no
9455         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9456     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9457             && test "$with_system_openssl" != "no"; then
9458         with_system_openssl=yes
9459         SYSTEM_OPENSSL=TRUE
9460         OPENSSL_CFLAGS=
9461         OPENSSL_LIBS="-lssl -lcrypto"
9462     else
9463         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9464     fi
9465     if test "$with_system_openssl" = "yes"; then
9466         libo_MINGW_CHECK_DLL([libssl])
9467         libo_MINGW_CHECK_DLL([libcrypto])
9468         AC_MSG_CHECKING([whether openssl supports SHA512])
9469         AC_LANG_PUSH([C])
9470         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9471             SHA512_CTX context;
9472 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9473         AC_LANG_POP(C)
9474     fi
9475 else
9476     AC_MSG_RESULT([yes])
9477     DISABLE_OPENSSL=TRUE
9479     # warn that although OpenSSL is disabled, system libraries may be depending on it
9480     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9481     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9484 AC_SUBST([DISABLE_OPENSSL])
9486 dnl ===================================================================
9487 dnl Check for building gnutls
9488 dnl ===================================================================
9489 AC_MSG_CHECKING([whether to use gnutls])
9490 if test "$WITH_WEBDAV" = "neon" && test "$enable_openssl" = "no"; then
9491     AC_MSG_RESULT([yes])
9492     AM_PATH_LIBGCRYPT()
9493     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9494         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9495                       available in the system to use as replacement.]]))
9498 AC_SUBST([LIBGCRYPT_CFLAGS])
9499 AC_SUBST([LIBGCRYPT_LIBS])
9501 dnl ===================================================================
9502 dnl Check for system redland
9503 dnl ===================================================================
9504 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9505 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9506 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9507 if test "$with_system_redland" = "yes"; then
9508     libo_MINGW_CHECK_DLL([librdf])
9509     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9510             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9511     libo_MINGW_TRY_DLL([libraptor])
9512     libo_MINGW_TRY_DLL([librasqal])
9513     libo_MINGW_TRY_DLL([libsqlite3])
9514 else
9515     RAPTOR_MAJOR="0"
9516     RASQAL_MAJOR="3"
9517     REDLAND_MAJOR="0"
9519 AC_SUBST(RAPTOR_MAJOR)
9520 AC_SUBST(RASQAL_MAJOR)
9521 AC_SUBST(REDLAND_MAJOR)
9523 dnl ===================================================================
9524 dnl Check for system hunspell
9525 dnl ===================================================================
9526 AC_MSG_CHECKING([which libhunspell to use])
9527 if test "$with_system_hunspell" = "yes"; then
9528     AC_MSG_RESULT([external])
9529     SYSTEM_HUNSPELL=TRUE
9530     AC_LANG_PUSH([C++])
9531     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9532     if test "$HUNSPELL_PC" != "TRUE"; then
9533         AC_CHECK_HEADER(hunspell.hxx, [],
9534             [
9535             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9536             [AC_MSG_ERROR(hunspell headers not found.)], [])
9537             ], [])
9538         AC_CHECK_LIB([hunspell], [main], [:],
9539            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9540         HUNSPELL_LIBS=-lhunspell
9541     fi
9542     AC_LANG_POP([C++])
9543     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9544     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9545 else
9546     AC_MSG_RESULT([internal])
9547     SYSTEM_HUNSPELL=
9548     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9549     if test "$COM" = "MSC"; then
9550         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9551     else
9552         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9553     fi
9554     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9556 AC_SUBST(SYSTEM_HUNSPELL)
9557 AC_SUBST(HUNSPELL_CFLAGS)
9558 AC_SUBST(HUNSPELL_LIBS)
9560 dnl ===================================================================
9561 dnl Checking for altlinuxhyph
9562 dnl ===================================================================
9563 AC_MSG_CHECKING([which altlinuxhyph to use])
9564 if test "$with_system_altlinuxhyph" = "yes"; then
9565     AC_MSG_RESULT([external])
9566     SYSTEM_HYPH=TRUE
9567     AC_CHECK_HEADER(hyphen.h, [],
9568        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9569     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9570        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9571        [#include <hyphen.h>])
9572     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9573         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9574     if test -z "$HYPHEN_LIB"; then
9575         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9576            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9577     fi
9578     if test -z "$HYPHEN_LIB"; then
9579         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9580            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9581     fi
9582     libo_MINGW_CHECK_DLL([libhyphen])
9583 else
9584     AC_MSG_RESULT([internal])
9585     SYSTEM_HYPH=
9586     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9587     if test "$COM" = "MSC"; then
9588         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9589     else
9590         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9591     fi
9593 AC_SUBST(SYSTEM_HYPH)
9594 AC_SUBST(HYPHEN_LIB)
9596 dnl ===================================================================
9597 dnl Checking for mythes
9598 dnl ===================================================================
9599 AC_MSG_CHECKING([which mythes to use])
9600 if test "$with_system_mythes" = "yes"; then
9601     AC_MSG_RESULT([external])
9602     SYSTEM_MYTHES=TRUE
9603     AC_LANG_PUSH([C++])
9604     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9605     if test "$MYTHES_PKGCONFIG" = "no"; then
9606         AC_CHECK_HEADER(mythes.hxx, [],
9607             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9608         AC_CHECK_LIB([mythes-1.2], [main], [:],
9609             [ MYTHES_FOUND=no], [])
9610     if test "$MYTHES_FOUND" = "no"; then
9611         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9612                 [ MYTHES_FOUND=no], [])
9613     fi
9614     if test "$MYTHES_FOUND" = "no"; then
9615         AC_MSG_ERROR([mythes library not found!.])
9616     fi
9617     fi
9618     AC_LANG_POP([C++])
9619     libo_MINGW_CHECK_DLL([libmythes-1.2])
9620     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9621 else
9622     AC_MSG_RESULT([internal])
9623     SYSTEM_MYTHES=
9624     BUILD_TYPE="$BUILD_TYPE MYTHES"
9625     if test "$COM" = "MSC"; then
9626         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9627     else
9628         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9629     fi
9631 AC_SUBST(SYSTEM_MYTHES)
9632 AC_SUBST(MYTHES_CFLAGS)
9633 AC_SUBST(MYTHES_LIBS)
9635 dnl ===================================================================
9636 dnl How should we build the linear programming solver ?
9637 dnl ===================================================================
9639 ENABLE_COINMP=
9640 AC_MSG_CHECKING([whether to build with CoinMP])
9641 if test "$enable_coinmp" != "no"; then
9642     ENABLE_COINMP=TRUE
9643     AC_MSG_RESULT([yes])
9644     # Should we check for system CoinMP ? How to do that ?
9645     BUILD_TYPE="$BUILD_TYPE COINMP"
9646 else
9647     AC_MSG_RESULT([no])
9649 AC_SUBST(ENABLE_COINMP)
9651 ENABLE_LPSOLVE=
9652 AC_MSG_CHECKING([whether to build with lpsolve])
9653 if test "$enable_lpsolve" != "no"; then
9654     ENABLE_LPSOLVE=TRUE
9655     AC_MSG_RESULT([yes])
9656 else
9657     AC_MSG_RESULT([no])
9659 AC_SUBST(ENABLE_LPSOLVE)
9661 if test "$ENABLE_LPSOLVE" = TRUE; then
9662     AC_MSG_CHECKING([which lpsolve to use])
9663     if test "$with_system_lpsolve" = "yes"; then
9664         AC_MSG_RESULT([external])
9665         SYSTEM_LPSOLVE=TRUE
9666         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9667            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9668         save_LIBS=$LIBS
9669         # some systems need this. Like Ubuntu....
9670         AC_CHECK_LIB(m, floor)
9671         AC_CHECK_LIB(dl, dlopen)
9672         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9673             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9674         LIBS=$save_LIBS
9675         libo_MINGW_CHECK_DLL([lpsolve55])
9676     else
9677         AC_MSG_RESULT([internal])
9678         SYSTEM_LPSOLVE=
9679         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9680     fi
9682 AC_SUBST(SYSTEM_LPSOLVE)
9684 dnl ===================================================================
9685 dnl Checking for libexttextcat
9686 dnl ===================================================================
9687 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9688 if test "$with_system_libexttextcat" = "yes"; then
9689     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9691 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9693 dnl ***************************************
9694 dnl testing libc version for Linux...
9695 dnl ***************************************
9696 if test "$_os" = "Linux"; then
9697     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9698     exec 6>/dev/null # no output
9699     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9700     exec 6>&1 # output on again
9701     if test "$HAVE_LIBC"; then
9702         AC_MSG_RESULT([yes])
9703     else
9704         AC_MSG_ERROR([no, upgrade libc])
9705     fi
9708 dnl =========================================
9709 dnl Check for the Windows  SDK.
9710 dnl =========================================
9711 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9712 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9713 if test "$_os" = "WINNT"; then
9714     AC_MSG_CHECKING([for Windows SDK])
9715     if test "$build_os" = "cygwin"; then
9716         find_winsdk
9717         WINDOWS_SDK_HOME=$winsdktest
9719         # normalize if found
9720         if test -n "$WINDOWS_SDK_HOME"; then
9721             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9722             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9723         fi
9724     fi
9726     if test -n "$WINDOWS_SDK_HOME"; then
9727         # Remove a possible trailing backslash
9728         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9730         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9731              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9732              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9733             have_windows_sdk_headers=yes
9734         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9735              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9736              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9737             have_windows_sdk_headers=yes
9738         else
9739             have_windows_sdk_headers=no
9740         fi
9742         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9743             have_windows_sdk_libs=yes
9744         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9745             have_windows_sdk_libs=yes
9746         else
9747             have_windows_sdk_libs=no
9748         fi
9750         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9751             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9752 the  Windows SDK are installed.])
9753         fi
9755         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9756              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9757              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9758              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9759         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9760              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9761              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9762              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9763         else
9764             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9765         fi
9766     fi
9768     if test -z "$WINDOWS_SDK_HOME"; then
9769         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9770     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9771         WINDOWS_SDK_VERSION=60
9772         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9773     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9774         WINDOWS_SDK_VERSION=61
9775         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9776     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9777         WINDOWS_SDK_VERSION=70
9778         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9779     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9780         WINDOWS_SDK_VERSION=80
9781         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9782         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9783         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9784             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9785             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9786             add_warning "If a build created with VS 2012 should run on Windows XP,"
9787             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9788         fi
9789     else
9790         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9791     fi
9792     PathFormat "$WINDOWS_SDK_HOME"
9793     WINDOWS_SDK_HOME="$formatted_path"
9794     if test "$build_os" = "cygwin"; then
9795         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9796         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9797             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9798         fi
9799     fi
9801     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9802     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9803     dnl but not in v8.0), so allow this to be overridden with a
9804     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9805     dnl and configuration error if no WiLangId.vbs is found would arguably be
9806     dnl better, but I do not know under which conditions exactly it is needed by
9807     dnl msiglobal.pm:
9808     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9809         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9810         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9811             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9812         fi
9813         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9814             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9815         fi
9816         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9817             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9818             add_warning "WiLangId.vbs not found - building translated packages will fail"
9819         fi
9820     fi
9822 AC_SUBST(WINDOWS_SDK_HOME)
9823 AC_SUBST(WINDOWS_SDK_VERSION)
9824 AC_SUBST(WINDOWS_SDK_WILANGID)
9826 dnl =========================================
9827 dnl Check for uuidgen
9828 dnl =========================================
9829 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9830     if test "$WITH_MINGW" = "yes"; then
9831         AC_PATH_PROG([UUIDGEN], [uuid])
9832         if test -z "$UUIDGEN"; then
9833             AC_MSG_WARN([uuid is needed for dev-install])
9834         fi
9835     else
9836         # presence is already tested above in the WINDOWS_SDK_HOME check
9837         UUIDGEN=uuidgen.exe
9838         AC_SUBST(UUIDGEN)
9839     fi
9840 else
9841     AC_PATH_PROG([UUIDGEN], [uuidgen])
9842     if test -z "$UUIDGEN"; then
9843         AC_MSG_WARN([uuid is needed for dev-install])
9844     fi
9847 dnl =========================================
9848 dnl Check for the Microsoft DirectX SDK.
9849 dnl =========================================
9850 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9851     AC_MSG_CHECKING([for DirectX SDK])
9852     if test "$build_os" = "cygwin"; then
9853         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9854         if test -n "$DXSDK_DIR"; then
9855             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9856             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9857         fi
9858         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9859         # the "DirectX SDK not found" error later.
9860         # (Where?)
9862         # Remove a possible trailing backslash
9863         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9864     fi
9866     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9867         HAVE_DIRECTXSDK_H="yes"
9868     else
9869         HAVE_DIRECTXSDK_H="no"
9870     fi
9872     if test "$BITNESS_OVERRIDE" = 64; then
9873         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9874     else
9875         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9876     fi
9877     PathFormat "$DIRECTXSDK_LIB"
9878     DIRECTXSDK_LIB="$formatted_path"
9880     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9881         HAVE_DIRECTXSDK_LIB="yes"
9882     else
9883         HAVE_DIRECTXSDK_LIB="no"
9884     fi
9886     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9887         AC_MSG_RESULT([found])
9888     else
9889         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9890     fi
9891     if test -n "$DIRECTXSDK_HOME"; then
9892         PathFormat "$DIRECTXSDK_HOME"
9893         DIRECTXSDK_HOME="$formatted_path"
9894         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9895     fi
9897 AC_SUBST(DIRECTXSDK_HOME)
9899 dnl ***************************************
9900 dnl Checking for bison and flex
9901 dnl ***************************************
9902 AC_PATH_PROG(BISON, bison)
9903 if test -z "$BISON"; then
9904     AC_MSG_ERROR([no bison found in \$PATH, install it])
9905 else
9906     AC_MSG_CHECKING([the bison version])
9907     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9908     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9909     # Accept newer than 2.0
9910     if test "$_bison_longver" -lt 2000; then
9911         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9912     fi
9915 AC_PATH_PROG(FLEX, flex)
9916 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9917     FLEX=`cygpath -m $FLEX`
9919 if test -z "$FLEX"; then
9920     AC_MSG_ERROR([no flex found in \$PATH, install it])
9921 else
9922     AC_MSG_CHECKING([the flex version])
9923     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9924     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9925         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9926     fi
9928 AC_SUBST([FLEX])
9929 dnl ***************************************
9930 dnl Checking for patch
9931 dnl ***************************************
9932 AC_PATH_PROG(PATCH, patch)
9933 if test -z "$PATCH"; then
9934     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9937 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9938 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9939     if test -z "$with_gnu_patch"; then
9940         GNUPATCH=$PATCH
9941     else
9942         if test -x "$with_gnu_patch"; then
9943             GNUPATCH=$with_gnu_patch
9944         else
9945             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9946         fi
9947     fi
9949     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9950     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9951         AC_MSG_RESULT([yes])
9952     else
9953         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9954     fi
9955 else
9956     GNUPATCH=$PATCH
9959 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9960     GNUPATCH=`cygpath -m $GNUPATCH`
9963 dnl We also need to check for --with-gnu-cp
9965 if test -z "$with_gnu_cp"; then
9966     # check the place where the good stuff is hidden on Solaris...
9967     if test -x /usr/gnu/bin/cp; then
9968         GNUCP=/usr/gnu/bin/cp
9969     else
9970         AC_PATH_PROGS(GNUCP, gnucp cp)
9971     fi
9972     if test -z $GNUCP; then
9973         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9974     fi
9975 else
9976     if test -x "$with_gnu_cp"; then
9977         GNUCP=$with_gnu_cp
9978     else
9979         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9980     fi
9983 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9984     GNUCP=`cygpath -m $GNUCP`
9987 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9988 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9989     AC_MSG_RESULT([yes])
9990 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9991     AC_MSG_RESULT([yes])
9992 else
9993     case "$build_os" in
9994     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9995         x_GNUCP=[\#]
9996         GNUCP=''
9997         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9998         ;;
9999     *)
10000         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10001         ;;
10002     esac
10005 AC_SUBST(GNUPATCH)
10006 AC_SUBST(GNUCP)
10007 AC_SUBST(x_GNUCP)
10009 dnl ***************************************
10010 dnl testing assembler path
10011 dnl ***************************************
10012 ML_EXE=""
10013 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
10014     if test "$BITNESS_OVERRIDE" = ""; then
10015         assembler=ml.exe
10016         assembler_bin=bin
10017     else
10018         assembler=ml64.exe
10019         assembler_bin=bin/amd64
10020     fi
10022     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10023     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10024         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10025         AC_MSG_RESULT([found])
10026         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10027     else
10028         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10029     fi
10031     PathFormat "$ASM_HOME"
10032     ASM_HOME="$formatted_path"
10033 else
10034     ASM_HOME=""
10037 AC_SUBST(ML_EXE)
10039 dnl ===================================================================
10040 dnl We need zip and unzip
10041 dnl ===================================================================
10042 AC_PATH_PROG(ZIP, zip)
10043 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10044 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10045     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],,)
10048 AC_PATH_PROG(UNZIP, unzip)
10049 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10051 dnl ===================================================================
10052 dnl Zip must be a specific type for different build types.
10053 dnl ===================================================================
10054 if test $build_os = cygwin; then
10055     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10056         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10057     fi
10060 dnl ===================================================================
10061 dnl We need touch with -h option support.
10062 dnl ===================================================================
10063 AC_PATH_PROG(TOUCH, touch)
10064 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10065 touch warn
10066 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10067     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],,)
10070 dnl ===================================================================
10071 dnl Test which vclplugs have to be built.
10072 dnl ===================================================================
10073 R=""
10074 GTK3_CFLAGS=""
10075 GTK3_LIBS=""
10076 ENABLE_GTK3=""
10077 if test "x$enable_gtk3" = "xyes"; then
10078     if test "$with_system_cairo" = no; then
10079         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10080     fi
10081     : ${with_system_cairo:=yes}
10082     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="")
10083     if test "x$ENABLE_GTK3" = "xTRUE"; then
10084         R="gtk3"
10085     else
10086         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
10087     fi
10088     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10090 AC_SUBST(GTK3_LIBS)
10091 AC_SUBST(GTK3_CFLAGS)
10092 AC_SUBST(ENABLE_GTK3)
10094 AC_MSG_CHECKING([which VCLplugs shall be built])
10095 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
10096     enable_gtk=no
10098 ENABLE_GTK=""
10099 if test "x$enable_gtk" = "xyes"; then
10100     if test "$with_system_cairo" = no; then
10101         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10102     fi
10103     : ${with_system_cairo:=yes}
10104     ENABLE_GTK="TRUE"
10105     AC_DEFINE(ENABLE_GTK)
10106     R="gtk $R"
10108 AC_SUBST(ENABLE_GTK)
10110 ENABLE_TDE=""
10111 if test "x$enable_tde" = "xyes"; then
10112     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
10113     # are built from the same sources. So we only allow one of them.
10114     if test "x$enable_kde" = "xyes"; then
10115         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
10116     fi
10117     ENABLE_TDE="TRUE"
10118     AC_DEFINE(ENABLE_TDE)
10119     R="$R tde"
10121 AC_SUBST(ENABLE_TDE)
10123 ENABLE_KDE=""
10124 if test "x$enable_kde" = "xyes"; then
10125     ENABLE_KDE="TRUE"
10126     AC_DEFINE(ENABLE_KDE)
10127     R="$R kde"
10129 AC_SUBST(ENABLE_KDE)
10131 ENABLE_KDE4=""
10132 if test "x$enable_kde4" = "xyes"; then
10133     ENABLE_KDE4="TRUE"
10134     AC_DEFINE(ENABLE_KDE4)
10135     R="$R kde4"
10137 AC_SUBST(ENABLE_KDE4)
10139 ENABLE_HEADLESS=""
10140 if test "x$enable_headless" = "xyes"; then
10141     ENABLE_HEADLESS="TRUE"
10142     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10143     R="headless"
10145 AC_SUBST(ENABLE_HEADLESS)
10147 if test -z "$R"; then
10148     AC_MSG_RESULT([none])
10149 else
10150     AC_MSG_RESULT([$R])
10153 dnl ===================================================================
10154 dnl GCONF check
10155 dnl ===================================================================
10157 ENABLE_GCONF=
10158 AC_MSG_CHECKING([whether to enable GConf support])
10159 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
10160     ENABLE_GCONF="TRUE"
10161     AC_MSG_RESULT([yes])
10162     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
10163     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10164 else
10165     AC_MSG_RESULT([no])
10167 AC_SUBST(GCONF_LIBS)
10168 AC_SUBST(GCONF_CFLAGS)
10169 AC_SUBST(ENABLE_GCONF)
10171 dnl ===================================================================
10172 dnl Gnome VFS check
10173 dnl ===================================================================
10175 ENABLE_GNOMEVFS=""
10176 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10177 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10178     ENABLE_GNOMEVFS="TRUE"
10179     AC_MSG_RESULT([yes])
10180     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10181     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10182     AC_DEFINE(ENABLE_GNOME_VFS)
10183 else
10184     AC_MSG_RESULT([no])
10186 AC_SUBST(GNOMEVFS_LIBS)
10187 AC_SUBST(GNOMEVFS_CFLAGS)
10188 AC_SUBST(ENABLE_GNOMEVFS)
10190 dnl ===================================================================
10191 dnl check for dbus support
10192 dnl ===================================================================
10193 ENABLE_DBUS=""
10194 DBUS_CFLAGS=""
10195 DBUS_LIBS=""
10197 if test "$enable_dbus" = "no"; then
10198     test_dbus=no
10201 AC_MSG_CHECKING([whether to enable DBUS support])
10202 if test "$test_dbus" = "yes"; then
10203     ENABLE_DBUS="TRUE"
10204     AC_MSG_RESULT([yes])
10205     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10206     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10207 else
10208     AC_MSG_RESULT([no])
10211 AC_SUBST(ENABLE_DBUS)
10212 AC_SUBST(DBUS_CFLAGS)
10213 AC_SUBST(DBUS_LIBS)
10215 AC_MSG_CHECKING([whether to enable font install via packagekit])
10216 if test "$ENABLE_DBUS" = "TRUE"; then
10217     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10218         ENABLE_PACKAGEKIT=TRUE
10219         AC_MSG_RESULT([yes])
10220     else
10221         ENABLE_PACKAGEKIT=
10222         AC_MSG_RESULT([no])
10223     fi
10224 else
10225     AC_MSG_RESULT([no, dbus disabled.])
10227 AC_SUBST(ENABLE_PACKAGEKIT)
10229 AC_MSG_CHECKING([whether to enable Impress remote control])
10230 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10231     AC_MSG_RESULT([yes])
10232     ENABLE_SDREMOTE=TRUE
10233     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10235     # If not explicitly enabled or disabled, default
10236     if test -z "$enable_sdremote_bluetooth"; then
10237         case "$OS" in
10238         LINUX|MACOSX|WNT)
10239             # Default to yes for these
10240             enable_sdremote_bluetooth=yes
10241             ;;
10242         *)
10243             # otherwise no
10244             enable_sdremote_bluetooth=no
10245             ;;
10246         esac
10247     fi
10248     # $enable_sdremote_bluetooth is guaranteed non-empty now
10250     if test "$enable_sdremote_bluetooth" != "no"; then
10251         if test "$OS" = "LINUX"; then
10252             if test "$ENABLE_DBUS" = "TRUE"; then
10253                 AC_MSG_RESULT([yes])
10254                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10255                 dnl ===================================================================
10256                 dnl Check for system bluez
10257                 dnl ===================================================================
10258                 AC_MSG_CHECKING([which Bluetooth header to use])
10259                 if test "$with_system_bluez" = "yes"; then
10260                     AC_MSG_RESULT([external])
10261                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10262                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10263                     SYSTEM_BLUEZ=TRUE
10264                 else
10265                     AC_MSG_RESULT([internal])
10266                     SYSTEM_BLUEZ=
10267                 fi
10268             else
10269                 AC_MSG_RESULT([no, dbus disabled])
10270                 ENABLE_SDREMOTE_BLUETOOTH=
10271                 SYSTEM_BLUEZ=
10272             fi
10273         else
10274             AC_MSG_RESULT([yes])
10275             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10276             SYSTEM_BLUEZ=
10277         fi
10278     else
10279         AC_MSG_RESULT([no])
10280         ENABLE_SDREMOTE_BLUETOOTH=
10281         SYSTEM_BLUEZ=
10282     fi
10283 else
10284     ENABLE_SDREMOTE=
10285     SYSTEM_BLUEZ=
10286     AC_MSG_RESULT([no])
10288 AC_SUBST(ENABLE_SDREMOTE)
10289 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10290 AC_SUBST(SYSTEM_BLUEZ)
10292 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10293 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10294     AC_MSG_RESULT([yes])
10295     ENABLE_SDREMOTE_ANDROID=TRUE
10296 else
10297     AC_MSG_RESULT([no])
10298     ENABLE_SDREMOTE_ANDROID=
10300 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10302 dnl ===================================================================
10303 dnl Check whether the gtk 2.0 libraries are available.
10304 dnl ===================================================================
10306 GTK_CFLAGS=""
10307 GTK_LIBS=""
10308 ENABLE_SYSTRAY_GTK=""
10309 if test  "$test_gtk" = "yes"; then
10311     if test "$ENABLE_GTK" = "TRUE"; then
10312         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]))
10313         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10314         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]))
10315         BUILD_TYPE="$BUILD_TYPE GTK"
10316         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10318         AC_MSG_CHECKING([whether to enable the systray quickstarter])
10319         if test "x$enable_systray" = "xyes"; then
10320             AC_MSG_RESULT([yes])
10321             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10322                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10323                             [ ENABLE_SYSTRAY_GTK="" ])
10324         else
10325             AC_MSG_RESULT([no])
10326         fi
10328         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10329         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10330                           [ENABLE_GTK_PRINT="TRUE"],
10331                           [ENABLE_GTK_PRINT=""])
10332         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10334         AC_MSG_CHECKING([whether to enable GIO support])
10335         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10336             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10337                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10338             fi
10339             dnl Need at least 2.26 for the dbus support.
10340             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10341                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10342             if test "$ENABLE_GIO" = "TRUE"; then
10343                 AC_DEFINE(ENABLE_GIO)
10344                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10345             fi
10346         else
10347             AC_MSG_RESULT([no])
10348         fi
10349     fi
10351 AC_SUBST(ENABLE_GIO)
10352 AC_SUBST(GIO_CFLAGS)
10353 AC_SUBST(GIO_LIBS)
10354 AC_SUBST(ENABLE_SYSTRAY_GTK)
10355 AC_SUBST(GTK_CFLAGS)
10356 AC_SUBST(GTK_LIBS)
10357 AC_SUBST(GTHREAD_CFLAGS)
10358 AC_SUBST(GTHREAD_LIBS)
10359 AC_SUBST([ENABLE_GTK_PRINT])
10360 AC_SUBST([GTK_PRINT_CFLAGS])
10361 AC_SUBST([GTK_PRINT_LIBS])
10364 dnl ===================================================================
10365 dnl Check whether the Telepathy libraries are available.
10366 dnl ===================================================================
10368 ENABLE_TELEPATHY=""
10369 TELEPATHY_CFLAGS=""
10370 TELEPATHY_LIBS=""
10372 AC_MSG_CHECKING([whether to enable Telepathy support])
10373 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10374     ENABLE_TELEPATHY="TRUE"
10375     AC_DEFINE(ENABLE_TELEPATHY)
10376     AC_MSG_RESULT([yes])
10377     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 )
10378     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10379 else
10380     AC_MSG_RESULT([no])
10383 AC_SUBST(ENABLE_TELEPATHY)
10384 AC_SUBST(TELEPATHY_CFLAGS)
10385 AC_SUBST(TELEPATHY_LIBS)
10388 dnl ===================================================================
10390 SPLIT_APP_MODULES=""
10391 if test "$enable_split_app_modules" = "yes"; then
10392     SPLIT_APP_MODULES="TRUE"
10394 AC_SUBST(SPLIT_APP_MODULES)
10396 SPLIT_OPT_FEATURES=""
10397 if test "$enable_split_opt_features" = "yes"; then
10398     SPLIT_OPT_FEATURES="TRUE"
10400 AC_SUBST(SPLIT_OPT_FEATURES)
10402 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10403     if test "$enable_cairo_canvas" = yes; then
10404         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10405     fi
10406     enable_cairo_canvas=no
10407 elif test -z "$enable_cairo_canvas"; then
10408     enable_cairo_canvas=yes
10411 ENABLE_CAIRO_CANVAS=""
10412 if test "$enable_cairo_canvas" = "yes"; then
10413     test_cairo=yes
10414     ENABLE_CAIRO_CANVAS="TRUE"
10416 AC_SUBST(ENABLE_CAIRO_CANVAS)
10418 dnl ===================================================================
10419 dnl Check whether the GStreamer libraries are available.
10420 dnl ===================================================================
10422 ENABLE_GSTREAMER=""
10424 if test "$build_gstreamer" = "yes"; then
10426     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10427     if test "$enable_avmedia" = yes -a "$enable_gstreamer" != no; then
10428         ENABLE_GSTREAMER="TRUE"
10429         AC_MSG_RESULT([yes])
10430         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10431         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10432     else
10433         AC_MSG_RESULT([no])
10434     fi
10436 AC_SUBST(GSTREAMER_CFLAGS)
10437 AC_SUBST(GSTREAMER_LIBS)
10438 AC_SUBST(ENABLE_GSTREAMER)
10441 ENABLE_GSTREAMER_0_10=""
10442 if test "$build_gstreamer_0_10" = "yes"; then
10444     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10445     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10446         ENABLE_GSTREAMER_0_10="TRUE"
10447         AC_MSG_RESULT([yes])
10448         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10449             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10450         ])
10451         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10452     else
10453         AC_MSG_RESULT([no])
10454     fi
10457 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10458 AC_SUBST(GSTREAMER_0_10_LIBS)
10459 AC_SUBST(ENABLE_GSTREAMER_0_10)
10461 dnl ===================================================================
10462 dnl Check whether to build the VLC avmedia backend
10463 dnl ===================================================================
10465 ENABLE_VLC=""
10467 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10468 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10469     ENABLE_VLC="TRUE"
10470     AC_MSG_RESULT([yes])
10471 else
10472     AC_MSG_RESULT([no])
10474 AC_SUBST(ENABLE_VLC)
10476 dnl ===================================================================
10477 dnl Check whether the OpenGL libraries are available
10478 dnl ===================================================================
10480 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10481 ENABLE_OPENGL=
10483 if test -z "$enable_opengl"; then
10484     if test $_os = WINNT; then
10485         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10486         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10487         # code for Windows.
10488         enable_opengl=no
10489     elif test $_os = iOS; then
10490         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10491         # build fine for iOS, too, but let's leave that for later
10492         enable_opengl=no
10493     elif test "$enable_headless" = "yes"; then
10494         enable_opengl=no
10495     else
10496         enable_opengl=yes
10497     fi
10500 if test "x$enable_opengl" = "xno"; then
10501     AC_MSG_RESULT([no])
10502 elif test "$_os" = "Darwin"; then
10503     # We use frameworks on Mac OS X, no need for detail checks
10504     ENABLE_OPENGL=TRUE
10505     ENABLE_OPENGL_CANVAS=
10506     add_warning "openGL canvas not adapted for Mac yet - disabling"
10507     SYSTEM_MESA_HEADERS=TRUE
10508     AC_MSG_RESULT([yes])
10509 elif test $_os = WINNT; then
10510     # Experimental: try to use OpenGL on Windows
10511     ENABLE_OPENGL=TRUE
10512     ENABLE_OPENGL_CANVAS=TRUE
10513     # We need the internal "Mesa" headers.
10514     SYSTEM_MESA_HEADERS=
10515     BUILD_TYPE="$BUILD_TYPE MESA"
10516     AC_MSG_RESULT([yes])
10517 else
10518     save_LDFLAGS=$LDFLAGS
10519     LDFLAGS="$LDFLAGS -lm"
10520     AC_MSG_RESULT([yes])
10521     AC_CHECK_LIB([GL], [main],
10522         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10523             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10524              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10525              ENABLE_OPENGL_CANVAS=], [])],
10526         [AC_MSG_ERROR(libGL not installed or functional)], [])
10527     LDFLAGS="$LDFLAGS -lGL"
10528     AC_CHECK_LIB([GLU], [main], [:],
10529               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10530     ENABLE_OPENGL=TRUE
10531     LDFLAGS=$save_LDFLAGS
10533     dnl ===================================================================
10534     dnl Check for system Mesa
10535     dnl ===================================================================
10536     AC_MSG_CHECKING([which Mesa headers to use])
10537     if test "$with_system_mesa_headers" = "yes"; then
10538         AC_MSG_RESULT([external])
10539         SYSTEM_MESA_HEADERS=TRUE
10540         AC_LANG_PUSH(C)
10541         AC_CHECK_HEADER(GL/glxext.h, [],
10542            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10543         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10544         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10545         AC_LANG_POP(C)
10546     else
10547         AC_MSG_RESULT([internal])
10548         SYSTEM_MESA_HEADERS=
10549         BUILD_TYPE="$BUILD_TYPE MESA"
10550     fi
10553 AC_SUBST(SYSTEM_MESA_HEADERS)
10554 AC_SUBST(ENABLE_OPENGL)
10555 AC_SUBST(ENABLE_OPENGL_CANVAS)
10557 dnl =================================================
10558 dnl Check whether to build with OpenCL support.
10559 dnl =================================================
10561 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10562 ENABLE_OPENCL=
10564 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10565     if test $_os = Darwin -a "$with_macosx_sdk" = "10.5"; then
10566         AC_MSG_RESULT([disabled on OS X 10.5])
10567     else
10568         AC_MSG_RESULT([yes])
10569         ENABLE_OPENCL=TRUE
10570         AC_DEFINE(HAVE_FEATURE_OPENCL)
10571     fi
10572 else
10573     AC_MSG_RESULT([no])
10576 AC_SUBST(ENABLE_OPENCL)
10578 dnl ===================================================================
10579 dnl Check whether to enable glTF support
10580 dnl ===================================================================
10581 AC_MSG_CHECKING([whether to enable glTF support])
10582 ENABLE_GLTF=
10583 if test "x$enable_gltf" != "xno" -a $_os != Darwin -a $_os != iOS -a $_os != Android; then
10584     ENABLE_GLTF=TRUE
10585     AC_MSG_RESULT([yes])
10586     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10587     BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10588     # otherwise build fails in collada2gltf external because of std::shared_ptr
10589     if test "$have_std_shared_ptr" = "yes"; then
10590         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10591     fi
10592 else
10593     AC_MSG_RESULT([no])
10595 AC_SUBST(ENABLE_GLTF)
10597 # pdf import?
10598 AC_MSG_CHECKING([whether to build the PDF import feature])
10599 ENABLE_PDFIMPORT=
10600 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10601     AC_MSG_RESULT([yes])
10602     ENABLE_PDFIMPORT=TRUE
10604     dnl ===================================================================
10605     dnl Check for system poppler
10606     dnl ===================================================================
10607     AC_MSG_CHECKING([which PDF import backend to use])
10608     if test "$with_system_poppler" = "yes"; then
10609         AC_MSG_RESULT([external])
10610         SYSTEM_POPPLER=TRUE
10611         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10612         AC_LANG_PUSH([C++])
10613         save_CXXFLAGS=$CXXFLAGS
10614         save_CPPFLAGS=$CPPFLAGS
10615         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10616         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10617         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10618                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10619         CXXFLAGS=$save_CXXFLAGS
10620         CPPFLAGS=$save_CPPFLAGS
10621         AC_LANG_POP([C++])
10622         libo_MINGW_CHECK_DLL([libpoppler])
10623         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10624     else
10625         AC_MSG_RESULT([internal])
10626         SYSTEM_POPPLER=
10627         BUILD_TYPE="$BUILD_TYPE POPPLER"
10628     fi
10629 else
10630     AC_MSG_RESULT([no])
10632 AC_SUBST(ENABLE_PDFIMPORT)
10633 AC_SUBST(SYSTEM_POPPLER)
10634 AC_SUBST(POPPLER_CFLAGS)
10635 AC_SUBST(POPPLER_LIBS)
10637 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10638 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10639     AC_MSG_RESULT([yes])
10640     ENABLE_MEDIAWIKI=TRUE
10641     BUILD_TYPE="$BUILD_TYPE XSLTML"
10642     if test  "x$with_java" = "xno"; then
10643         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10644     fi
10645 else
10646     AC_MSG_RESULT([no])
10647     ENABLE_MEDIAWIKI=
10648     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10650 AC_SUBST(ENABLE_MEDIAWIKI)
10652 AC_MSG_CHECKING([whether to build the Report Builder])
10653 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10654     AC_MSG_RESULT([yes])
10655     ENABLE_REPORTBUILDER=TRUE
10656     AC_MSG_CHECKING([which jfreereport libs to use])
10657     if test "$with_system_jfreereport" = "yes"; then
10658         SYSTEM_JFREEREPORT=TRUE
10659         AC_MSG_RESULT([external])
10660         if test -z $SAC_JAR; then
10661             SAC_JAR=/usr/share/java/sac.jar
10662         fi
10663         AC_CHECK_FILE($SAC_JAR, [],
10664              [AC_MSG_ERROR(sac.jar not found.)], [])
10666         if test -z $LIBXML_JAR; then
10667             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10668                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10669                 [
10670                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10671                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10672                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10673                     )
10674                 ]
10675             )
10676         else
10677             AC_CHECK_FILE($LIBXML_JAR, [],
10678                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10679         fi
10681         if test -z $FLUTE_JAR; then
10682             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10683                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10684                 [
10685                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10686                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10687                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10688                     )
10689                 ]
10690             )
10691         else
10692             AC_CHECK_FILE($FLUTE_JAR, [],
10693                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10694         fi
10696         if test -z $JFREEREPORT_JAR; then
10697             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10698                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10699                 [
10700                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10701                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10702                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10703                     )
10704                 ]
10705             )
10706         else
10707             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10708                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10709         fi
10711         if test -z $LIBLAYOUT_JAR; then
10712             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10713                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10714                 [
10715                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10716                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10717                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10718                     )
10719                 ]
10720             )
10721         else
10722             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10723                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10724         fi
10726         if test -z $LIBLOADER_JAR; then
10727             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10728                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10729                 [
10730                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10731                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10732                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10733                     )
10734                 ]
10735             )
10736         else
10737             AC_CHECK_FILE($LIBLOADER_JAR, [],
10738                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10739         fi
10741         if test -z $LIBFORMULA_JAR; then
10742             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10743                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10744                  [
10745                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10746                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10747                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10748                      )
10749                  ]
10750             )
10751         else
10752             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10753                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10754         fi
10756         if test -z $LIBREPOSITORY_JAR; then
10757             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10758                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10759                 [
10760                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10761                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10762                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10763                     )
10764                 ]
10765             )
10766         else
10767             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10768                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10769         fi
10771         if test -z $LIBFONTS_JAR; then
10772             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10773                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10774                 [
10775                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10776                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10777                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10778                     )
10779                 ]
10780             )
10781         else
10782             AC_CHECK_FILE($LIBFONTS_JAR, [],
10783                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10784         fi
10786         if test -z $LIBSERIALIZER_JAR; then
10787             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10788                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10789                 [
10790                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10791                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10792                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10793                     )
10794                 ]
10795             )
10796         else
10797             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10798                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10799         fi
10801         if test -z $LIBBASE_JAR; then
10802             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10803                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10804                 [
10805                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10806                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10807                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10808                     )
10809                 ]
10810             )
10811         else
10812             AC_CHECK_FILE($LIBBASE_JAR, [],
10813                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10814         fi
10816     else
10817         AC_MSG_RESULT([internal])
10818         SYSTEM_JFREEREPORT=
10819         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10820     fi
10821 else
10822     AC_MSG_RESULT([no])
10823     ENABLE_REPORTBUILDER=
10824     SYSTEM_JFREEREPORT=
10826 AC_SUBST(ENABLE_REPORTBUILDER)
10827 AC_SUBST(SYSTEM_JFREEREPORT)
10828 AC_SUBST(SAC_JAR)
10829 AC_SUBST(LIBXML_JAR)
10830 AC_SUBST(FLUTE_JAR)
10831 AC_SUBST(JFREEREPORT_JAR)
10832 AC_SUBST(LIBBASE_JAR)
10833 AC_SUBST(LIBLAYOUT_JAR)
10834 AC_SUBST(LIBLOADER_JAR)
10835 AC_SUBST(LIBFORMULA_JAR)
10836 AC_SUBST(LIBREPOSITORY_JAR)
10837 AC_SUBST(LIBFONTS_JAR)
10838 AC_SUBST(LIBSERIALIZER_JAR)
10840 # this has to be here because both the Wiki Publisher and the SRB use
10841 # commons-logging
10842 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10843     AC_MSG_CHECKING([which Apache commons-* libs to use])
10844     if test "$with_system_apache_commons" = "yes"; then
10845         SYSTEM_APACHE_COMMONS=TRUE
10846         AC_MSG_RESULT([external])
10847         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10848             if test -z $COMMONS_CODEC_JAR; then
10849                 _commons_codec_path=""
10850                 if test "$HAVE_JAVA6" = "TRUE"; then
10851                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10852                 else
10853                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10854                 fi
10855                 AC_CHECK_FILE($_commons_codec_path,
10856                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10857                     [
10858                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10859                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10860                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10861                         )
10862                     ]
10863                 )
10864             else
10865                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10866                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10867             fi
10869             if test -z $COMMONS_LANG_JAR; then
10870                 _commons_lang_path=""
10871                 if test "$HAVE_JAVA6" = "TRUE"; then
10872                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10873                 else
10874                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10875                 fi
10876                 AC_CHECK_FILE($_commons_lang_path,
10877                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10878                     [
10879                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10880                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10881                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10882                             )
10883                     ]
10884                 )
10885             else
10886                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10887                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10888             fi
10890             if test -z $COMMONS_HTTPCLIENT_JAR; then
10891                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10892                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10893                     [
10894                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10895                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10896                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10897                         )
10898                     ]
10899                 )
10900             else
10901                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10902                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10903             fi
10904         fi
10905         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10906             if test -z $COMMONS_LOGGING_JAR; then
10907                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
10908                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
10909                    [
10910                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10911                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10912                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10913                         )
10914                     ]
10915                 )
10916             else
10917                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10918                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10919             fi
10920         fi
10921     else
10922         AC_MSG_RESULT([internal])
10923         SYSTEM_APACHE_COMMONS=
10924         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10925     fi
10927 AC_SUBST(SYSTEM_APACHE_COMMONS)
10928 AC_SUBST(COMMONS_CODEC_JAR)
10929 AC_SUBST(COMMONS_LANG_JAR)
10930 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10931 AC_SUBST(COMMONS_LOGGING_JAR)
10933 # scripting provider for BeanShell?
10934 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10935 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10936     AC_MSG_RESULT([yes])
10937     ENABLE_SCRIPTING_BEANSHELL=TRUE
10939     dnl ===================================================================
10940     dnl Check for system beanshell
10941     dnl ===================================================================
10942     AC_MSG_CHECKING([which beanshell to use])
10943     if test "$with_system_beanshell" = "yes"; then
10944         AC_MSG_RESULT([external])
10945         SYSTEM_BSH=TRUE
10946         if test -z $BSH_JAR; then
10947             BSH_JAR=/usr/share/java/bsh.jar
10948         fi
10949         AC_CHECK_FILE($BSH_JAR, [],
10950                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10951     else
10952         AC_MSG_RESULT([internal])
10953         SYSTEM_BSH=
10954         BUILD_TYPE="$BUILD_TYPE BSH"
10955     fi
10956 else
10957     AC_MSG_RESULT([no])
10958     ENABLE_SCRIPTING_BEANSHELL=
10959     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10961 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10962 AC_SUBST(SYSTEM_BSH)
10963 AC_SUBST(BSH_JAR)
10965 # scripting provider for JavaScript?
10966 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10967 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10968     AC_MSG_RESULT([yes])
10969     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10971     dnl ===================================================================
10972     dnl Check for system rhino
10973     dnl ===================================================================
10974     AC_MSG_CHECKING([which rhino to use])
10975     if test "$with_system_rhino" = "yes"; then
10976         AC_MSG_RESULT([external])
10977         SYSTEM_RHINO=TRUE
10978         if test -z $RHINO_JAR; then
10979             RHINO_JAR=/usr/share/java/js.jar
10980         fi
10981         AC_CHECK_FILE($RHINO_JAR, [],
10982                    [AC_MSG_ERROR(js.jar not found.)], [])
10983     else
10984         AC_MSG_RESULT([internal])
10985         SYSTEM_RHINO=
10986         BUILD_TYPE="$BUILD_TYPE RHINO"
10987     fi
10988 else
10989     AC_MSG_RESULT([no])
10990     ENABLE_SCRIPTING_JAVASCRIPT=
10991     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10993 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10994 AC_SUBST(SYSTEM_RHINO)
10995 AC_SUBST(RHINO_JAR)
10997 supports_multilib=
10998 case "$host_cpu" in
10999 x86_64 | powerpc64 | s390x)
11000     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11001         supports_multilib="yes"
11002     fi
11003     ;;
11005     ;;
11006 esac
11008 dnl ===================================================================
11009 dnl Check whether the TQt and TDE libraries are available.
11010 dnl ===================================================================
11012 TDE_CFLAGS=""
11013 TDE_LIBS=""
11014 if test "$_os" != "OpenBSD"; then
11015     MOC="moc"
11017 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
11018     dnl Search paths for TQt and TDE
11019     if test -z "$supports_multilib"; then
11020         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"
11021         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"
11022     else
11023         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"
11024         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"
11025     fi
11026     if test -n "$TQTDIR"; then
11027         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
11028         if test -z "$supports_multilib"; then
11029             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
11030         else
11031             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
11032         fi
11033     fi
11034     if test -z "$supports_multilib"; then
11035         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"
11036         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"
11037     else
11038         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"
11039         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"
11040     fi
11041     if test -n "$TDEDIR"; then
11042         tde_incdirs="$TDEDIR/include $tde_incdirs"
11043         if test -z "$supports_multilib"; then
11044             tde_libdirs="$TDEDIR/lib $tde_libdirs"
11045         else
11046             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
11047         fi
11048     fi
11050     dnl What to test
11051     tqt_test_include="ntqstyle.h"
11052     tde_test_include="kapp.h"
11054     if test "$_os" != "OpenBSD"; then
11055         tqt_test_library="libtqt-mt.so"
11056         tde_test_library="libDCOP.so"
11057     else
11058         tqt_test_library="libtqt-mt.so*"
11059         tde_test_library="libDCOP.so*"
11060     fi
11062     dnl Check for TQt headers
11063     AC_MSG_CHECKING([for TQt headers])
11064     tqt_incdir="no"
11065     for tde_check in $tqt_incdirs; do
11066         if test -r "$tde_check/$tqt_test_include"; then
11067             tqt_incdir="$tde_check"
11068             break
11069         fi
11070     done
11071     AC_MSG_RESULT([$tqt_incdir])
11072     if test "x$tqt_incdir" = "xno"; then
11073         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
11074 your TQt installation by exporting TQTDIR before running "configure".])
11075     fi
11077     dnl Check for TQt libraries
11078     AC_MSG_CHECKING([for TQt libraries])
11079     tqt_libdir="no"
11080     for tqt_check in $tqt_libdirs; do
11081         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11082             tqt_libdir="$tqt_check"
11083             break
11084         fi
11085     done
11086     AC_MSG_RESULT([$tqt_libdir])
11087     if test "x$tqt_libdir" = "xno"; then
11088         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11089 your TQt installation by exporting TQTDIR before running "configure".])
11090     fi
11092     dnl Check for Meta Object Compiler
11093     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11094     if test "$MOC" = "no"; then
11095         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11096 the root of your TQt installation by exporting TQTDIR before running "configure".])
11097     fi
11099     dnl Check for TDE headers
11100     AC_MSG_CHECKING([for TDE headers])
11101     tde_incdir="no"
11102     for tde_check in $tde_incdirs; do
11103         if test -r "$tde_check/$tde_test_include"; then
11104             tde_incdir="$tde_check"
11105             break
11106         fi
11107     done
11108     AC_MSG_RESULT([$tde_incdir])
11109     if test "x$tde_incdir" = "xno"; then
11110         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11111 your TDE installation by exporting TDEDIR before running "configure".])
11112     fi
11114     dnl Check for TDE libraries
11115     AC_MSG_CHECKING([for TDE libraries])
11116     tde_libdir="no"
11117     for tde_check in $tde_libdirs; do
11118         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11119             tde_libdir="$tde_check"
11120             break
11121         fi
11122     done
11123     AC_MSG_RESULT([$tde_libdir])
11124     if test "x$tde_libdir" = "xno"; then
11125         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11126 your TDE installation by exporting TDEDIR before running "configure".])
11127     fi
11129     dnl Set the variables
11130     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11131     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11133 AC_SUBST(TDE_CFLAGS)
11134 AC_SUBST(TDE_LIBS)
11135 AC_SUBST(MOC)
11137 dnl ===================================================================
11138 dnl Check whether the Qt3 and KDE3 libraries are available.
11139 dnl ===================================================================
11141 KDE_CFLAGS=""
11142 KDE_LIBS=""
11143 if test "$_os" != "OpenBSD"; then
11144     MOC="moc"
11146 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
11147     dnl Search paths for Qt3 and KDE3
11148     if test -z "$supports_multilib"; then
11149         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"
11150         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"
11151     else
11152         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"
11153         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"
11154     fi
11155     if test -n "$QTDIR"; then
11156         qt_incdirs="$QTDIR/include $qt_incdirs"
11157         if test -z "$supports_multilib"; then
11158             qt_libdirs="$QTDIR/lib $qt_libdirs"
11159         else
11160             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11161         fi
11162     fi
11163     if test -z "$supports_multilib"; then
11164         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"
11165         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"
11166     else
11167         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"
11168         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"
11169     fi
11170     if test -n "$KDEDIR"; then
11171         kde_incdirs="$KDEDIR/include $kde_incdirs"
11172         if test -z "$supports_multilib"; then
11173             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11174         else
11175             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11176         fi
11177     fi
11179     dnl What to test
11180     qt_test_include="qstyle.h"
11181     kde_test_include="kapp.h"
11183     if test "$_os" != "OpenBSD"; then
11184         qt_test_library="libqt-mt.so"
11185         kde_test_library="libDCOP.so"
11186     else
11187         qt_test_library="libqt-mt.so*"
11188         kde_test_library="libDCOP.so*"
11189     fi
11191     dnl Check for Qt3 headers
11192     AC_MSG_CHECKING([for Qt3 headers])
11193     qt_incdir="no"
11194     for kde_check in $qt_incdirs; do
11195         if test -r "$kde_check/$qt_test_include"; then
11196             qt_incdir="$kde_check"
11197             break
11198         fi
11199     done
11200     AC_MSG_RESULT([$qt_incdir])
11201     if test "x$qt_incdir" = "xno"; then
11202         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11203 your Qt3 installation by exporting QTDIR before running "configure".])
11204     fi
11206     dnl Check for Qt3 libraries
11207     AC_MSG_CHECKING([for Qt3 libraries])
11208     qt_libdir="no"
11209     for qt_check in $qt_libdirs; do
11210         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11211             qt_libdir="$qt_check"
11212             break
11213         fi
11214     done
11215     AC_MSG_RESULT([$qt_libdir])
11216     if test "x$qt_libdir" = "xno"; then
11217         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11218 your Qt3 installation by exporting QTDIR before running "configure".])
11219     fi
11221     dnl Check for Meta Object Compiler
11222     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11223     if test "$MOC" = "no"; then
11224         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11225 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11226     fi
11228     dnl Check for KDE3 headers
11229     AC_MSG_CHECKING([for KDE3 headers])
11230     kde_incdir="no"
11231     for kde_check in $kde_incdirs; do
11232         if test -r "$kde_check/$kde_test_include"; then
11233             kde_incdir="$kde_check"
11234             break
11235         fi
11236     done
11237     AC_MSG_RESULT([$kde_incdir])
11238     if test "x$kde_incdir" = "xno"; then
11239         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11240 your KDE3 installation by exporting KDEDIR before running "configure".])
11241     fi
11243     dnl Check for KDE3 libraries
11244     AC_MSG_CHECKING([for KDE3 libraries])
11245     kde_libdir="no"
11246     for kde_check in $kde_libdirs; do
11247         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11248             kde_libdir="$kde_check"
11249             break
11250         fi
11251     done
11252     AC_MSG_RESULT([$kde_libdir])
11253     if test "x$kde_libdir" = "xno"; then
11254         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11255 your KDE3 installation by exporting KDEDIR before running "configure".])
11256     fi
11258     dnl Set the variables
11259     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11260     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11261     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11263 AC_SUBST(KDE_CFLAGS)
11264 AC_SUBST(KDE_LIBS)
11265 AC_SUBST(MOC)
11267 dnl ===================================================================
11268 dnl KDE4 Integration
11269 dnl ===================================================================
11271 KDE4_CFLAGS=""
11272 KDE4_LIBS=""
11273 QMAKE4="qmake"
11274 MOC4="moc"
11275 KDE_GLIB_CFLAGS=""
11276 KDE_GLIB_LIBS=""
11277 KDE_HAVE_GLIB=""
11278 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11279     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11280     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11282     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11283     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11285     if test -n "$supports_multilib"; then
11286         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11287         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11288     fi
11290     if test -n "$QTDIR"; then
11291         qt_incdirs="$QTDIR/include $qt_incdirs"
11292         if test -z "$supports_multilib"; then
11293             qt_libdirs="$QTDIR/lib $qt_libdirs"
11294         else
11295             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11296         fi
11297     fi
11298     if test -n "$QT4DIR"; then
11299         qt_incdirs="$QT4DIR/include $qt_incdirs"
11300         if test -z "$supports_multilib"; then
11301             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11302         else
11303             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11304         fi
11305     fi
11307     if test -n "$KDEDIR"; then
11308         kde_incdirs="$KDEDIR/include $kde_incdirs"
11309         if test -z "$supports_multilib"; then
11310             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11311         else
11312             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11313         fi
11314     fi
11315     if test -n "$KDE4DIR"; then
11316         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11317         if test -z "$supports_multilib"; then
11318             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11319         else
11320             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11321         fi
11322     fi
11324     qt_test_include="Qt/qobject.h"
11325     qt_test_library="libQtNetwork.so"
11326     kde_test_include="kwindowsystem.h"
11327     kde_test_library="libsolid.so"
11329     AC_MSG_CHECKING([for Qt4 headers])
11330     qt_header_dir="no"
11331     for inc_dir in $qt_incdirs; do
11332         if test -r "$inc_dir/$qt_test_include"; then
11333             qt_header_dir="$inc_dir"
11334             break
11335         fi
11336     done
11338     AC_MSG_RESULT([$qt_header_dir])
11339     if test "x$qt_header_dir" = "xno"; then
11340         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11341     fi
11343     dnl Check for qmake
11344     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11345     QMAKE4="$QMAKEQT4"
11346     if test "$QMAKE4" = "no"; then
11347         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11348         if test "$QMAKE4" = "no"; then
11349             AC_MSG_ERROR([Qmake not found.  Please specify
11350 the root of your Qt installation by exporting QT4DIR before running "configure".])
11351         fi
11352     fi
11354     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11355     AC_MSG_CHECKING([for Qt4 libraries])
11356     qt_lib_dir="no"
11357     for lib_dir in $qt_libdirs; do
11358         if test -r "$lib_dir/$qt_test_library"; then
11359             qt_lib_dir="$lib_dir"
11360             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11361             break
11362         fi
11363     done
11365     AC_MSG_RESULT([$qt_lib_dir])
11367     if test "x$qt_lib_dir" = "xno"; then
11368         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11369     fi
11371     dnl Check for Meta Object Compiler
11373     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11374     MOC4="$MOCQT4"
11375     if test "$MOC4" = "no"; then
11376         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11377         if test "$MOC4" = "no"; then
11378             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11379 the root of your Qt installation by exporting QT4DIR before running "configure".])
11380         fi
11381     fi
11383     dnl Check for KDE4 headers
11384     AC_MSG_CHECKING([for KDE4 headers])
11385     kde_incdir="no"
11386     for kde_check in $kde_incdirs; do
11387         if test -r "$kde_check/$kde_test_include"; then
11388             kde_incdir="$kde_check"
11389             break
11390         fi
11391     done
11392     AC_MSG_RESULT([$kde_incdir])
11393     if test "x$kde_incdir" = "xno"; then
11394         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11395     fi
11397     dnl Check for KDE4 libraries
11398     AC_MSG_CHECKING([for KDE4 libraries])
11399     kde_libdir="no"
11400     for kde_check in $kde_libdirs; do
11401         if test -r "$kde_check/$kde_test_library"; then
11402             kde_libdir="$kde_check"
11403             break
11404         fi
11405     done
11407     AC_MSG_RESULT([$kde_libdir])
11408     if test "x$kde_libdir" = "xno"; then
11409         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11410     fi
11412     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11413     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11414     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11415     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11417     AC_LANG_PUSH([C++])
11418     save_CXXFLAGS=$CXXFLAGS
11419     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11420     AC_MSG_CHECKING([whether KDE is >= 4.2])
11421        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11422 #include <kdeversion.h>
11424 int main(int argc, char **argv) {
11425        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11426        else return 1;
11428        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11429     CXXFLAGS=$save_CXXFLAGS
11430     AC_LANG_POP([C++])
11432     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11433     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11434     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11435         [
11436             KDE_HAVE_GLIB=1
11437             AC_DEFINE(KDE_HAVE_GLIB,1)
11438             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11440             qt4_fix_warning=
11442             AC_LANG_PUSH([C++])
11443             save_CXXFLAGS=$CXXFLAGS
11444             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11445             save_LIBS=$LIBS
11446             LIBS="$LIBS $KDE4_LIBS"
11447             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11449             # Prepare meta object data
11450             TSTBASE="tst_exclude_socket_notifiers"
11451             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11452             ln -fs "${TSTMOC}.hxx"
11453             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11455             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11456 #include "tst_exclude_socket_notifiers.moc"
11458 int main(int argc, char *argv[])
11460     QCoreApplication app(argc, argv);
11461     exit(tst_processEventsExcludeSocket());
11462     return 0;
11464             ]])],[
11465                 AC_MSG_RESULT([yes])
11466             ],[
11467                 AC_MSG_RESULT([no])
11468                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11469                 if test -z "$qt4_fix_warning"; then
11470                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11471                 fi
11472                 qt4_fix_warning=1
11473                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11474             ])
11476             # Remove meta object data
11477             rm -f "${TSTBASE}."*
11479             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11481             # Prepare meta object data
11482             TSTBASE="tst_exclude_posted_events"
11483             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11484             ln -fs "${TSTMOC}.hxx"
11485             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11487             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11488 #include "tst_exclude_posted_events.moc"
11490 int main(int argc, char *argv[])
11492     QCoreApplication app(argc, argv);
11493     exit(tst_excludePostedEvents());
11494     return 0;
11496             ]])],[
11497                 AC_MSG_RESULT([yes])
11498             ],[
11499                 AC_MSG_RESULT([no])
11500                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11501                 if test -z "$qt4_fix_warning"; then
11502                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11503                 fi
11504                 qt4_fix_warning=1
11505                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11506             ])
11508             # Remove meta object data
11509             rm -f "${TSTBASE}."*
11511             if test -n "$qt4_fix_warning"; then
11512                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11513             fi
11515             LIBS=$save_LIBS
11516             CXXFLAGS=$save_CXXFLAGS
11517             AC_LANG_POP([C++])
11518         ],
11519         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11521 AC_SUBST(KDE4_CFLAGS)
11522 AC_SUBST(KDE4_LIBS)
11523 AC_SUBST(MOC4)
11524 AC_SUBST(KDE_GLIB_CFLAGS)
11525 AC_SUBST(KDE_GLIB_LIBS)
11526 AC_SUBST(KDE_HAVE_GLIB)
11528 dnl ===================================================================
11529 dnl Test for the enabling the lockdown pieces
11530 dnl ===================================================================
11531 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11532 ENABLE_LOCKDOWN=
11533 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11534     ENABLE_LOCKDOWN=TRUE
11535     AC_MSG_RESULT([yes])
11536 else
11537     AC_MSG_RESULT([no])
11539 AC_SUBST(ENABLE_LOCKDOWN)
11541 dnl ===================================================================
11542 dnl Test whether to include Evolution 2 support
11543 dnl ===================================================================
11544 AC_MSG_CHECKING([whether to enable evolution 2 support])
11545 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11546     AC_MSG_RESULT([yes])
11547     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11548     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11549     ENABLE_EVOAB2="TRUE"
11550 else
11551     ENABLE_EVOAB2=""
11552     AC_MSG_RESULT([no])
11554 AC_SUBST(ENABLE_EVOAB2)
11555 AC_SUBST(GOBJECT_CFLAGS)
11556 AC_SUBST(GOBJECT_LIBS)
11558 dnl ===================================================================
11559 dnl Test whether to include TDE AB support
11560 dnl ===================================================================
11561 AC_MSG_CHECKING([whether to enable TDE address book support])
11562 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11563     AC_MSG_RESULT([yes])
11564     AC_LANG_PUSH([C++])
11565     save_CXXFLAGS=$CXXFLAGS
11566     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11567     AC_MSG_CHECKING([whether TDE is at least R14.0])
11568        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11569 #include <tdeversion.h>
11571 int main(int argc, char **argv) {
11572        if (TDE_VERSION_MAJOR >= 14) return 0;
11573        else return 1;
11575        ]])],[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])],[])
11576     CXXFLAGS=$save_CXXFLAGS
11577     AC_LANG_POP([C++])
11578     ENABLE_TDEAB=TRUE
11579 else
11580     AC_MSG_RESULT([no])
11581     ENABLE_TDEAB=
11583 AC_SUBST(ENABLE_TDEAB)
11585 dnl ===================================================================
11586 dnl Test whether to include KDE AB support
11587 dnl ===================================================================
11588 AC_MSG_CHECKING([whether to enable KDE address book support])
11589 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11590     AC_MSG_RESULT([yes])
11591     AC_LANG_PUSH([C++])
11592     save_CXXFLAGS=$CXXFLAGS
11593     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11594     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11595        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11596 #include <kdeversion.h>
11598 int main(int argc, char **argv) {
11599        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11600        else return 1;
11602        ]])],[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])],[])
11603     CXXFLAGS=$save_CXXFLAGS
11604     AC_LANG_POP([C++])
11605     ENABLE_KAB=TRUE
11606 else
11607     AC_MSG_RESULT([no])
11608     ENABLE_KAB=
11610 AC_SUBST(ENABLE_KAB)
11612 dnl ===================================================================
11613 dnl Test which themes to include
11614 dnl ===================================================================
11615 AC_MSG_CHECKING([which themes to include])
11616 # if none given use default subset of available themes
11617 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11618     with_theme="crystal default galaxy hicontrast oxygen tango sifr"
11619     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11622 WITH_THEMES=""
11623 if test "x$with_theme" != "xno"; then
11624     for theme in $with_theme; do
11625         case $theme in
11626         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11627         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11628         esac
11629         WITH_THEMES="$WITH_THEMES $theme"
11630     done
11632 AC_MSG_RESULT([$WITH_THEMES])
11633 AC_SUBST([WITH_THEMES])
11635 dnl ===================================================================
11636 dnl Test whether to integrate helppacks into the product's installer
11637 dnl ===================================================================
11638 AC_MSG_CHECKING([for helppack integration])
11639 if test "$with_helppack_integration" = "no"; then
11640     WITH_HELPPACK_INTEGRATION=
11641     AC_MSG_RESULT([no integration])
11642 else
11643     WITH_HELPPACK_INTEGRATION=TRUE
11644     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11645     AC_MSG_RESULT([integration])
11647 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11649 ###############################################################################
11650 # Extensions checking
11651 ###############################################################################
11652 AC_MSG_CHECKING([for extensions integration])
11653 if test "x$enable_extension_integration" != "xno"; then
11654     WITH_EXTENSION_INTEGRATION=TRUE
11655     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11656     AC_MSG_RESULT([yes, use integration])
11657 else
11658     WITH_EXTENSION_INTEGRATION=
11659     AC_MSG_RESULT([no, do not integrate])
11661 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11663 dnl Should any extra extensions be included?
11664 dnl There are standalone tests for each of these below.
11665 WITH_EXTRA_EXTENSIONS=
11666 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11668 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11669 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11670 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11671 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11672 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11673 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11674 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11675 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11676 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11677 if test "x$with_java" != "xno"; then
11678     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11679     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11682 dnl ===================================================================
11683 dnl Test whether to include Sun Professional Template Pack
11684 dnl ===================================================================
11685 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11686 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11687     AC_MSG_RESULT([no integration])
11688 else
11689     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11690     sun_supported_langs="en-US de it fr es hu"
11691     if test "$with_sun_templates" = "yes"; then
11692         wanted_sun_templates="$sun_supported_langs"
11693     else
11694         # check whether the langs are supported by Sun
11695         wanted_sun_templates=
11696         for lang in $with_sun_templates; do
11697             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11698                 wanted_sun_templates="$wanted_sun_templates $lang"
11699             fi
11700         done
11701     fi
11702     SUNTEMPLATES_LANG=
11703     SUNTEMPLATES_DE_PACK=
11704     SUNTEMPLATES_EN_US_PACK=
11705     SUNTEMPLATES_ES_PACK=
11706     SUNTEMPLATES_FR_PACK=
11707     SUNTEMPLATES_HU_PACK=
11708     SUNTEMPLATES_IT_PACK=
11709     # check whether the langs are requested at all
11710     for lang in $wanted_sun_templates; do
11711     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11712         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11713         case $lang in
11714         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11715         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11716         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11717         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11718         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11719         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11720         esac
11721     fi
11722     done
11723     WITH_EXTRA_EXTENSIONS=TRUE
11724     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11726 AC_SUBST(SUNTEMPLATES_DE_PACK)
11727 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11728 AC_SUBST(SUNTEMPLATES_ES_PACK)
11729 AC_SUBST(SUNTEMPLATES_FR_PACK)
11730 AC_SUBST(SUNTEMPLATES_HU_PACK)
11731 AC_SUBST(SUNTEMPLATES_IT_PACK)
11733 TEST_FONTS_MISSING=0
11735 # $1  = font family
11736 # $2+ = accepted font mappings
11737 test_font_map()
11739     FONT="$1" ; shift
11740     AC_MSG_CHECKING([font mapping for '$FONT'])
11741     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11742     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11744     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11745     while true ; do
11746         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11747         test -n "$MAPPING" || break
11748         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11749     done
11750     if test $TESTEXPR
11751     then
11752         AC_MSG_RESULT([ok])
11753     else
11754         AC_MSG_RESULT([unknown ($FONTFILE)])
11755         TEST_FONTS_MISSING=1
11756     fi
11759 dnl ===================================================================
11760 dnl Test whether to include fonts
11761 dnl ===================================================================
11762 AC_MSG_CHECKING([whether to include third-party fonts])
11763 if test "$with_fonts" != "no"; then
11764     AC_MSG_RESULT([yes])
11765     WITH_FONTS=TRUE
11766     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11767 else
11768     AC_MSG_RESULT([no])
11769     WITH_FONTS=
11770     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11771     if test "$test_fontconfig" = "yes"; then
11772         AC_PATH_PROG([FCMATCH], [fc-match])
11773         if test -z "$FCMATCH"; then
11774             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11775             TEST_FONTS_MISSING=1
11776         else
11777             test_font_map 'Calibri' 'Carlito'
11778             if test ${TEST_FONTS_MISSING} -eq 1
11779             then
11780                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11781             fi
11782         fi
11783     else
11784         TEST_FONTS_MISSING=0
11785     fi
11787 AC_SUBST(WITH_FONTS)
11788 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11790 dnl ===================================================================
11791 dnl Test whether to include ppds
11792 dnl ===================================================================
11793 AC_MSG_CHECKING([whether to include PPDs])
11794 if test "$with_ppds" != "no"; then
11795     AC_MSG_RESULT([yes])
11796     WITHOUT_PPDS=
11797 else
11798     AC_MSG_RESULT([no])
11799     WITHOUT_PPDS=TRUE
11800     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11802 AC_SUBST(WITHOUT_PPDS)
11804 dnl ===================================================================
11805 dnl Test whether to include extra galleries
11806 dnl ===================================================================
11807 AC_MSG_CHECKING([whether to include extra galleries])
11808 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11809     AC_MSG_RESULT([no])
11810     WITH_EXTRA_GALLERY=
11811     OOOP_GALLERY_PACK=""
11812 else
11813     AC_MSG_RESULT([yes])
11814     WITH_EXTRA_GALLERY=TRUE
11815     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11816     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11817     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11819 AC_SUBST(WITH_EXTRA_GALLERY)
11820 AC_SUBST(OOOP_GALLERY_PACK)
11822 dnl ===================================================================
11823 dnl Test whether to include extra templates
11824 dnl ===================================================================
11825 AC_MSG_CHECKING([whether to include extra templates])
11826 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11827     AC_MSG_RESULT([no])
11828     WITH_EXTRA_TEMPLATE=
11829     OOOP_TEMPLATES_PACK=""
11830 else
11831     AC_MSG_RESULT([yes])
11832     WITH_EXTRA_TEMPLATE=TRUE
11833     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11834     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11835     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11837 AC_SUBST(WITH_EXTRA_TEMPLATE)
11838 AC_SUBST(OOOP_TEMPLATES_PACK)
11840 dnl ===================================================================
11841 dnl Test whether to include extra samples
11842 dnl ===================================================================
11843 AC_MSG_CHECKING([whether to include extra samples])
11844 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11845     AC_MSG_RESULT([no])
11846     WITH_EXTRA_SAMPLE=
11847     OOOP_SAMPLES_PACK=""
11848 else
11849     AC_MSG_RESULT([yes])
11850     WITH_EXTRA_SAMPLE=TRUE
11851     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11852     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11853     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11855 AC_SUBST(WITH_EXTRA_SAMPLE)
11856 AC_SUBST(OOOP_SAMPLES_PACK)
11858 dnl ===================================================================
11859 dnl Test whether to include extra fonts
11860 dnl ===================================================================
11861 AC_MSG_CHECKING([whether to include extra fonts])
11862 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11863     AC_MSG_RESULT([no])
11864     WITH_EXTRA_FONT=
11865     OOOP_FONTS_PACK=""
11866 else
11867     AC_MSG_RESULT([yes])
11868     WITH_EXTRA_FONT=TRUE
11869     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11870     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11871     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11873 AC_SUBST(WITH_EXTRA_FONT)
11874 AC_SUBST(OOOP_FONTS_PACK)
11876 dnl ===================================================================
11877 dnl Test whether to enable online update service
11878 dnl ===================================================================
11879 AC_MSG_CHECKING([whether to enable online update])
11880 ENABLE_ONLINE_UPDATE=
11881 if test "$enable_online_update" = ""; then
11882     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11883         AC_MSG_RESULT([yes])
11884         ENABLE_ONLINE_UPDATE="TRUE"
11885     else
11886         AC_MSG_RESULT([no])
11887     fi
11888 else
11889     if test "$enable_online_update" = "yes"; then
11890         AC_MSG_RESULT([yes])
11891         ENABLE_ONLINE_UPDATE="TRUE"
11892     else
11893         AC_MSG_RESULT([no])
11894     fi
11896 AC_SUBST(ENABLE_ONLINE_UPDATE)
11898 dnl ===================================================================
11899 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11900 dnl ===================================================================
11901 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11902 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11903     AC_MSG_RESULT([no])
11904     ENABLE_SILENT_MSI=
11905 else
11906     AC_MSG_RESULT([yes])
11907     ENABLE_SILENT_MSI=TRUE
11908     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11910 AC_SUBST(ENABLE_SILENT_MSI)
11912 AC_MSG_CHECKING([whether and how to use Xinerama])
11913 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11914     if test "$x_libraries" = "default_x_libraries"; then
11915         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11916         if test "x$XINERAMALIB" = x; then
11917            XINERAMALIB="/usr/lib"
11918         fi
11919     else
11920         XINERAMALIB="$x_libraries"
11921     fi
11922     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11923         # we have both versions, let the user decide but use the dynamic one
11924         # per default
11925         USE_XINERAMA=TRUE
11926         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11927             XINERAMA_LINK=dynamic
11928         else
11929             XINERAMA_LINK=static
11930         fi
11931     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11932         # we have only the dynamic version
11933         USE_XINERAMA=TRUE
11934         XINERAMA_LINK=dynamic
11935     elif test -e "$XINERAMALIB/libXinerama.a"; then
11936         # static version
11937         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11938             USE_XINERAMA=TRUE
11939             XINERAMA_LINK=static
11940         else
11941             USE_XINERAMA=
11942             XINERAMA_LINK=none
11943         fi
11944     else
11945         # no Xinerama
11946         USE_XINERAMA=
11947         XINERAMA_LINK=none
11948     fi
11949     if test "$USE_XINERAMA" = "TRUE"; then
11950         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11951         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11952             [AC_MSG_ERROR(Xinerama header not found.)], [])
11953         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11954         if test "x$XEXTLIB" = x; then
11955            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11956         fi
11957         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11958         if test "$_os" = "FreeBSD"; then
11959             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11960         fi
11961         if test "$_os" = "Linux"; then
11962             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11963         fi
11964         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11965             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11966     else
11967         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11968     fi
11969 else
11970     USE_XINERAMA=
11971     XINERAMA_LINK=none
11972     AC_MSG_RESULT([no])
11974 AC_SUBST(USE_XINERAMA)
11975 AC_SUBST(XINERAMA_LINK)
11977 dnl ===================================================================
11978 dnl Test whether to build cairo or rely on the system version
11979 dnl ===================================================================
11981 if test "$GUIBASE" = "unx"; then
11982     # Used in vcl/Library_vclplug_gen.mk
11983     test_cairo=yes
11986 if test "$test_cairo" = "yes"; then
11987     AC_MSG_CHECKING([whether to use the system cairo])
11989     : ${with_system_cairo:=$with_system_libs}
11990     if test "$with_system_cairo" = "yes"; then
11991         SYSTEM_CAIRO=TRUE
11992         AC_MSG_RESULT([yes])
11994         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11995         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11997         if test "$test_xrender" = "yes"; then
11998             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11999             AC_LANG_PUSH([C])
12000             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12001 #ifdef PictStandardA8
12002 #else
12003       return fail;
12004 #endif
12005 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12007             AC_LANG_POP([C])
12008         fi
12009         libo_MINGW_CHECK_DLL([libcairo])
12010         libo_MINGW_TRY_DLL([libfontconfig])
12011         libo_MINGW_TRY_DLL([libfreetype])
12012         libo_MINGW_TRY_DLL([libpixman])
12013         libo_MINGW_TRY_DLL([libpng15])
12014     else
12015         SYSTEM_CAIRO=
12016         AC_MSG_RESULT([no])
12018         BUILD_TYPE="$BUILD_TYPE CAIRO"
12019         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
12020     fi
12023 AC_SUBST(SYSTEM_CAIRO)
12024 AC_SUBST(CAIRO_CFLAGS)
12025 AC_SUBST(CAIRO_LIBS)
12027 dnl ===================================================================
12028 dnl Test whether to use avahi
12029 dnl ===================================================================
12030 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12031     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12032                       [ENABLE_AVAHI="TRUE"])
12033     AC_DEFINE(HAVE_FEATURE_AVAHI)
12034     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12037 AC_SUBST(ENABLE_AVAHI)
12038 AC_SUBST(AVAHI_CFLAGS)
12039 AC_SUBST(AVAHI_LIBS)
12041 dnl ===================================================================
12042 dnl Test whether to use liblangtag
12043 dnl ===================================================================
12044 ENABLE_LIBLANGTAG=
12045 SYSTEM_LIBLANGTAG=
12046 AC_MSG_CHECKING([whether to use liblangtag])
12047 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
12048     ENABLE_LIBLANGTAG=TRUE
12049     AC_MSG_RESULT([yes])
12050     AC_MSG_CHECKING([whether to use system liblangtag])
12051     if test "$with_system_liblangtag" = yes; then
12052         SYSTEM_LIBLANGTAG=TRUE
12053         AC_MSG_RESULT([yes])
12054         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12055         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12056         libo_MINGW_CHECK_DLL([liblangtag])
12057     else
12058         SYSTEM_LIBLANGTAG=
12059         AC_MSG_RESULT([no])
12060         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12061         if test "$COM" = "MSC"; then
12062             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
12063         else
12064             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
12065         fi
12066     fi
12067 else
12068     AC_MSG_RESULT([no])
12070 AC_SUBST(ENABLE_LIBLANGTAG)
12071 AC_SUBST(SYSTEM_LIBLANGTAG)
12072 AC_SUBST(LIBLANGTAG_CFLAGS)
12073 AC_SUBST(LIBLANGTAG_LIBS)
12075 dnl ===================================================================
12076 dnl Test whether to build libpng or rely on the system version
12077 dnl ===================================================================
12079 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
12081 dnl ===================================================================
12082 dnl Check for runtime JVM search path
12083 dnl ===================================================================
12084 if test "$ENABLE_JAVA" != ""; then
12085     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12086     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12087         AC_MSG_RESULT([yes])
12088         if ! test -d "$with_jvm_path"; then
12089             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12090         fi
12091         if ! test -d "$with_jvm_path"jvm; then
12092             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12093         fi
12094         JVM_ONE_PATH_CHECK="$with_jvm_path"
12095         AC_SUBST(JVM_ONE_PATH_CHECK)
12096     else
12097         AC_MSG_RESULT([no])
12098     fi
12101 dnl ===================================================================
12102 dnl Test for the presence of Ant and that it works
12103 dnl ===================================================================
12105 if test "$ENABLE_JAVA" != ""; then
12106     ANT_HOME=; export ANT_HOME
12107     WITH_ANT_HOME=; export WITH_ANT_HOME
12108     if test -z "$with_ant_home"; then
12109         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
12110     else
12111         if test "$_os" = "WINNT"; then
12112             # AC_PATH_PROGS needs unix path
12113             with_ant_home=`cygpath -u "$with_ant_home"`
12114         fi
12115         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12116         WITH_ANT_HOME=$with_ant_home
12117         ANT_HOME=$with_ant_home
12118     fi
12120     if test -z "$ANT"; then
12121         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12122     else
12123         # resolve relative or absolute symlink
12124         while test -h "$ANT"; do
12125             a_cwd=`pwd`
12126             a_basename=`basename "$ANT"`
12127             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12128             cd "`dirname "$ANT"`"
12129             cd "`dirname "$a_script"`"
12130             ANT="`pwd`"/"`basename "$a_script"`"
12131             cd "$a_cwd"
12132         done
12134         AC_MSG_CHECKING([if $ANT works])
12135         cat > conftest.java << EOF
12136         public class conftest {
12137             int testmethod(int a, int b) {
12138                     return a + b;
12139             }
12140         }
12143         cat > conftest.xml << EOF
12144         <project name="conftest" default="conftest">
12145         <target name="conftest">
12146             <javac srcdir="." includes="conftest.java">
12147             </javac>
12148         </target>
12149         </project>
12152         oldJAVA_HOME=$JAVA_HOME
12153         if test "$JAVACISGCJ" = "yes"; then
12154             JAVA_HOME=; export JAVA_HOME
12155             ant_gcj="-Dbuild.compiler=gcj"
12156         fi
12157         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12158         if test $? = 0 -a -f ./conftest.class; then
12159             AC_MSG_RESULT([Ant works])
12160             if test -z "$WITH_ANT_HOME"; then
12161                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12162                 if test -z "$ANT_HOME"; then
12163                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12164                 fi
12165             else
12166                 ANT_HOME="$WITH_ANT_HOME"
12167             fi
12168         else
12169             echo "configure: Ant test failed" >&5
12170             cat conftest.java >&5
12171             cat conftest.xml >&5
12172             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12173             ANT_HOME=""
12174             add_warning "Ant does not work - Some Java projects will not build!"
12175         fi
12176         JAVA_HOME=$oldJAVA_HOME
12177         rm -f conftest* core core.* *.core
12178     fi
12179     if test -z "$ANT_HOME"; then
12180         ANT_HOME="NO_ANT_HOME"
12181     else
12182         PathFormat "$ANT_HOME"
12183         ANT_HOME="$formatted_path"
12184         PathFormat "$ANT"
12185         ANT="$formatted_path"
12186     fi
12187     AC_SUBST(ANT_HOME)
12188     AC_SUBST(ANT)
12190     dnl Checking for ant.jar
12191     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12192         AC_MSG_CHECKING([Ant lib directory])
12193         if test -f $ANT_HOME/lib/ant.jar; then
12194             ANT_LIB="$ANT_HOME/lib"
12195         else
12196             if test -f $ANT_HOME/ant.jar; then
12197                 ANT_LIB="$ANT_HOME"
12198             else
12199                 if test -f /usr/share/java/ant.jar; then
12200                     ANT_LIB=/usr/share/java
12201                 else
12202                     if test -f /usr/share/ant-core/lib/ant.jar; then
12203                         ANT_LIB=/usr/share/ant-core/lib
12204                     else
12205                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12206                             ANT_LIB="$ANT_HOME/lib/ant"
12207                         else
12208                             if test -f /usr/share/lib/ant/ant.jar; then
12209                                 ANT_LIB=/usr/share/lib/ant
12210                             else
12211                                 AC_MSG_ERROR([Ant libraries not found!])
12212                             fi
12213                         fi
12214                     fi
12215                 fi
12216             fi
12217         fi
12218         PathFormat "$ANT_LIB"
12219         ANT_LIB="$formatted_path"
12220         AC_MSG_RESULT([Ant lib directory found.])
12221     fi
12222     AC_SUBST(ANT_LIB)
12224     ant_minver=1.6.0
12225     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12227     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12228     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12229     ant_version_major=`echo $ant_version | cut -d. -f1`
12230     ant_version_minor=`echo $ant_version | cut -d. -f2`
12231     echo "configure: ant_version $ant_version " >&5
12232     echo "configure: ant_version_major $ant_version_major " >&5
12233     echo "configure: ant_version_minor $ant_version_minor " >&5
12234     if test "$ant_version_major" -ge "2"; then
12235         AC_MSG_RESULT([yes, $ant_version])
12236     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12237         AC_MSG_RESULT([yes, $ant_version])
12238     else
12239         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12240     fi
12242     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
12243         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
12244         rm -rf confdir
12245         mkdir confdir
12246         cat > conftest.java << EOF
12247             public class conftest {
12248                 int testmethod(int a, int b) {
12249                     return a + b;
12250                 }
12251             }
12254         cat > conftest.xml << EOF
12255             <project name="conftest" default="conftest">
12256             <target name="conftest" depends="copytest">
12257                 <javac srcdir="." includes="conftest.java">
12258                 </javac>
12259             </target>
12260             <target name="copytest">
12261                  <copy todir="confdir">
12262                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
12263                  <filterset/>
12264                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
12265                  </copy>
12266             </target>
12267             </project>
12270         if test "$JAVACISGCJ" = "yes"; then
12271             JAVA_HOME=; export JAVA_HOME
12272             ant_gcj="-Dbuild.compiler=gcj"
12273         fi
12274         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12275         if test $? = 0 -a -f ./conftest.class; then
12276             AC_MSG_RESULT([yes])
12277             rm -rf confdir
12278         else
12279             echo "configure: Ant test failed" >&5
12280             cat conftest.java >&5
12281             cat conftest.xml >&5
12282             rm -rf confdir
12283             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
12284         fi
12285     fi
12286     rm -f conftest* core core.* *.core
12289 OOO_JUNIT_JAR=
12290 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12291     AC_MSG_CHECKING([for JUnit 4])
12292     if test "$with_junit" = "yes"; then
12293         if test -e /usr/share/java/junit4.jar; then
12294             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12295         else
12296            if test -e /usr/share/lib/java/junit.jar; then
12297               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12298            else
12299               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12300            fi
12301         fi
12302     else
12303         OOO_JUNIT_JAR=$with_junit
12304     fi
12305     if test "$_os" = "WINNT"; then
12306         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12307     fi
12308     printf 'import org.junit.Before; import org.hamcrest.BaseDescription;' \
12309         > conftest.java
12310     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12311         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12312     else
12313         AC_MSG_ERROR(
12314 [cannot find JUnit 4 jar, or JUnit 4 jar does not provide Hamcrest; please
12315 install one in the default location (/usr/share/java), specify its pathname via
12316 --with-junit=..., or disable it via --without-junit])
12317     fi
12318     rm -f conftestj.class conftestj.java
12319     if test $OOO_JUNIT_JAR != ""; then
12320     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12321     fi
12323 AC_SUBST(OOO_JUNIT_JAR)
12326 AC_SUBST(SCPDEFS)
12329 # check for wget and curl
12331 WGET=
12332 CURL=
12334 if test "$enable_fetch_external" != "no"; then
12336 CURL=`which curl 2>/dev/null`
12338 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12339     eval "$i --version" > /dev/null 2>&1
12340     ret=$?
12341     if test $ret -eq 0; then
12342         WGET=$i
12343         break
12344     fi
12345 done
12347 if test -z "$WGET" -a -z "$CURL"; then
12348     AC_MSG_ERROR([neither wget nor curl found!])
12353 AC_SUBST(WGET)
12354 AC_SUBST(CURL)
12357 # check for md5sum
12359 MD5SUM=
12361 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12362     if test "$i" = "md5"; then
12363         eval "$i -x" > /dev/null 2>&1
12364     else
12365         eval "$i --version" > /dev/null 2>&1
12366     fi
12367     ret=$?
12368     if test $ret -eq 0; then
12369         MD5SUM=$i
12370         break
12371     fi
12372 done
12374 if test "$MD5SUM" = "md5"; then
12375     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12376         MD5SUM="$MD5SUM -r"
12377     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12378         MD5SUM="$MD5SUM -n"
12379     fi
12382 if test -z "$MD5SUM"; then
12383     AC_MSG_ERROR([no md5sum: found!])
12386 AC_SUBST(MD5SUM)
12388 dnl ===================================================================
12389 dnl Dealing with l10n options
12390 dnl ===================================================================
12391 AC_MSG_CHECKING([which languages to be built])
12392 # get list of all languages
12393 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12394 # the sed command does the following:
12395 #   + if a line ends with a backslash, append the next line to it
12396 #   + adds " on the beginning of the value (after =)
12397 #   + adds " at the end of the value
12398 #   + removes en-US; we want to put it on the beginning
12399 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12400 [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)]
12401 ALL_LANGS="en-US $completelangiso"
12402 # check the configured localizations
12403 WITH_LANG="$with_lang"
12404 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12405     AC_MSG_RESULT([en-US])
12406 else
12407     AC_MSG_RESULT([$WITH_LANG])
12408     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12410 # check that the list is valid
12411 for lang in $WITH_LANG; do
12412     test "$lang" = "ALL" && continue
12413     # need to check for the exact string, so add space before and after the list of all languages
12414     for vl in $ALL_LANGS; do
12415         if test "$vl" = "$lang"; then
12416            break
12417         fi
12418     done
12419     if test "$vl" != "$lang"; then
12420         # if you're reading this - you prolly quoted your languages remove the quotes ...
12421         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12422     fi
12423 done
12424 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12425     echo $WITH_LANG | grep -q en-US
12426     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12428 # list with substituted ALL
12429 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12430 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12431 test "$WITH_LANG" = "en-US" && WITH_LANG=
12432 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12433     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12434     ALL_LANGS=`echo $ALL_LANGS qtz`
12436 AC_SUBST(ALL_LANGS)
12437 AC_SUBST(WITH_LANG)
12438 AC_SUBST(WITH_LANG_LIST)
12439 AC_SUBST(GIT_NEEDED_SUBMODULES)
12441 WITH_POOR_HELP_LOCALIZATIONS=
12442 if test -d "$SRC_ROOT/translations/source"; then
12443     for l in `ls -1 $SRC_ROOT/translations/source`; do
12444         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12445             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12446         fi
12447     done
12449 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12451 if test -n "$with_locales"; then
12452     WITH_LOCALES="$with_locales"
12454     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12455     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12456     # config_host/config_locales.h.in
12457     for locale in $WITH_LOCALES; do
12458         lang=${locale%_*}
12460         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12462         case $lang in
12463         hi|mr*ne)
12464             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12465             ;;
12466         bg|ru)
12467             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12468             ;;
12469         esac
12470     done
12471 else
12472     AC_DEFINE(WITH_LOCALE_ALL)
12474 AC_SUBST(WITH_LOCALES)
12476 dnl git submodule update --reference
12477 dnl ===================================================================
12478 if test -n "${GIT_REFERENCE_SRC}"; then
12479     for repo in ${GIT_NEEDED_SUBMODULES}; do
12480         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12481             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12482         fi
12483     done
12485 AC_SUBST(GIT_REFERENCE_SRC)
12487 dnl git submodules linked dirs
12488 dnl ===================================================================
12489 if test -n "${GIT_LINK_SRC}"; then
12490     for repo in ${GIT_NEEDED_SUBMODULES}; do
12491         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12492             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12493         fi
12494     done
12496 AC_SUBST(GIT_LINK_SRC)
12498 dnl branding
12499 dnl ===================================================================
12500 AC_MSG_CHECKING([for alternative branding images directory])
12501 # initialize mapped arrays
12502 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12503 brand_files="$BRAND_INTRO_IMAGES about.svg"
12505 if test -z "$with_branding" -o "$with_branding" = "no"; then
12506     AC_MSG_RESULT([none])
12507     DEFAULT_BRAND_IMAGES="$brand_files"
12508 else
12509     if ! test -d $with_branding ; then
12510         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12511     else
12512         AC_MSG_RESULT([$with_branding])
12513         CUSTOM_BRAND_DIR="$with_branding"
12514         for lfile in $brand_files
12515         do
12516             if ! test -f $with_branding/$lfile ; then
12517                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12518                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12519             else
12520                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12521             fi
12522         done
12523         check_for_progress="yes"
12524     fi
12526 AC_SUBST([BRAND_INTRO_IMAGES])
12527 AC_SUBST([CUSTOM_BRAND_DIR])
12528 AC_SUBST([CUSTOM_BRAND_IMAGES])
12529 AC_SUBST([DEFAULT_BRAND_IMAGES])
12532 AC_MSG_CHECKING([for 'intro' progress settings])
12533 PROGRESSBARCOLOR=
12534 PROGRESSSIZE=
12535 PROGRESSPOSITION=
12536 PROGRESSFRAMECOLOR=
12537 PROGRESSTEXTCOLOR=
12538 PROGRESSTEXTBASELINE=
12540 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12541     source "$with_branding/progress.conf"
12542     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12543 else
12544     AC_MSG_RESULT([none])
12547 AC_SUBST(PROGRESSBARCOLOR)
12548 AC_SUBST(PROGRESSSIZE)
12549 AC_SUBST(PROGRESSPOSITION)
12550 AC_SUBST(PROGRESSFRAMECOLOR)
12551 AC_SUBST(PROGRESSTEXTCOLOR)
12552 AC_SUBST(PROGRESSTEXTBASELINE)
12555 AC_MSG_CHECKING([for extra build ID])
12556 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12557     EXTRA_BUILDID="$with_extra_buildid"
12559 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12560 if test -n "$EXTRA_BUILDID" ; then
12561     AC_MSG_RESULT([$EXTRA_BUILDID])
12562 else
12563     AC_MSG_RESULT([not set])
12565 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12567 OOO_VENDOR=
12568 AC_MSG_CHECKING([for vendor])
12569 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12570     OOO_VENDOR="$USERNAME"
12572     if test -z "$OOO_VENDOR"; then
12573         OOO_VENDOR="$USER"
12574     fi
12576     if test -z "$OOO_VENDOR"; then
12577         OOO_VENDOR="`id -u -n`"
12578     fi
12580     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12581 else
12582     OOO_VENDOR="$with_vendor"
12583     AC_MSG_RESULT([$OOO_VENDOR])
12585 AC_SUBST(OOO_VENDOR)
12587 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12588 if test "$with_compat_oowrappers" = "yes"; then
12589     WITH_COMPAT_OOWRAPPERS=TRUE
12590     AC_MSG_RESULT(yes)
12591 else
12592     WITH_COMPAT_OOWRAPPERS=
12593     AC_MSG_RESULT(no)
12595 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12597 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12598 AC_MSG_CHECKING([for install dirname])
12599 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12600     INSTALLDIRNAME="$with_install_dirname"
12602 AC_MSG_RESULT([$INSTALLDIRNAME])
12603 AC_SUBST(INSTALLDIRNAME)
12605 AC_MSG_CHECKING([for prefix])
12606 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12607 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12608 PREFIXDIR="$prefix"
12609 AC_MSG_RESULT([$PREFIXDIR])
12610 AC_SUBST(PREFIXDIR)
12612 LIBDIR=[$(eval echo $(eval echo $libdir))]
12613 AC_SUBST(LIBDIR)
12615 DATADIR=[$(eval echo $(eval echo $datadir))]
12616 AC_SUBST(DATADIR)
12618 MANDIR=[$(eval echo $(eval echo $mandir))]
12619 AC_SUBST(MANDIR)
12621 DOCDIR=[$(eval echo $(eval echo $docdir))]
12622 AC_SUBST(DOCDIR)
12624 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12625 AC_SUBST(INSTALLDIR)
12627 TESTINSTALLDIR="${BUILDDIR}/test-install"
12628 AC_SUBST(TESTINSTALLDIR)
12631 # ===================================================================
12632 # OAuth2 id and secrets
12633 # ===================================================================
12635 AC_MSG_CHECKING([for Google Drive client id and secret])
12636 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12637 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12638 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12639     GDRIVE_CLIENT_ID="\"\""
12642 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12643     GDRIVE_CLIENT_SECRET="\"\""
12646 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12647     AC_MSG_RESULT([not set])
12648 else
12649     AC_MSG_RESULT([set])
12652 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12653 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12655 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12656 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12657 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12658 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12659     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12662 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12663     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12666 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12667     AC_MSG_RESULT([not set])
12668 else
12669     AC_MSG_RESULT([set])
12671 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12672 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12674 # ===================================================================
12675 # De- or increase default verbosity of build process
12676 # ===================================================================
12677 AC_MSG_CHECKING([build verbosity])
12678 if test -n "$enable_verbose"; then
12679     if test "$enable_verbose" = "yes"; then
12680         VERBOSE="TRUE"
12681         AC_MSG_RESULT([high])
12682     fi
12683     if test "$enable_verbose" = "no"; then
12684         VERBOSE="FALSE"
12685         AC_MSG_RESULT([low])
12686     fi
12687 else
12688     AC_MSG_RESULT([not set])
12690 AC_SUBST(VERBOSE)
12692 dnl ===================================================================
12693 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12694 dnl --enable-dependency-tracking configure option
12695 dnl ===================================================================
12696 AC_MSG_CHECKING([whether to enable dependency tracking])
12697 if test "$enable_dependency_tracking" = "no"; then
12698     nodep=TRUE
12699     AC_MSG_RESULT([no])
12700 else
12701     AC_MSG_RESULT([yes])
12703 AC_SUBST(nodep)
12705 dnl ===================================================================
12706 dnl Number of CPUs to use during the build
12707 dnl ===================================================================
12708 AC_MSG_CHECKING([for number of processors to use])
12709 # plain --with-parallelism is just the default
12710 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12711     if test "$with_parallelism" = "no"; then
12712         PARALLELISM=0
12713     else
12714         PARALLELISM=$with_parallelism
12715     fi
12716 else
12717     if test "$enable_icecream" = "yes"; then
12718         PARALLELISM="10"
12719     else
12720         case `uname -s` in
12722         Darwin|FreeBSD|NetBSD|OpenBSD)
12723             PARALLELISM=`sysctl -n hw.ncpu`
12724             ;;
12726         Linux)
12727             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12728         ;;
12729         # what else than above does profit here *and* has /proc?
12730         *)
12731             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12732             ;;
12733         esac
12735         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12736         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12737     fi
12740 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12741     if test -z "$with_parallelism"; then
12742             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12743             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12744             PARALLELISM="1"
12745     else
12746         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."
12747     fi
12750 if test $PARALLELISM -eq 0; then
12751     AC_MSG_RESULT([explicit make -j option needed])
12752 else
12753     AC_MSG_RESULT([$PARALLELISM])
12755 AC_SUBST(PARALLELISM)
12758 # Set up ILIB for MSVC build
12760 if test "$build_os" = "cygwin"; then
12761     ILIB="."
12762     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12763         ILIB="$ILIB;$JAVA_HOME/lib"
12764     fi
12765     if test "$BITNESS_OVERRIDE" = 64; then
12766         ILIB="$ILIB;$COMPATH/lib/amd64"
12767         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12768         if test "$WINDOWS_SDK_VERSION" = "80"; then
12769             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12770         fi
12771     else
12772         ILIB="$ILIB;$COMPATH/lib"
12773         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12774         if test "$WINDOWS_SDK_VERSION" = "80"; then
12775             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12776         fi
12777     fi
12778     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12780     if test "$ENABLE_DIRECTX" = "TRUE"; then
12781         ILIB="$ILIB;$DIRECTXSDK_LIB"
12782     fi
12783     AC_SUBST(ILIB)
12787 # ===================================================================
12788 # Creating bigger shared library to link against
12789 # ===================================================================
12790 AC_MSG_CHECKING([whether to create huge library])
12791 MERGELIBS=
12793 if test $_os = iOS -o $_os = Android; then
12794     # Never any point in mergelibs for these as we build just static
12795     # libraries anyway...
12796     enable_mergelibs=no
12799 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12800     if test $_os != Linux -a $_os != WINNT; then
12801         add_warning "--enable-mergelibs is not tested for this platform"
12802     fi
12803     if test "$enable_mergelibs" = "all"; then
12804         MERGELIBS="ALL"
12805         URELIBS="TRUE"
12806         AC_DEFINE(STATIC_LINKING)
12807     else
12808         MERGELIBS="CORE"
12809     fi
12810     AC_MSG_RESULT([yes])
12811 else
12812     AC_MSG_RESULT([no])
12814 AC_SUBST([MERGELIBS])
12815 AC_SUBST([URELIBS])
12817 # ===================================================================
12818 # Create hardlinks on deliver instead of copying for smaller size and speed up
12819 # ===================================================================
12820 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12821 HARDLINKDELIVER=
12822 if test "$enable_hardlink_deliver" = "yes"; then
12823     HARDLINKDELIVER="TRUE"
12824     AC_MSG_RESULT([yes])
12825 else
12826     AC_MSG_RESULT([no])
12828 AC_SUBST(HARDLINKDELIVER)
12830 dnl ===================================================================
12831 dnl icerun is a wrapper that stops us spawning tens of processes
12832 dnl locally - for tools that can't be executed on the compile cluster
12833 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12834 dnl ===================================================================
12835 AC_MSG_CHECKING([whether to use icerun wrapper])
12836 ICECREAM_RUN=
12837 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12838     ICECREAM_RUN=icerun
12839     AC_MSG_RESULT([yes])
12840 else
12841     AC_MSG_RESULT([no])
12843 AC_SUBST(ICECREAM_RUN)
12845 dnl ===================================================================
12847 AC_MSG_CHECKING([MPL subset])
12848 MPL_SUBSET=
12850 if test "$enable_mpl_subset" = "yes"; then
12851     warn_report=false
12852     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12853         warn_report=true
12854     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12855         warn_report=true
12856     fi
12857     if test "$warn_report" = "true"; then
12858         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12859     fi
12860     if test "x$enable_postgresql_sdbc" != "xno"; then
12861         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12862     fi
12863     if test "$enable_lotuswordpro" = "yes"; then
12864         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12865     fi
12866     if test "$WITH_WEBDAV" = "neon"; then
12867         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12868     fi
12869     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12870         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12871     fi
12872     if test -n "$ENABLE_PDFIMPORT"; then
12873         if test "x$SYSTEM_POPPLER" != "x"; then
12874             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12875         fi
12876     fi
12877     # cf. m4/libo_check_extension.m4
12878     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12879         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12880     fi
12881     for theme in $WITH_THEMES; do
12882         case $theme in
12883         crystal|default|hicontrast|human|oxygen|sifr)
12884             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12885         *) : ;;
12886         esac
12887     done
12888     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12889         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12890     fi
12891     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12892         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12893     fi
12895     MPL_SUBSET="TRUE"
12896     AC_DEFINE(MPL_HAVE_SUBSET)
12897     AC_MSG_RESULT([only])
12898 else
12899     AC_MSG_RESULT([no restrictions])
12901 AC_SUBST(MPL_SUBSET)
12904 dnl ===================================================================
12905 dnl Setting up the environment.
12906 dnl ===================================================================
12907 echo "setting up the build environment variables..."
12909 AC_SUBST(COMPATH)
12911 if test "$build_os" = "cygwin"; then
12912     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12913         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12914         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12915     else
12916         ATL_LIB="$COMPATH/atlmfc/lib"
12917         ATL_INCLUDE="$COMPATH/atlmfc/include"
12918     fi
12919     if test "$BITNESS_OVERRIDE" = 64; then
12920         ATL_LIB="$ATL_LIB/amd64"
12921     fi
12922     PathFormat "/usr/bin/grep.exe"
12923     WIN_GREP="$formatted_path"
12924     PathFormat "/usr/bin/find.exe"
12925     WIN_FIND="$formatted_path"
12926     PathFormat "/usr/bin/ls.exe"
12927     WIN_LS="$formatted_path"
12928     PathFormat "/usr/bin/touch.exe"
12929     WIN_TOUCH="$formatted_path"
12932 AC_SUBST(ATL_INCLUDE)
12933 AC_SUBST(ATL_LIB)
12934 AC_SUBST(WIN_FIND)
12935 AC_SUBST(WIN_GREP)
12936 AC_SUBST(WIN_LS)
12937 AC_SUBST(WIN_TOUCH)
12939 AC_SUBST(BUILD_TYPE)
12941 AC_SUBST(SOLARINC)
12943 PathFormat "$PERL"
12944 PERL="$formatted_path"
12945 AC_SUBST(PERL)
12947 if test -n "$TMPDIR"; then
12948     TEMP_DIRECTORY="$TMPDIR"
12949 else
12950     TEMP_DIRECTORY="/tmp"
12952 if test "$build_os" = "cygwin"; then
12953     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12955 AC_SUBST(TEMP_DIRECTORY)
12957 # setup the PATH for the environment
12958 if test -n "$LO_PATH_FOR_BUILD"; then
12959     LO_PATH="$LO_PATH_FOR_BUILD"
12960 else
12961     LO_PATH="$PATH"
12963     case "$host_os" in
12965     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12966         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12967             pathmunge "$JAVA_HOME/bin" "after"
12968         fi
12969         ;;
12971     cygwin*)
12972         # Win32 make needs native paths
12973         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12974             LO_PATH=`cygpath -p -m "$PATH"`
12975         fi
12976         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12977         pathmunge "$ASM_HOME" "before"
12978         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12979         pathmunge "$CSC_PATH" "before"
12980         pathmunge "$MIDL_PATH" "before"
12981         pathmunge "$AL_PATH" "before"
12982         pathmunge "$MSPDB_PATH" "before"
12983         if test "$BITNESS_OVERRIDE" = 64; then
12984             pathmunge "$COMPATH/bin/amd64" "before"
12985             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12986         else
12987             pathmunge "$COMPATH/bin" "before"
12988             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12989         fi
12990         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12991             if test -d "$JAVA_HOME/jre/bin/client"; then
12992                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12993             fi
12994             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12995                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12996             fi
12997             pathmunge "$JAVA_HOME/bin" "before"
12998         fi
12999         ;;
13001     solaris*)
13002         pathmunge "/usr/css/bin" "before"
13003         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
13004             pathmunge "$JAVA_HOME/bin" "after"
13005         fi
13006         ;;
13007     esac
13009     pathmunge "$SRC_ROOT/solenv/bin" "before"
13010     pathmunge "." "before"
13013 AC_SUBST(LO_PATH)
13015 # Generate a configuration md5 we can use for deps
13016 if test -f config_host.mk; then
13017     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
13020 AC_CONFIG_FILES([config_host.mk
13021                  Makefile
13022                  lo.xcent
13023                  instsetoo_native/util/openoffice.lst
13024                  sysui/desktop/macosx/Info.plist
13025                  ios/lo.xcconfig])
13026 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13027 AC_CONFIG_HEADERS([config_host/config_clang.h])
13028 AC_CONFIG_HEADERS([config_host/config_eot.h])
13029 AC_CONFIG_HEADERS([config_host/config_features.h])
13030 AC_CONFIG_HEADERS([config_host/config_folders.h])
13031 AC_CONFIG_HEADERS([config_host/config_gcc.h])
13032 AC_CONFIG_HEADERS([config_host/config_global.h])
13033 AC_CONFIG_HEADERS([config_host/config_graphite.h])
13034 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13035 AC_CONFIG_HEADERS([config_host/config_locales.h])
13036 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13037 AC_CONFIG_HEADERS([config_host/config_orcus.h])
13038 AC_CONFIG_HEADERS([config_host/config_kde4.h])
13039 AC_CONFIG_HEADERS([config_host/config_mingw.h])
13040 AC_CONFIG_HEADERS([config_host/config_oox.h])
13041 AC_CONFIG_HEADERS([config_host/config_options.h])
13042 AC_CONFIG_HEADERS([config_host/config_test.h])
13043 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
13044 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13045 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13046 AC_CONFIG_HEADERS([config_host/config_version.h])
13047 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13048 AC_OUTPUT
13050 if test "$CROSS_COMPILING" = TRUE; then
13051     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13054 # touch the config timestamp file
13055 if test ! -f config_host.mk.stamp; then
13056     echo > config_host.mk.stamp
13057 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
13058     echo "Configuration unchanged - avoiding scp2 stamp update"
13059 else
13060     echo > config_host.mk.stamp
13064 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13066 cygwin_arch=`echo $MACHTYPE | sed 's/-.*//'`
13067 if test "$cygwin_arch" = "x86_64"; then
13068     download_make_url=http://users.freedesktop.org/~michael/x86_64/make
13069 else
13070     download_make_url=http://dev-www.libreoffice.org/bin/cygwin/make
13073 cat << _EOS
13074 ****************************************************************************
13075 WARNING:
13076 Your make version is known to be horribly slow, and hard to debug
13077 problems with. To get a reasonably functional make please do:
13079 to install a pre-compiled binary make for cygwin
13081 mkdir -p /opt/lo/bin
13082 cd /opt/lo/bin
13083 wget $download_make_url
13084 chmod +x make
13086 to install from source:
13087 place yourself in a working directory of you choice.
13089 git clone https://gerrit.libreoffice.org/p/gnu-make-lo.git
13090 cd gnu-make-lo
13091 autoreconf -i
13092 ./configure --prefix=/opt/lo
13093 make
13094 make install
13096 Then re-run autogen.sh
13098 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13099 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13101 _EOS
13104 cat << _EOF
13105 ****************************************************************************
13107 To build, issue:
13108 $GNUMAKE
13110 For details, run:
13111 $GNUMAKE help
13113 _EOF
13115 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13116     cat << _EOF
13117 After the build has finished, you can immediately run it using:
13118 instdir/program/soffice
13120 If you want to run the smoketest, issue:
13121 $GNUMAKE check
13123 _EOF
13126 if test -f warn; then
13127     cat warn
13128     rm warn
13131 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: