Bump version to 4.3-5
[libreoffice.git] / configure.ac
blobff9d790b0ec24958c0b97e818c3a09329c6cea0b
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.3.10.5],[],[],[https://libreoffice-from-collabora.com/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 PathFormat()
30     formatted_path="$1"
31     if test "$build_os" = "cygwin"; then
32         pf_part1=
33         pf_conv_to_dos=
34         for pf_part in $formatted_path; do
35             if test -z "$pf_part1"; then
36                 pf_part1="$pf_part"
37             else
38                 pf_conv_to_dos="yes"
39             fi
40         done
41         if test "$pf_conv_to_dos" = "yes"; then
42             formatted_path=`cygpath -d "$formatted_path"`
43             if test $? -ne 0;  then
44                 AC_MSG_ERROR([path conversion failed for "$1".])
45             fi
46         fi
47         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
48         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
49         if test "$fp_count_slash$fp_count_colon" != "00"; then
50             if test "$fp_count_colon" = "0"; then
51                 formatted_path=`realpath "$formatted_path"`
52                 if test $? -ne 0;  then
53                     AC_MSG_ERROR([realpath failed for "$1".])
54                 fi
55             fi
56             formatted_path=`cygpath -m "$formatted_path"`
57             if test $? -ne 0;  then
58                 AC_MSG_ERROR([path conversion failed for "$1".])
59             fi
60         fi
61     fi
64 AbsolutePath()
66     # There appears to be no simple and portable method to get an absolute and
67     # canonical path, so we try creating the directory if does not exist and
68     # utilizing the shell and pwd.
69     rel="$1"
70     absolute_path=""
71     test ! -e "$rel" && mkdir -p "$rel"
72     if test -d "$rel" ; then
73         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
74         absolute_path="$(pwd)"
75         cd - > /dev/null
76     else
77         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
78     fi
81 rm -f warn
82 have_WARNINGS="no"
83 add_warning()
85     if test "$have_WARNINGS" = "no"; then
86         echo "*************************************" > warn
87         have_WARNINGS="yes"
88         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
89             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
90             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
91         else
92             COLORWARN="* WARNING :"
93         fi
94     fi
95     echo "$COLORWARN $@" >> warn
98 echo "********************************************************************"
99 echo "*"
100 echo "*   Running ${PACKAGE_NAME} build configuration."
101 echo "*"
102 echo "********************************************************************"
103 echo ""
105 dnl ===================================================================
106 dnl checks build and host OSes
107 dnl do this before argument processing to allow for platform dependent defaults
108 dnl ===================================================================
109 AC_CANONICAL_HOST
111 AC_MSG_CHECKING([for product name])
112 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
113     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
114 else
115     PRODUCTNAME=AC_PACKAGE_NAME
117 AC_MSG_RESULT([$PRODUCTNAME])
118 AC_SUBST(PRODUCTNAME)
120 dnl ===================================================================
121 dnl Our version is defined by the AC_INIT() at the top of this script.
122 dnl ===================================================================
124 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
126 LIBO_VERSION_MAJOR=$1
127 LIBO_VERSION_MINOR=$2
128 LIBO_VERSION_MICRO=$3
129 LIBO_VERSION_PATCH=$4
131 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
132 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
133 # no way to encode that into an integer in general.
134 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
136 LIBO_VERSION_SUFFIX=$5
137 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
138 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
139 # they get undoubled before actually passed to sed.
140 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
141 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
142 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
143 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
145 AC_SUBST(LIBO_VERSION_MAJOR)
146 AC_SUBST(LIBO_VERSION_MINOR)
147 AC_SUBST(LIBO_VERSION_MICRO)
148 AC_SUBST(LIBO_VERSION_PATCH)
149 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
150 AC_SUBST(LIBO_VERSION_SUFFIX)
151 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
153 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
154 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
155 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
156 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
158 LIBO_THIS_YEAR=`date +%Y`
159 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
161 # This UPD silly thing must go away soon
162 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
163 AC_SUBST(UPD)
165 # This too should go away
166 SOURCEVERSION="OOO$UPD"
167 AC_SUBST(SOURCEVERSION)
169 dnl ===================================================================
170 dnl Product version
171 dnl ===================================================================
172 AC_MSG_CHECKING([for product version])
173 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
174 AC_MSG_RESULT([$PRODUCTVERSION])
175 AC_SUBST(PRODUCTVERSION)
177 AC_PROG_EGREP
178 # AC_PROG_EGREP doesn't set GREP on all systems as well
179 AC_PATH_PROG(GREP, grep)
181 BUILDDIR=`pwd`
182 cd $srcdir
183 SRC_ROOT=`pwd`
184 cd $BUILDDIR
185 x_Cygwin=[\#]
187 if test "$build_os" = "cygwin"; then
188     PathFormat "$SRC_ROOT"
189     SRC_ROOT="$formatted_path"
190     PathFormat "$BUILDDIR"
191     BUILDDIR="$formatted_path"
192     x_Cygwin=
195 AC_SUBST(SRC_ROOT)
196 AC_SUBST(BUILDDIR)
197 AC_SUBST(x_Cygwin)
198 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
199 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
201 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
202     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
205 # need sed in os checks...
206 AC_PATH_PROGS(SED, sed)
207 if test -z "$SED"; then
208     AC_MSG_ERROR([install sed to run this script])
211 # Set the ENABLE_LTO variable
212 # ===================================================================
213 AC_MSG_CHECKING([whether to use link-time optimization])
214 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
215     ENABLE_LTO="TRUE"
216     AC_MSG_RESULT([yes])
217     AC_DEFINE(STATIC_LINKING)
218 else
219     ENABLE_LTO=""
220     AC_MSG_RESULT([no])
222 AC_SUBST(ENABLE_LTO)
224 dnl ===================================================================
225 dnl When building for Android, --with-android-ndk,
226 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
227 dnl mandatory
228 dnl ===================================================================
230 AC_ARG_WITH(android-ndk,
231     AS_HELP_STRING([--with-android-ndk],
232         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
235 AC_ARG_WITH(android-ndk-toolchain-version,
236     AS_HELP_STRING([--with-android-ndk-toolchain-version],
237         [Specify which toolchain version to use, of those present in the
238         Android NDK you are using. Mandatory if the NDK used has several
239         toolchain versions for the host architecture you are building for.
240         Possible values are 4.6, 4.8, clang3.3 and clang3.4. Only 4.8 has been
241         tested for real...]), ,)
243 AC_ARG_WITH(android-sdk,
244     AS_HELP_STRING([--with-android-sdk],
245         [Specify location of the Android SDK. Mandatory when building for Android,
246         or when building the Impress Remote Android app.]),
249 ANDROID_NDK_HOME=
250 if test -n "$with_android_ndk"; then
251     ANDROID_NDK_HOME=$with_android_ndk
253     # Set up a lot of pre-canned defaults
255     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
256         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
257     fi
258     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
260     case $ANDROID_NDK_VERSION in
261     r8*|r9*)
262         ;;
263     *)
264         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* and r9* versions are supported])
265         ;;
266     esac
268     if test $host_cpu = arm; then
269         android_cpu=arm
270         android_platform_prefix=$android_cpu-linux-androideabi
271     elif test $host_cpu = mips; then
272         android_cpu=mips
273         android_platform_prefix=$android_cpu-linux-androideabi
274     else
275         # host_cpu is something like "i386" or "i686" I guess, NDK uses
276         # "x86" in some contexts
277         android_cpu=x86
278         android_platform_prefix=$android_cpu
279     fi
281     case "$with_android_ndk_toolchain_version" in
282     4.6|4.7|4.8)
283         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
284         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
285         ;;
286     clang3.3|clang3.4)
287         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
288         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
289         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
290         ANDROID_USING_CLANG=true
291         ;;
292     *)
293         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
294     esac
296     if test ! -d $ANDROID_BINUTILS_DIR; then
297         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
298     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
299         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
300     fi
302     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
303     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
304     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
305     # manage to link the (app-specific) single huge .so that is built for the apps in
306     # android/experimental/* if there is debug information in a significant part of the object files.
307     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
308     # all objects have been built with debug information.)
309     toolchain_system='*'
310     if test $build_os = linux-gnu; then
311         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
312         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
313         if test $build_cpu = x86_64; then
314             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
315                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
316             fi
317             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
318                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
319             fi
320         fi
321         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
322     fi
324     # This stays empty if there is just one version of the toolchain in the NDK
325     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
326     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
327     */bin\ */bin*)
328         # Trailing slash intentional and necessary, compare to how this is used
329         if test -n "$ANDROID_USING_CLANG"; then
330             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
331         else
332             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
333         fi
334         ;;
335     esac
337     if test $host_cpu = arm; then
338        android_gnu_prefix=arm-linux-androideabi
339     elif test $host_cpu = mips; then
340        android_gnu_prefix=mipsel-linux-android
341     elif test $ANDROID_NDK_VERSION = r8; then
342         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
343         android_gnu_prefix=i686-android-linux
344     else
345         android_gnu_prefix=i686-linux-android
346     fi
348     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu
349     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
350     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
351     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
352     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
353     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
355     if test $host_cpu = arm; then
356         ANDROID_APP_ABI=armeabi-v7a
357         if test -n "$ANDROID_USING_CLANG"; then
358             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
359             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
360             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
361         else
362             :
363         fi
364         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
365         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
366     elif test $host_cpu = mips; then
367         ANDROID_APP_ABI=mips
368         ANDROIDCFLAGS=""
369     else # x86
370         ANDROID_APP_ABI=x86
371         ANDROIDCFLAGS="-march=atom"
372     fi
373     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
374     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
375     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu"
376     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
378     if test -n "$ANDROID_USING_CLANG"; then
379         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
380     else
381         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
382     fi
384     # When using the 4.6 or newer toolchain, use the gold linker
385     case "$with_android_ndk_toolchain_version" in
386     4.[[6789]]*|[[56789]].*|clang*)
387         # The NDK doesn't have ld.gold for MIPS for some reason
388         if test "$host_cpu" != mips -a "$ENABLE_LTO" != TRUE; then
389             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
390         fi
391         ;;
392     esac
394     if test "$ENABLE_LTO" = TRUE; then
395         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
396         # $CC and $CXX when building external libraries
397         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
398     fi
400     # gdbserver can be in different locations
401     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
402         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
403     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
404         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
405     else
406         AC_MSG_ERROR([Can't find gdbserver for your Android target])
407     fi
409     if test $host_cpu = arm; then
410         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"
411     elif test $host_cpu = mips; then
412         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/mips/include"
413     else # x86
414         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
415     fi
417     if test -z "$CC"; then
418         case "$with_android_ndk_toolchain_version" in
419         4.*)
420             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
421             ;;
422         clang*)
423             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
424         esac
425     fi
426     if test -z "$CXX"; then
427         case "$with_android_ndk_toolchain_version" in
428         4.*)
429             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
430             ;;
431         clang*)
432             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
433             ;;
434         esac
435     fi
437 AC_SUBST(ANDROID_NDK_GDBSERVER)
438 AC_SUBST(ANDROID_APP_ABI)
440 dnl ===================================================================
441 dnl Also --with-android-sdk is mandatory
442 dnl ===================================================================
443 ANDROID_SDK_HOME=
444 if test -n "$with_android_sdk"; then
445     ANDROID_SDK_HOME=$with_android_sdk
446     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
448 AC_SUBST(ANDROID_SDK_HOME)
450 dnl ===================================================================
451 dnl The following is a list of supported systems.
452 dnl Sequential to keep the logic very simple
453 dnl These values may be checked and reset later.
454 dnl ===================================================================
455 #defaults unless the os test overrides this:
456 test_randr=yes
457 test_xrender=yes
458 test_cups=yes
459 test_dbus=yes
460 test_fontconfig=yes
461 test_cairo=no
463 # Default values, as such probably valid just for Linux, set
464 # differently below just for Mac OSX,but at least better than
465 # hardcoding these as we used to do. Much of this is duplicated also
466 # in solenv for old build system and for gbuild, ideally we should
467 # perhaps define stuff like this only here in configure.ac?
469 LINKFLAGSSHL="-shared"
470 PICSWITCH="-fpic"
471 DLLPOST=".so"
473 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
475 INSTROOTSUFFIX=
476 SDKDIRNAME=sdk
478 case "$host_os" in
480 solaris*)
481     test_gtk=yes
482     build_gstreamer=yes
483     build_gstreamer_0_10=yes
484     test_tde=yes
485     test_kde=yes
486     test_freetype=yes
487     test_gstreamer=yes
488     _os=SunOS
490     dnl ===========================================================
491     dnl Check whether we're using Solaris 10 - SPARC or Intel.
492     dnl ===========================================================
493     AC_MSG_CHECKING([the Solaris operating system release])
494     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
495     if test "$_os_release" -lt "10"; then
496         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
497     else
498         AC_MSG_RESULT([ok ($_os_release)])
499     fi
501     dnl Check whether we're using a SPARC or i386 processor
502     AC_MSG_CHECKING([the processor type])
503     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
504         AC_MSG_RESULT([ok ($host_cpu)])
505     else
506         AC_MSG_ERROR([only SPARC and i386 processors are supported])
507     fi
508     ;;
510 linux-gnu*|k*bsd*-gnu*)
511     test_gtk=yes
512     build_gstreamer=yes
513     build_gstreamer_0_10=yes
514     test_tde=yes
515     test_kde=yes
516     test_kde4=yes
517     test_freetype=yes
518     _os=Linux
519     ;;
521 gnu)
522     test_randr=no
523     test_xrender=no
524     _os=GNU
525      ;;
527 cygwin*|interix*|mingw32*)
529     # When building on Windows normally with MSVC under Cygwin,
530     # configure thinks that the host platform (the platform the
531     # built code will run on) is Cygwin, even if it obviously is
532     # Windows, which in Autoconf terminology is called
533     # "mingw32". (Which is misleading as MinGW is the name of the
534     # tool-chain, not an operating system.)
536     # Somewhat confusing, yes. But this configure script doesn't
537     # look at $host etc that much, it mostly uses its own $_os
538     # variable, set here in this case statement.
540     # When cross-compiling to Windows from Unix, the host platform
541     # is "mingw32" (because in that case it is the MinGW
542     # tool-chain that is used).
544     test_cups=no
545     test_dbus=no
546     test_randr=no
547     test_xrender=no
548     test_freetype=no
549     test_fontconfig=no
550     _os=WINNT
552     DLLPOST=".dll"
553     LINKFLAGSNOUNDEFS=
555     # If the host OS matches "mingw32*", that means we are using the
556     # MinGW cross-compiler, because we don't see the point in building
557     # LibreOffice using MinGW on Windows. If you want to build on
558     # Windows, use MSVC. If you want to use MinGW, surely you want to
559     # cross-compile (from Linux or some other Unix).
561     case "$host_os" in
562     mingw32*)
563         WITH_MINGW=yes
564         if test -z "$CC"; then
565             CC="$host_cpu-$host_vendor-$host_os-gcc"
566         fi
567         if test -z "$CXX"; then
568             CXX="$host_cpu-$host_vendor-$host_os-g++"
569         fi
570         ;;
571     esac
572     ;;
574 darwin*) # Mac OS X or iOS
575     test_gtk=yes
576     test_randr=no
577     test_xrender=no
578     test_freetype=no
579     test_fontconfig=no
580     test_dbus=no
581     if test "$host_cpu" = "arm"; then
582         _os=iOS
583         test_gtk=no
584         test_cups=no
585     else
586         _os=Darwin
587         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
588         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
589     fi
590     enable_systray=no
591     # See comment above the case "$host_os"
592     LINKFLAGSSHL="-dynamiclib -single_module"
594     # -fPIC is default
595     PICSWITCH=""
597     DLLPOST=".dylib"
599     # -undefined error is the default
600     LINKFLAGSNOUNDEFS=""
603 freebsd*)
604     test_gtk=yes
605     build_gstreamer=yes
606     build_gstreamer_0_10=yes
607     test_tde=yes
608     test_kde=yes
609     test_kde4=yes
610     test_freetype=yes
611     AC_MSG_CHECKING([the FreeBSD operating system release])
612     if test -n "$with_os_version"; then
613         OSVERSION="$with_os_version"
614     else
615         OSVERSION=`/sbin/sysctl -n kern.osreldate`
616     fi
617     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
618     AC_MSG_CHECKING([which thread library to use])
619     if test "$OSVERSION" -lt "500016"; then
620         PTHREAD_CFLAGS="-D_THREAD_SAFE"
621         PTHREAD_LIBS="-pthread"
622     elif test "$OSVERSION" -lt "502102"; then
623         PTHREAD_CFLAGS="-D_THREAD_SAFE"
624         PTHREAD_LIBS="-lc_r"
625     else
626         PTHREAD_CFLAGS=""
627         PTHREAD_LIBS="-pthread"
628     fi
629     AC_MSG_RESULT([$PTHREAD_LIBS])
630     _os=FreeBSD
631     ;;
633 *netbsd*)
634     test_gtk=yes
635     build_gstreamer=yes
636     build_gstreamer_0_10=yes
637     test_tde=no
638     test_kde=no
639     test_kde4=yes
640     test_freetype=yes
641     PTHREAD_LIBS="-pthread -lpthread"
642     _os=NetBSD
643     ;;
645 aix*)
646     test_randr=no
647     test_freetype=yes
648     PTHREAD_LIBS=-pthread
649     _os=AIX
650     ;;
652 openbsd*)
653     test_gtk=yes
654     test_tde=yes
655     test_kde=yes
656     test_freetype=yes
657     PTHREAD_CFLAGS="-D_THREAD_SAFE"
658     PTHREAD_LIBS="-pthread"
659     _os=OpenBSD
660     ;;
662 dragonfly*)
663     test_gtk=yes
664     build_gstreamer=yes
665     build_gstreamer_0_10=yes
666     test_tde=yes
667     test_kde=yes
668     test_kde4=yes
669     test_freetype=yes
670     PTHREAD_LIBS="-pthread"
671     _os=DragonFly
672     ;;
674 linux-android*)
675     build_gstreamer=no
676     build_gstreamer_0_10=no
677     enable_lotuswordpro=no
678     enable_mpl_subset=yes
679     enable_opengl=no
680     enable_coinmp=yes
681     enable_lpsolve=no
682     enable_report_builder=no
683     with_theme="tango"
684     test_cups=no
685     test_dbus=no
686     test_fontconfig=no
687     test_freetype=no
688     test_gtk=no
689     test_tde=no
690     test_kde=no
691     test_kde4=no
692     test_randr=no
693     test_xrender=no
694     _os=Android
696     if test -z "$with_android_ndk"; then
697         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
698     fi
700     if test -z "$with_android_ndk_toolchain_version"; then
701         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
702     fi
704     # Verify that the NDK and SDK options are proper
705     if test ! -f "$ANDROID_NDK_HOME/platforms/android-15/arch-arm/usr/lib/libc.a"; then
706         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
707     fi
709     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
710     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
711     ;;
714     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
715     ;;
716 esac
718 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
719     if test -z "$with_android_sdk"; then
720         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
721     fi
723     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
724         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
725     fi
728 if test "$_os" = "AIX"; then
729     AC_PATH_PROG(GAWK, gawk)
730     if test -z "$GAWK"; then
731         AC_MSG_ERROR([gawk not found in \$PATH])
732     fi
735 AC_SUBST(SDKDIRNAME)
737 AC_SUBST(WITH_MINGW)
738 AC_SUBST(PTHREAD_CFLAGS)
739 AC_SUBST(PTHREAD_LIBS)
741 ###############################################################################
742 # Extensions switches --enable/--disable
743 ###############################################################################
744 # By default these should be enabled unless having extra dependencies.
745 # If there is extra dependency over configure options then the enable should
746 # be automagic based on whether the requiring feature is enabled or not.
747 # All this options change anything only with --enable-extension-integration.
749 # The name of this option and its help string makes it sound as if
750 # extensions are built anyway, just not integrated in the installer,
751 # if you use --disable-extension-integration. Is that really the
752 # case?
754 AC_ARG_ENABLE(extension-integration,
755     AS_HELP_STRING([--disable-extension-integration],
756         [Disable integration of the built extensions in the installer of the
757          product. Use this switch to disable the integration.])
760 AC_ARG_ENABLE(export,
761     AS_HELP_STRING([--disable-export],
762         [Disable (some) code for document export. Useful when building viewer-only apps that lack
763          save/export functionality, to avoid having an excessive amount of code and data used
764          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
767 AC_ARG_ENABLE(avmedia,
768     AS_HELP_STRING([--disable-avmedia],
769         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
772 AC_ARG_ENABLE(database-connectivity,
773     AS_HELP_STRING([--disable-database-connectivity],
774         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
777 # This doesn't mean not building (or "integrating") extensions
778 # (although it probably should; i.e. it should imply
779 # --disable-extension-integration I guess), it means not supporting
780 # any extension mechanism at all
781 AC_ARG_ENABLE(extensions,
782     AS_HELP_STRING([--disable-extensions],
783         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
786 AC_ARG_ENABLE(scripting,
787     AS_HELP_STRING([--disable-scripting],
788         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
791 # This is mainly for Android and iOS, but could potentially be used in some
792 # special case otherwise, too, so factored out as a separate setting
794 AC_ARG_ENABLE(dynamic-loading,
795     AS_HELP_STRING([--disable-dynamic-loading],
796         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
799 AC_ARG_ENABLE(ext-mariadb-connector,
800     AS_HELP_STRING([--enable-ext-mariadb-connector],
801         [Enable the build of the MariaDB/MySQL Connector extension.])
804 AC_ARG_ENABLE(report-builder,
805     AS_HELP_STRING([--disable-report-builder],
806         [Disable the Report Builder.])
809 AC_ARG_ENABLE(ext-wiki-publisher,
810     AS_HELP_STRING([--enable-ext-wiki-publisher],
811         [Enable the Wiki Publisher extension.])
814 AC_ARG_ENABLE(lpsolve,
815     AS_HELP_STRING([--disable-lpsolve],
816         [Disable compilation of the lp solve solver ])
818 AC_ARG_ENABLE(coinmp,
819     AS_HELP_STRING([--disable-coinmp],
820         [Disable compilation of the CoinMP solver ])
823 AC_ARG_ENABLE(pdfimport,
824     AS_HELP_STRING([--disable-pdfimport],
825         [Disable building the PDF import feature.])
828 ###############################################################################
830 dnl ---------- *** ----------
832 AC_ARG_ENABLE([hardlink-deliver],
833     AS_HELP_STRING([--enable-hardlink-deliver],
834         [Put files into deliver folder as hardlinks instead of copying them
835         over. Saves space and speeds up build.])
838 AC_ARG_ENABLE(mergelibs,
839     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
840         [Enables linking of big, merged, library. Experimental feature, tested
841         only for Linux at some stage in history, but possibly does not work even
842         for Linux any more. 'all' will link a lot of libraries into libmerged
843         while 'yes' will do it for just a core set of libraries.])
846 AC_ARG_ENABLE(graphite,
847     AS_HELP_STRING([--enable-graphite],
848         [Enables the compilation of Graphite smart font rendering.])
851 AC_ARG_ENABLE(orcus,
852     AS_HELP_STRING([--enable-orcus],
853         [Enables orcus for extra file import filters for Calc.])
856 AC_ARG_ENABLE(fetch-external,
857     AS_HELP_STRING([--disable-fetch-external],
858         [Disables fetching external tarballs from web sources.])
861 AC_ARG_ENABLE(lockdown,
862     AS_HELP_STRING([--disable-lockdown],
863         [Disables the gconf integration work in LibreOffice.]),
866 AC_ARG_ENABLE(vba,
867     AS_HELP_STRING([--disable-vba],
868         [Disables the vba compatibility feature.])
871 AC_ARG_ENABLE(pch,
872     AS_HELP_STRING([--enable-pch],
873         [Enables precompiled header support for C++.])
876 AC_ARG_ENABLE(win-mozab-driver,
877     AS_HELP_STRING([--enable-win-mozab-driver],
878         [LibreOffice includes a driver to connect to Mozilla
879          address books under Windows, to build with this version, use this option.])
882 AC_ARG_ENABLE(epm,
883     AS_HELP_STRING([--enable-epm],
884         [LibreOffice includes self-packaging code, that requires epm, however epm is
885          useless for large scale package building.])
888 AC_ARG_ENABLE(odk,
889     AS_HELP_STRING([--disable-odk],
890         [LibreOffice includes an ODK, office development kit which some packagers may
891          wish to build without.])
894 AC_ARG_ENABLE(mpl-subset,
895     AS_HELP_STRING([--enable-mpl-subset],
896         [Don't compile any pieces which are not MPL or more liberally licensed])
899 AC_ARG_ENABLE(evolution2,
900     AS_HELP_STRING([--enable-evolution2],
901         [Allows the built-in evolution 2 addressbook connectivity build to be
902          enabled.])
905 AC_ARG_ENABLE(directx,
906     AS_HELP_STRING([--disable-directx],
907         [Remove DirectX implementation for the new XCanvas interface.
908          The DirectX support requires more stuff installed on Windows to
909          compile. (DirectX SDK, GDI+ libs)])
912 AC_ARG_ENABLE(activex,
913     AS_HELP_STRING([--disable-activex],
914         [Disable the use of ActiveX for a Windows build.
915         This switch is mandatory when using an Express edition of Visual Studio.])
918 AC_ARG_ENABLE(atl,
919     AS_HELP_STRING([--disable-atl],
920         [Disable the use of ATL for a Windows build.])
921     [
922         This switch is mandatory when using an Express edition of Visual Studio.
923     ],
926 AC_ARG_ENABLE(avahi,
927     AS_HELP_STRING([--enable-avahi],
928         [Determines whether to use Avahi to advertise Impress to remote controls.]),
931 AC_ARG_ENABLE(werror,
932     AS_HELP_STRING([--enable-werror],
933         [Turn warnings to errors. (Has no effect in modules where the treating
934          of warnings as errors is disabled explicitly.)]),
937 AC_ARG_ENABLE(assert-always-abort,
938     AS_HELP_STRING([--enable-assert-always-abort],
939         [make assert() abort even in release code.]),
942 AC_ARG_ENABLE(dbgutil,
943     AS_HELP_STRING([--enable-dbgutil],
944         [Provide debugging support from --enable-debug and include additional debugging
945          utilities such as object counting or more expensive checks.
946          This is the recommended option for developers.
947          Note that this makes the build ABI incompatible, it is not possible to mix object
948          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
950 AC_ARG_ENABLE(debug,
951     AS_HELP_STRING([--enable-debug],
952         [Include debugging information, disable compiler optimization and inlining plus
953          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
955 AC_ARG_ENABLE(selective-debuginfo,
956     AS_HELP_STRING([--enable-selective-debuginfo],
957         [If --enable-debug or --enable-dbgutil is used, build debugging information
958          (-g compiler flag) only for the specified gbuild build targets
959          (where all means everything, - prepended means not to enable, / appended means
960          everything in the directory; there is no ordering, more specific overrides
961          more general, and disabling takes precedence).
962          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
964 AC_ARG_ENABLE(symbols,
965     AS_HELP_STRING([--enable-symbols],
966         [Include debugging symbols in output while preserve optimization.
967          This enables -g compiler flag for GCC or equivalent,
968          without changing anything else compared to productive code.]))
970 AC_ARG_ENABLE(runtime-optimizations,
971     AS_HELP_STRING([--disable-runtime-optimizations],
972         [Statically disable certain runtime optimizations (like rtl/alloc.h or
973          JVM JIT) that are known to interact badly with certain dynamic analysis
974          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
975          CC contains "-fsanitize=address".  (For Valgrind, those runtime
976          optimizations are typcially disabled dynamically via
977          RUNNING_ON_VALGRIND.)]))
979 AC_ARG_ENABLE(compiler-plugins,
980     AS_HELP_STRING([--enable-compiler-plugins],
981         [Enable compiler plugins that will perform additional checks during
982          building. Enabled automatically by --enable-dbgutil.]))
984 AC_ARG_ENABLE(ooenv,
985     AS_HELP_STRING([--disable-ooenv],
986         [Disable ooenv for the instdir installation.]))
988 AC_ARG_ENABLE(lto,
989     AS_HELP_STRING([--enable-lto],
990         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
991          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
992          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
993          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
994          are working on it.)]))
996 AC_ARG_ENABLE(crashdump,
997     AS_HELP_STRING([--enable-crashdump],
998         [Enable the crashdump feature.]))
1000 AC_ARG_ENABLE(python,
1001     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1002         [Enables or disables Python support at run-time and build-time.
1003          Also specifies what Python to use. 'auto' is the default.
1004          'fully-internal' even forces the internal version for uses of Python
1005          during the build (for testing purposes, mainly).]))
1007 AC_ARG_ENABLE(gtk,
1008     AS_HELP_STRING([--disable-gtk],
1009         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1010 ,enable_gtk=yes)
1012 AC_ARG_ENABLE(gtk3,
1013     AS_HELP_STRING([--enable-gtk3],
1014         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1015 ,enable_gtk3=no)
1017 AC_ARG_ENABLE(systray,
1018     AS_HELP_STRING([--disable-systray],
1019         [Determines whether to build the systray quickstarter.]),
1020 ,enable_systray=yes)
1022 AC_ARG_ENABLE(split-app-modules,
1023     AS_HELP_STRING([--enable-split-app-modules],
1024         [Split file lists for app modules, e.g. base, calc.
1025          Has effect only with make distro-pack-install]),
1028 AC_ARG_ENABLE(split-opt-features,
1029     AS_HELP_STRING([--enable-split-opt-features],
1030         [Split file lists for some optional features, .e.g. pyuno, testtool.
1031          Has effect only with make distro-pack-install]),
1034 AC_ARG_ENABLE(cairo-canvas,
1035 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1036                           platforms where Cairo is available.
1039 AC_ARG_ENABLE(opengl,
1040     AS_HELP_STRING([--disable-opengl],
1041         [Determines whether to build the OpenGL 3D slide transitions and canvas component.]))
1043 AC_ARG_ENABLE(opencl,
1044     AS_HELP_STRING([--disable-opencl],
1045         [Determines whether to build with OpenCL support.]))
1047 AC_ARG_ENABLE(dbus,
1048     AS_HELP_STRING([--disable-dbus],
1049         [Determines whether to enable features that depend on dbus.
1050          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1051 ,enable_dbus=yes)
1053 AC_ARG_ENABLE(packagekit,
1054     AS_HELP_STRING([--enable-packagekit],
1055         [Determines whether to enable features using packagekit.
1056          Right now that is auto font install]),
1059 AC_ARG_ENABLE(sdremote,
1060     AS_HELP_STRING([--disable-sdremote],
1061         [Determines whether to enable Impress remote control (i.e. the server component).]),
1062 ,enable_sdremote=yes)
1064 AC_ARG_ENABLE(sdremote-bluetooth,
1065     AS_HELP_STRING([--disable-sdremote-bluetooth],
1066         [Determines whether to build sdremote with bluetooth support.
1067          Requires dbus on Linux.]))
1069 AC_ARG_ENABLE(sdremote-android,
1070     AS_HELP_STRING([--enable-sdremote-android],
1071         [Determines whether to build the Impress Remote Android app -- requires
1072         a correctly configured android sdk.]),
1073 ,enable_sdremote_android=no)
1075 AC_ARG_ENABLE(gconf,
1076     AS_HELP_STRING([--disable-gconf],
1077         [Determines whether to use the GConf support.]),
1078 ,enable_gconf=yes)
1080 AC_ARG_ENABLE(gnome-vfs,
1081     AS_HELP_STRING([--enable-gnome-vfs],
1082         [Determines whether to use the Gnome Virtual Filing System on platforms
1083          where that VFS is available.]),
1084 ,enable_gnome_vfs=no)
1086 AC_ARG_ENABLE(gio,
1087     AS_HELP_STRING([--disable-gio],
1088         [Determines whether to use the GIO support.]),
1089 ,enable_gio=yes)
1091 AC_ARG_ENABLE(telepathy,
1092     AS_HELP_STRING([--enable-telepathy],
1093         [Determines whether to enable Telepathy for collaboration.]),
1094 ,enable_telepathy=no)
1096 AC_ARG_ENABLE(tde,
1097     AS_HELP_STRING([--enable-tde],
1098         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1099          TDE are available.]),
1102 AC_ARG_ENABLE(tdeab,
1103     AS_HELP_STRING([--disable-tdeab],
1104         [Disable the TDE address book support.]),
1106     if test "$enable_tde" = "yes"; then
1107         enable_tdeab=yes
1108     fi
1111 AC_ARG_ENABLE(kde,
1112     AS_HELP_STRING([--enable-kde],
1113         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1114          KDE3 are available.]),
1117 AC_ARG_ENABLE(kdeab,
1118     AS_HELP_STRING([--disable-kdeab],
1119         [Disable the KDE3 address book support.]),
1121     if test "$enable_kde" = "yes"; then
1122         enable_kdeab=yes
1123     fi
1126 AC_ARG_ENABLE(kde4,
1127     AS_HELP_STRING([--enable-kde4],
1128         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1129          KDE4 are available. May be used with --enable-kde if you want to support
1130          both KDE3 and KDE4.]),
1133 AC_ARG_ENABLE(headless,
1134     AS_HELP_STRING([--enable-headless],
1135         [Disable building of GUIs to reduce dependencies. Useful for
1136         server usage. Work in progress, use only if you are hacking on
1137         it. Not related to the --headless option.]), ,)
1139 AC_ARG_ENABLE(randr,
1140     AS_HELP_STRING([--disable-randr],
1141         [Disable RandR support in the vcl project.]),
1142 ,enable_randr=yes)
1144 AC_ARG_ENABLE(randr-link,
1145     AS_HELP_STRING([--disable-randr-link],
1146         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1147 ,enable_randr_link=yes)
1149 AC_ARG_ENABLE(gstreamer,
1150     AS_HELP_STRING([--enable-gstreamer],
1151         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1152 ,enable_gstreamer=no)
1154 AC_ARG_ENABLE(gstreamer-0-10,
1155     AS_HELP_STRING([--disable-gstreamer-0-10],
1156         [Disable building the gstreamer avmedia backend.]),
1157 ,enable_gstreamer_0_10=yes)
1159 AC_ARG_ENABLE(vlc,
1160     AS_HELP_STRING([--enable-vlc],
1161         [Enable building with the VLC avmedia backend.]),
1162 ,enable_vlc=no)
1164 AC_ARG_ENABLE(neon,
1165     AS_HELP_STRING([--disable-neon],
1166         [Disable neon and the compilation of webdav binding.]),
1169 AC_ARG_ENABLE([eot],
1170     [AS_HELP_STRING([--enable-eot],
1171         [Enable support for Embedded OpenType fonts.])],
1172 , [enable_eot=no])
1174 AC_ARG_ENABLE(cve-tests,
1175     AS_HELP_STRING([--disable-cve-tests],
1176         [Prevent CVE tests to be executed]),
1179 AC_ARG_ENABLE(chart-tests,
1180     AS_HELP_STRING([--enable-chart-tests],
1181         [Executes chart XShape tests]),
1184 AC_ARG_ENABLE(build-unowinreg,
1185     AS_HELP_STRING([--enable-build-unowinreg],
1186         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1187          compiler is needed on Linux.])
1188     [
1189                           Usage:     --enable-build-unowinreg
1190     ],
1193 AC_ARG_ENABLE(verbose,
1194     AS_HELP_STRING([--enable-verbose],
1195         [Increase build verbosity.])[
1196   --disable-verbose       Decrease build verbosity.],
1199 AC_ARG_ENABLE(dependency-tracking,
1200     AS_HELP_STRING([--enable-dependency-tracking],
1201         [Do not reject slow dependency extractors.])[
1202   --disable-dependency-tracking
1203                           Disables generation of dependency information.
1204                           Speed up one-time builds.],
1207 AC_ARG_ENABLE(icecream,
1208     AS_HELP_STRING([--enable-icecream],
1209         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1210          It defaults to /opt/icecream for the location of the icecream gcc/g++
1211          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1214 AC_ARG_ENABLE(cups,
1215     AS_HELP_STRING([--disable-cups],
1216         [Do not build cups support.])
1219 AC_ARG_ENABLE(ccache,
1220     AS_HELP_STRING([--disable-ccache],
1221         [Do not try to use ccache automatically.
1222          By default, we will try to detect if ccache is available; in that case if
1223          CC/CXX are not yet set, and --enable-icecream is not given, we
1224          attempt to use ccache. --disable-ccache disables ccache completely.
1228 AC_ARG_ENABLE(64-bit,
1229     AS_HELP_STRING([--enable-64-bit],
1230         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit. Works fine for OS
1231          X. In other cases this option is experimental and possibly quite broken, use only if you are
1232          hacking on 64-bit support.]), ,)
1234 AC_ARG_ENABLE(extra-gallery,
1235     AS_HELP_STRING([--enable-extra-gallery],
1236         [Add extra gallery content.]),
1239 AC_ARG_ENABLE(extra-template,
1240     AS_HELP_STRING([--enable-extra-template],
1241         [Add extra template content.]),
1244 AC_ARG_ENABLE(extra-sample,
1245     AS_HELP_STRING([--enable-extra-sample],
1246         [Add extra sample content.]),
1249 AC_ARG_ENABLE(extra-font,
1250     AS_HELP_STRING([--enable-extra-font],
1251         [Add extra font content.]),
1254 AC_ARG_ENABLE(online-update,
1255     AS_HELP_STRING([--enable-online-update],
1256         [Enable the online update service that will check for new versions of
1257          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1260 AC_ARG_ENABLE(release-build,
1261     AS_HELP_STRING([--enable-release-build],
1262         [Enable release build.
1263          See http://wiki.documentfoundation.org/DevBuild]),
1266 AC_ARG_ENABLE(windows-build-signing,
1267     AS_HELP_STRING([--enable-windows-build-signing],
1268         [Enable signing of windows binaries (*.exe, *.dll)]),
1271 AC_ARG_ENABLE(silent-msi,
1272     AS_HELP_STRING([--enable-silent-msi],
1273         [Enable MSI with LIMITUI=1 (silent install).]),
1276 AC_ARG_ENABLE(macosx-retina,
1277     AS_HELP_STRING([--enable-macosx-retina],
1278         [Declare the application as High Resolution Capable. (retina display)
1279          ]),
1282 AC_ARG_ENABLE(macosx-code-signing,
1283     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1284         [Sign executables, dylibs, frameworks and the app bundle. If you
1285          don't provide an identity the first suitable certificate
1286          in your keychain is used.]),
1289 AC_ARG_ENABLE(macosx-package-signing,
1290     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1291         [Create a .pkg suitable for uploading to the Mac App Store and sign
1292          it. If you don't provide an identity the first suitable certificate
1293          in your keychain is used.]),
1296 AC_ARG_ENABLE(macosx-sandbox,
1297     AS_HELP_STRING([--enable-macosx-sandbox],
1298         [Make the app bundle run in a sandbox. Requires code signing.
1299          Is required by apps distributed in the Mac App Store, and implies
1300          adherence to App Store rules.]),
1303 AC_ARG_WITH(macosx-teamid,
1304     AS_HELP_STRING([--with-macosx-teamid=<teamid>],
1305         [The "team id" to be used for com.apple.application-identifier
1306          in the entitlements when building a sandboxed LibreOffice.]),
1309 AC_ARG_ENABLE(canonical-installation-tree-structure,
1310     AS_HELP_STRING([--enable-canonical-installation-tree-structure],
1311         [Make the installation tree structure be more canonical for
1312          the platform. Implemented only for OS X. Experimental and currently broken.]),
1316 AC_ARG_WITH(macosx-bundle-identifier,
1317     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1318         [Define the OS X bundle identifier. Default is the somewhat weird
1319          org.libreoffice.script ("script", huh?).]),
1320 ,with_macosx_bundle_identifier=org.libreoffice.script)
1322 AC_ARG_WITH(macosx-app-name,
1323     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1324         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1325 ,with_macosx_app_name=$PRODUCTNAME)
1327 AC_ARG_ENABLE(libc++,
1328     AS_HELP_STRING([--enable-libc++],
1329         [Use the libc++ C++ library instead of GNU libstdc++ on OS X. Only effective
1330          if --with-macosx-version-min-required is 10.7 or later.]),
1333 AC_ARG_ENABLE(ios-simulator,
1334     AS_HELP_STRING([--enable-ios-simulator],
1335         [Build for the iOS Simulator, not iOS device.]),
1338 AC_ARG_ENABLE(readonly-installset,
1339     AS_HELP_STRING([--enable-readonly-installset],
1340         [Prevents any attempts by LibreOffice to write into its installation. That means
1341          at least that no "system-wide" extensions can be added. Experimental work in
1342          progress.]),
1345 AC_ARG_ENABLE(postgresql-sdbc,
1346     AS_HELP_STRING([--disable-postgresql-sdbc],
1347         [Disable the build of the PostgreSQL-SDBC driver.])
1350 AC_ARG_ENABLE(lotuswordpro,
1351     AS_HELP_STRING([--disable-lotuswordpro],
1352         [Disable the build of the Lotus Word Pro filter.]),
1353 ,enable_lotuswordpro=yes)
1355 AC_ARG_ENABLE(firebird-sdbc,
1356     AS_HELP_STRING([--disable-firebird-sdbc],
1357         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1358 ,enable_firebird_sdbc=yes)
1360 AC_ARG_ENABLE(winegcc,
1361     AS_HELP_STRING([--enable-winegcc],
1362         [Enable use of winegcc during the build, in order to create msi* tools
1363          needed for MinGW cross-compilation.]),
1366 AC_ARG_ENABLE(liblangtag,
1367     AS_HELP_STRING([--disable-liblangtag],
1368         [Disable use of liblangtag, and instead use an own simple
1369          implementation.]),
1372 AC_ARG_ENABLE(bogus-pkg-config,
1373     AS_HELP_STRING([--enable-bogus-pkg-config],
1374         [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.]),
1377 AC_ARG_ENABLE(openssl,
1378     AS_HELP_STRING([--disable-openssl],
1379         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1380          components will either use GNUTLS or NSS. Work in progress,
1381          use only if you are hacking on it.]),
1382 ,enable_openssl=yes)
1384 AC_ARG_ENABLE(library-bin-tar,
1385     AS_HELP_STRING([--enable-library-bin-tar],
1386         [Enable the building and reused of tarball of binary build for some 'external' libraries
1387         Some libraries can save their build result in a tarball
1388         stored in TARFILE_LOCATION. that binary tarball is
1389         uniquely identified by the source tarbal,
1390         the content of the config_host.mk file and the content
1391         of the top-level directory in core for that library
1392         If this option is enabled, then if such a tarfile exist, it will be untarred
1393         isntead of the source tarfile, and the build step will be skipped for that
1394         library.
1395         If a proper tarfile does not exist, then the normal source-based
1396         build is done for taht library and a proper binary tarfile is created
1397         for the next time.]),
1400 AC_ARG_ENABLE(gltf,
1401     AS_HELP_STRING([--disable-gltf],
1402         [Determines whether to build libraries related to glTF 3D model rendering.]))
1404 AC_ARG_ENABLE(collada,
1405     AS_HELP_STRING([--disable-collada],
1406         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1408 dnl ===================================================================
1409 dnl Optional Packages (--with/without-)
1410 dnl ===================================================================
1412 AC_ARG_WITH(gnu-patch,
1413     AS_HELP_STRING([--with-gnu-patch],
1414         [Specify location of GNU patch on Solaris or FreeBSD.]),
1417 AC_ARG_WITH(build-platform-configure-options,
1418         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1420 AC_ARG_WITH(gnu-cp,
1421     AS_HELP_STRING([--with-gnu-cp],
1422         [Specify location of GNU cp on Solaris or FreeBSD.]),
1425 AC_ARG_WITH(external-tar,
1426     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1427         [Specify an absolute path of where to find (and store) tarfiles.]),
1428     TARFILE_LOCATION=$withval ,
1431 AC_ARG_WITH(referenced-git,
1432     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1433         [Specify another checkout directory to reference. This makes use of
1434                  git submodule update --reference, and saves a lot of diskspace
1435                  when having multiple trees side-by-side.]),
1436     GIT_REFERENCE_SRC=$withval ,
1439 AC_ARG_WITH(linked-git,
1440     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1441         [Specify a directory where the repositories of submodules are located.
1442          This uses a method similar to git-new-workdir to get submodules.]),
1443     GIT_LINK_SRC=$withval ,
1446 AC_ARG_WITH(galleries,
1447     AS_HELP_STRING([--with-galleries],
1448         [Specify how galleries should be built. It is possible either to
1449          build these internally from source ("build"),
1450          or to disable them ("no")]),
1453 AC_ARG_WITH(theme,
1454     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1455         [Choose which themes to include. By default those themes with an '*' are included.
1456          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1459 AC_ARG_WITH(helppack-integration,
1461   --without-helppack-integration      It will not integrate the helppacks to the installer
1462                           of the product.
1463                           Please use this switch to use the online help or separate help packages.],
1466 AC_ARG_WITH(fonts,
1467     AS_HELP_STRING([--without-fonts],
1468         [LibreOffice includes some third-party fonts to provide a reliable basis for
1469          help content, templates, samples, etc. When these fonts are already
1470          known to be available on the system then you should use this option.]),
1473 AC_ARG_WITH(ppds,
1474     AS_HELP_STRING([--without-ppds],
1475         [Removes Postscript Printer definition files from LibreOffice
1476          installation set, for people building for specific distributions where
1477          PPDs are known to be already available (every recent distro with CUPS backend).]),
1480 AC_ARG_WITH(epm,
1481     AS_HELP_STRING([--with-epm],
1482         [Decides which epm to use. Default is to use the one from the system if
1483          one is built. When either this is not there or you say =internal epm
1484          will be built.]),
1487 AC_ARG_WITH(package-format,
1488     AS_HELP_STRING([--with-package-format],
1489         [Specify package format(s) for LibreOffice installation sets. The
1490          implicit --without-package-format leads to no installation sets being
1491          generated. Possible values: aix, archive, bsd, deb, dmg,
1492          installed, msi, native, pkg, portable, and rpm.
1493          Example: --with-package-format='deb rpm']),
1496 AC_ARG_WITH(tls,
1497     AS_HELP_STRING([--with-tls],
1498         [Decides which TLS/SSL and cryptographic implementations to use for
1499          LibreOffice's code. Notice that this doesn't apply for depending
1500          libraries like "neon", for example. Default is to use OpenSSL
1501          although NSS is also possible. Notice that selecting NSS restricts
1502          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1503          restrict by now the usage of NSS in LO's code. Possible values:
1504          openssl, nss. Example: --with-tls="nss"]),
1507 AC_ARG_WITH(system-libs,
1508     AS_HELP_STRING([--with-system-libs],
1509         [Use libraries already on system -- enables all --with-system-* flags.]),
1512 AC_ARG_WITH(system-headers,
1513     AS_HELP_STRING([--with-system-headers],
1514         [Use headers already on system -- enables all --with-system-* flags for
1515          external packages whose headers are the only entities used i.e.
1516          boost/vigra/odbc/sane-header(s).]),,
1517     [with_system_headers="$with_system_libs"])
1519 AC_ARG_WITH(system-jars,
1520     AS_HELP_STRING([--without-system-jars],
1521         [When building with --with-system-libs, also the needed jars are expected
1522          on the system. Use this to disable that]),,
1523     [with_system_jars="$with_system_libs"])
1525 AC_ARG_WITH(system-cairo,
1526     AS_HELP_STRING([--with-system-cairo],
1527         [Use cairo libraries already on system.  Happens automatically for
1528          (implicit) --enable-gtk and for --enable-gtk3.]))
1530 AC_ARG_WITH(myspell-dicts,
1531     AS_HELP_STRING([--with-myspell-dicts],
1532         [Adds myspell dictionaries to the LibreOffice installation set]),
1535 AC_ARG_WITH(system-dicts,
1536     AS_HELP_STRING([--without-system-dicts],
1537         [Do not use dictionaries from system paths.]),
1540 AC_ARG_WITH(external-dict-dir,
1541     AS_HELP_STRING([--with-external-dict-dir],
1542         [Specify external dictionary dir.]),
1545 AC_ARG_WITH(external-hyph-dir,
1546     AS_HELP_STRING([--with-external-hyph-dir],
1547         [Specify external hyphenation pattern dir.]),
1550 AC_ARG_WITH(external-thes-dir,
1551     AS_HELP_STRING([--with-external-thes-dir],
1552         [Specify external thesaurus dir.]),
1555 AC_ARG_WITH(system-zlib,
1556     AS_HELP_STRING([--with-system-zlib],
1557         [Use zlib already on system.]),,
1558     [with_system_zlib=auto])
1560 AC_ARG_WITH(system-jpeg,
1561     AS_HELP_STRING([--with-system-jpeg],
1562         [Use jpeg already on system.]),,
1563     [with_system_jpeg="$with_system_libs"])
1565 AC_ARG_WITH(system-libgltf,
1566     AS_HELP_STRING([--with-system-libgltf],
1567         [Use libgltf already on system.]),,
1568     [with_system_libgltf=auto])
1570 AC_ARG_WITH(system-clucene,
1571     AS_HELP_STRING([--with-system-clucene],
1572         [Use clucene already on system.]),,
1573     [with_system_clucene="$with_system_libs"])
1575 AC_ARG_WITH(system-expat,
1576     AS_HELP_STRING([--with-system-expat],
1577         [Use expat already on system.]),,
1578     [with_system_expat="$with_system_libs"])
1580 AC_ARG_WITH(system-libxml,
1581     AS_HELP_STRING([--with-system-libxml],
1582         [Use libxml/libxslt already on system.]),,
1583     [with_system_libxml=auto])
1585 AC_ARG_WITH(system-icu,
1586     AS_HELP_STRING([--with-system-icu],
1587         [Use icu already on system.]),,
1588     [with_system_icu="$with_system_libs"])
1590 AC_ARG_WITH(system-ucpp,
1591     AS_HELP_STRING([--with-system-ucpp],
1592         [Use ucpp already on system.]),,
1593     [])
1595 AC_ARG_WITH(system-openldap,
1596     AS_HELP_STRING([--with-system-openldap],
1597         [Use the OpenLDAP LDAP SDK already on system.]),,
1598     [with_system_openldap="$with_system_libs"])
1600 AC_ARG_WITH(system-poppler,
1601     AS_HELP_STRING([--with-system-poppler],
1602         [Use system poppler (only needed for PDF import).]),,
1603     [with_system_poppler="$with_system_libs"])
1605 AC_ARG_WITH(system-apache-commons,
1606     AS_HELP_STRING([--with-system-apache-commons],
1607         [Use Apache commons libraries already on system.]),,
1608     [with_system_apache_commons="$with_system_jars"])
1610 AC_ARG_WITH(system-mariadb,
1611     AS_HELP_STRING([--with-system-mariadb],
1612         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1613          extension.]),,
1614     [with_system_mariadb="$with_system_libs"])
1616 AC_ARG_ENABLE(bundle-mariadb,
1617     AS_HELP_STRING([--enable-bundle-mariadb],
1618         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1621 AC_ARG_WITH(system-mysql-cppconn,
1622     AS_HELP_STRING([--with-system-mysql-cppconn],
1623         [Use MySQL C++ Connector libraries already on system.]),,
1624     [with_system_mysql_cppconn="$with_system_libs"])
1626 AC_ARG_WITH(system-postgresql,
1627     AS_HELP_STRING([--with-system-postgresql],
1628         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1629          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1630     [with_system_postgresql="$with_system_libs"])
1632 AC_ARG_WITH(libpq-path,
1633     AS_HELP_STRING([--with-libpq-path],
1634         [Use this PostgreSQL C interface (libpq) installation for building
1635          the PostgreSQL-SDBC extension.])
1636     [
1637                           Usage:     --with-libpq-path=<absolute path to
1638                                                   your libpq installation>
1639     ],
1642 AC_ARG_WITH(system-firebird,
1643     AS_HELP_STRING([--with-system-firebird],
1644         [Use Firebird libraries already on system, for building the Firebird-SDBC
1645          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1646     [with_system_firebird="$with_system_libs"])
1648 AC_ARG_WITH(system-hsqldb,
1649     AS_HELP_STRING([--with-system-hsqldb],
1650         [Use hsqldb already on system.]))
1652 AC_ARG_WITH(hsqldb-jar,
1653     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1654         [Specify path to jarfile manually.]),
1655     HSQLDB_JAR=$withval)
1657 AC_ARG_ENABLE(scripting-beanshell,
1658     AS_HELP_STRING([--disable-scripting-beanshell],
1659         [Disable support for scripts in BeanShell.]),
1663 AC_ARG_WITH(system-beanshell,
1664     AS_HELP_STRING([--with-system-beanshell],
1665         [Use beanshell already on system.]),,
1666     [with_system_beanshell="$with_system_jars"])
1668 AC_ARG_WITH(beanshell-jar,
1669     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1670         [Specify path to jarfile manually.]),
1671     BSH_JAR=$withval)
1673 AC_ARG_ENABLE(scripting-javascript,
1674     AS_HELP_STRING([--disable-scripting-javascript],
1675         [Disable support for scripts in JavaScript.]),
1679 AC_ARG_WITH(system-rhino,
1680     AS_HELP_STRING([--with-system-rhino],
1681         [Use rhino already on system.]),,)
1682 #    [with_system_rhino="$with_system_jars"])
1683 # Above is not used as we have different debug interface
1684 # patched into internal rhino. This code needs to be fixed
1685 # before we can enable it by default.
1687 AC_ARG_WITH(rhino-jar,
1688     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1689         [Specify path to jarfile manually.]),
1690     RHINO_JAR=$withval)
1692 AC_ARG_WITH(commons-codec-jar,
1693     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1694         [Specify path to jarfile manually.]),
1695     COMMONS_CODEC_JAR=$withval)
1697 AC_ARG_WITH(commons-lang-jar,
1698     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1699         [Specify path to jarfile manually.]),
1700     COMMONS_LANG_JAR=$withval)
1702 AC_ARG_WITH(commons-httpclient-jar,
1703     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1704         [Specify path to jarfile manually.]),
1705     COMMONS_HTTPCLIENT_JAR=$withval)
1707 AC_ARG_WITH(commons-logging-jar,
1708     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1709         [Specify path to jarfile manually.]),
1710     COMMONS_LOGGING_JAR=$withval)
1712 AC_ARG_WITH(system-jfreereport,
1713     AS_HELP_STRING([--with-system-jfreereport],
1714         [Use JFreeReport already on system.]),,
1715     [with_system_jfreereport="$with_system_jars"])
1717 AC_ARG_WITH(sac-jar,
1718     AS_HELP_STRING([--with-sac-jar=JARFILE],
1719         [Specify path to jarfile manually.]),
1720     SAC_JAR=$withval)
1722 AC_ARG_WITH(libxml-jar,
1723     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1724         [Specify path to jarfile manually.]),
1725     LIBXML_JAR=$withval)
1727 AC_ARG_WITH(flute-jar,
1728     AS_HELP_STRING([--with-flute-jar=JARFILE],
1729         [Specify path to jarfile manually.]),
1730     FLUTE_JAR=$withval)
1732 AC_ARG_WITH(jfreereport-jar,
1733     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1734         [Specify path to jarfile manually.]),
1735     JFREEREPORT_JAR=$withval)
1737 AC_ARG_WITH(liblayout-jar,
1738     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1739         [Specify path to jarfile manually.]),
1740     LIBLAYOUT_JAR=$withval)
1742 AC_ARG_WITH(libloader-jar,
1743     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1744         [Specify path to jarfile manually.]),
1745     LIBLOADER_JAR=$withval)
1747 AC_ARG_WITH(libloader-jar,
1748     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1749         [Specify path to jarfile manually.]),
1750     LIBLOADER_JAR=$withval)
1752 AC_ARG_WITH(libformula-jar,
1753     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1754         [Specify path to jarfile manually.]),
1755     LIBFORMULA_JAR=$withval)
1757 AC_ARG_WITH(librepository-jar,
1758     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1759         [Specify path to jarfile manually.]),
1760     LIBREPOSITORY_JAR=$withval)
1762 AC_ARG_WITH(libfonts-jar,
1763     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1764         [Specify path to jarfile manually.]),
1765     LIBFONTS_JAR=$withval)
1767 AC_ARG_WITH(libserializer-jar,
1768     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1769         [Specify path to jarfile manually.]),
1770     LIBSERIALIZER_JAR=$withval)
1772 AC_ARG_WITH(libbase-jar,
1773     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1774         [Specify path to jarfile manually.]),
1775     LIBBASE_JAR=$withval)
1777 AC_ARG_WITH(system-odbc,
1778     AS_HELP_STRING([--with-system-odbc],
1779         [Use the odbc headers already on system.]),,
1780     [with_system_odbc="$with_system_headers"])
1782 AC_ARG_WITH(system-sane,
1783     AS_HELP_STRING([--with-system-sane],
1784         [Use sane.h already on system.]),,
1785     [with_system_sane="$with_system_headers"])
1787 AC_ARG_WITH(system-bluez,
1788     AS_HELP_STRING([--with-system-bluez],
1789         [Use bluetooth.h already on system.]),,
1790     [with_system_bluez="$with_system_headers"])
1792 AC_ARG_WITH(system-mesa-headers,
1793     AS_HELP_STRING([--with-system-mesa-headers],
1794         [Use Mesa headers already on system.]),,
1795     [with_system_mesa_headers="$with_system_headers"])
1797 AC_ARG_WITH(system-curl,
1798     AS_HELP_STRING([--with-system-curl],
1799         [Use curl already on system.]),,
1800     [with_system_curl=auto])
1802 AC_ARG_WITH(system-boost,
1803     AS_HELP_STRING([--with-system-boost],
1804         [Use boost already on system.]),,
1805     [with_system_boost="$with_system_headers"])
1807 AC_ARG_WITH(system-glm,
1808     AS_HELP_STRING([--with-system-glm],
1809         [Use glm already on system.]),,
1810     [with_system_glm="$with_system_headers"])
1812 AC_ARG_WITH(system-vigra,
1813     AS_HELP_STRING([--with-system-vigra],
1814         [Use vigra already on system.]),,
1815     [with_system_vigra="$with_system_headers"])
1817 AC_ARG_WITH(system-hunspell,
1818     AS_HELP_STRING([--with-system-hunspell],
1819         [Use libhunspell already on system.]),,
1820     [with_system_hunspell="$with_system_libs"])
1822 AC_ARG_WITH(system-mythes,
1823     AS_HELP_STRING([--with-system-mythes],
1824         [Use mythes already on system.]),,
1825     [with_system_mythes="$with_system_libs"])
1827 AC_ARG_WITH(system-altlinuxhyph,
1828     AS_HELP_STRING([--with-system-altlinuxhyph],
1829         [Use ALTLinuxhyph already on system.]),,
1830     [with_system_altlinuxhyph="$with_system_libs"])
1832 AC_ARG_WITH(system-lpsolve,
1833     AS_HELP_STRING([--with-system-lpsolve],
1834         [Use lpsolve already on system.]),,
1835     [with_system_lpsolve="$with_system_libs"])
1837 AC_ARG_WITH(system-liblangtag,
1838     AS_HELP_STRING([--with-system-liblangtag],
1839         [Use liblangtag library already on system.]),,
1840     [with_system_liblangtag="$with_system_libs"])
1842 AC_ARG_WITH(system-npapi-headers,
1843     AS_HELP_STRING([--with-system-npapi-headers],
1844         [Use NPAPI headers provided by system instead of bundled ones. Used in
1845          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=TRUE) and
1846          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1847     [with_system_npapi_headers="$with_system_headers"]
1850 AC_ARG_WITH(webdav,
1851     AS_HELP_STRING([--with-webdav],
1852         [Specify which library to use for webdav implementation.
1853          Possible values: "neon", "serf", "no". The default value is "neon".
1854          Example: --with-webdav="serf"]),
1855     WITH_WEBDAV=$withval,
1856     WITH_WEBDAV="neon")
1858 AC_ARG_WITH(linker-hash-style,
1859     AS_HELP_STRING([--with-linker-hash-style],
1860         [Use linker with --hash-style=<style> when linking shared objects.
1861          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1862          if supported on the build system, and "sysv" otherwise.]))
1864 AC_ARG_WITH(jdk-home,
1865     AS_HELP_STRING([--with-jdk-home],
1866         [If you have installed JDK 1.3 or later on your system please supply the
1867          path here. Note that this is not the location of the java command but the
1868          location of the entire distribution.])
1869     [
1870                           Usage:     --with-jdk-home=<absolute path to JDK home>
1871     ],
1874 AC_ARG_WITH(help,
1875     AS_HELP_STRING([--with-help],
1876         [Enable the build of help. There is a special parameter "common" that
1877          can be used to bundle only the common part, .e.g help-specific icons.
1878          This is useful when you build the helpcontent separately.])
1879     [
1880                           Usage:     --with-help    build the entire local help
1881                                  --without-help     no local help (default)
1882                                  --with-help=common bundle common files for the local
1883                                                     help but do not build the whole help
1884     ],
1887 AC_ARG_WITH(java,
1888     AS_HELP_STRING([--with-java],
1889         [Specify the name of the Java interpreter command. Typically "java"
1890          which is the default.
1892          To build without support for Java components, applets, accessibility
1893          or the XML filters written in Java, use --without-java or --with-java=no.])
1894     [
1895                           Usage:     --with-java==<java command>
1896                                      --without-java
1897     ],
1898     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1899     [ with_java=java ]
1902 AC_ARG_WITH(jvm-path,
1903     AS_HELP_STRING([--with-jvm-path],
1904         [Use a specific JVM search path at runtime.])
1905     [
1906                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1908                           e. g.: --with-jvm-path=/usr/lib/
1909                                  to find JRE/JDK in /usr/lib/jvm/
1910     ],
1913 AC_ARG_WITH(ant-home,
1914     AS_HELP_STRING([--with-ant-home],
1915         [If you have installed Jakarta Ant on your system, please supply the path here.
1916          Note that this is not the location of the Ant binary but the location
1917          of the entire distribution.])
1918     [
1919                           Usage:     --with-ant-home=<absolute path to Ant home>
1920     ],
1923 AC_ARG_WITH(export-validation,
1924     AS_HELP_STRING([--with-export-validation],
1925         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1926          Note: You need an executable script officeotron that takes the path to the file.])
1927     [
1928                             Usage: --with-export-validation
1929     ],
1932 AC_ARG_WITH(junit,
1933     AS_HELP_STRING([--with-junit],
1934         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1935          --without-junit disables those tests. Not relevant in the --without-java case.])
1936     [
1937                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1938     ],
1939 ,with_junit=yes)
1941 AC_ARG_WITH(perl-home,
1942     AS_HELP_STRING([--with-perl-home],
1943         [If you have installed Perl 5 Distribution, on your system, please
1944          supply the path here. Note that this is not the location of the Perl
1945          binary but the location of the entire distribution.])
1946     [
1947                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1948     ],
1951 AC_ARG_WITH(
1952     [doxygen],
1953     AS_HELP_STRING(
1954         [--with-doxygen],
1955         [Specifies the doxygen executable to use when generating ODK C/C++
1956          documentation. --without-doxygen disables generation of ODK C/C++
1957          documentation. Not relevant in the --disable-odk case.])
1958     [
1959                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1960     ],,
1961     [with_doxygen=yes])
1963 AC_ARG_WITH(visual-studio,
1964     AS_HELP_STRING([--with-visual-studio=<2012/2010/2013>],
1965         [Specify which Visual Studio version to use in case several are
1966          are installed. If not specified, the order of preference is
1967          2012, 2010, 2013 (including Express editions).])
1968     [
1969                           Usage:     --with-visual-studio=<2012/2010/2013>
1970     ],
1973 AC_ARG_WITH(windows-sdk,
1974     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1975         [Specify which Windows SDK, or "Windows Kit", version to use
1976          in case the one that came with the selected Visual Studio
1977          is not what you want for some reason. Note that not all compiler/SDK
1978          combinations are supported. The intent is that this option should not
1979          be needed.])
1980     [
1981                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1982     ],
1985 AC_ARG_WITH(lang,
1986     AS_HELP_STRING([--with-lang],
1987         [Use this option to build LibreOffice with additional UI language support.
1988          English (US) is always included by default.
1989          Separate multiple languages with space.
1990          For all languages, use --with-lang=ALL.])
1991     [
1992                           Usage:     --with-lang="es sw tu cs sk"
1993     ],
1996 AC_ARG_WITH(locales,
1997     AS_HELP_STRING([--with-locales],
1998         [Use this option to limit the locale information built in.
1999          Separate multiple locales with space.
2000          Very experimental and might well break stuff.
2001          Just a desperate measure to shrink code and data size.
2002          By default all the locales available is included.
2003          This option is completely unrelated to --with-lang.])
2004     [
2005                           Affects also our character encoding conversion
2006                           tables for encodings mainly targeted for a
2007                           particular locale, like EUC-CN and EUC-TW for
2008                           zh, ISO-2022-JP for ja.
2010                           Affects also our add-on break iterator data for
2011                           some languages.
2013                           For the default, all locales, don't use this switch at all.
2014                           Specifying just the language part of a locale means all matching
2015                           locales will be included.
2017                           Usage:     --with-locales="en es pt fr zh kr ja"
2018     ],
2021 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2022 AC_ARG_WITH(krb5,
2023     AS_HELP_STRING([--with-krb5],
2024         [Enable MIT Kerberos 5 support in modules that support it.
2025          By default automatically enabled on platforms
2026          where a good system Kerberos 5 is available.]),
2029 AC_ARG_WITH(gssapi,
2030     AS_HELP_STRING([--with-gssapi],
2031         [Enable GSSAPI support in modules that support it.
2032          By default automatically enabled on platforms
2033          where a good system GSSAPI is available.]),
2036 dnl ===================================================================
2037 dnl Branding
2038 dnl ===================================================================
2040 AC_ARG_WITH(branding,
2041     AS_HELP_STRING([--with-branding],
2042         [Use given path to retrieve branding images set.])
2043     [
2044                           Search for intro.png about.svg and flat_logo.svg.
2045                           If any is missing, default ones will be used instead.
2047                           Search also progress.conf for progress
2048                           settings on intro screen :
2050                           PROGRESSBARCOLOR="255,255,255" Set color of
2051                           progress bar. Comma separated RGB decimal values.
2052                           PROGRESSSIZE="407,6" Set size of progress bar.
2053                           Comma separated decimal values (width, height).
2054                           PROGRESSPOSITION="61,317" Set position of progress
2055                           bar from left,top. Comma separated decimal values.
2056                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2057                           bar frame. Comma separated RGB decimal values.
2058                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2059                           bar text. Comma separated RGB decimal values.
2060                           PROGRESSTEXTBASELINE="287" Set vertical position of
2061                           progress bar text from top. Decimal value.
2063                           Default values will be used if not found.
2065                           Usage:     --with-branding=/path/to/images
2066     ],
2070 AC_ARG_WITH(extra-buildid,
2071     AS_HELP_STRING([--with-extra-buildid],
2072         [Show addition build identification in about dialog.])
2073     [
2074                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2075     ],
2079 AC_ARG_WITH(vendor,
2080     AS_HELP_STRING([--with-vendor],
2081         [Set vendor of the build.])
2082     [
2083                           Usage:     --with-vendor="John the Builder"
2084     ],
2087 AC_ARG_WITH(compat-oowrappers,
2088     AS_HELP_STRING([--with-compat-oowrappers],
2089         [Install oo* wrappers in parallel with
2090          lo* ones to keep backward compatibility.
2091          Has effect only with make distro-pack-install]),
2094 AC_ARG_WITH(os-version,
2095     AS_HELP_STRING([--with-os-version],
2096         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2097     [
2098                           Usage:     --with-os-version=<OSVERSION>
2099     ],
2102 AC_ARG_WITH(mingw-cross-compiler,
2103     AS_HELP_STRING([--with-mingw-cross-compiler],
2104         [Specify the MinGW cross-compiler to use.])
2105     [
2106                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2108                           When building on the ODK on Unix and building unowinreg.dll,
2109                           specify the MinGW C++ cross-compiler.
2110     ],
2113 AC_ARG_WITH(idlc-cpp,
2114     AS_HELP_STRING([--with-idlc-cpp],
2115         [Specify the C Preprocessor to use for idlc.])
2116     [
2117                           Usage:     --with-idlc-cpp=cpp
2119                           Default is ucpp.
2120     ]
2123 AC_ARG_WITH(build-version,
2124     AS_HELP_STRING([--with-build-version],
2125         [Allows the builder to add a custom version tag that will appear in the
2126          Help/About box for QA purposes.])
2127     [
2128                           Usage:     --with-build-version="Built by Jim"
2129     ],
2130     with_build_version=$withval ,
2133 AC_ARG_WITH(alloc,
2134     AS_HELP_STRING([--with-alloc],
2135         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2136          Note that on FreeBSD/NetBSD system==jemalloc]),
2139 AC_ARG_WITH(sun-templates,
2140     AS_HELP_STRING([--with-sun-templates],
2141         [Integrate Sun template packages.]),
2144 AC_ARG_WITH(parallelism,
2145     AS_HELP_STRING([--with-parallelism],
2146         [Number of jobs to run simultaneously during build. Parallel builds can
2147         save a lot of time on multi-cpu machines. Defaults to the number of
2148         CPUs on the machine, unless you configure --enable-icecream - then to
2149         10.]),
2152 AC_ARG_WITH(all-tarballs,
2153     AS_HELP_STRING([--with-all-tarballs],
2154         [Download all external tarballs unconditionally]))
2156 AC_ARG_WITH(gdrive-client-id,
2157     AS_HELP_STRING([--with-gdrive-client-id],
2158         [Provides the client id of the application for OAuth2 authentication
2159         on Google Drive. If either this or --with-gdrive-client-secret is
2160         empty, the feature will be disabled]),
2163 AC_ARG_WITH(gdrive-client-secret,
2164     AS_HELP_STRING([--with-gdrive-client-secret],
2165         [Provides the client secret of the application for OAuth2
2166         authentication on Google Drive. If either this or
2167         --with-gdrive-client-id is empty, the feature will be disabled]),
2170 AC_ARG_WITH(alfresco-cloud-client-id,
2171     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2172         [Provides the client id of the application for OAuth2 authentication
2173         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2174         empty, the feature will be disabled]),
2177 AC_ARG_WITH(alfresco-cloud-client-secret,
2178     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2179         [Provides the client secret of the application for OAuth2
2180         authentication on Alfresco Cloud. If either this or
2181         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2184 dnl ===================================================================
2185 dnl Do we want to use pre-build binary tarball for recompile
2186 dnl ===================================================================
2188 if test "$enable_library_bin_tar" = "yes" ; then
2189    USE_LIBRARY_BIN_TAR=TRUE
2190 else
2191    USE_LIBRARY_BIN_TAR=
2193 AC_SUBST(USE_LIBRARY_BIN_TAR)
2195 dnl ===================================================================
2196 dnl Test whether build target is Release Build
2197 dnl ===================================================================
2198 AC_MSG_CHECKING([whether build target is Release Build])
2199 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2200     AC_MSG_RESULT([no])
2201     ENABLE_RELEASE_BUILD=
2202 else
2203     AC_MSG_RESULT([yes])
2204     ENABLE_RELEASE_BUILD=TRUE
2206 AC_SUBST(ENABLE_RELEASE_BUILD)
2208 dnl ===================================================================
2209 dnl Test whether to sign Windows Build
2210 dnl ===================================================================
2211 AC_MSG_CHECKING([whether to sign windows build])
2212 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2213     AC_MSG_RESULT([yes])
2214     WINDOWS_BUILD_SIGNING="TRUE"
2215 else
2216     AC_MSG_RESULT([no])
2217     WINDOWS_BUILD_SIGNING="FALSE"
2219 AC_SUBST(WINDOWS_BUILD_SIGNING)
2221 dnl ===================================================================
2222 dnl MacOSX build and runtime environment options
2223 dnl ===================================================================
2225 AC_ARG_WITH(macosx-sdk,
2226     AS_HELP_STRING([--with-macosx-sdk],
2227         [Use a specific SDK for building.])
2228     [
2229                           Usage:     --with-macosx-sdk=<version>
2231                           e. g.: --with-macosx-sdk=10.6
2233                           there are 3 options to control the MacOSX build:
2234                           --with-macosx-sdk (refered as 'sdk' below)
2235                           --with-macosx-version-min-required (refered as 'min' below)
2236                           --with-macosx-version-max-allowed (refered as 'max' below)
2238                           the connection between these value and the default they take is as follow:
2239                           ( ? means not specified on the command line, s means the SDK version found,
2240                           constraint: x <= y <= z)
2242                           ==========================================
2243                            command line      || config result
2244                           ==========================================
2245                           min  | max  | sdk  || min  | max  | sdk  |
2246                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
2247                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
2248                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
2249                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
2250                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2251                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2252                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2253                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2256                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2257                           for a detailled technical explanation of these variables
2259                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2261                           Note that even if in theory using a --with-macosx-version-max-allowed
2262                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2263                           should work, in practice Apple doesn't seem to test that, and at least
2264                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2265                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2266                           headers, but still.
2267     ],
2270 AC_ARG_WITH(macosx-version-min-required,
2271     AS_HELP_STRING([--with-macosx-version-min-required],
2272         [set the minimum OS version needed to run the built LibreOffice])
2273     [
2274                           Usage:     --with-macosx-version-min-required=<version>
2276                           e. g.: --with-macos-version-min-required=10.6
2277                           see --with-macosx-sdk for more info
2278     ],
2281 AC_ARG_WITH(macosx-version-max-allowed,
2282     AS_HELP_STRING([--with-macosx-version-max-allowed],
2283         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2284     [
2285                           Usage:     --with-macosx-version-max-allowed=<version>
2287                           e. g.: --with-macos-version-max-allowed=10.6
2288                           see --with-macosx-sdk for more info
2289     ],
2293 dnl ===================================================================
2294 dnl options for stuff used during cross-compilation build
2295 dnl These are superseded by --with-build-platform-configure-options.
2296 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2297 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2298 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2299 dnl ===================================================================
2301 AC_ARG_WITH(system-boost-for-build,
2302     AS_HELP_STRING([--with-system-boost-for-build],
2303         [Use boost already on system for build tools (cross-compilation only).]))
2305 AC_ARG_WITH(system-cppunit-for-build,
2306     AS_HELP_STRING([--with-system-cppunit-for-build],
2307         [Use cppunit already on system for build tools (cross-compilation only).]))
2309 AC_ARG_WITH(system-expat-for-build,
2310     AS_HELP_STRING([--with-system-expat-for-build],
2311         [Use expat already on system for build tools (cross-compilation only).]))
2313 AC_ARG_WITH(system-icu-for-build,
2314     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2315         [Use icu already on system for build tools (cross-compilation only).]))
2317 AC_ARG_WITH(system-libxml-for-build,
2318     AS_HELP_STRING([--with-system-libxml-for-build],
2319         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2322 dnl ===================================================================
2323 dnl check for required programs (grep, awk, sed, bash)
2324 dnl ===================================================================
2326 pathmunge ()
2328     if test -n "$1"; then
2329         if test "$build_os" = "cygwin"; then
2330             PathFormat "$1"
2331             new_path=`cygpath -u "$formatted_path"`
2332         else
2333             new_path="$1"
2334         fi
2335         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2336             if test "$2" = "after"; then
2337                 LO_PATH="$LO_PATH:$new_path"
2338             else
2339                 LO_PATH="$new_path:$LO_PATH"
2340             fi
2341         fi
2342         unset new_path
2343     fi
2346 AC_PROG_AWK
2347 AC_PATH_PROG( AWK, $AWK)
2348 if test -z "$AWK"; then
2349     AC_MSG_ERROR([install awk to run this script])
2352 AC_PATH_PROG(BASH, bash)
2353 if test -z "$BASH"; then
2354     AC_MSG_ERROR([bash not found in \$PATH])
2356 AC_SUBST(BASH)
2358 AC_MSG_CHECKING([for GNU or BSD tar])
2359 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2360     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2361     if test $? -eq 0;  then
2362         GNUTAR=$a
2363         break
2364     fi
2365 done
2366 AC_MSG_RESULT($GNUTAR)
2367 if test -z "$GNUTAR"; then
2368     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2370 AC_SUBST(GNUTAR)
2372 AC_MSG_CHECKING([for tar's option to strip components])
2373 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2374 if test $? -eq 0; then
2375     STRIP_COMPONENTS="--strip-components"
2376 else
2377     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2378     if test $? -eq 0; then
2379         STRIP_COMPONENTS="--strip-path"
2380     else
2381         STRIP_COMPONENTS="unsupported"
2382     fi
2384 AC_MSG_RESULT($STRIP_COMPONENTS)
2385 if test x$STRIP_COMPONENTS = xunsupported; then
2386     AC_MSG_ERROR([you need a tar that is able to strip components.])
2388 AC_SUBST(STRIP_COMPONENTS)
2390 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2391 dnl desktop OSes from "mobile" ones.
2393 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2394 dnl In other words, that when building for an OS that is not a
2395 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2397 dnl Note the direction of the implication; there is no assumption that
2398 dnl cross-compiling would imply a non-desktop OS.
2400 if test $_os != iOS -a $_os != Android; then
2401     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2402     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2403     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2406 DISABLE_EXPORT=''
2407 if test "$enable_export" != no; then
2408     BUILD_TYPE="$BUILD_TYPE EXPORT"
2409 else
2410     DISABLE_EXPORT='TRUE'
2411     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2413 AC_SUBST(DISABLE_EXPORT)
2415 # Whether to build "avmedia" functionality or not.
2416 # We probably don't want it for non-desktop.
2418 if test -z "$enable_avmedia"; then
2419     if test $_os != iOS -a $_os != Android; then
2420         enable_avmedia=yes
2421     fi
2424 if test "$enable_avmedia" = yes; then
2425     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2426     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2427 else
2428     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2431 # Decide whether to build database connectivity stuff (including
2432 # Base) or not. We probably don't want to on non-desktop OSes.
2434 if test -z "$enable_database_connectivity"; then
2435     # --disable-database-connectivity is unfinished work in progress
2436     # and the iOS test app doesn't link if we actually try to use it.
2437     # if test $_os != iOS -a $_os != Android; then
2438         enable_database_connectivity=yes
2439     # fi
2442 if test "$enable_database_connectivity" = yes; then
2443     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2444     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2447 if test -z "$enable_extensions"; then
2448     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2449     if test $_os != iOS -a $_os != Android; then
2450         enable_extensions=yes
2451     fi
2454 if test "$enable_extensions" = yes; then
2455     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2456     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2459 if test -z "$enable_scripting"; then
2460     # Disable scripting for iOS unless specifically overridden
2461     # with --enable-scripting.
2462     if test $_os != iOS; then
2463         enable_scripting=yes
2464     fi
2467 DISABLE_SCRIPTING=''
2468 if test "$enable_scripting" = yes; then
2469     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2470 else
2471     DISABLE_SCRIPTING='TRUE'
2472     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2474 AC_SUBST(DISABLE_SCRIPTING)
2476 if test $_os = iOS -o $_os = Android; then
2477     # Disable dynamic_loading always for iOS and Android
2478     enable_dynamic_loading=no
2479 elif test -z "$enable_dynamic_loading"; then
2480     # Otherwise enable it unless speficically disabled
2481     enable_dynamic_loading=yes
2484 DISABLE_DYNLOADING=''
2485 if test "$enable_dynamic_loading" = yes; then
2486     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2487 else
2488     DISABLE_DYNLOADING='TRUE'
2489     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2491 AC_SUBST(DISABLE_DYNLOADING)
2493 # remenber SYSBASE value
2494 AC_SUBST(SYSBASE)
2496 dnl ===================================================================
2497 dnl  Sort out various gallery compilation options
2498 dnl ===================================================================
2499 AC_MSG_CHECKING([how to build and package galleries])
2500 if test -n "${with_galleries}"; then
2501     if test "$with_galleries" = "build"; then
2502         WITH_GALLERY_BUILD=TRUE
2503         AC_MSG_RESULT([build from source images internally])
2504     elif test "$with_galleries" = "no"; then
2505         WITH_GALLERY_BUILD=
2506         AC_MSG_RESULT([disable non-internal gallery build])
2507     else
2508         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2509     fi
2510 else
2511     if test $_os != iOS -a $_os != Android; then
2512         WITH_GALLERY_BUILD=TRUE
2513         AC_MSG_RESULT([internal src images for desktop])
2514     else
2515         WITH_GALLERY_BUILD=
2516         AC_MSG_RESULT([disable src imgage build])
2517     fi
2519 AC_SUBST(WITH_GALLERY_BUILD)
2521 dnl ===================================================================
2522 dnl  Checks if ccache is available
2523 dnl ===================================================================
2524 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2525     case "%$CC%$CXX%" in
2526     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2527     # assume that's good then
2528     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2529         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2530         ;;
2531     *)
2532         AC_PATH_PROG([CCACHE],[ccache],[not found])
2533         if test "$CCACHE" = "not found"; then
2534             CCACHE=""
2535         else
2536             # Need to check for ccache version: otherwise prevents
2537             # caching of the results (like "-x objective-c++" for Mac)
2538             if test $_os = Darwin -o $_os = iOS; then
2539                 # Check ccache version
2540                 AC_MSG_CHECKING([whether version of ccache is suitable])
2541                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2542                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2543                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2544                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2545                 else
2546                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2547                     CCACHE=""
2548                 fi
2549             fi
2550         fi
2551         ;;
2552     esac
2553 else
2554     CCACHE=""
2557 if test "$CCACHE" != ""; then
2558     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2559     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2560     if test "$ccache_size" = ""; then
2561         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2562         if test "$ccache_size" = ""; then
2563             ccache_size=0
2564         fi
2565         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2566         if test $ccache_size -lt 1024; then
2567             CCACHE=""
2568             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2569             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2570         else
2571             # warn that ccache may be too small for debug build
2572             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2573             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2574         fi
2575     else
2576         if test $ccache_size -lt 5; then
2577             #warn that ccache may be too small for debug build
2578             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2579             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2580         fi
2581     fi
2584 dnl ===================================================================
2585 dnl  Checks for C compiler,
2586 dnl  The check for the C++ compiler is later on.
2587 dnl ===================================================================
2588 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2589     GCC_HOME_SET="true"
2590     AC_MSG_CHECKING([gcc home])
2591     if test -z "$with_gcc_home"; then
2592         if test "$enable_icecream" = "yes"; then
2593             if test -d "/usr/lib/icecc/bin"; then
2594                 GCC_HOME="/usr/lib/icecc/"
2595             else
2596                 GCC_HOME="/opt/icecream/"
2597             fi
2598         else
2599             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2600             GCC_HOME_SET="false"
2601         fi
2602     else
2603         GCC_HOME="$with_gcc_home"
2604     fi
2605     AC_MSG_RESULT($GCC_HOME)
2606     AC_SUBST(GCC_HOME)
2608     if test "$GCC_HOME_SET" = "true"; then
2609         if test -z "$CC"; then
2610             CC="$GCC_HOME/bin/gcc"
2611         fi
2612         if test -z "$CXX"; then
2613             CXX="$GCC_HOME/bin/g++"
2614         fi
2615     fi
2618 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2619 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2620     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2621     save_CFLAGS=$CFLAGS
2622     AC_PROG_CC
2623     CFLAGS=$save_CFLAGS
2626 COMPATH=`dirname "$CC"`
2627 if test "$COMPATH" = "."; then
2628     AC_PATH_PROGS(COMPATH, $CC)
2629     dnl double square bracket to get single because of M4 quote...
2630     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2632 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2634 dnl ===================================================================
2635 dnl Java support
2636 dnl ===================================================================
2637 AC_MSG_CHECKING([whether to build with Java support])
2638 if test "$with_java" != "no"; then
2639     if test "$DISABLE_SCRIPTING" = TRUE; then
2640         AC_MSG_RESULT([no, overridden by --disable-scripting])
2641         ENABLE_JAVA=""
2642         with_java=no
2643     else
2644         AC_MSG_RESULT([yes])
2645         ENABLE_JAVA="TRUE"
2646         AC_DEFINE(HAVE_FEATURE_JAVA)
2647     fi
2648 else
2649     AC_MSG_RESULT([no])
2650     ENABLE_JAVA=""
2653 AC_SUBST(ENABLE_JAVA)
2655 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2657 dnl ENABLE_JAVA="" indicate no Java support at all
2659 dnl ===================================================================
2660 dnl Export file validation
2661 dnl ===================================================================
2662 AC_MSG_CHECKING([whether to enable export file validation])
2663 if test "$with_export_validation" = yes; then
2664     AC_MSG_RESULT([yes])
2665     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2666 else
2667     AC_MSG_RESULT([no])
2670 dnl ===================================================================
2671 dnl  Test the Solaris compiler version
2672 dnl ===================================================================
2673 if test "$_os" = "SunOS"; then
2674     if test "$CC" = "cc"; then
2675         AC_PATH_PROGS(_cc, cc)
2676         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2677         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2678         dnl cc -V outputs to standard error!!!!
2679         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2680         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2681         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2682         if test "$_sunstudio_major" != "5"; then
2683             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2684         else
2685             _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" }'`
2686             if test "$_sunstudio_minor" = "false"; then
2687                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2688             else
2689                 dnl compiler will do
2690                 AC_MSG_RESULT([checked])
2691             fi
2692         fi
2693     fi
2697 dnl ===================================================================
2698 dnl Check OS X SDK and compiler
2699 dnl ===================================================================
2701 if test $_os = Darwin; then
2703     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2704         bitness=-m32
2705     else
2706         bitness=-m64
2707         BITNESS_OVERRIDE=64
2708     fi
2710     # If no --with-macosx-sdk option is given, look for 10.6,
2711     # 10.7, 10.8 and 10.9 SDKs, in that order. If not found
2712     # in some default locations, try the xcode-select tool.
2713     # 10.5 must be specified explicitely to be considered
2715     # The intent is that for "most" Mac-based developers, a suitable
2716     # SDK will be found automatically without any configure options.
2718     # For developers still using old Xcode in /Developer, either
2719     # because it is the only Xcode they have, or they have that in
2720     # addition to Xcode 4 in /Applications/Xcode.app, the 10.5 SDK
2721     # or 10.6 SDK should be found.
2723     # For developers with a current Xcode, the lowest-numbered SDK
2724     # should be found.
2726     AC_MSG_CHECKING([what Mac OS X SDK to use])
2728     if test -z "$with_macosx_sdk"; then
2729         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2730             with_macosx_sdk=10.6
2731         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2732             with_macosx_sdk=10.6
2733         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2734             with_macosx_sdk=10.6
2735         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2736             with_macosx_sdk=10.7
2737         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2738             with_macosx_sdk=10.6
2739         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2740             with_macosx_sdk=10.7
2741         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2742             with_macosx_sdk=10.8
2743         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2744             with_macosx_sdk=10.9
2745         elif test -x /usr/bin/xcode-select; then
2746             xcodepath="`xcode-select -print-path`"
2747             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2748                 with_macosx_sdk=10.6
2749             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2750                 with_macosx_sdk=10.7
2751             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2752                 with_macosx_sdk=10.8
2753             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2754                 with_macosx_sdk=10.9
2755             fi
2756         fi
2757         if test -z "$with_macosx_sdk"; then
2758             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2759         fi
2760     fi
2762     case $with_macosx_sdk in
2763     10.5)
2764         MACOSX_SDK_VERSION=1050
2765         ;;
2766     10.6)
2767         MACOSX_SDK_VERSION=1060
2768         ;;
2769     10.7)
2770         MACOSX_SDK_VERSION=1070
2771         ;;
2772     10.8)
2773         MACOSX_SDK_VERSION=1080
2774         ;;
2775     10.9)
2776         MACOSX_SDK_VERSION=1090
2777         ;;
2778     10.10)
2779         MACOSX_SDK_VERSION=101000
2780         ;;
2781     *)
2782         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.5--10])
2783         ;;
2784     esac
2786     # Next find it (again, if we deduced its version above by finding
2787     # it... but we need to look for it once more in case
2788     # --with-macosx-sdk was given so that the above search did not
2789     # happen).
2790     if test -z "$MACOSX_SDK_PATH"; then
2791         case $with_macosx_sdk in
2792         10.5)
2793             if test -x /usr/bin/xcode-select; then
2794                 xcodepath="`xcode-select -print-path`"
2795                 if test -d "$xcodepath/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2796                     MACOSX_SDK_PATH="$xcodepath/SDKs/MacOSX$with_macosx_sdk.sdk"
2797                 fi
2798             elif test -d /Developer/SDKs/MacOSX10.5.sdk; then
2799                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.5.sdk
2800             elif test -d /Developer-old/SDKs/MacOSX10.5.sdk; then
2801                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.5.sdk
2802             elif test -d /Xcode3/SDKs/MacOSX10.5.sdk; then
2803                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.5.sdk
2804             fi
2805             ;;
2806         10.6)
2807             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2808                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2809             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2810                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2811             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2812                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2813             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2814                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2815             elif test -x /usr/bin/xcode-select; then
2816                 xcodepath="`xcode-select -print-path`"
2817                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2818                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2819                 fi
2820             fi
2821             ;;
2822         10.7)
2823             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2824                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2825             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2826                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2827             elif test -x /usr/bin/xcode-select; then
2828                 xcodepath="`xcode-select -print-path`"
2829                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2830                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2831                 fi
2832             fi
2833             ;;
2834         10.8|10.9|10.10)
2835             xcodepath="`xcode-select -print-path`"
2836             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2837                 MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2838             fi
2839             ;;
2840         esac
2841         if test -z "$MACOSX_SDK_PATH"; then
2842             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2843         fi
2844     fi
2845     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2847     if test "$with_macosx_version_min_required" = ""; then
2848         case $with_macosx_sdk in
2849         10.5)
2850             with_macosx_version_min_required="10.5";;
2851         *)
2852             with_macosx_version_min_required="10.6";;
2853         esac
2854     fi
2856     if test "$with_macosx_version_max_allowed" = ""; then
2857         with_macosx_version_max_allowed="$with_macosx_sdk"
2858     fi
2860     # export this so that "xcrun" invocations later return matching values
2861     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2862     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2863     export DEVELOPER_DIR
2864     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2865     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2867     case "$with_macosx_version_min_required" in
2868     10.5)
2869         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2870         ;;
2871     10.6)
2872         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2873         ;;
2874     10.7)
2875         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2876         ;;
2877     10.8)
2878         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2879         ;;
2880     10.9)
2881         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2882         ;;
2883     10.10)
2884         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2885         ;;
2886     *)
2887         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.5--10])
2888         ;;
2889     esac
2891     if test "$BITNESS_OVERRIDE" = ""; then
2892         case "$with_macosx_version_min_required" in
2893         10.5)
2894             case "$with_macosx_sdk" in
2895             10.5)
2896                 ;;
2897             *)
2898                 AC_MSG_WARN([Building with a SDK > 10.5 possibly breaks 10.5 compatibility.])
2899                 add_warning "Building with a SDK > 10.5 possibly breaks 10.5 compatibility."
2900                 ;;
2901             esac
2902             ;;
2903         10.6)
2904             case "$with_macosx_sdk" in
2905             10.6)
2906                 ;;
2907             *)
2908                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2909                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2910                 ;;
2911             esac
2912             ;;
2913         *)
2914             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2915             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2916             ;;
2917         esac
2918     fi
2920     # If no CC and CXX environment vars, try to guess where the compiler is
2921     LIBTOOL=libtool
2922     INSTALL_NAME_TOOL=install_name_tool
2923     if test -z "$save_CC"; then
2924         AC_MSG_CHECKING([what compiler to use])
2925         case $with_macosx_sdk in
2926         10.5)
2927             if test "$enable_libc__" = yes; then
2928                 AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2929             fi
2930             CC="${gccprefix}gcc-4.2 $arch -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2931             CXX="${gccprefix}g++-4.2 $arch -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2932             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2933             ;;
2934         10.6)
2935             if test "$enable_libc__" = yes; then
2936                 AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2937             fi
2938             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2939             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2940                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2941                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2942             else
2943                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2944                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2945             fi
2946             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2947             LIBTOOL=libtool
2948             ;;
2949         10.7|10.8|10.9|10.10)
2950             if test "$enable_libc__" = yes; then
2951                 if test "$with_macosx_version_min_required" = 10.6; then
2952                     AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2953                 fi
2954                 # Use libc++ instead of libstdc++ when possible
2955                 stdlib=-stdlib=libc++
2956             fi
2957             if test "$ENABLE_LTO" = TRUE; then
2958                 lto=-flto
2959             fi
2960             CC="`xcrun -find clang` $bitness $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2961             CXX="`xcrun -find clang++` $bitness $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2962             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2963             AR=`xcrun -find ar`
2964             NM=`xcrun -find nm`
2965             STRIP=`xcrun -find strip`
2966             LIBTOOL=`xcrun -find libtool`
2967             RANLIB=`xcrun -find ranlib`
2968             ;;
2969         esac
2970         AC_MSG_RESULT([$CC and $CXX])
2971     fi
2973     case "$with_macosx_version_max_allowed" in
2974     10.5)
2975         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2976         ;;
2977     10.6)
2978         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2979         ;;
2980     10.7)
2981         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2982         ;;
2983     10.8)
2984         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2985         ;;
2986     10.9)
2987         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2988         ;;
2989     10.10)
2990         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2991         ;;
2992     *)
2993         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.5--10])
2994         ;;
2995     esac
2997     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2998     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2999         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
3000     else
3001         AC_MSG_RESULT([ok])
3002     fi
3004     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3005     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3006         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
3007     else
3008         AC_MSG_RESULT([ok])
3009     fi
3010     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3011     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3013     AC_MSG_CHECKING([whether to do code signing])
3015     if test "$enable_macosx_code_signing" = yes; then
3016         # By default use the first suitable certificate (?).
3018         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3019         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3020         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3021         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
3022         # "Developer ID Application" one.
3024         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3025         if test -n "$identity"; then
3026             MACOSX_CODESIGNING_IDENTITY=$identity
3027             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3028             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3029         fi
3030     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3031         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3032         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3033         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3034     else
3035         AC_MSG_RESULT([no])
3036     fi
3038     AC_MSG_CHECKING([whether to create a Mac App Store package])
3040     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3041         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3042     elif test "$enable_macosx_package_signing" = yes; then
3043         # By default use the first suitable certificate.
3044         # It should be a "3rd Party Mac Developer Installer" one
3046         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3047         if test -n "$identity"; then
3048             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3049             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3050             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3051         else
3052             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3053         fi
3054     elif test -n "$enable_macosx_package_signing"; then
3055         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3056         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3057         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3058     else
3059         AC_MSG_RESULT([no])
3060     fi
3062     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3063         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3064     fi
3066     AC_MSG_CHECKING([whether to sandbox the application])
3068     if test -n "$with_macosx_teamid" -a "$with_macosx_teamid != yes -a "$with_macosx_teamid != no; then
3069         MACOSX_TEAMID="$with_macosx_teamid"
3070     fi
3072     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3073         AC_MSG_ERROR([OS X sandboxing requires code signing])
3074     elif test -z "$MACOSX_TEAMID" -a "$enable_macosx_sandbox" = yes; then
3075         AC_MSG_ERROR([OS X sandboxing requires a team id])
3076     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3077         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
3078     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3079         ENABLE_MACOSX_SANDBOX=TRUE
3080         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3081         AC_MSG_RESULT([yes])
3082     else
3083         AC_MSG_RESULT([no])
3084     fi
3086     AC_MSG_CHECKING([what OS X app bundle identifier to use])
3087     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3088     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3090     AC_MSG_CHECKING([what OS X app name to use])
3091     MACOSX_APP_NAME="$with_macosx_app_name"
3092     AC_MSG_RESULT([$MACOSX_APP_NAME])
3094     AC_MSG_CHECKING([build with mac retina support])
3095     if test "$enable_macosx_retina" = yes ; then
3096         MACOSX_HIGH_RESOLUTION_VALUE=true
3097     else
3098         MACOSX_HIGH_RESOLUTION_VALUE=false
3099     fi
3100     AC_MSG_RESULT([$MACOSX_HIGH_RESOLUTION_VALUE])
3102 AC_SUBST(MACOSX_SDK_PATH)
3103 AC_SUBST(MACOSX_SDK_VERSION)
3104 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3105 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3106 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3107 AC_SUBST(INSTALL_NAME_TOOL)
3108 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
3109 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3110 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3111 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3112 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3113 AC_SUBST(MACOSX_TEAMID)
3114 AC_SUBST(MACOSX_APP_NAME)
3115 AC_SUBST(MACOSX_HIGH_RESOLUTION_VALUE)
3117 dnl ===================================================================
3118 dnl Check iOS SDK and compiler
3119 dnl ===================================================================
3121 if test $_os = iOS; then
3123     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3124         :
3125     else
3126         BITNESS_OVERRIDE=64
3127     fi
3129     AC_MSG_CHECKING([what iOS SDK to use])
3131     if test "$enable_ios_simulator" = yes; then
3132         platform=iPhoneSimulator
3133     else
3134         platform=iPhoneOS
3135     fi
3137     xcode_developer=`xcode-select -print-path`
3139     pref_sdk_ver=7.0
3140     for sdkver in 7.1 7.0 6.1 6.0; do
3141         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3142         if test -d $t; then
3143             ios_sdk=$sdkver
3144             sysroot=$t
3145             break
3146         fi
3147     done
3149     if test -z "$sysroot"; then
3150         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
3151     fi
3153     AC_MSG_RESULT($sysroot)
3155     if test "$enable_ios_simulator" = yes; then
3156         if test "$BITNESS_OVERRIDE" = 64; then
3157             XCODE_ARCHS=x86_64
3158             versionmin=-mios-simulator-version-min=7.0
3159         else
3160             XCODE_ARCHS=i386
3161             case $sdkver in
3162             7.*)
3163                 versionmin=-mios-simulator-version-min=6.1
3164                 ;;
3165             *)
3166                 versionmin=-mmacosx-version-min=10.7
3167                 ;;
3168             esac
3169         fi
3170     else
3171         platform=iPhoneOS
3172         if test "$BITNESS_OVERRIDE" = 64; then
3173             XCODE_ARCHS=arm64
3174             versionmin=-miphoneos-version-min=7.0
3175         else
3176             XCODE_ARCHS=armv7
3177             versionmin=-miphoneos-version-min=6.1
3178         fi
3179     fi
3181     # LTO is not really recommended for iOS builds,
3182     # the link time will be astronomical
3183     if test "$ENABLE_LTO" = TRUE; then
3184         lto=-flto
3185     fi
3186     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3187     # get compiled with it, to avoid ld warnings when linking all that together into one
3188     # executable.
3190     # Use libc++ for iOS 7 SDK and libstdc++ for earlier (but we don't really expect anybody to
3191     # be be using an earlier SDK)
3193     XCODE_CLANG_CXX_LIBRARY=libstdc++
3194     case $ios_sdk in
3195     6.*)
3196         if test "$enable_libc__" = yes; then
3197             AC_MSG_ERROR([--enable-libc++ requires using Xcode 5 and iOS SDK 7 or newer it seems])
3198         fi
3199         ;;
3200     *)
3201         if test "$enable_libc__" = no; then
3202             AC_MSG_ERROR([--disable-libc++ not allowed])
3203         fi
3204         XCODE_CLANG_CXX_LIBRARY=libc++
3205         ;;
3206     esac
3208     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3210     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3211     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3213     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3214     AR=`xcrun -find ar`
3215     NM=`xcrun -find nm`
3216     STRIP=`xcrun -find strip`
3217     LIBTOOL=`xcrun -find libtool`
3218     RANLIB=`xcrun -find ranlib`
3221 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3222 AC_SUBST(XCODE_ARCHS)
3224 AC_MSG_CHECKING([whether to treat the installation as read-only])
3226 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3227         "$enable_extensions" != yes; then
3228     enable_readonly_installset=yes
3230 if test "$enable_readonly_installset" = yes; then
3231     AC_MSG_RESULT([yes])
3232     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3233 else
3234     AC_MSG_RESULT([no])
3237 dnl ===================================================================
3238 dnl Structure of install set
3239 dnl ===================================================================
3241 if test $_os = Darwin -a "$enable_canonical_installation_tree_structure" = yes; then
3242     LIBO_BIN_FOLDER=MacOS
3243     LIBO_ETC_FOLDER=Resources
3244     LIBO_LIBEXEC_FOLDER=MacOS
3245     LIBO_LIB_FOLDER=Frameworks
3246     LIBO_SHARE_FOLDER=Resources
3247     LIBO_SHARE_HELP_FOLDER=Resources/help
3248     LIBO_SHARE_JAVA_FOLDER=Resources/java
3249     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3250     LIBO_LIB_PYUNO_FOLDER=Resources
3251     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3252     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3253     LIBO_URE_BIN_FOLDER=MacOS
3254     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3255     LIBO_URE_LIB_FOLDER=Frameworks
3256     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3257     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3258     ENABLE_MACOSX_MACLIKE_APP_STRUCTURE=TRUE
3259     AC_DEFINE(HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE)
3260 elif test $_os = Darwin; then
3261     LIBO_BIN_FOLDER=MacOS
3262     LIBO_ETC_FOLDER=MacOS
3263     LIBO_LIBEXEC_FOLDER=MacOS
3264     LIBO_LIB_FOLDER=MacOS
3265     LIBO_LIB_PYUNO_FOLDER=MacOS
3266     LIBO_SHARE_FOLDER=share
3267     LIBO_SHARE_HELP_FOLDER=help
3268     LIBO_SHARE_JAVA_FOLDER=MacOS/classes
3269     LIBO_SHARE_PRESETS_FOLDER=presets
3270     LIBO_SHARE_RESOURCE_FOLDER=MacOS/resource
3271     LIBO_SHARE_SHELL_FOLDER=MacOS/shell
3272     LIBO_URE_BIN_FOLDER=ure-link/bin
3273     LIBO_URE_ETC_FOLDER=ure-link/lib
3274     LIBO_URE_LIB_FOLDER=ure-link/lib
3275     LIBO_URE_SHARE_FOLDER=ure-link/share
3276     LIBO_URE_SHARE_JAVA_FOLDER=ure-link/share/java
3277 elif test $_os = WINNT; then
3278     LIBO_BIN_FOLDER=program
3279     LIBO_ETC_FOLDER=program
3280     LIBO_LIBEXEC_FOLDER=program
3281     LIBO_LIB_FOLDER=program
3282     LIBO_LIB_PYUNO_FOLDER=program
3283     LIBO_SHARE_FOLDER=share
3284     LIBO_SHARE_HELP_FOLDER=help
3285     LIBO_SHARE_JAVA_FOLDER=program/classes
3286     LIBO_SHARE_PRESETS_FOLDER=presets
3287     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3288     LIBO_SHARE_SHELL_FOLDER=program/shell
3289     LIBO_URE_BIN_FOLDER=URE/bin
3290     LIBO_URE_ETC_FOLDER=URE/bin
3291     LIBO_URE_LIB_FOLDER=URE/bin
3292     LIBO_URE_SHARE_FOLDER=URE
3293     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3294 else
3295     LIBO_BIN_FOLDER=program
3296     LIBO_ETC_FOLDER=program
3297     LIBO_LIBEXEC_FOLDER=program
3298     LIBO_LIB_FOLDER=program
3299     LIBO_LIB_PYUNO_FOLDER=program
3300     LIBO_SHARE_FOLDER=share
3301     LIBO_SHARE_HELP_FOLDER=help
3302     LIBO_SHARE_JAVA_FOLDER=program/classes
3303     LIBO_SHARE_PRESETS_FOLDER=presets
3304     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3305     LIBO_SHARE_SHELL_FOLDER=program/shell
3306     LIBO_URE_BIN_FOLDER=ure/bin
3307     LIBO_URE_ETC_FOLDER=ure/lib
3308     LIBO_URE_LIB_FOLDER=ure/lib
3309     LIBO_URE_SHARE_FOLDER=ure/share
3310     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3312 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3313 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3314 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3315 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3316 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3317 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3318 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3319 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3320 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3321 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3322 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3323 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3324 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3325 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3326 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3327 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3329 # Not all of them needed in config_host.mk, add more if need arises
3330 AC_SUBST(LIBO_BIN_FOLDER)
3331 AC_SUBST(LIBO_ETC_FOLDER)
3332 AC_SUBST(LIBO_LIB_FOLDER)
3333 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3334 AC_SUBST(LIBO_SHARE_FOLDER)
3335 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3336 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3337 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3338 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3339 AC_SUBST(LIBO_URE_BIN_FOLDER)
3340 AC_SUBST(LIBO_URE_ETC_FOLDER)
3341 AC_SUBST(LIBO_URE_LIB_FOLDER)
3342 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3343 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3344 AC_SUBST(ENABLE_MACOSX_MACLIKE_APP_STRUCTURE)
3346 dnl ===================================================================
3347 dnl Windows specific tests and stuff
3348 dnl ===================================================================
3350 # Get a value from the 32-bit side of the Registry
3351 reg_get_value_32()
3353     # Return value: $regvalue
3354     unset regvalue
3355     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3357     if test $? -eq 0; then
3358         regvalue=$_regvalue
3359     fi
3362 # Get a value from the 64-bit side of the Registry
3363 reg_get_value_64()
3365     # Return value: $regvalue
3366     unset regvalue
3367     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3369     if test $? -eq 0; then
3370         regvalue=$_regvalue
3371     fi
3374 if test "$_os" = "WINNT"; then
3375     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3376     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3377         AC_MSG_RESULT([no])
3378         WINDOWS_SDK_ARCH="x86"
3379     else
3380         AC_MSG_RESULT([yes])
3381         WINDOWS_SDK_ARCH="x64"
3382         BITNESS_OVERRIDE=64
3383     fi
3386 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3387     AC_MSG_CHECKING([whether to use DirectX])
3388     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3389         ENABLE_DIRECTX="TRUE"
3390         AC_MSG_RESULT([yes])
3391     else
3392         ENABLE_DIRECTX=""
3393         AC_MSG_RESULT([no])
3394     fi
3396     AC_MSG_CHECKING([whether to use ActiveX])
3397     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
3398         DISABLE_ACTIVEX=""
3399         AC_MSG_RESULT([yes])
3400     else
3401         DISABLE_ACTIVEX="TRUE"
3402         AC_MSG_RESULT([no])
3403     fi
3405     AC_MSG_CHECKING([whether to use ATL])
3406     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
3407         DISABLE_ATL=""
3408         AC_MSG_RESULT([yes])
3409     else
3410         DISABLE_ATL="TRUE"
3411         AC_MSG_RESULT([no])
3412     fi
3413 else
3414     ENABLE_DIRECTX=""
3415     DISABLE_ACTIVEX="TRUE"
3416     DISABLE_ATL="TRUE"
3419 AC_SUBST(ENABLE_DIRECTX)
3420 AC_SUBST(DISABLE_ACTIVEX)
3421 AC_SUBST(DISABLE_ATL)
3423 if test "$cross_compiling" = "yes"; then
3424     export CROSS_COMPILING=TRUE
3425     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3426 else
3427     CROSS_COMPILING=
3428     BUILD_TYPE="$BUILD_TYPE NATIVE"
3430 AC_SUBST(CROSS_COMPILING)
3432 dnl ===================================================================
3433 dnl  Is GCC actually Clang?
3434 dnl ===================================================================
3436 COM_GCC_IS_CLANG=
3437 if test "$GCC" = "yes"; then
3438     AC_MSG_CHECKING([whether GCC is actually Clang])
3439     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3440         #ifndef __clang__
3441         you lose
3442         #endif
3443         int foo=42;
3444         ]])],
3445         [AC_MSG_RESULT([yes])
3446          COM_GCC_IS_CLANG=TRUE],
3447         [AC_MSG_RESULT([no])])
3449     if test "$COM_GCC_IS_CLANG" = TRUE; then
3450         AC_MSG_CHECKING([the Clang version])
3451         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3452         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3453         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3454         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3455         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3456     fi
3458 AC_SUBST(COM_GCC_IS_CLANG)
3460 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3461     if test -z "$CCACHE_CPP2"; then
3462             AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3463             add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3464     fi
3467 dnl ===================================================================
3468 dnl  Test the gcc version
3469 dnl ===================================================================
3470 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3471     AC_MSG_CHECKING([the GCC version])
3472     _gcc_version=`$CC -dumpversion`
3473     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3475     if test "$_os" = "Darwin"; then
3476         if test "$with_macosx_sdk" = "10.5"; then
3477             # use gcc 4.2 for OS X SDK 10.5
3478             if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.2"; then
3479                 export CC="$GCC_HOME/bin/gcc-4.2" # make CC finally available to config.guess
3480             fi
3481             AC_MSG_RESULT([using CC=$CC])
3482         fi
3483     else
3484         AC_MSG_RESULT([gcc $_gcc_version])
3485     fi
3487     if test "$GCC_VERSION" -lt 0401; then
3488         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.1.0])
3489     fi
3490 else
3491     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3492     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3493     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3494     # (which reports itself as GCC 4.2.1).
3495     GCC_VERSION=
3497 AC_SUBST(GCC_VERSION)
3499 # ===================================================================
3500 # check various GCC options that Clang does not support now but maybe
3501 # will somewhen in the future, check them even for GCC, so that the
3502 # flags are set
3503 # ===================================================================
3505 HAVE_GCC_GGDB2=
3506 HAVE_GCC_FINLINE_LIMIT=
3507 HAVE_GCC_FNO_INLINE=
3508 if test "$GCC" = "yes"; then
3509     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3510     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3511         # Option just ignored and silly warning that isn't a real
3512         # warning printed
3513         :
3514     else
3515         save_CFLAGS=$CFLAGS
3516         CFLAGS="$CFLAGS -Werror -ggdb2"
3517         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3518         CFLAGS=$save_CFLAGS
3519     fi
3520     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3521         AC_MSG_RESULT([yes])
3522     else
3523         AC_MSG_RESULT([no])
3524     fi
3526     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3527     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3528         # As above
3529         :
3530     else
3531         save_CFLAGS=$CFLAGS
3532         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3533         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3534         CFLAGS=$save_CFLAGS
3535     fi
3536     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3537         AC_MSG_RESULT([yes])
3538     else
3539         AC_MSG_RESULT([no])
3540     fi
3542     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3543     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3544         # Ditto
3545         :
3546     else
3547         save_CFLAGS=$CFLAGS
3548         CFLAGS="$CFLAGS -Werror -fno-inline"
3549         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3550         CFLAGS=$save_CFLAGS
3551     fi
3552     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3553         AC_MSG_RESULT([yes])
3554     else
3555         AC_MSG_RESULT([no])
3556     fi
3558 AC_SUBST(HAVE_GCC_GGDB2)
3559 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3560 AC_SUBST(HAVE_GCC_FNO_INLINE)
3562 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3563 if test "$GCC" = "yes"; then
3564     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3565     bsymbolic_functions_ldflags_save=$LDFLAGS
3566     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3567     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3568 #include <stdio.h>
3569         ],[
3570 printf ("hello world\n");
3571         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3572     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3573         AC_MSG_RESULT( found )
3574     else
3575         AC_MSG_RESULT( not found )
3576     fi
3577     LDFLAGS=$bsymbolic_functions_ldflags_save
3579 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3581 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3582 # NOTE: must _not_ be used for bundled external libraries!
3583 ISYSTEM=
3584 if test "$GCC" = "yes"; then
3585     AC_MSG_CHECKING( for -isystem )
3586     save_CFLAGS=$CFLAGS
3587     CFLAGS="$CFLAGS -Werror"
3588     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
3589     CFLAGS=$save_CFLAGS
3590     if test -n "$ISYSTEM"; then
3591         AC_MSG_RESULT(yes)
3592     else
3593         AC_MSG_RESULT(no)
3594     fi
3596 if test -z "$ISYSTEM"; then
3597     # fall back to using -I
3598     ISYSTEM=-I
3600 AC_SUBST(ISYSTEM)
3602 dnl ===================================================================
3603 dnl  Check which Visual Studio or MinGW compiler is used
3604 dnl ===================================================================
3606 map_vs_year_to_version()
3608     # Return value: $vsversion
3610     unset vsversion
3612     case $1 in
3613     2010)
3614         vsversion=10.0;;
3615     2012)
3616         vsversion=11.0;;
3617     2013)
3618         vsversion=12.0;;
3619     *)
3620         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3621     esac
3624 vs_versions_to_check()
3626     # Args: $1 (optional) : versions to check, in the order of preference
3627     # Return value: $vsversions
3629     unset vsversions
3631     if test -n "$1"; then
3632         map_vs_year_to_version "$1"
3633         vsversions=$vsversion
3634     else
3635         # By default we prefer 2012, then 2010, then 2013
3636         vsversions="11.0 10.0 12.0"
3637     fi
3640 find_msvs()
3642     # Find Visual Studio 2012/2010/2013
3643     # Args: $1 (optional) : versions to check, in the order of preference
3644     # Return value: $vstest
3646     unset vstest
3648     vs_versions_to_check "$1"
3650     for ver in $vsversions; do
3651         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3652         if test -n "$regvalue"; then
3653             vstest=$regvalue
3654             break
3655         fi
3656         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3657         if test -n "$regvalue"; then
3658             vstest=$regvalue
3659             break
3660         fi
3661     done
3664 find_msvc()
3666     # Find Visual C++ 2012/2010/2013
3667     # Args: $1 (optional) : The VS version year
3668     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3670     unset vctest vcnum vcnumwithdot
3672     vs_versions_to_check "$1"
3674     for ver in $vsversions; do
3675         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3676         if test -n "$regvalue"; then
3677             vctest=$regvalue
3678             break
3679         fi
3680         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3681         if test -n "$regvalue"; then
3682             vctest=$regvalue
3683             break
3684         fi
3685     done
3686     if test -n "$vctest"; then
3687         vcnumwithdot=$ver
3688         case "$vcnumwithdot" in
3689         10.0)
3690             vcyear=2010
3691             vcnum=100
3692             ;;
3693         11.0)
3694             vcyear=2012
3695             vcnum=110
3696             ;;
3697         12.0)
3698             vcyear=2013
3699             vcnum=120
3700             ;;
3701         esac
3702     fi
3705 SHOWINCLUDES_PREFIX=
3706 if test "$_os" = "WINNT"; then
3707     if test "$WITH_MINGW" != "yes"; then
3708         AC_MSG_CHECKING([Visual C++])
3710         find_msvc "$with_visual_studio"
3712         if test -z "$vctest"; then
3713             if test -n "$with_visual_studio"; then
3714                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3715             else
3716                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2013 installation found])
3717             fi
3718         fi
3720         if test "$BITNESS_OVERRIDE" = ""; then
3721             if test -f "$vctest/bin/cl.exe"; then
3722                 VC_PRODUCT_DIR=$vctest
3723             else
3724                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3725             fi
3726         else
3727             if test -f "$vctest/bin/amd64/cl.exe"; then
3728                 VC_PRODUCT_DIR=$vctest
3729             else
3730                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3731             fi
3732         fi
3734         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3735         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3736         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3738         dnl ===========================================================
3739         dnl  Check for the corresponding mspdb*.dll
3740         dnl ===========================================================
3742         MSPDB_PATH=
3744         if test "$BITNESS_OVERRIDE" = ""; then
3745             if test "$vcnum" = "120"; then
3746                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3747             else
3748                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3749             fi
3750         else
3751             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3752         fi
3754         mspdbnum=$vcnum
3756         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3757             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3758         fi
3760         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3761         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3763         dnl The path needs to be added before cl is called
3764         PATH="$MSPDB_PATH:$PATH"
3766         AC_MSG_CHECKING([cl.exe])
3768         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3769         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3770         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3771         # is not enough?
3773         if test -z "$CC"; then
3774             if test "$BITNESS_OVERRIDE" = ""; then
3775                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3776                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3777                 fi
3778             else
3779                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3780                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3781                 fi
3782             fi
3784             # This gives us a posix path with 8.3 filename restrictions
3785             CC=`cygpath -d "$CC"`
3786             CC=`cygpath -u "$CC"`
3787         fi
3789         if test -n "$CC"; then
3790             # Remove /cl.exe from CC case insensitive
3791             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3792             if test "$BITNESS_OVERRIDE" = ""; then
3793                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3794             else
3795                 if test -n "$VC_PRODUCT_DIR"; then
3796                     # Huh, why not just an assignment?
3797                     COMPATH=`echo $VC_PRODUCT_DIR`
3798                 fi
3799             fi
3800             if test "$BITNESS_OVERRIDE" = "" -a "$vcnum" != "100"; then
3801                 CC="$CC -arch:SSE" # MSVC 2012 default for x86 is -arch:SSE2
3802             fi
3803             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3805             PathFormat "$COMPATH"
3806             COMPATH="$formatted_path"
3808             VCVER=$vcnum
3809             MSVSVER=$vcyear
3811             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3812             # are always "better", we list them in reverse chronological order.
3814             case $vcnum in
3815             100)
3816                 COMEX=13
3817                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3818                 if test "$ENABLE_LTO" = TRUE; then
3820                     AC_MSG_WARN([LTO is known to cause problems with MSVC 2010])
3821                     add_warning "LTO is known to cause problems with MSVC 2010"
3822                 fi
3823                 ;;
3824             110)
3825                 COMEX=14
3826                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3827                 ;;
3828             120)
3829                 COMEX=15
3830                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3831                 ;;
3832             esac
3834             # The expectation is that --with-windows-sdk should not need to be used
3835             if test -n "$with_windows_sdk"; then
3836                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3837                 *" "$with_windows_sdk" "*)
3838                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3839                     ;;
3840                 *)
3841                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3842                     ;;
3843                 esac
3844             fi
3846             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3847             ac_objext=obj
3848             ac_exeext=exe
3850         else
3851             AC_MSG_ERROR([Visual C++ not found after all, huh])
3852         fi
3854         dnl We need to guess the prefix of the -showIncludes output, it can be
3855         dnl localized
3856         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3857         echo "#include <stdlib.h>" > conftest.c
3858         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3859             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3860         rm -f conftest.c conftest.obj
3861         if test -z "$SHOWINCLUDES_PREFIX"; then
3862             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3863         else
3864             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3865         fi
3867         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3868         # version of the Explorer extension (and maybe other small
3869         # bits, too) needed when installing a 32-bit LibreOffice on a
3870         # 64-bit OS. The 64-bit Explorer extension is a feature that
3871         # has been present since long in OOo. Don't confuse it with
3872         # building LibreOffice itself as 64-bit code, which is
3873         # unfinished work and highly experimental.
3875         BUILD_X64=
3876         CXX_X64_BINARY=
3877         LINK_X64_BINARY=
3879         if test "$BITNESS_OVERRIDE" = ""; then
3880             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3881             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3882                 # Prefer native x64 compiler to cross-compiler, in case we are running
3883                 # the build on a 64-bit OS.
3884                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3885                     BUILD_X64=TRUE
3886                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3887                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3888                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3889                     BUILD_X64=TRUE
3890                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3891                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3892                 fi
3893             fi
3894             if test "$BUILD_X64" = TRUE; then
3895                 AC_MSG_RESULT([found])
3896             else
3897                 AC_MSG_RESULT([not found])
3898                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3899             fi
3900         fi
3901         AC_SUBST(BUILD_X64)
3903         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3904         AC_SUBST(CXX_X64_BINARY)
3905         AC_SUBST(LINK_X64_BINARY)
3906     else
3907         AC_MSG_CHECKING([the compiler is MinGW])
3908         MACHINE_PREFIX=`$CC -dumpmachine`
3909         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3910             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3911             AC_MSG_RESULT([yes])
3912         else
3913             AC_MSG_ERROR([Compiler is not MinGW.])
3914         fi
3915     fi
3917 AC_SUBST(VCVER)
3918 PathFormat "$MSPDB_PATH"
3919 MSPDB_PATH="$formatted_path"
3920 AC_SUBST(SHOWINCLUDES_PREFIX)
3923 # dbghelp.dll
3925 if test "$_os" = "WINNT"; then
3926     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3930 # unowinreg.dll
3932 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3933 AC_SUBST(UNOWINREG_DLL)
3936 # prefix C with ccache if needed
3938 if test "$CCACHE" != ""; then
3939     AC_MSG_CHECKING([whether $CC is already ccached])
3941     AC_LANG_PUSH([C])
3942     save_CFLAGS=$CFLAGS
3943     CFLAGS="$CFLAGS --ccache-skip -O2"
3944     dnl an empty program will do, we're checking the compiler flags
3945     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3946                       [use_ccache=yes], [use_ccache=no])
3947     if test $use_ccache = yes; then
3948         AC_MSG_RESULT([yes])
3949     else
3950         CC="$CCACHE $CC"
3951         AC_MSG_RESULT([no])
3952     fi
3953     CFLAGS=$save_CFLAGS
3954     AC_LANG_POP([C])
3957 dnl Set the ENABLE_DBGUTIL variable
3958 dnl ===================================================================
3959 AC_MSG_CHECKING([whether to build with additional debug utilities])
3960 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3961     ENABLE_DBGUTIL="TRUE"
3962     # this is an extra var so it can have different default on different MSVC
3963     # versions (in case there are version specific problems with it)
3964     MSVC_USE_DEBUG_RUNTIME="TRUE"
3966     AC_MSG_RESULT([yes])
3967     # cppunit and graphite expose STL in public headers
3968     if test "$with_system_cppunit" = "yes"; then
3969         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3970     else
3971         with_system_cppunit=no
3972     fi
3973     if test "$with_system_graphite" = "yes"; then
3974         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3975     else
3976         with_system_graphite=no
3977     fi
3978     if test "$with_system_mysql_cppconn" = "yes"; then
3979         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3980     else
3981         with_system_mysql_cppconn=no
3982     fi
3983     if test "$with_system_orcus" = "yes"; then
3984         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3985     else
3986         with_system_orcus=no
3987     fi
3988     if test "$with_system_libcmis" = "yes"; then
3989         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3990     else
3991         with_system_libcmis=no
3992     fi
3993     if test "$enable_win_mozab_driver" = "yes"; then
3994         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3995     fi
3996 else
3997     ENABLE_DBGUTIL=""
3998     MSVC_USE_DEBUG_RUNTIME=""
3999     AC_MSG_RESULT([no])
4001 AC_SUBST(ENABLE_DBGUTIL)
4002 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4004 dnl Set the ENABLE_DEBUG variable.
4005 dnl ===================================================================
4006 AC_MSG_CHECKING([whether to do a debug build])
4007 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4008     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
4010 if test -n "$ENABLE_DBGUTIL"; then
4011     if test "$enable_debug" = "no"; then
4012         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4013     fi
4014     ENABLE_DEBUG="TRUE"
4015     AC_MSG_RESULT([yes (dbgutil)])
4016 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
4017     ENABLE_DEBUG="TRUE"
4018     AC_MSG_RESULT([yes])
4019 else
4020     ENABLE_DEBUG=""
4021     AC_MSG_RESULT([no])
4023 AC_SUBST(ENABLE_DEBUG)
4025 dnl Selective debuginfo
4026 ENABLE_DEBUGINFO_FOR=
4027 if test -n "$ENABLE_DEBUG"; then
4028     AC_MSG_CHECKING([whether to use selective debuginfo])
4029     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
4030         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
4031         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
4032     else
4033         ENABLE_DEBUGINFO_FOR=all
4034         AC_MSG_RESULT([no, for all])
4035     fi
4037 AC_SUBST(ENABLE_DEBUGINFO_FOR)
4039 dnl Check for enable symbols option
4040 dnl ===================================================================
4041 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
4042 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
4043     ENABLE_SYMBOLS="TRUE"
4044     if test -n "$ENABLE_DBGUTIL"; then
4045         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
4046     elif test -n "$ENABLE_DEBUG"; then
4047         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
4048     fi
4049     AC_MSG_RESULT([yes])
4050 else
4051     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
4052         ENABLE_SYMBOLS="FALSE"
4053     else
4054         ENABLE_SYMBOLS=
4055     fi
4056     AC_MSG_RESULT([no])
4058 AC_SUBST(ENABLE_SYMBOLS)
4060 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
4061 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
4062 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
4063 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
4064 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
4065     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4067 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4069 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4070 # By default use the ones specified by our build system,
4071 # but explicit override is possible.
4072 AC_MSG_CHECKING(for explicit AFLAGS)
4073 if test -n "$AFLAGS"; then
4074     AC_MSG_RESULT([$AFLAGS])
4075     x_AFLAGS=
4076 else
4077     AC_MSG_RESULT(no)
4078     x_AFLAGS=[\#]
4080 AC_MSG_CHECKING(for explicit CFLAGS)
4081 if test -n "$CFLAGS"; then
4082     AC_MSG_RESULT([$CFLAGS])
4083     x_CFLAGS=
4084 else
4085     AC_MSG_RESULT(no)
4086     x_CFLAGS=[\#]
4088 AC_MSG_CHECKING(for explicit CXXFLAGS)
4089 if test -n "$CXXFLAGS"; then
4090     AC_MSG_RESULT([$CXXFLAGS])
4091     x_CXXFLAGS=
4092 else
4093     AC_MSG_RESULT(no)
4094     x_CXXFLAGS=[\#]
4096 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4097 if test -n "$OBJCFLAGS"; then
4098     AC_MSG_RESULT([$OBJCFLAGS])
4099     x_OBJCFLAGS=
4100 else
4101     AC_MSG_RESULT(no)
4102     x_OBJCFLAGS=[\#]
4104 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4105 if test -n "$OBJCXXFLAGS"; then
4106     AC_MSG_RESULT([$OBJCXXFLAGS])
4107     x_OBJCXXFLAGS=
4108 else
4109     AC_MSG_RESULT(no)
4110     x_OBJCXXFLAGS=[\#]
4112 AC_MSG_CHECKING(for explicit LDFLAGS)
4113 if test -n "$LDFLAGS"; then
4114     AC_MSG_RESULT([$LDFLAGS])
4115     x_LDFLAGS=
4116 else
4117     AC_MSG_RESULT(no)
4118     x_LDFLAGS=[\#]
4120 AC_SUBST(AFLAGS)
4121 AC_SUBST(CFLAGS)
4122 AC_SUBST(CXXFLAGS)
4123 AC_SUBST(OBJCFLAGS)
4124 AC_SUBST(OBJCXXFLAGS)
4125 AC_SUBST(LDFLAGS)
4126 AC_SUBST(x_AFLAGS)
4127 AC_SUBST(x_CFLAGS)
4128 AC_SUBST(x_CXXFLAGS)
4129 AC_SUBST(x_OBJCFLAGS)
4130 AC_SUBST(x_OBJCXXFLAGS)
4131 AC_SUBST(x_LDFLAGS)
4134 # determine CPUNAME, GUIBASE, ...
4136 LIB64="lib"
4137 SOLARINC=
4139 case "$host_os" in
4141 aix*)
4142     COM=GCC
4143     CPUNAME=POWERPC
4144     GUIBASE=unx
4145     OS=AIX
4146     RTL_OS=AIX
4147     RTL_ARCH=PowerPC
4148     PLATFORMID=aix_powerpc
4149     OUTPATH=unxaigppc
4150     P_SEP=:
4151     ;;
4153 cygwin*)
4154     COM=MSC
4155     GUIBASE=not-used
4156     OS=WNT
4157     RTL_OS=Windows
4158     P_SEP=";"
4160     case "$host_cpu" in
4161     i*86|x86_64)
4162         if test "$BITNESS_OVERRIDE" = 64; then
4163             CPUNAME=X86_64
4164             RTL_ARCH=X86_64
4165             LIB64="lib/x64"
4166             PLATFORMID=windows_x86_64
4167             OUTPATH=wntmscx$COMEX
4168         else
4169             CPUNAME=INTEL
4170             RTL_ARCH=x86
4171             PLATFORMID=windows_x86
4172             OUTPATH=wntmsci$COMEX
4173         fi
4174         ;;
4175     *)
4176         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4177         ;;
4178     esac
4179     SCPDEFS="$SCPDEFS -D_MSC_VER"
4180     ;;
4182 darwin*)
4183     COM=GCC
4184     GUIBASE=not-used
4185     OS=MACOSX
4186     RTL_OS=MacOSX
4187     P_SEP=:
4189     case "$host_cpu" in
4190     arm*)
4191         CPUNAME=ARM
4192         RTL_ARCH=ARM_EABI
4193         PLATFORMID=ios_arm
4194         OUTPATH=unxiosr
4195         OS=IOS
4196         SDKDIR=sdk
4197         ;;
4198     powerpc*)
4199         CPUNAME=POWERPC
4200         RTL_ARCH=PowerPC
4201         PLATFORMID=macosx_powerpc
4202         OUTPATH=unxmacxp
4203         ;;
4204     i*86)
4205         if test "$BITNESS_OVERRIDE" = 64; then
4206             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4207         fi
4208         CPUNAME=INTEL
4209         RTL_ARCH=x86
4210         PLATFORMID=macosx_x86
4211         OUTPATH=unxmacxi
4212         ;;
4213     x86_64)
4214         if test "$BITNESS_OVERRIDE" = 64; then
4215             CPUNAME=X86_64
4216             RTL_ARCH=X86_64
4217             PLATFORMID=macosx_x86_64
4218             OUTPATH=unxmacxx
4219         else
4220             CPUNAME=INTEL
4221             RTL_ARCH=x86
4222             PLATFORMID=macosx_x86
4223             OUTPATH=unxmacxi
4224         fi
4225         ;;
4226     *)
4227         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4228         ;;
4229     esac
4230     ;;
4232 dragonfly*)
4233     COM=GCC
4234     GUIBASE=unx
4235     OS=DRAGONFLY
4236     RTL_OS=DragonFly
4237     OUTPATH=unxdfly
4238     P_SEP=:
4240     case "$host_cpu" in
4241     i*86)
4242         CPUNAME=INTEL
4243         RTL_ARCH=x86
4244         PLATFORMID=dragonfly_x86
4245         ;;
4246     x86_64)
4247         CPUNAME=X86_64
4248         RTL_ARCH=X86_64
4249         PLATFORMID=dragonfly_x86_64
4250         ;;
4251     *)
4252         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4253         ;;
4254     esac
4255     ;;
4257 freebsd*)
4258     COM=GCC
4259     GUIBASE=unx
4260     RTL_OS=FreeBSD
4261     OS=FREEBSD
4262     OUTPATH=unxfbsd
4263     P_SEP=:
4265     case "$host_cpu" in
4266     i*86)
4267         CPUNAME=INTEL
4268         RTL_ARCH=x86
4269         PLATFORMID=freebsd_x86
4270         OUTPATH=unxfbsdi
4271         ;;
4272     x86_64|amd64)
4273         CPUNAME=X86_64
4274         RTL_ARCH=X86_64
4275         PLATFORMID=freebsd_x86_64
4276         ;;
4277     *)
4278         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4279         ;;
4280     esac
4281     ;;
4283 kfreebsd*)
4284     COM=GCC
4285     GUIBASE=unx
4286     OS=LINUX
4287     RTL_OS=kFreeBSD
4288     P_SEP=:
4290     case "$host_cpu" in
4292     i*86)
4293         CPUNAME=INTEL
4294         RTL_ARCH=x86
4295         PLATFORMID=kfreebsd_x86
4296         OUTPATH=unxkfgi6
4297         ;;
4298     x86_64)
4299         CPUNAME=X86_64
4300         RTL_ARCH=X86_64
4301         LIB64="lib64"
4302         PLATFORMID=kfreebsd_x86_64
4303         OUTPATH=unxkfgx6
4304         ;;
4305     *)
4306         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4307         ;;
4308     esac
4309     ;;
4311 linux-gnu*)
4312     COM=GCC
4313     GUIBASE=unx
4314     OS=LINUX
4315     RTL_OS=Linux
4316     P_SEP=:
4318     case "$host_cpu" in
4320     alpha)
4321         CPUNAME=AXP
4322         RTL_ARCH=ALPHA
4323         PLATFORMID=linux_alpha
4324         OUTPATH=unxlngaxp
4325         ;;
4326     arm*)
4327         CPUNAME=ARM
4328         EPM_FLAGS="-a arm"
4329         OUTPATH=unxlngr
4330         RTL_ARCH=ARM_EABI
4331         PLATFORMID=linux_arm_eabi
4332         case "$host_cpu" in
4333         arm*-linux)
4334             RTL_ARCH=ARM_OABI
4335             PLATFORMID=linux_arm_oabi
4336             ;;
4337         esac
4338         ;;
4339     hppa)
4340         CPUNAME=HPPA
4341         RTL_ARCH=HPPA
4342         EPM_FLAGS="-a hppa"
4343         PLATFORMID=linux_hppa
4344         OUTPATH=unxlnghppa
4345         ;;
4346     i*86)
4347         CPUNAME=INTEL
4348         RTL_ARCH=x86
4349         PLATFORMID=linux_x86
4350         OUTPATH=unxlngi6
4351         ;;
4352     ia64)
4353         CPUNAME=IA64
4354         RTL_ARCH=IA64
4355         PLATFORMID=linux_ia64
4356         OUTPATH=unxlnga
4357         ;;
4358     mips)
4359         CPUNAME=GODSON
4360         RTL_ARCH=MIPS_EB
4361         EPM_FLAGS="-a mips"
4362         PLATFORMID=linux_mips_eb
4363         OUTPATH=unxlngmips
4364         ;;
4365     mips64)
4366         CPUNAME=GODSON
4367         RTL_ARCH=MIPS_EB
4368         EPM_FLAGS="-a mips64"
4369         PLATFORMID=linux_mips_eb
4370         OUTPATH=unxlngmips
4371         ;;
4372     mips64el)
4373         CPUNAME=GODSON
4374         RTL_ARCH=MIPS_EL
4375         EPM_FLAGS="-a mips64el"
4376         PLATFORMID=linux_mips_el
4377         OUTPATH=unxlngmips
4378         ;;
4379     mipsel)
4380         CPUNAME=GODSON
4381         RTL_ARCH=MIPS_EL
4382         EPM_FLAGS="-a mipsel"
4383         PLATFORMID=linux_mips_el
4384         OUTPATH=unxlngmips
4385         ;;
4386     m68k)
4387         CPUNAME=M68K
4388         RTL_ARCH=M68K
4389         PLATFORMID=linux_m68k
4390         OUTPATH=unxlngm68k
4391         ;;
4392     powerpc)
4393         CPUNAME=POWERPC
4394         RTL_ARCH=PowerPC
4395         PLATFORMID=linux_powerpc
4396         OUTPATH=unxlngppc
4397         ;;
4398     powerpc64)
4399         CPUNAME=POWERPC64
4400         RTL_ARCH=PowerPC_64
4401         LIB64="lib64"
4402         PLATFORMID=linux_powerpc64
4403         OUTPATH=unxlngppc64
4404         ;;
4405     powerpc64le)
4406         CPUNAME=POWERPC64
4407         RTL_ARCH=PowerPC_64_LE
4408         LIB64="lib64"
4409         PLATFORMID=linux_powerpc64_le
4410         OUTPATH=unxlngppc64
4411         ;;
4412     sparc)
4413         CPUNAME=SPARC
4414         RTL_ARCH=SPARC
4415         PLATFORMID=linux_sparc
4416         OUTPATH=unxlngs
4417         ;;
4418     s390)
4419         CPUNAME=S390
4420         RTL_ARCH=S390
4421         PLATFORMID=linux_s390
4422         OUTPATH=unxlngs390
4423         ;;
4424     s390x)
4425         CPUNAME=S390X
4426         RTL_ARCH=S390x
4427         LIB64="lib64"
4428         PLATFORMID=linux_s390x
4429         OUTPATH=unxlngs390x
4430         ;;
4431     x86_64)
4432         CPUNAME=X86_64
4433         RTL_ARCH=X86_64
4434         LIB64="lib64"
4435         PLATFORMID=linux_x86_64
4436         OUTPATH=unxlngx6
4437         ;;
4438     *)
4439         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4440         ;;
4441     esac
4442     ;;
4444 linux-android*)
4445     COM=GCC
4446     GUIBASE=not-used
4447     OS=ANDROID
4448     RTL_OS=Android
4449     P_SEP=:
4451     case "$host_cpu" in
4453     arm|armel)
4454         CPUNAME=ARM
4455         RTL_ARCH=ARM_EABI
4456         PLATFORMID=android_arm_eabi
4457         OUTPATH=unxandr
4458         ;;
4459     mips|mipsel)
4460         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4461         RTL_ARCH=MIPS_EL
4462         PLATFORMID=android_mips_el
4463         OUTPATH=unxandm
4464         ;;
4465     i*86)
4466         CPUNAME=INTEL
4467         RTL_ARCH=x86
4468         PLATFORMID=android_x86
4469         OUTPATH=unxandi
4470         ;;
4471     *)
4472         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4473         ;;
4474     esac
4475     ;;
4477 mingw*)
4478     COM=GCC
4479     GUIBASE=not-used
4480     OS=WNT
4481     RTL_OS=Windows
4482     P_SEP=:
4484     case "$host_cpu" in
4485     i*86|x86_64)
4486         if test "$BITNESS_OVERRIDE" = 64; then
4487             CPUNAME=X86_64
4488             RTL_ARCH=X86_84
4489             PLATFORMID=windows_x86_64
4490             OUTPATH=wntgccx$COMEX
4491             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4492         else
4493             CPUNAME=INTEL
4494             RTL_ARCH=x86
4495             PLATFORMID=windows_x86
4496             OUTPATH=wntgcci$COMEX
4497             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4498         fi
4499         ;;
4500     *)
4501         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4502         ;;
4503     esac
4504     ;;
4506 *netbsd*)
4508     COM=GCC
4509     GUIBASE=unx
4510     OS=NETBSD
4511     RTL_OS=NetBSD
4512     OUTPATH=unxnbsd
4513     P_SEP=:
4515     case "$host_cpu" in
4516     i*86)
4517         CPUNAME=INTEL
4518         RTL_ARCH=x86
4519         PLATFORMID=netbsd_x86
4520         ;;
4521     powerpc)
4522         CPUNAME=POWERPC
4523         RTL_ARCH=PowerPC
4524         PLATFORMID=netbsd_powerpc
4525         ;;
4526     sparc)
4527         CPUNAME=SPARC
4528         RTL_ARCH=SPARC
4529         PLATFORMID=netbsd_sparc
4530         ;;
4531     x86_64)
4532         CPUNAME=X86_64
4533         RTL_ARCH=X86_64
4534         PLATFORMID=netbsd_x86_64
4535         ;;
4536     *)
4537         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4538         ;;
4539     esac
4540     ;;
4542 openbsd*)
4543     COM=GCC
4544     GUIBASE=unx
4545     OS=OPENBSD
4546     RTL_OS=OpenBSD
4547     OUTPATH=unxobsd
4548     P_SEP=:
4550     case "$host_cpu" in
4551     i*86)
4552         CPUNAME=INTEL
4553         RTL_ARCH=x86
4554         PLATFORMID=openbsd_x86
4555         ;;
4556     x86_64)
4557         CPUNAME=X86_64
4558         RTL_ARCH=X86_64
4559         PLATFORMID=openbsd_x86_64
4560         ;;
4561     *)
4562         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4563         ;;
4564     esac
4565     SOLARINC="$SOLARINC -I/usr/local/include"
4566     ;;
4568 solaris*)
4570     COM=GCC
4571     GUIBASE=unx
4572     OS=SOLARIS
4573     RTL_OS=Solaris
4574     P_SEP=:
4576     case "$host_cpu" in
4577     i*86)
4578         CPUNAME=INTEL
4579         RTL_ARCH=x86
4580         PLATFORMID=solaris_x86
4581         OUTPATH=unxsogi
4582         ;;
4583     sparc)
4584         CPUNAME=SPARC
4585         RTL_ARCH=SPARC
4586         PLATFORMID=solaris_sparc
4587         OUTPATH=unxsogs
4588         ;;
4589     sparc64)
4590         CPUNAME=SPARC64
4591         RTL_ARCH=SPARC64
4592         PLATFORMID=solaris_sparc64
4593         OUTPATH=unxsogu
4594         ;;
4595     *)
4596         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4597         ;;
4598     esac
4599     SOLARINC="$SOLARINC -I/usr/local/include"
4600     ;;
4603     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4604     ;;
4605 esac
4607 if test "$enable_headless" = "yes"; then
4608     if test "$GUIBASE" != "unx"; then
4609         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
4610     fi
4611     GUIBASE=not-used
4614 WORKDIR="${BUILDDIR}/workdir"
4615 INSTDIR="${BUILDDIR}/instdir"
4616 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4617 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4618 AC_SUBST(COM)
4619 AC_SUBST(CPUNAME)
4620 AC_SUBST(RTL_OS)
4621 AC_SUBST(RTL_ARCH)
4622 AC_SUBST(EPM_FLAGS)
4623 AC_SUBST(GUIBASE)
4624 AC_SUBST([INSTDIR])
4625 AC_SUBST([INSTROOT])
4626 AC_SUBST(OS)
4627 AC_SUBST(OUTPATH)
4628 AC_SUBST(P_SEP)
4629 AC_SUBST(WORKDIR)
4630 AC_SUBST(PLATFORMID)
4631 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4633 dnl ===================================================================
4634 dnl Test which package format to use
4635 dnl ===================================================================
4636 AC_MSG_CHECKING([which package format to use])
4637 if test -n "$with_package_format" -a "$with_package_format" != no; then
4638     for i in $with_package_format; do
4639         case "$i" in
4640         aix | bsd | deb | pkg | rpm | native | portable | archive | dmg | installed | msi)
4641             ;;
4642         *)
4643             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4644 aix - AIX software distribution
4645 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4646 deb - Debian software distribution
4647 pkg - Solaris software distribution
4648 rpm - RedHat software distribution
4649 native - "Native" software distribution for the platform
4650 portable - Portable software distribution
4652 LibreOffice additionally supports:
4653 archive - .tar.gz or .zip
4654 dmg - Mac OS X .dmg
4655 installed - installation tree
4656 msi - Windows .msi
4657         ])
4658             ;;
4659         esac
4660     done
4661     PKGFORMAT="$with_package_format"
4662     AC_MSG_RESULT([$PKGFORMAT])
4663 else
4664     PKGFORMAT=
4665     AC_MSG_RESULT([none])
4667 AC_SUBST(PKGFORMAT)
4669 dnl ===================================================================
4670 dnl Set up a different compiler to produce tools to run on the build
4671 dnl machine when doing cross-compilation
4672 dnl ===================================================================
4674 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4675 if test "$cross_compiling" = "yes"; then
4676     AC_MSG_CHECKING([for BUILD platform configuration])
4677     echo
4678     rm -rf CONF-FOR-BUILD config_build.mk
4679     mkdir CONF-FOR-BUILD
4680     # Here must be listed all files needed when running the configure script. In particular, also
4681     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4682     # keep them in the same order as there.
4683     (cd $SRC_ROOT && tar cf - \
4684         config.guess \
4685         bin/get_config_variables \
4686         solenv/bin/getcompver.awk \
4687         solenv/inc/langlist.mk \
4688         config_host.mk.in \
4689         Makefile.in \
4690         lo.xcent.in \
4691         instsetoo_native/util/openoffice.lst.in \
4692         config_host/*.in \
4693         sysui/desktop/macosx/Info.plist.in \
4694         ios/lo.xcconfig.in \
4695         ure/source/unorc.in) \
4696     | (cd CONF-FOR-BUILD && tar xf -)
4697     cp configure CONF-FOR-BUILD
4698     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4699     (
4700     unset COM GUIBASE OS CPUNAME
4701     unset CC CXX SYSBASE CFLAGS
4702     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4703     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4704     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4705     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4706     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4707     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4708     cd CONF-FOR-BUILD
4709     sub_conf_opts=""
4710     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4711     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4712     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4713     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4714     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4715     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4716     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4717     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4718     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4719     # we need the msi build tools on mingw if we are creating the
4720     # installation set
4721     if test "$WITH_MINGW" = "yes"; then
4722         enable_winegcc_for_build=
4723         for pkgformat in $PKGFORMAT; do
4724             case "$pkgformat" in
4725             msi|native) enable_winegcc_for_build=yes ;;
4726             esac
4727         done
4728         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4729     fi
4730     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4731     # Don't bother having configure look for stuff not needed for the build platform anyway
4732     ./configure \
4733         --disable-graphite \
4734         --disable-pdfimport \
4735         --disable-postgresql-sdbc \
4736         --with-parallelism="$with_parallelism" \
4737         --without-doxygen \
4738         --without-java \
4739         $sub_conf_opts \
4740         --srcdir=$srcdir \
4741         2>&1 | sed -e 's/^/    /'
4742     test -f ./config_host.mk 2>/dev/null || exit
4743     cp config_host.mk ../config_build.mk
4744     mv config.log ../config.Build.log
4745     mkdir -p ../config_build
4746     mv config_host/*.h ../config_build
4747     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXSLT WORKDIR
4749     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXSLT; do
4750         VV='$'$V
4751         VV=`eval "echo $VV"`
4752         if test -n "$VV"; then
4753             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4754             echo "$line" >>build-config
4755         fi
4756     done
4758     for V in INSTDIR INSTROOT WORKDIR; do
4759         VV='$'$V
4760         VV=`eval "echo $VV"`
4761         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4762         if test -n "$VV"; then
4763             line="${V}_FOR_BUILD='$VV'"
4764             echo "$line" >>build-config
4765         fi
4766     done
4768     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4769     echo "$line" >>build-config
4771     )
4772     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4773     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])
4774     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4775              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4777     eval `cat CONF-FOR-BUILD/build-config`
4779     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4781     rm -rf CONF-FOR-BUILD
4782 else
4783     OS_FOR_BUILD="$OS"
4784     CC_FOR_BUILD="$CC"
4785     CXX_FOR_BUILD="$CXX"
4786     INSTDIR_FOR_BUILD="$INSTDIR"
4787     INSTROOT_FOR_BUILD="$INSTROOT"
4788     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4789     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4790     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4791     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4792     WORKDIR_FOR_BUILD="$WORKDIR"
4794 AC_SUBST(OS_FOR_BUILD)
4795 AC_SUBST(INSTDIR_FOR_BUILD)
4796 AC_SUBST(INSTROOT_FOR_BUILD)
4797 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4798 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4799 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4800 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4801 AC_SUBST(WORKDIR_FOR_BUILD)
4803 dnl ===================================================================
4804 dnl Check for syslog header
4805 dnl ===================================================================
4806 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4808 dnl ===================================================================
4809 dnl Set the ENABLE_CRASHDUMP variable.
4810 dnl ===================================================================
4811 AC_MSG_CHECKING([whether to enable crashdump feature])
4812 if test "$enable_crashdump" = "yes"; then
4813     ENABLE_CRASHDUMP="TRUE"
4814     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4815     AC_MSG_RESULT([yes])
4816 else
4817     ENABLE_CRASHDUMP=""
4818     AC_MSG_RESULT([no])
4820 AC_SUBST(ENABLE_CRASHDUMP)
4823 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4824 dnl ===================================================================
4825 AC_MSG_CHECKING([whether to turn warnings to errors])
4826 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4827     ENABLE_WERROR="TRUE"
4828     AC_MSG_RESULT([yes])
4829 else
4830     AC_MSG_RESULT([no])
4832 AC_SUBST(ENABLE_WERROR)
4834 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4835 dnl ===================================================================
4836 AC_MSG_CHECKING([whether to have assert to abort in release code])
4837 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4838     ASSERT_ALWAYS_ABORT="TRUE"
4839     AC_MSG_RESULT([yes])
4840 else
4841     ASSERT_ALWAYS_ABORT="FALSE"
4842     AC_MSG_RESULT([no])
4844 AC_SUBST(ASSERT_ALWAYS_ABORT)
4846 # Determine whether to use ooenv for the instdir installation
4847 # ===================================================================
4848 if test $_os != "WINNT" -a $_os != "Darwin"; then
4849     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4850     if test "$enable_ooenv" = "no"; then
4851         AC_MSG_RESULT([no])
4852     else
4853         ENABLE_OOENV="TRUE"
4854         AC_MSG_RESULT([yes])
4855     fi
4857 AC_SUBST(ENABLE_OOENV)
4859 if test "$enable_headless" = "yes"; then
4860     # be sure to do not mess with uneeded stuff
4861     test_randr=no
4862     test_xrender=no
4863     test_cups=no
4864     test_dbus=no
4865     test_fontconfig=yes
4866     test_gtk=no
4867     build_gstreamer=no
4868     build_gstreamer_0_10=no
4869     test_tde=no
4870     test_kde=no
4871     test_kde4=no
4872     enable_cairo_canvas=no
4873     enable_gnome_vfs=no
4876 dnl ===================================================================
4877 dnl check for cups support
4878 dnl ===================================================================
4879 ENABLE_CUPS=""
4881 if test "$enable_cups" = "no"; then
4882     test_cups=no
4885 AC_MSG_CHECKING([whether to enable CUPS support])
4886 if test "$test_cups" = "yes"; then
4887     ENABLE_CUPS="TRUE"
4888     AC_MSG_RESULT([yes])
4890     AC_MSG_CHECKING([whether cups support is present])
4891     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4892     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4893     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4894         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4895     fi
4897 else
4898     AC_MSG_RESULT([no])
4901 AC_SUBST(ENABLE_CUPS)
4903 # fontconfig checks
4904 if test "$test_fontconfig" = "yes"; then
4905     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4906     SYSTEM_FONTCONFIG=TRUE
4908 AC_SUBST(FONTCONFIG_CFLAGS)
4909 AC_SUBST(FONTCONFIG_LIBS)
4910 AC_SUBST([SYSTEM_FONTCONFIG])
4912 dnl whether to find & fetch external tarballs?
4913 dnl ===================================================================
4914 if test -z "$TARFILE_LOCATION"; then
4915     if test -d "$SRC_ROOT/src" ; then
4916         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4917         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4918     fi
4919     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4920 else
4921     AbsolutePath "$TARFILE_LOCATION"
4922     TARFILE_LOCATION="${absolute_path}"
4924 AC_SUBST(TARFILE_LOCATION)
4926 AC_MSG_CHECKING([whether we want to fetch tarballs])
4927 if test "$enable_fetch_external" != "no"; then
4928     if test "$with_all_tarballs" = "yes"; then
4929         AC_MSG_RESULT(["yes, all of them"])
4930         DO_FETCH_TARBALLS="ALL"
4931     else
4932         AC_MSG_RESULT(["yes, if we use them"])
4933         DO_FETCH_TARBALLS="TRUE"
4934     fi
4935 else
4936     AC_MSG_RESULT([no])
4937     DO_FETCH_TARBALLS=
4939 AC_SUBST(DO_FETCH_TARBALLS)
4941 AC_MSG_CHECKING([whether to build help])
4942 HELP_COMMON_ONLY=FALSE
4943 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4944     BUILD_TYPE="$BUILD_TYPE HELP"
4945     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4946     if test "$with_help" = "common" ; then
4947         HELP_COMMON_ONLY=TRUE
4948         AC_MSG_RESULT([common only])
4949     else
4950         SCPDEFS="$SCPDEFS -DWITH_HELP"
4951         AC_MSG_RESULT([yes])
4952     fi
4953 else
4954     AC_MSG_RESULT([no])
4956 AC_SUBST(HELP_COMMON_ONLY)
4958 dnl Test whether to include MySpell dictionaries
4959 dnl ===================================================================
4960 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4961 if test "$with_myspell_dicts" = "yes"; then
4962     AC_MSG_RESULT([yes])
4963     WITH_MYSPELL_DICTS=TRUE
4964     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4965     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4966 else
4967     AC_MSG_RESULT([no])
4968     WITH_MYSPELL_DICTS=
4970 AC_SUBST(WITH_MYSPELL_DICTS)
4972 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4973 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4974     if test "$with_system_dicts" = yes; then
4975         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4976     fi
4977     with_system_dicts=no
4980 AC_MSG_CHECKING([whether to use dicts from external paths])
4981 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4982     AC_MSG_RESULT([yes])
4983     SYSTEM_DICTS=TRUE
4984     AC_MSG_CHECKING([for spelling dictionary directory])
4985     if test -n "$with_external_dict_dir"; then
4986         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4987     else
4988         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4989         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4990             DICT_SYSTEM_DIR=file:///usr/share/myspell
4991         fi
4992     fi
4993     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4994     AC_MSG_CHECKING([for hyphenation patterns directory])
4995     if test -n "$with_external_hyph_dir"; then
4996         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4997     else
4998         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4999     fi
5000     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5001     AC_MSG_CHECKING([for thesaurus directory])
5002     if test -n "$with_external_thes_dir"; then
5003         THES_SYSTEM_DIR=file://$with_external_thes_dir
5004     else
5005         THES_SYSTEM_DIR=file:///usr/share/mythes
5006     fi
5007     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5008 else
5009     AC_MSG_RESULT([no])
5010     SYSTEM_DICTS=
5012 AC_SUBST(SYSTEM_DICTS)
5013 AC_SUBST(DICT_SYSTEM_DIR)
5014 AC_SUBST(HYPH_SYSTEM_DIR)
5015 AC_SUBST(THES_SYSTEM_DIR)
5017 dnl ===================================================================
5018 AC_MSG_CHECKING([whether to enable pch feature])
5019 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
5020     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5021         ENABLE_PCH="TRUE"
5022         AC_MSG_RESULT([yes])
5023     elif test "$GCC" = "yes"; then
5024         ENABLE_PCH="TRUE"
5025         AC_MSG_RESULT([yes])
5026     else
5027         ENABLE_PCH=""
5028         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5029     fi
5030 else
5031     ENABLE_PCH=""
5032     AC_MSG_RESULT([no])
5034 AC_SUBST(ENABLE_PCH)
5036 dnl ===================================================================
5037 dnl Search all the common names for GNU make
5038 dnl ===================================================================
5039 AC_MSG_CHECKING([for GNU make])
5041 # try to use our own make if it is available and GNUMAKE was not already defined
5042 if test -z "$GNUMAKE"; then
5043     if test -x "/opt/lo/bin/make"; then
5044         GNUMAKE="/opt/lo/bin/make"
5045     fi
5048 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
5049     if test -n "$a"; then
5050         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
5051         if test $? -eq 0;  then
5052             if test "$build_os" = "cygwin"; then
5053                 if test -n "$($a -v | grep 'Built for Windows')" ; then
5054                     AC_MSG_NOTICE([$a is a native Win32 make, which is not supported on this old branch.])
5055                     unset GNUMAKE
5056                 else
5057                     GNUMAKE=`which $a`
5058                     break
5059                 fi
5060             else
5061                 GNUMAKE=`which $a`
5062                 break
5063             fi
5064         fi
5065     fi
5066 done
5067 AC_MSG_RESULT($GNUMAKE)
5068 if test -z "$GNUMAKE"; then
5069     AC_MSG_ERROR([not found. install GNU make.])
5072 TAB=`printf '\t'`
5074 AC_MSG_CHECKING([the GNU make version])
5075 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5076 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5077 if test "$_make_longver" -ge "038200"; then
5078     AC_MSG_RESULT([$GNUMAKE $_make_version])
5080 elif test "$_make_longver" -ge "038100"; then
5081     if test "$build_os" = "cygwin"; then
5082         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5083     fi
5084     AC_MSG_RESULT([$GNUMAKE $_make_version])
5086     dnl ===================================================================
5087     dnl Search all the common names for sha1sum
5088     dnl ===================================================================
5089     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5090     if test -z "$SHA1SUM"; then
5091         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
5092     elif test "$SHA1SUM" = "openssl"; then
5093         SHA1SUM="openssl sha1"
5094     fi
5095     AC_MSG_CHECKING([for GNU make bug 20033])
5096     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5097     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5098 A := \$(wildcard *.a)
5100 .PHONY: all
5101 all: \$(A:.a=.b)
5102 <TAB>@echo survived bug20033.
5104 .PHONY: setup
5105 setup:
5106 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5108 define d1
5109 @echo lala \$(1)
5110 @sleep 1
5111 endef
5113 define d2
5114 @echo tyty \$(1)
5115 @sleep 1
5116 endef
5118 %.b : %.a
5119 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5120 <TAB>\$(call d1,\$(CHECKSUM)),\
5121 <TAB>\$(call d2,\$(CHECKSUM)))
5123     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5124         no_parallelism_make="YES"
5125         AC_MSG_RESULT([yes, disable parallelism])
5126     else
5127         AC_MSG_RESULT([no, keep parallelism enabled])
5128     fi
5129     rm -rf $TESTGMAKEBUG20033
5130 else
5131     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5134 # find if gnumake support file function
5135 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
5136 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5137 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5138 \$(file >test.txt,Success )
5140 .PHONY: all
5141 all:
5142 <TAB>@cat test.txt
5145 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5146 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5147     HAVE_GNUMAKE_FILE_FUNC=TRUE
5148     AC_MSG_RESULT([yes])
5149 else
5150     AC_MSG_RESULT([no])
5152 rm -rf $TESTGMAKEFILEFUNC
5153 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5154 AC_SUBST(GNUMAKE)
5156 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
5157 STALE_MAKE=
5158 make_warning=
5159 if test "$_make_ver_check" = ""; then
5160    STALE_MAKE=TRUE
5163 HAVE_LD_HASH_STYLE=FALSE
5164 WITH_LINKER_HASH_STYLE=
5165 AC_MSG_CHECKING( for --hash-style gcc linker support )
5166 if test "$GCC" = "yes"; then
5167     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5168         hash_styles="gnu sysv"
5169     elif test "$with_linker_hash_style" = "no"; then
5170         hash_styles=
5171     else
5172         hash_styles="$with_linker_hash_style"
5173     fi
5175     for hash_style in $hash_styles; do
5176         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5177         hash_style_ldflags_save=$LDFLAGS
5178         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5180         AC_LINK_IFELSE([AC_LANG_PROGRAM(
5181             [
5182 #include <stdio.h>
5183             ],[
5184 printf ("");
5185             ])],
5186             [ if ./conftest$EXEEXT; then
5187                   HAVE_LD_HASH_STYLE=TRUE
5188                   WITH_LINKER_HASH_STYLE=$hash_style
5189               fi],
5190             [HAVE_LD_HASH_STYLE=FALSE])
5191         LDFLAGS=$hash_style_ldflags_save
5192     done
5194     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5195         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5196     else
5197         AC_MSG_RESULT( no )
5198     fi
5199     LDFLAGS=$hash_style_ldflags_save
5200 else
5201     AC_MSG_RESULT( no )
5203 AC_SUBST(HAVE_LD_HASH_STYLE)
5204 AC_SUBST(WITH_LINKER_HASH_STYLE)
5206 dnl ===================================================================
5207 dnl Check whether there's a Perl version available.
5208 dnl ===================================================================
5209 if test -z "$with_perl_home"; then
5210     AC_PATH_PROG(PERL, perl)
5211 else
5212     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5213     _perl_path="$with_perl_home/bin/perl"
5214     if test -x "$_perl_path"; then
5215         PERL=$_perl_path
5216     else
5217         AC_MSG_ERROR([$_perl_path not found])
5218     fi
5221 dnl ===================================================================
5222 dnl Testing for Perl version 5 or greater.
5223 dnl $] is the Perl version variable, it is returned as an integer
5224 dnl ===================================================================
5225 if test "$PERL"; then
5226     AC_MSG_CHECKING([the Perl version])
5227     ${PERL} -e "exit($]);"
5228     _perl_version=$?
5229     if test "$_perl_version" -lt 5; then
5230         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5231     fi
5232     AC_MSG_RESULT([checked (perl $_perl_version)])
5233 else
5234     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5237 dnl ===================================================================
5238 dnl Testing for required Perl modules
5239 dnl ===================================================================
5241 AC_MSG_CHECKING([for required Perl modules])
5242 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5243     AC_MSG_RESULT([all modules found])
5244 else
5245     AC_MSG_RESULT([failed to find some modules])
5246     # Find out which modules are missing.
5247     missing_perl_modules=
5248     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5249        missing_perl_modules=Archive::Zip
5250     fi
5251     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5252        missing_perl_modules="$missing_perl_modules Cwd"
5253     fi
5254     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5255        missing_perl_modules="$missing_perl_modules Digest::MD5"
5256     fi
5257        AC_MSG_ERROR([
5258     The missing Perl modules are: $missing_perl_modules
5259     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5262 dnl ===================================================================
5263 dnl Check for pkg-config
5264 dnl ===================================================================
5265 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5266     PKG_PROG_PKG_CONFIG
5269 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5271     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5272     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5273     # explicitly. Or put /path/to/compiler in PATH yourself.
5275     AC_CHECK_TOOL(AR,ar)
5276     AC_CHECK_TOOL(NM,nm)
5277     AC_CHECK_TOOL(OBJDUMP,objdump)
5278     AC_CHECK_TOOL(RANLIB,ranlib)
5279     AC_CHECK_TOOL(READELF,readelf)
5280     AC_CHECK_TOOL(STRIP,strip)
5281     if test "$_os" = "WINNT"; then
5282         AC_CHECK_TOOL(DLLTOOL,dlltool)
5283         AC_CHECK_TOOL(WINDRES,windres)
5284     fi
5286 AC_SUBST(AR)
5287 AC_SUBST(DLLTOOL)
5288 AC_SUBST(NM)
5289 AC_SUBST(OBJDUMP)
5290 AC_SUBST(PKG_CONFIG)
5291 AC_SUBST(RANLIB)
5292 AC_SUBST(READELF)
5293 AC_SUBST(STRIP)
5294 AC_SUBST(WINDRES)
5296 dnl ===================================================================
5297 dnl pkg-config checks on Mac OS X
5298 dnl ===================================================================
5300 if test $_os = Darwin; then
5301     AC_MSG_CHECKING([for bogus pkg-config])
5302     if test -n "$PKG_CONFIG"; then
5303         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5304             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5305         else
5306             if test "$enable_bogus_pkg_config" = "yes"; then
5307                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5308             else
5309                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5310             fi
5311         fi
5312     else
5313         AC_MSG_RESULT([no, good])
5314     fi
5317 find_csc()
5319     # Return value: $csctest
5321     unset csctest
5323     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5324     if test -n "$regvalue"; then
5325         csctest=$regvalue
5326         return
5327     fi
5330 find_al()
5332     # Return value: $altest
5334     unset altest
5336     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5337         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5338         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5339             altest=$regvalue
5340             return
5341         fi
5342     done
5345 find_dotnetsdk()
5347     # Return value: $frametest (that's a silly name...)
5349     unset frametest
5351     for ver in 1.1 2.0; do
5352         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5353         if test -n "$regvalue"; then
5354             frametest=$regvalue
5355             return
5356         fi
5357     done
5360 find_winsdk_version()
5362     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5363     # Return value: $winsdktest
5365     unset winsdktest
5367     # Why we look for them in this particular order I don't know. But OTOH I
5368     case "$1" in
5369     6.0*|7.*)
5370         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5371         if test -n "$regvalue"; then
5372             winsdktest=$regvalue
5373             return
5374         fi
5375         ;;
5376     8.*)
5377         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5378         if test -n "$regvalue"; then
5379             winsdktest=$regvalue
5380             return
5381         fi
5382         ;;
5383     esac
5386 find_winsdk()
5388     # Args: $1 (optional) : list of acceptable SDK versions
5389     # Return value: $winsdktest
5391     unset winsdktest
5393     if test -n "$1"; then
5394         sdkversions=$1
5395     else
5396         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5397     fi
5399     for ver in $sdkversions; do
5400         find_winsdk_version $ver
5401         if test -n "$winsdktest"; then
5402             return
5403         fi
5404     done
5407 find_msms()
5409     for ver in 10.0 11.0; do
5410         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5411         if test -n "$regvalue"; then
5412             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5413                 msmdir=$regvalue
5414                 break
5415             fi
5416         fi
5417     done
5418     if test -z "$msmdir"; then
5419         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "${COMMONPROGRAMFILES}/Merge Modules/"])
5420         msmdir="${COMMONPROGRAMFILES}/Merge Modules/"
5421     fi
5422     msmdir=`cygpath -m "$msmdir"`
5423     if test -z "$msmdir"; then
5424         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5425             AC_MSG_ERROR([Merge modules not found in $msmdir])
5426         else
5427             AC_MSG_WARN([Merge modules not found in $msmdir])
5428             msmdir=""
5429         fi
5430     fi
5433 find_msvc_x64_dlls()
5435     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5436     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5437     for dll in $msvcdlls; do
5438         if ! test -f "$msvcdllpath/$dll"; then
5439             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5440         fi
5441     done
5444 if test "$build_os" = "cygwin"; then
5445     dnl Check midl.exe
5446     AC_MSG_CHECKING([for midl.exe])
5448     find_winsdk
5449     if test -f "$winsdktest/Bin/midl.exe"; then
5450         MIDL_PATH="$winsdktest/Bin"
5451     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5452         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5453     fi
5454     if test ! -f "$MIDL_PATH/midl.exe"; then
5455         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5456     else
5457         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5458     fi
5460     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5461     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
5462     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
5464     dnl Check csc.exe
5465     AC_MSG_CHECKING([for csc.exe])
5466     find_csc
5467     if test -f "$csctest/csc.exe"; then
5468         CSC_PATH="$csctest"
5469     fi
5470     if test ! -f "$CSC_PATH/csc.exe"; then
5471         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5472     else
5473         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5474     fi
5476     CSC_PATH=`cygpath -d "$CSC_PATH"`
5477     CSC_PATH=`cygpath -u "$CSC_PATH"`
5479     dnl Check al.exe
5480     AC_MSG_CHECKING([for al.exe])
5481     find_winsdk
5482     if test -f "$winsdktest/Bin/al.exe"; then
5483         AL_PATH="$winsdktest/Bin"
5484     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5485         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5486     fi
5488     if test -z "$AL_PATH"; then
5489         find_al
5490         if test -f "$altest/bin/al.exe"; then
5491             AL_PATH="$altest/bin"
5492         elif test -f "$altest/al.exe"; then
5493             AL_PATH="$altest"
5494         fi
5495     fi
5496     if test ! -f "$AL_PATH/al.exe"; then
5497         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5498     else
5499         AC_MSG_RESULT([$AL_PATH/al.exe])
5500     fi
5502     AL_PATH=`cygpath -d "$AL_PATH"`
5503     AL_PATH=`cygpath -u "$AL_PATH"`
5505     dnl Check mscoree.lib / .NET Framework dir
5506     AC_MSG_CHECKING(.NET Framework)
5507     find_dotnetsdk
5508     if test -f "$frametest/lib/mscoree.lib"; then
5509         DOTNET_FRAMEWORK_HOME="$frametest"
5510     else
5511         find_winsdk
5512         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5513             DOTNET_FRAMEWORK_HOME="$winsdktest"
5514         fi
5515     fi
5517     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5518         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5519     fi
5520     AC_MSG_RESULT(found)
5522     PathFormat "$MIDL_PATH"
5523     MIDL_PATH="$formatted_path"
5525     PathFormat "$AL_PATH"
5526     AL_PATH="$formatted_path"
5528     PathFormat "$DOTNET_FRAMEWORK_HOME"
5529     DOTNET_FRAMEWORK_HOME="$formatted_path"
5531     PathFormat "$CSC_PATH"
5532     CSC_PATH="$formatted_path"
5535 dnl ===================================================================
5536 dnl Check if stdc headers are available excluding MSVC.
5537 dnl ===================================================================
5538 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5539     AC_HEADER_STDC
5542 dnl ===================================================================
5543 dnl Testing for C++ compiler and version...
5544 dnl ===================================================================
5546 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5547     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5548     save_CXXFLAGS=$CXXFLAGS
5549     AC_PROG_CXX
5550     CXXFLAGS=$save_CXXFLAGS
5551 else
5552     if test -n "$CC" -a -z "$CXX"; then
5553         CXX="$CC"
5554     fi
5557 dnl check for GNU C++ compiler version
5558 if test "$GXX" = "yes"; then
5559     AC_MSG_CHECKING([the GNU C++ compiler version])
5561     _gpp_version=`$CXX -dumpversion`
5562     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5564     if test "$_gpp_majmin" -lt "401"; then
5565         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5566     else
5567         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5568     fi
5570     dnl see https://code.google.com/p/android/issues/detail?id=41770
5571     if test "$_gpp_majmin" -ge "401"; then
5572         glibcxx_threads=no
5573         AC_LANG_PUSH([C++])
5574         AC_REQUIRE_CPP
5575         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5576         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5577             #include <bits/c++config.h>]],[[
5578             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5579             && !defined(_GLIBCXX__PTHREADS) \
5580             && !defined(_GLIBCXX_HAS_GTHREADS)
5581             choke me
5582             #endif
5583         ]])],[AC_MSG_RESULT([yes])
5584         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5585         AC_LANG_POP([C++])
5586         if test $glibcxx_threads = yes; then
5587               BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5588         fi
5589      fi
5591 AC_SUBST(BOOST_CXXFLAGS)
5594 # prefx CXX with ccache if needed
5596 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5597     if test "$CCACHE" != ""; then
5598         AC_MSG_CHECKING([whether $CXX is already ccached])
5599         AC_LANG_PUSH([C++])
5600         save_CXXFLAGS=$CXXFLAGS
5601         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5602         dnl an empty program will do, we're checking the compiler flags
5603         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5604                           [use_ccache=yes], [use_ccache=no])
5605         if test $use_ccache = yes; then
5606             AC_MSG_RESULT([yes])
5607         else
5608             CXX="$CCACHE $CXX"
5609             AC_MSG_RESULT([no])
5610         fi
5611         CXXFLAGS=$save_CXXFLAGS
5612         AC_LANG_POP([C++])
5613     fi
5616 dnl ===================================================================
5617 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5618 dnl ===================================================================
5620 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5621     AC_PROG_CXXCPP
5623     dnl Check whether there's a C pre-processor.
5624     dnl ===================================================================
5625     dnl When using SunStudio compiler, there is a bug with the cc
5626     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5627     dnl See Issuezilla #445.
5628     dnl ===================================================================
5629     if test "$_os" = "SunOS"; then
5630         CPP=$CXXCPP
5631     else
5632         AC_PROG_CPP
5633     fi
5637 dnl ===================================================================
5638 dnl Find integral type sizes and alignments
5639 dnl ===================================================================
5641 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5643     AC_CHECK_SIZEOF(long)
5644     AC_CHECK_SIZEOF(short)
5645     AC_CHECK_SIZEOF(int)
5646     AC_CHECK_SIZEOF(long long)
5647     AC_CHECK_SIZEOF(double)
5648     AC_CHECK_SIZEOF(void*)
5650     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5651     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5652     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5653     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5654     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5656     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5657     m4_pattern_allow([AC_CHECK_ALIGNOF])
5658     m4_ifdef([AC_CHECK_ALIGNOF],
5659         [
5660             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5661             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5662             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5663             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5664         ],
5665         [
5666             case "$_os-$host_cpu" in
5667             Linux-i686)
5668                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5669                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5670                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5671                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5672                 ;;
5673             Linux-x86_64)
5674                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5675                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5676                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5677                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5678                 ;;
5679             *)
5680                 if test -z "$ac_cv_alignof_short" -o \
5681                         -z "$ac_cv_alignof_int" -o \
5682                         -z "$ac_cv_alignof_long" -o \
5683                         -z "$ac_cv_alignof_double"; then
5684                    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.])
5685                 fi
5686                 ;;
5687             esac
5688         ])
5690     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5691     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5692     if test $ac_cv_sizeof_long -eq 8; then
5693         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5694     elif test $ac_cv_sizeof_double -eq 8; then
5695         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5696     else
5697         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5698     fi
5700     dnl Check for large file support
5701     AC_SYS_LARGEFILE
5702     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5703         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5704     fi
5705     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5706         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5707     fi
5708 else
5709     # Hardcode for MSVC
5710     SAL_TYPES_SIZEOFSHORT=2
5711     SAL_TYPES_SIZEOFINT=4
5712     SAL_TYPES_SIZEOFLONG=4
5713     SAL_TYPES_SIZEOFLONGLONG=8
5714     if test "$BITNESS_OVERRIDE" = ""; then
5715         SAL_TYPES_SIZEOFPOINTER=4
5716     else
5717         SAL_TYPES_SIZEOFPOINTER=8
5718     fi
5719     SAL_TYPES_ALIGNMENT2=2
5720     SAL_TYPES_ALIGNMENT4=4
5721     SAL_TYPES_ALIGNMENT8=8
5722     LFS_CFLAGS=''
5724 AC_SUBST(LFS_CFLAGS)
5726 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5727 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5728 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5729 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5730 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5731 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5732 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5733 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5735 dnl ===================================================================
5736 dnl Check whether to enable runtime optimizations
5737 dnl ===================================================================
5738 ENABLE_RUNTIME_OPTIMIZATIONS=
5739 AC_MSG_CHECKING([whether to enable runtime optimizations])
5740 if test -z "$enable_runtime_optimizations"; then
5741     for i in $CC; do
5742         case $i in
5743         -fsanitize=address)
5744             enable_runtime_optimizations=no
5745             break
5746             ;;
5747         esac
5748     done
5750 if test "$enable_runtime_optimizations" != no; then
5751     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5752     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5753     AC_MSG_RESULT([yes])
5754 else
5755     AC_MSG_RESULT([no])
5757 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5759 dnl ===================================================================
5760 dnl Check if valgrind headers are available
5761 dnl ===================================================================
5762 ENABLE_VALGRIND=
5763 if test "$cross_compiling" != yes; then
5764     prev_cppflags=$CPPFLAGS
5765     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5766     # or where does it come from?
5767     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5768     AC_CHECK_HEADER([valgrind/valgrind.h],
5769         [ENABLE_VALGRIND=TRUE])
5770     CPPFLAGS=$prev_cppflags
5772 AC_SUBST([ENABLE_VALGRIND])
5773 if test -z "$ENABLE_VALGRIND"; then
5774     VALGRIND_CFLAGS=
5776 AC_SUBST([VALGRIND_CFLAGS])
5779 dnl ===================================================================
5780 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5781 dnl ===================================================================
5783 # We need at least the sys/sdt.h include header.
5784 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5785 if test "$SDT_H_FOUND" = "TRUE"; then
5786   # Found sys/sdt.h header, now make sure the c++ compiler works.
5787   # Old g++ versions had problems with probes in constructors/destructors.
5788   AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5789   AC_LANG_PUSH([C++])
5790   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5791     #include <sys/sdt.h>
5792     class ProbeClass
5793     {
5794     private:
5795       int& ref;
5796       const char *name;
5798     public:
5799       ProbeClass(int& v, const char *n) : ref(v), name(n)
5800       {
5801         DTRACE_PROBE2(_test_, cons, name, ref);
5802       }
5804       void method(int min)
5805       {
5806         DTRACE_PROBE3(_test_, meth, name, ref, min);
5807         ref -= min;
5808       }
5810       ~ProbeClass()
5811       {
5812         DTRACE_PROBE2(_test_, dest, name, ref);
5813       }
5814     };
5815   ]],[[
5816     int i = 64;
5817     DTRACE_PROBE1(_test_, call, i);
5818     ProbeClass inst = ProbeClass(i, "call");
5819     inst.method(24);
5820   ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5821         [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5822   AC_LANG_POP([C++])
5824 AC_CONFIG_HEADERS([config_host/config_probes.h])
5826 dnl ===================================================================
5827 dnl Set the MinGW sys-root
5828 dnl ===================================================================
5829 if test "$WITH_MINGW" = "yes"; then
5830     AC_MSG_CHECKING([for MinGW sysroot])
5831     sysroot=`$CC -print-sysroot`
5832     AS_IF([test -d "$sysroot"/mingw],
5833           [MINGW_SYSROOT="$sysroot"/mingw
5834            AC_MSG_RESULT([$MINGW_SYSROOT])],
5835           [AC_MSG_RESULT([not found])
5836            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5838 AC_SUBST([MINGW_DLLS])
5839 AC_SUBST([MINGW_SYSROOT])
5841 dnl ===================================================================
5842 dnl Set the MinGW include directories
5843 dnl ===================================================================
5844 if test "$WITH_MINGW" = "yes"; then
5845     AC_MSG_CHECKING([for MinGW include path])
5846     cat >conftest.$ac_ext <<_ACEOF
5847 #include <stddef.h>
5848 #include <bits/c++config.h>
5849 _ACEOF
5850     _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`
5851     rm conftest.$ac_ext
5852     if test -z "$_mingw_lib_include_path"; then
5853         _mingw_lib_include_path="NO_LIB_INCLUDE"
5854         AC_MSG_RESULT([no MinGW include path])
5855     else
5856         AC_MSG_RESULT([$_mingw_lib_include_path])
5857     fi
5858     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5859     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5861     AC_LANG_PUSH([C++])
5863     AC_MSG_CHECKING([for dynamic libgcc])
5864     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5865 #include <iostream>
5866 using namespace std;
5867 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5868             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5869             if test -n "$MINGW_GCCDLL"; then
5870                 MINGW_SHARED_GCCLIB=TRUE
5871                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5872             else
5873                 MINGW_SHARED_GCCLIB=
5874                 AC_MSG_RESULT([no])
5875             fi
5876        ],[ AC_MSG_RESULT([no])
5878     ])
5880     AC_MSG_CHECKING([for dynamic libstdc++])
5881     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5882 #include <iostream>
5883 using namespace std;
5884 ]], [[ cout << "Hello there." << endl; ]])],[
5885             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5886             if test -n "$MINGW_GXXDLL"; then
5887                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5888                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5889                 if test "$CROSS_COMPILING" = "TRUE"; then
5890                     dnl m4 escaping!
5891                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5892                 fi
5893                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5894                 MINGW_SHARED_GXXLIB=TRUE
5895                 AC_MSG_RESULT([$MINGW_GXXDLL])
5896             else
5897                 MINGW_SHARED_GXXLIB=
5898                 AC_MSG_RESULT([no])
5899             fi
5900        ],[ AC_MSG_RESULT([no])
5902     ])
5904     AC_LANG_POP([C++])
5906     AC_SUBST(MINGW_SHARED_GCCLIB)
5907     AC_SUBST(MINGW_SHARED_GXXLIB)
5908     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5909     AC_SUBST(MINGW_GCCDLL)
5910     AC_SUBST(MINGW_GXXDLL)
5913 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5914     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5917 if test "$WITH_MINGW" = "yes"; then
5918     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5919     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5920     [
5921     #include <usp10.h>
5922     ],
5923     [
5924     SCRIPT_CONTROL c;
5925     c.fMergeNeutralItems = 1;
5926     ])],
5927     [
5928     AC_MSG_RESULT(yes)
5929     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5930     ],
5931     [AC_MSG_RESULT(no)])
5934 dnl ===================================================================
5935 dnl Extra checking for the SunOS compiler
5936 dnl ===================================================================
5937 if test "$_os" = "SunOS"; then
5938     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5939     if test "$CC" = "cc"; then
5940     AC_MSG_CHECKING([SunStudio C++ Compiler])
5941         if test "$CXX" != "CC"; then
5942             AC_MSG_WARN([SunStudio C++ was not found])
5943             add_warning "SunStudio C++ was not found"
5944         else
5945             AC_MSG_RESULT([checked])
5946         fi
5947     fi
5950 dnl *************************************************************
5951 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5952 dnl *************************************************************
5953 if test "$WITH_MINGW" = "yes"; then
5954     AC_MSG_CHECKING([exception type])
5955     AC_LANG_PUSH([C++])
5956     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5958         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5960         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5961     ])
5962     AC_MSG_RESULT($exceptions_type)
5963     AC_LANG_POP([C++])
5966 EXCEPTIONS="$exceptions_type"
5967 AC_SUBST(EXCEPTIONS)
5969 dnl ===================================================================
5970 dnl thread-safe statics
5971 dnl ===================================================================
5972 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5973 unset HAVE_THREADSAFE_STATICS
5974 if test "$GCC" = "yes"; then
5975     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5976     dnl us.  However, some C++ runtimes use a single lock for all static
5977     dnl variables, which can cause deadlock in multi-threaded applications.
5978     dnl This is not easily tested here; for POSIX-based systems, if executing
5979     dnl the following C++ program does not terminate then the tool chain
5980     dnl apparently has this problem:
5981     dnl
5982     dnl   #include <pthread.h>
5983     dnl   int h() { return 0; }
5984     dnl   void * g(void * unused) {
5985     dnl     static int n = h();
5986     dnl     return &n;
5987     dnl   }
5988     dnl   int f() {
5989     dnl     pthread_t t;
5990     dnl     pthread_create(&t, 0, g, 0);
5991     dnl     pthread_join(t, 0);
5992     dnl     return 0;
5993     dnl   }
5994     dnl   int main() {
5995     dnl     static int n = f();
5996     dnl     return n;
5997     dnl   }
5998     dnl
5999     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
6000     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
6001     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
6002     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
6003     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
6004     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
6005     dnl it working in GCC >= 4.3, so conservative way to check here is to use
6006     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
6007     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
6008     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
6009     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
6010     dnl "too old"):
6011     if test "$_os" != Darwin -a "$_os" != Android; then
6012         if test "$COM_GCC_IS_CLANG" = TRUE; then
6013             AC_LANG_PUSH([C++])
6014             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6015 #include <list>
6016 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
6017 #error
6018 #endif
6019                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
6020             AC_LANG_POP([C++])
6021         elif test "${GCC_VERSION?}" -ge 0403; then
6022             HAVE_THREADSAFE_STATICS=TRUE
6023         fi
6024     fi
6025     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
6026         AC_DEFINE(HAVE_THREADSAFE_STATICS)
6027         AC_MSG_RESULT([yes])
6028     else
6029         AC_MSG_RESULT([broken (i.e., no)])
6030     fi
6031 else
6032     AC_MSG_RESULT([unknown (assuming no)])
6034 AC_SUBST(HAVE_THREADSAFE_STATICS)
6036 dnl ===================================================================
6037 dnl visibility and other gcc features
6038 dnl ===================================================================
6039 if test "$GCC" = "yes"; then
6040     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
6041     save_CFLAGS=$CFLAGS
6042     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
6043     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
6044     CFLAGS=$save_CFLAGS
6046     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6047         AC_MSG_RESULT([yes])
6048     else
6049         AC_MSG_RESULT([no])
6050     fi
6052     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
6053     save_CFLAGS=$CFLAGS
6054     CFLAGS="$CFLAGS -Werror -Wno-long-double"
6055     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
6056     CFLAGS=$save_CFLAGS
6057     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
6058         AC_MSG_RESULT([yes])
6059     else
6060         AC_MSG_RESULT([no])
6061     fi
6063     AC_MSG_CHECKING([whether $CC supports -mno-avx])
6064     save_CFLAGS=$CFLAGS
6065     CFLAGS="$CFLAGS -Werror -mno-avx"
6066     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6067     CFLAGS=$save_CFLAGS
6068     if test "$HAVE_GCC_AVX" = "TRUE"; then
6069         AC_MSG_RESULT([yes])
6070     else
6071         AC_MSG_RESULT([no])
6072     fi
6074     AC_MSG_CHECKING([whether $CC supports atomic functions])
6075     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6076     int v = 0;
6077     if (__sync_add_and_fetch(&v, 1) != 1 ||
6078         __sync_sub_and_fetch(&v, 1) != 0)
6079         return 1;
6080     __sync_synchronize();
6081     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6082         v != 1)
6083         return 1;
6084     return 0;
6085 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6086     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6087         AC_MSG_RESULT([yes])
6088         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6089     else
6090         AC_MSG_RESULT([no])
6091     fi
6093     AC_MSG_CHECKING(
6094         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
6095     save_CFLAGS=$CFLAGS
6096     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6097     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6098             #pragma GCC diagnostic ignored "-Wunused-parameter"
6099             void dummy(int n) {}
6100         ])], [
6101             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
6102             AC_MSG_RESULT([yes])
6103         ], [AC_MSG_RESULT([no])])
6104     CFLAGS=$save_CFLAGS
6106     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
6107     save_CFLAGS=$CFLAGS
6108     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6109     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6110             #pragma GCC diagnostic push
6111             #pragma GCC diagnostic ignored "-Wunused-parameter"
6112             void dummy(int n) {}
6113             #pragma GCC diagnostic pop
6114         ])], [
6115             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
6116             AC_MSG_RESULT([yes])
6117         ], [AC_MSG_RESULT([no])])
6118     CFLAGS=$save_CFLAGS
6120     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6121     save_CFLAGS=$CFLAGS
6122     CFLAGS="$CFLAGS -Werror"
6123     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6124             __attribute__((deprecated("test"))) void f();
6125         ])], [
6126             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6127             AC_MSG_RESULT([yes])
6128         ], [AC_MSG_RESULT([no])])
6129     CFLAGS=$save_CFLAGS
6131     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6132     AC_LANG_PUSH([C++])
6133     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6134             #include <cxxabi.h>
6135             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6136         ])], [
6137             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6138             AC_MSG_RESULT([yes])
6139         ], [AC_MSG_RESULT([no])])
6140     AC_LANG_POP([C++])
6142     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6143     AC_LANG_PUSH([C++])
6144     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6145             #include <cxxabi.h>
6146             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6147         ])], [
6148             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6149             AC_MSG_RESULT([yes])
6150         ], [AC_MSG_RESULT([no])])
6151     AC_LANG_POP([C++])
6153     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6154     AC_LANG_PUSH([C++])
6155     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6156             #include <cxxabi.h>
6157             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6158         ])], [
6159             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6160             AC_MSG_RESULT([yes])
6161         ], [AC_MSG_RESULT([no])])
6162     AC_LANG_POP([C++])
6164     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6165     AC_LANG_PUSH([C++])
6166     save_CXXFLAGS=$CXXFLAGS
6167     CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
6168     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6169             struct __attribute__((warn_unused)) dummy {};
6170         ])], [
6171             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6172             AC_MSG_RESULT([yes])
6173         ], [AC_MSG_RESULT([no])])
6174     CXXFLAGS=$save_CXXFLAGS
6175     AC_LANG_POP([C++])
6177     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6178     AC_LANG_PUSH([C++])
6179     save_CXXFLAGS=$CXXFLAGS
6180     CXXFLAGS="$CFLAGS -Werror -Wunused"
6181     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6182             #include <string>
6183             void f() { std::string s; }
6184         ])], [
6185             AC_MSG_RESULT([no])
6186         ], [
6187             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6188             AC_MSG_RESULT([yes])])
6189     CXXFLAGS=$save_CXXFLAGS
6190     AC_LANG_POP([C++])
6193 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
6194 AC_SUBST(HAVE_GCC_AVX)
6195 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6197 dnl ===================================================================
6198 dnl Identify the C++ library
6199 dnl ===================================================================
6201 AC_MSG_CHECKING([What the C++ library is])
6202 AC_LANG_PUSH([C++])
6203 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6204 #include <utility>
6205 #ifndef __GLIBCXX__
6206 foo bar
6207 #endif
6208 ]])],
6209     [CPP_LIBRARY=GLIBCXX
6210      cpp_library_name="GNU libstdc++"
6211     ],
6212     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6213 #include <utility>
6214 #ifndef _LIBCPP_VERSION
6215 foo bar
6216 #endif
6217 ]])],
6218     [CPP_LIBRARY=LIBCPP
6219      cpp_library_name="LLVM libc++"
6220     ],
6221     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6222 #include <utility>
6223 #ifndef _MSC_VER
6224 foo bar
6225 #endif
6226 ]])],
6227     [CPP_LIBRARY=MSVCRT
6228      cpp_library_name="Microsoft"
6229     ],
6230     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6231 AC_MSG_RESULT([$cpp_library_name])
6232 AC_LANG_POP([C++])
6233 AC_SUBST(CPP_LIBRARY)
6235 dnl ===================================================================
6236 dnl C++11
6237 dnl ===================================================================
6239 CXXFLAGS_CXX11=
6240 HAVE_CXX11=
6241 if test "$COM" = MSC; then
6242     AC_MSG_CHECKING([whether $CXX supports C++11])
6243     AC_MSG_RESULT(yes)
6244     # MSVC supports (a subset of) CXX11 without any switch
6245     HAVE_CXX11=TRUE
6246     CXXFLAGS_CXX11=
6247 elif test "$GCC" = "yes"; then
6248     CXXFLAGS_CXX11=
6249     AC_MSG_CHECKING([whether $CXX supports C++11])
6250     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6251         save_CXXFLAGS=$CXXFLAGS
6252         CXXFLAGS="$CXXFLAGS $flag -Werror"
6253         AC_LANG_PUSH([C++])
6254         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6255         AC_LANG_POP([C++])
6256         CXXFLAGS=$save_CXXFLAGS
6257         if test -n "$CXXFLAGS_CXX11"; then
6258             HAVE_CXX11=TRUE
6259             break
6260         fi
6261     done
6262     if test "$HAVE_CXX11" = TRUE; then
6263         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6264     else
6265         AC_MSG_RESULT(no)
6266     fi
6269 if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then
6270     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6271     AC_LANG_PUSH([C++])
6272     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6273 #include <list>
6274 #if !defined(__GLIBCXX__)
6275 /* ok */
6276 #elif __GLIBCXX__ < 20111004
6277 /* before breakage */
6278 #elif __GLIBCXX__ > 20120703
6279 /* after breakage */
6280 #else
6281 abi broken
6282 #endif
6283         ]])], [AC_MSG_RESULT(no, ok)],
6284         [AC_MSG_RESULT(yes, disabling C++11)
6285          HAVE_CXX11=])
6286     AC_LANG_POP([C++])
6289 if test "$HAVE_CXX11" = TRUE; then
6290     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6291     save_CXXFLAGS=$CXXFLAGS
6292     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6293     AC_LANG_PUSH([C++])
6295     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6296 #include <stddef.h>
6298 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6300 namespace
6302         struct b
6303         {
6304                 int i;
6305                 int j;
6306         };
6308 ]], [[
6309 struct a
6311         int i;
6312         int j;
6314 a thinga[]={{0,0}, {1,1}};
6315 b thingb[]={{0,0}, {1,1}};
6316 size_t i = sizeof(sal_n_array_size(thinga));
6317 size_t j = sizeof(sal_n_array_size(thingb));
6318 return !(i != 0 && j != 0);
6320         ], [ AC_MSG_RESULT(yes) ],
6321         [ AC_MSG_RESULT(no)
6322           HAVE_CXX11=
6323         ])
6324     AC_LANG_POP([C++])
6325     CXXFLAGS=$save_CXXFLAGS
6328 if test "$HAVE_CXX11" = TRUE; then
6329     AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6330     save_CXXFLAGS=$CXXFLAGS
6331     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6332     AC_LANG_PUSH([C++])
6334     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6335 #include <vector>
6336     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6337     // (__float128)
6339     ],[ AC_MSG_RESULT(yes) ],
6340     [
6341         AC_MSG_RESULT(no)
6342         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6343         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6344         # __float128 is available during its build, but it's usually built using GCC,
6345         # and so c++config.h hardcodes __float128 being supported). As the only place
6346         # where __float128 is actually used is in a template specialization,
6347         # -D__float128=void will avoid the problem there while still causing a problem
6348         # if somebody actually uses the type.
6349         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6350         CXXFLAGS="$CXXFLAGS -D__float128=void"
6351         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6352 #include <vector>
6353     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6354     // (__float128)
6356         ],
6357         [
6358          AC_MSG_RESULT(yes)
6359          CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6360         ],
6361         [
6362          AC_MSG_RESULT(no)
6363          HAVE_CXX11=
6364         ])
6365     ])
6367     AC_LANG_POP([C++])
6368     CXXFLAGS=$save_CXXFLAGS
6371 if test "$HAVE_CXX11" = "TRUE"; then
6372     AC_DEFINE(HAVE_CXX11)
6373 elif test -n "$CXXFLAGS_CXX11"; then
6374     AC_MSG_NOTICE([Disabling C++11 support])
6375     CXXFLAGS_CXX11=
6376 elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
6377     AC_MSG_ERROR([Selected libc++ but C++11 support broken])
6380 AC_SUBST(CXXFLAGS_CXX11)
6381 AC_SUBST(HAVE_CXX11)
6383 dnl ==================================
6384 dnl Check for C++11 "= delete" support
6385 dnl ==================================
6387 if test "$HAVE_CXX11" = "TRUE"; then
6388     AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6389     save_CXXFLAGS=$CXXFLAGS
6390     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6391     AC_LANG_PUSH([C++])
6392     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6393 struct A
6394     {
6395     void test() = delete;
6396     };
6397 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6399     AC_LANG_POP([C++])
6400     CXXFLAGS=$save_CXXFLAGS
6401     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6402         AC_MSG_RESULT([yes])
6403         AC_DEFINE([HAVE_CXX11_DELETE])
6404     else
6405         AC_MSG_RESULT([no])
6406     fi
6409 dnl ==================================
6410 dnl Check for C++11 "override" support
6411 dnl ==================================
6413 if test "$HAVE_CXX11" = "TRUE"; then
6414     AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6415     save_CXXFLAGS=$CXXFLAGS
6416     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6417     AC_LANG_PUSH([C++])
6418     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6419 struct A
6421         virtual void test();
6424 struct B : A
6426         virtual void test() override;
6428 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6430     AC_LANG_POP([C++])
6431     CXXFLAGS=$save_CXXFLAGS
6432     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6433         AC_MSG_RESULT([yes])
6434         AC_DEFINE([HAVE_CXX11_OVERRIDE])
6435     else
6436         AC_MSG_RESULT([no])
6437     fi
6440 dnl ==================================
6441 dnl Check for C++11 "final" support
6442 dnl ==================================
6444 if test "$HAVE_CXX11" = "TRUE"; then
6445     AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6446     save_CXXFLAGS=$CXXFLAGS
6447     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6448     AC_LANG_PUSH([C++])
6449     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6450 // First check that this correct program that uses "final" compiles
6451 struct A final
6455 struct B
6457         virtual void test();
6460 struct C : B
6462         void test() final;
6464 ]])],[have_final=yes],[])
6466     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6467 // Then check that the "final" works as expected,
6468 // that this program fails to compile
6469 struct A final
6473 struct B : A
6476 ]])],[],[final_class_works=yes])
6478     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6479 // Also this should fail to compile
6480 struct B
6482         virtual void test();
6485 struct C : B
6487         void test() final;
6490 struct D : C
6492         void test();
6494 ]])],[],[final_method_works=yes])
6495     AC_LANG_POP([C++])
6497     CXXFLAGS=$save_CXXFLAGS
6499     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6500         AC_MSG_RESULT([yes])
6501         AC_DEFINE([HAVE_CXX11_FINAL])
6502     else
6503         AC_MSG_RESULT([no])
6504     fi
6507 dnl ===================================================================
6508 dnl Check for C++11 perfect forwarding support
6509 dnl ===================================================================
6510 if test "$HAVE_CXX11" = "TRUE"; then
6511     AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6512     save_CXXFLAGS=$CXXFLAGS
6513     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6514     AC_LANG_PUSH([C++])
6515     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6516         #include <utility>
6517         template<typename T, typename... Args> T * f(Args &&... v) {
6518             return new T(std::forward<Args>(v)...);
6519         }
6520         ]], [[
6521         f<int>(0);
6522         ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6523     AC_LANG_POP([C++])
6524     CXXFLAGS=$save_CXXFLAGS
6525     AC_MSG_RESULT([$perfect_forwarding])
6526     if test "$perfect_forwarding" = yes; then
6527         AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6528     fi
6531 HAVE_GCC_PRAGMA_OPERATOR=
6532 dnl _Pragma support (may require C++11)
6533 if test "$GCC" = "yes"; then
6534     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6535     AC_LANG_PUSH([C++])
6536     save_CXXFLAGS=$CXXFLAGS
6537     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6538     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6539             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6540         ])], [
6541             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6542             HAVE_GCC_PRAGMA_OPERATOR=1
6543             AC_MSG_RESULT([yes])
6544         ], [AC_MSG_RESULT([no])])
6545     AC_LANG_POP([C++])
6546     CXXFLAGS=$save_CXXFLAGS
6548 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6550 dnl ===================================================================
6551 dnl system stl sanity tests
6552 dnl ===================================================================
6553 HAVE_GCC_VISIBILITY_BROKEN=
6554 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6556     AC_LANG_PUSH([C++])
6558     save_CPPFLAGS="$CPPFLAGS"
6559     if test -n "$MACOSX_SDK_PATH"; then
6560         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6561     fi
6563     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6564     # only.
6565     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6566         dnl gcc#19664, gcc#22482, rhbz#162935
6567         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6568         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6569         AC_MSG_RESULT([$stlvisok])
6570         if test "$stlvisok" = "no"; then
6571             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6572             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6573             unset HAVE_GCC_VISIBILITY_FEATURE
6574         fi
6575     fi
6577     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6578         sharedlink_ldflags_save=$LDFLAGS
6579         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6581         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6582         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6583 #include <sstream>
6584 using namespace std;
6585             ]], [[
6586 istringstream strm( "test" ); return 0;
6587             ]])],
6588             # Ugh, surely bad to assume an error message will contain
6589             # the word "unresolvable", a problem with
6590             # -fvisibility-inlines-hidden and STL headers might cause
6591             # some more obscure message on some platform, and anway,
6592             # the error message could be localised.
6593             [$EGREP -q unresolvable conftest.err;
6594             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6595         ])
6596         AC_MSG_RESULT([$gccvisok])
6597         if test "$gccvisok" = "no"; then
6598             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6599             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6600             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6601         fi
6603         LDFLAGS=$sharedlink_ldflags_save
6604     fi
6606     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6607     # when we don't make any dynamic libraries?
6608     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6609         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6610         cat > conftestlib1.cc <<_ACEOF
6611 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6612 struct S2: S1<int> { virtual ~S2(); };
6613 S2::~S2() {}
6614 _ACEOF
6615         cat > conftestlib2.cc <<_ACEOF
6616 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6617 struct S2: S1<int> { virtual ~S2(); };
6618 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6619 _ACEOF
6620         gccvisinlineshiddenok=yes
6621         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6622             gccvisinlineshiddenok=no
6623         else
6624             dnl At least Clang -fsanitize=address is known to not work with
6625             dnl -z defs (unsetting which makes the test moot, though):
6626             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6627             if test "$COM_GCC_IS_CLANG" = TRUE; then
6628                 for i in $CXX; do
6629                     case $i in
6630                     -fsanitize=address)
6631                         my_linkflagsnoundefs=
6632                         break
6633                         ;;
6634                     esac
6635                 done
6636             fi
6637             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6638                 gccvisinlineshiddenok=no
6639             fi
6640         fi
6642         rm -fr libconftest*
6643         AC_MSG_RESULT([$gccvisinlineshiddenok])
6644         if test "$gccvisinlineshiddenok" = "no"; then
6645             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6646             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6647             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6648         fi
6649     fi
6651     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6652         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6653         cat >visibility.cxx <<_ACEOF
6654 #pragma GCC visibility push(hidden)
6655 struct __attribute__ ((visibility ("default"))) TestStruct {
6656   static void Init();
6658 __attribute__ ((visibility ("default"))) void TestFunc() {
6659   TestStruct::Init();
6661 _ACEOF
6662         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6663             gccvisbroken=yes
6664         else
6665             case "$host_cpu" in
6666             i?86|x86_64)
6667                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6668                     gccvisbroken=no
6669                 else
6670                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6671                         gccvisbroken=no
6672                     else
6673                         gccvisbroken=yes
6674                     fi
6675                 fi
6676                 ;;
6677             *)
6678                 gccvisbroken=no
6679                 ;;
6680             esac
6681         fi
6682         rm -f visibility.s visibility.cxx
6684         AC_MSG_RESULT([$gccvisbroken])
6685         if test "$gccvisbroken" = "yes"; then
6686             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6687             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6688             unset HAVE_GCC_VISIBILITY_FEATURE
6689         fi
6690     fi
6692     CPPFLAGS="$save_CPPFLAGS"
6694     AC_LANG_POP([C++])
6697 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6698 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6700 dnl ===================================================================
6701 dnl  Clang++ tests
6702 dnl ===================================================================
6704 HAVE_GCC_FNO_DEFAULT_INLINE=
6705 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6706 if test "$GCC" = "yes"; then
6707     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6708     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6709         # Option just ignored and silly warning that isn't a real
6710         # warning printed
6711         :
6712     else
6713         AC_LANG_PUSH([C++])
6714         save_CXXFLAGS=$CXXFLAGS
6715         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6716         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6717         CXXFLAGS=$save_CXXFLAGS
6718         AC_LANG_POP([C++])
6719     fi
6720     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6721         AC_MSG_RESULT([yes])
6722     else
6723         AC_MSG_RESULT([no])
6724     fi
6726     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6727     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6728         # As above
6729         :
6730     else
6731         AC_LANG_PUSH([C++])
6732         save_CXXFLAGS=$CXXFLAGS
6733         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6734         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6735         CXXFLAGS=$save_CXXFLAGS
6736         AC_LANG_POP([C++])
6737     fi
6738     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6739         AC_MSG_RESULT([yes])
6740     else
6741         AC_MSG_RESULT([no])
6742     fi
6744 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6745 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6747 dnl ===================================================================
6748 dnl Compiler plugins
6749 dnl ===================================================================
6751 COMPILER_PLUGINS=
6752 # currently only Clang
6753 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6754     if test -n "$enable_compiler_plugins"; then
6755         compiler_plugins="$enable_compiler_plugins"
6756     elif test -n "$ENABLE_DBGUTIL"; then
6757         compiler_plugins=test
6758     else
6759         compiler_plugins=no
6760     fi
6761     if test "$compiler_plugins" != "no"; then
6762         dnl The prefix where Clang resides, override to where Clang resides if
6763         dnl using a source build:
6764         if test -z "$CLANGDIR"; then
6765             CLANGDIR=/usr
6766         fi
6767         AC_LANG_PUSH([C++])
6768         save_CPPFLAGS=$CPPFLAGS
6769         save_CXX=$CXX
6770         # compiler plugins must be built with "native" bitness of clang
6771         # because they link against clang libraries
6772         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6773         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6774         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6775             [COMPILER_PLUGINS=TRUE],
6776             [
6777             if test "$compiler_plugins" = "yes"; then
6778                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6779             else
6780                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6781                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6782             fi
6783             ])
6784         CXX=$save_CXX
6785         CPPFLAGS=$save_CPPFLAGS
6786         AC_LANG_POP([C++])
6787     fi
6788 else
6789     if test "$enable_compiler_plugins" = "yes"; then
6790         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6791     fi
6793 AC_SUBST(COMPILER_PLUGINS)
6794 AC_SUBST(CLANGDIR)
6796 # Plugin to help linker.
6797 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6798 # This makes --enable-lto build with clang work.
6799 AC_SUBST(LD_PLUGIN)
6801 dnl ===================================================================
6802 dnl allocator
6803 dnl ===================================================================
6804 AC_MSG_CHECKING([which memory allocator to use])
6805 if test "$with_alloc" = "system"; then
6806     AC_MSG_RESULT([system])
6807     ALLOC="SYS_ALLOC"
6809 if test "$with_alloc" = "tcmalloc"; then
6810     AC_MSG_RESULT(tcmalloc)
6811     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6812         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6813     fi
6814     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6815         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6816     ALLOC="TCMALLOC"
6818 if test "$with_alloc" = "jemalloc"; then
6819     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6820         AC_MSG_RESULT(jemalloc)
6821         save_CFLAGS=$CFLAGS
6822         CFLAGS="$CFLAGS -pthread"
6823         AC_CHECK_LIB([jemalloc], [malloc], [:],
6824             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6825         ALLOC="JEMALLOC"
6826         CFLAGS=$save_CFLAGS
6827     else
6828         AC_MSG_RESULT([system])
6829         ALLOC="SYS_ALLOC"
6830     fi
6832 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6833     AC_MSG_RESULT([internal])
6835 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6836 AC_SUBST(HAVE_POSIX_FALLOCATE)
6837 AC_SUBST(ALLOC)
6839 dnl ===================================================================
6840 dnl Custom build version
6841 dnl ===================================================================
6843 AC_MSG_CHECKING([whether to add custom build version])
6844 if test "$with_build_version" != ""; then
6845     BUILD_VER_STRING=$with_build_version
6846     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6847 else
6848     BUILD_VER_STRING=
6849     AC_MSG_RESULT([no])
6851 AC_SUBST(BUILD_VER_STRING)
6853 JITC_PROCESSOR_TYPE=""
6854 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6855     # IBMs JDK needs this...
6856     JITC_PROCESSOR_TYPE=6
6857     export JITC_PROCESSOR_TYPE
6859 AC_SUBST([JITC_PROCESSOR_TYPE])
6861 # Misc Windows Stuff
6862 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6863     find_msvc_x64_dlls
6864     find_msms
6865     MSVC_DLL_PATH="$msvcdllpath"
6866     MSVC_DLLS="$msvcdlls"
6867     MSM_PATH="$msmdir"
6868     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6871 AC_SUBST(MSVC_DLL_PATH)
6872 AC_SUBST(MSVC_DLLS)
6873 AC_SUBST(MSM_PATH)
6875 dnl ===================================================================
6876 dnl Checks for Java
6877 dnl ===================================================================
6878 if test "$ENABLE_JAVA" != ""; then
6880     # Windows-specific tests
6881     if test "$build_os" = "cygwin"; then
6882         if test "$BITNESS_OVERRIDE" = 64; then
6883             bitness=64
6884         else
6885             bitness=32
6886         fi
6888         if test -z "$with_jdk_home"; then
6889             for ver in 1.8 1.7 1.6; do
6890                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6891                if test -n "$regvalue"; then
6892                    _jdk_home=$regvalue
6893                    break
6894                fi
6895             done
6896             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6897                 with_jdk_home="$_jdk_home"
6898                 howfound="found automatically"
6899             else
6900                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6901             fi
6902         else
6903             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6904             howfound="you passed"
6905         fi
6906     fi
6908     JAVA_HOME=; export JAVA_HOME
6909     if test -z "$with_jdk_home"; then
6910         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6911     else
6912         _java_path="$with_jdk_home/bin/$with_java"
6913         dnl Check if there is a Java interpreter at all.
6914         if test -x "$_java_path"; then
6915             JAVAINTERPRETER=$_java_path
6916         else
6917             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6918         fi
6919     fi
6921     if test "$build_os" = "cygwin"; then
6922         # Check that the JDK found is correct architecture
6923         # Why is this necessary, we don't link with any library from the JDK I think,
6925         shortjdkhome=`cygpath -d "$with_jdk_home"`
6926         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
6927             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6928             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6929         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
6930             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6931             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6932         fi
6934         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6935             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6936         fi
6937         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6938         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6939     elif test $_os = Darwin -a "$BITNESS_OVERRIDE" = ""; then
6940         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6941         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6942         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6943         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6944         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6945             AC_MSG_RESULT([yes])
6946             JAVAIFLAGS=-d32
6947         else
6948             AC_MSG_RESULT([no])
6949         fi
6950     fi
6953 HAVE_JAVA6=
6954 dnl ===================================================================
6955 dnl Checks for JDK.
6956 dnl ===================================================================
6958 # Note that JAVA_HOME as for now always means the *build* platform's
6959 # JAVA_HOME. Whether all the complexity here actually is needed any
6960 # more or not, no idea.
6962 if test "$ENABLE_JAVA" != ""; then
6963     _gij_longver=0
6964     AC_MSG_CHECKING([the installed JDK])
6965     if test -n "$JAVAINTERPRETER"; then
6966         dnl java -version sends output to stderr!
6967         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6968             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6969         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6970             JDK=gcj
6971             AC_MSG_RESULT([checked (gcj)])
6972             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6973             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6975         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6976             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6977         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6978             JDK=ibm
6980             dnl IBM JDK specific tests
6981             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6982             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6984             if test "$_jdk_ver" -lt 10500; then
6985                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6986             fi
6987             if test "$_jdk_ver" -ge 10600; then
6988                 HAVE_JAVA6=TRUE
6989             fi
6991             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6993             if test "$with_jdk_home" = ""; then
6994                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6995 you must use the "--with-jdk-home" configure option explicitly])
6996             fi
6998            JAVA_HOME=$with_jdk_home
7000         else
7001             JDK=sun
7003             dnl Sun JDK specific tests
7004             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7005             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7007             if test "$_jdk_ver" -lt 10500; then
7008                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
7009             fi
7010             if test "$_jdk_ver" -gt 10600; then
7011                 JAVA_CLASSPATH_NOT_SET="1"
7012             fi
7013             if test "$_jdk_ver" -ge 10600; then
7014                 HAVE_JAVA6=TRUE
7015             fi
7017             AC_MSG_RESULT([checked (JDK $_jdk)])
7018             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7019             if test "$_os" = "WINNT"; then
7020                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7021             fi
7022         fi
7023     else
7024         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
7025     fi
7026 else
7027     dnl Java disabled
7028     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
7030 AC_SUBST([HAVE_JAVA6])
7032 dnl ===================================================================
7033 dnl Set target Java bytecode version
7034 dnl ===================================================================
7035 if test "$ENABLE_JAVA" != ""; then
7036     _java_target_ver="1.5"
7038     JAVA_SOURCE_VER="$_java_target_ver"
7039     JAVA_TARGET_VER="$_java_target_ver"
7042 dnl ===================================================================
7043 dnl Checks for javac
7044 dnl ===================================================================
7045 if test "$ENABLE_JAVA" != ""; then
7046     if test "$JDK" = "gcj"; then
7047         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
7048     else
7049         javacompiler="javac"
7050     fi
7051     if test -z "$with_jdk_home"; then
7052         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7053     else
7054         _javac_path="$with_jdk_home/bin/$javacompiler"
7055         dnl Check if there is a Java compiler at all.
7056         if test -x "$_javac_path"; then
7057             JAVACOMPILER=$_javac_path
7058         fi
7059     fi
7060     if test -z "$JAVACOMPILER"; then
7061         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7062     fi
7063     if test "$build_os" = "cygwin"; then
7064         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7065             JAVACOMPILER="${JAVACOMPILER}.exe"
7066         fi
7067         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
7068         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
7069     fi
7071     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
7072         AC_MSG_CHECKING([re-checking JDK])
7073         JDK=gcj
7074         AC_MSG_RESULT([checked (ecj)])
7075         _gij_longver="40200"
7076     fi
7079 JAVACISGCJ=""
7080 dnl ===================================================================
7081 dnl Checks that javac is gcj
7082 dnl ===================================================================
7083 if test "$ENABLE_JAVA" != ""; then
7084     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
7085         JAVACISGCJ="yes"
7086     fi
7088 AC_SUBST(JAVACISGCJ)
7090 dnl ===================================================================
7091 dnl Checks for javadoc
7092 dnl ===================================================================
7093 if test "$ENABLE_JAVA" != ""; then
7094     if test -z "$with_jdk_home"; then
7095         AC_PATH_PROG(JAVADOC, javadoc)
7096     else
7097         _javadoc_path="$with_jdk_home/bin/javadoc"
7098         dnl Check if there is a javadoc at all.
7099         if test -x "$_javadoc_path"; then
7100             JAVADOC=$_javadoc_path
7101         else
7102             AC_PATH_PROG(JAVADOC, javadoc)
7103         fi
7104     fi
7105     if test -z "$JAVADOC"; then
7106         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7107     fi
7108     if test "$build_os" = "cygwin"; then
7109         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7110             JAVADOC="${JAVADOC}.exe"
7111         fi
7112         JAVADOC=`cygpath -d "$JAVADOC"`
7113         JAVADOC=`cygpath -u "$JAVADOC"`
7114     fi
7116     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7117     JAVADOCISGJDOC="yes"
7118     fi
7120 AC_SUBST(JAVADOCISGJDOC)
7122 if test "$ENABLE_JAVA" != ""; then
7123     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7124     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7125         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7126            # try to recover first by looking whether we have a alternatives
7127            # system as in Debian or newer SuSEs where following /usr/bin/javac
7128            # over /etc/alternatives/javac leads to the right bindir where we
7129            # just need to strip a bit away to get a valid JAVA_HOME
7130            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7131         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7132             # maybe only one level of symlink (e.g. on Mac)
7133             JAVA_HOME=$(readlink $JAVACOMPILER)
7134             if test "$(dirname $JAVA_HOME)" = "."; then
7135                 # we've got no path to trim back
7136                 JAVA_HOME=""
7137             fi
7138         else
7139             # else warn
7140             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7141             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7142             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7143             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7144         fi
7145         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
7146         if test "$JAVA_HOME" != "/usr"; then
7147             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7148                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7149                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7150                 dnl Tiger already returns a JDK path..
7151                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7152             else
7153                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7154             fi
7155         fi
7156     fi
7157     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7159     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7160     if test -z "$JAVA_HOME"; then
7161         if test "x$with_jdk_home" = "x"; then
7162             cat > findhome.java <<_ACEOF
7163 [import java.io.File;
7165 class findhome
7167     public static void main(String args[])
7168     {
7169         String jrelocation = System.getProperty("java.home");
7170         File jre = new File(jrelocation);
7171         System.out.println(jre.getParent());
7172     }
7174 _ACEOF
7175             AC_MSG_CHECKING([if javac works])
7176             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7177             AC_TRY_EVAL(javac_cmd)
7178             if test $? = 0 -a -f ./findhome.class; then
7179                 AC_MSG_RESULT([javac works])
7180             else
7181                 echo "configure: javac test failed" >&5
7182                 cat findhome.java >&5
7183                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7184             fi
7185             AC_MSG_CHECKING([if gij knows its java.home])
7186             JAVA_HOME=`$JAVAINTERPRETER findhome`
7187             if test $? = 0 -a "$JAVA_HOME" != ""; then
7188                 AC_MSG_RESULT([$JAVA_HOME])
7189             else
7190                 echo "configure: java test failed" >&5
7191                 cat findhome.java >&5
7192                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7193             fi
7194             # clean-up after ourselves
7195             rm -f ./findhome.java ./findhome.class
7196         else
7197             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7198         fi
7199     fi
7201     dnl second sanity check JAVA_HOME if possible
7202     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
7203         # now check if $JAVA_HOME is really valid
7204         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7205             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7206                 JAVA_HOME_OK="NO"
7207             fi
7208         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7209             JAVA_HOME_OK="NO"
7210         fi
7211         if test "$JAVA_HOME_OK" = "NO"; then
7212             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7213             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7214             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7215             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7216             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7217             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7218         fi
7219     fi
7220     PathFormat "$JAVA_HOME"
7221     JAVA_HOME="$formatted_path"
7224 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7225     "$_os" != Darwin
7226 then
7227     AC_MSG_CHECKING([for JAWT lib])
7228     if test "$_os" = WINNT; then
7229         if test "$WITH_MINGW" = yes; then
7230             # The path is taken care of in gb_LinkTarget__use_jawt
7231             # in RepositoryExternal.mk:
7232             JAWTLIB=-ljawt
7233         else
7234             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7235             JAWTLIB=jawt.lib
7236         fi
7237     else
7238         case "$host_cpu" in
7239         arm*)
7240             my_java_arch=arm
7241             ;;
7242         i*86)
7243             my_java_arch=i386
7244             ;;
7245         m68k)
7246             my_java_arch=mk68
7247             ;;
7248         powerpc)
7249             my_java_arch=ppc
7250             ;;
7251         powerpc64*)
7252             my_java_arch=ppc64
7253             ;;
7254         x86_64)
7255             my_java_arch=amd64
7256             ;;
7257         *)
7258             my_java_arch=$host_cpu
7259             ;;
7260         esac
7261         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7262     fi
7263     AC_MSG_RESULT([$JAWTLIB])
7265 AC_SUBST(JAWTLIB)
7267 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7268     case "$host_os" in
7270     aix*)
7271         JAVAINC="-I$JAVA_HOME/include"
7272         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7273         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7274         ;;
7276     cygwin*)
7277         JAVAINC="-I$JAVA_HOME/include/win32"
7278         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7279         ;;
7281     darwin*)
7282         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
7283         ;;
7285     dragonfly*)
7286         JAVAINC="-I$JAVA_HOME/include"
7287         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7288         ;;
7290     freebsd*)
7291         JAVAINC="-I$JAVA_HOME/include"
7292         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7293         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7294         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7295         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7296         ;;
7298     k*bsd*-gnu*)
7299         JAVAINC="-I$JAVA_HOME/include"
7300         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7301         ;;
7303     linux-gnu*)
7304         JAVAINC="-I$JAVA_HOME/include"
7305         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7306         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7307         ;;
7309     mingw*)
7310         JAVAINC="-I$JAVA_HOME/include"
7311         ;;
7313     *netbsd*)
7314         JAVAINC="-I$JAVA_HOME/include"
7315         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7316         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7317        ;;
7319     openbsd*)
7320         JAVAINC="-I$JAVA_HOME/include"
7321         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7322         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7323         ;;
7325     solaris*)
7326         JAVAINC="-I$JAVA_HOME/include"
7327         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7328         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7329         ;;
7330     esac
7332 SOLARINC="$SOLARINC $JAVAINC"
7334 AC_SUBST(JAVACOMPILER)
7335 AC_SUBST(JAVADOC)
7336 AC_SUBST(JAVAINTERPRETER)
7337 AC_SUBST(JAVAIFLAGS)
7338 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7339 AC_SUBST(JAVA_HOME)
7340 AC_SUBST(JAVA_SOURCE_VER)
7341 AC_SUBST(JAVA_TARGET_VER)
7342 AC_SUBST(JDK)
7344 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7345 if test -n "$with_idlc_cpp"; then
7346     AC_MSG_RESULT([$with_idlc_cpp])
7347     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7348 else
7349     AC_MSG_RESULT([ucpp])
7350     AC_MSG_CHECKING([which ucpp tp use])
7351     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7352         AC_MSG_RESULT([external])
7353         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7354     else
7355         AC_MSG_RESULT([internal])
7356         BUILD_TYPE="$BUILD_TYPE UCPP"
7357     fi
7359 AC_SUBST(SYSTEM_UCPP)
7361 dnl ===================================================================
7362 dnl Check for epm (not needed for Windows)
7363 dnl ===================================================================
7364 AC_MSG_CHECKING([whether to enable EPM for packing])
7365 if test "$enable_epm" = "yes"; then
7366     AC_MSG_RESULT([yes])
7367     if test "$_os" != "WINNT"; then
7368         if test $_os = Darwin; then
7369             EPM=internal
7370         elif test -n "$with_epm"; then
7371             EPM=$with_epm
7372         else
7373             AC_PATH_PROG(EPM, epm, no)
7374         fi
7375         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7376             echo "EPM will be built."
7377             BUILD_TYPE="$BUILD_TYPE EPM"
7378             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7379         else
7380             # Gentoo has some epm which is something different...
7381             AC_MSG_CHECKING([whether the found epm is the right epm])
7382             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7383                 AC_MSG_RESULT([yes])
7384             else
7385                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7386             fi
7387             AC_MSG_CHECKING([epm version])
7388             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7389             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7390                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7391                 AC_MSG_RESULT([OK, >= 3.7])
7392             else
7393                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7394                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7395             fi
7396         fi
7397     fi
7399     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7400         AC_MSG_CHECKING([for rpm])
7401         for a in "$RPM" rpmbuild rpm; do
7402             $a --usage >/dev/null 2> /dev/null
7403             if test $? -eq 0; then
7404                 RPM=$a
7405                 break
7406             else
7407                 $a --version >/dev/null 2> /dev/null
7408                 if test $? -eq 0; then
7409                     RPM=$a
7410                     break
7411                 fi
7412             fi
7413         done
7414         if test -z "$RPM"; then
7415             AC_MSG_ERROR([not found])
7416         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7417             RPM_PATH=`which $RPM`
7418             AC_MSG_RESULT([$RPM_PATH])
7419             SCPDEFS="$SCPDEFS -DWITH_RPM"
7420         else
7421             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7422         fi
7423     fi
7424     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7425         AC_PATH_PROG(DPKG, dpkg, no)
7426         if test "$DPKG" = "no"; then
7427             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7428         fi
7429     fi
7430     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7431        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7432         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7433             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7434                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7435                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7436                     AC_MSG_RESULT([yes])
7437                 else
7438                     AC_MSG_RESULT([no])
7439                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7440                         _pt="rpm"
7441                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7442                         add_warning "the rpms will need to be installed with --nodeps"
7443                     else
7444                         _pt="pkg"
7445                     fi
7446                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7447                     add_warning "the ${_pt}s will not be relocateable"
7448                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7449                                  relocation will work, you need to patch your epm with the
7450                                  patch in epm/epm-3.7.patch or build with
7451                                  --with-epm=internal which will build a suitable epm])
7452                 fi
7453             fi
7454         fi
7455     fi
7456     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7457         AC_PATH_PROG(PKGMK, pkgmk, no)
7458         if test "$PKGMK" = "no"; then
7459             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7460         fi
7461     fi
7462     AC_SUBST(RPM)
7463     AC_SUBST(DPKG)
7464     AC_SUBST(PKGMK)
7465 else
7466     for i in $PKGFORMAT; do
7467         case "$i" in
7468         aix | bsd | deb | pkg | rpm | native | portable)
7469             AC_MSG_ERROR(
7470                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7471             ;;
7472         esac
7473     done
7474     AC_MSG_RESULT([no])
7475     EPM=NO
7477 AC_SUBST(EPM)
7479 dnl ===================================================================
7480 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7481 dnl ===================================================================
7482 WINEGCC=
7483 if test "$enable_winegcc" = "yes"; then
7484     AC_PATH_PROG(WINEGCC, winegcc)
7485     if test "$WINEGCC" = ""; then
7486         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7487     fi
7488     CC_save="$CC"
7489     ac_exeext_save="$ac_exeext"
7490     CC="$WINEGCC -m32"
7491     ac_exeext=".exe"
7492     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7493 #include <stdio.h>
7494         ],[
7495 printf ("hello world\n");
7496         ])],,
7497         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7498     )
7499     CC="$CC_save"
7500     ac_exeext="$ac_exeext_save"
7502 AC_SUBST(WINEGCC)
7504 if test $_os = iOS; then
7505     enable_mpl_subset=yes
7506     enable_opengl=no
7507     enable_lotuswordpro=no
7508     enable_coinmp=yes
7509     enable_lpsolve=no
7510     enable_postgresql_sdbc=no
7511     enable_extension_integration=no
7512     enable_report_builder=no
7513     with_theme="tango"
7514     with_ppds=no
7517 ENABLE_LWP=
7518 if test "$enable_lotuswordpro" = "yes"; then
7519     ENABLE_LWP="TRUE"
7520     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7522 AC_SUBST(ENABLE_LWP)
7524 dnl ===================================================================
7525 dnl Check for gperf
7526 dnl ===================================================================
7527 AC_PATH_PROG(GPERF, gperf)
7528 if test -z "$GPERF"; then
7529     AC_MSG_ERROR([gperf not found but needed. Install it.])
7531 AC_MSG_CHECKING([gperf version])
7532 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7533     AC_MSG_RESULT([OK])
7534 else
7535     AC_MSG_ERROR([too old, you need at least 3.0.0])
7537 AC_SUBST(GPERF)
7539 dnl ===================================================================
7540 dnl Check for building ODK
7541 dnl ===================================================================
7542 if test "$enable_odk" = no; then
7543     unset DOXYGEN
7544 else
7545     if test "$with_doxygen" = no; then
7546         AC_MSG_CHECKING([for doxygen])
7547         unset DOXYGEN
7548         AC_MSG_RESULT([no])
7549     else
7550         if test "$with_doxygen" = yes; then
7551             AC_PATH_PROG([DOXYGEN], [doxygen])
7552             if test -z "$DOXYGEN"; then
7553                 if test "$enable_odk" = "" ; then
7554                     enable_odk="no"
7555                 else
7556                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7557                 fi
7558             fi
7559         else
7560             AC_MSG_CHECKING([for doxygen])
7561             DOXYGEN=$with_doxygen
7562             AC_MSG_RESULT([$DOXYGEN])
7563         fi
7564         if test -n "$DOXYGEN"; then
7565            DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7566            DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7567            if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7568               AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7569            fi
7570         fi
7571     fi
7573 AC_SUBST([DOXYGEN])
7575 AC_MSG_CHECKING([whether to build the ODK])
7576 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7577     AC_MSG_RESULT([yes])
7579     if test "$with_java" != "no"; then
7580         AC_MSG_CHECKING([whether to build unowinreg.dll])
7581         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7582             # build on Win by default
7583             enable_build_unowinreg=yes
7584         fi
7585         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7586             AC_MSG_RESULT([no])
7587             BUILD_UNOWINREG=
7588         else
7589             AC_MSG_RESULT([yes])
7590             BUILD_UNOWINREG=TRUE
7591         fi
7592         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7593             if test -z "$with_mingw_cross_compiler"; then
7594                 dnl Guess...
7595                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7596             elif test -x "$with_mingw_cross_compiler"; then
7597                  MINGWCXX="$with_mingw_cross_compiler"
7598             else
7599                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7600             fi
7602             if test "$MINGWCXX" = "false"; then
7603                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7604             fi
7606             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7607             if test -x "$mingwstrip_test"; then
7608                 MINGWSTRIP="$mingwstrip_test"
7609             else
7610                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7611             fi
7613             if test "$MINGWSTRIP" = "false"; then
7614                 AC_MSG_ERROR(MinGW32 binutils not found.)
7615             fi
7616         fi
7617     fi
7618     BUILD_TYPE="$BUILD_TYPE ODK"
7619 else
7620     AC_MSG_RESULT([no])
7621     BUILD_UNOWINREG=
7623 AC_SUBST(BUILD_UNOWINREG)
7624 AC_SUBST(MINGWCXX)
7625 AC_SUBST(MINGWSTRIP)
7627 dnl ===================================================================
7628 dnl Check for system zlib
7629 dnl ===================================================================
7630 if test "$with_system_zlib" = "auto"; then
7631     case "$_os" in
7632     WINNT)
7633         with_system_zlib="$with_system_libs"
7634         ;;
7635     *)
7636         with_system_zlib=yes
7637         ;;
7638     esac
7641 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7642 dnl and has no pkg-config for it at least on some tinderboxes,
7643 dnl so leaving that out for now
7644 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7645 AC_MSG_CHECKING([which zlib to use])
7646 if test "$with_system_zlib" = "yes"; then
7647     AC_MSG_RESULT([external])
7648     SYSTEM_ZLIB=TRUE
7649     AC_CHECK_HEADER(zlib.h, [],
7650         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7651     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7652         [AC_MSG_ERROR(zlib not found or functional)], [])
7653 else
7654     AC_MSG_RESULT([internal])
7655     SYSTEM_ZLIB=
7656     BUILD_TYPE="$BUILD_TYPE ZLIB"
7657     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7658     ZLIB_LIBS="-lzlib"
7660 AC_SUBST(ZLIB_CFLAGS)
7661 AC_SUBST(ZLIB_LIBS)
7662 AC_SUBST(SYSTEM_ZLIB)
7664 dnl ===================================================================
7665 dnl Check for system jpeg
7666 dnl ===================================================================
7667 if test "$with_system_jpeg" = "yes"; then
7668     AC_MSG_RESULT([external])
7669     SYSTEM_JPEG=TRUE
7670     AC_CHECK_HEADER(jpeglib.h, [],
7671         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7672     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7673     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7674     libo_MINGW_CHECK_DLL([libjpeg])
7675 else
7676     AC_MSG_RESULT([internal])
7677     SYSTEM_JPEG=
7678     BUILD_TYPE="$BUILD_TYPE JPEG"
7680 AC_SUBST(SYSTEM_JPEG)
7683 dnl ===================================================================
7684 dnl Check for system clucene
7685 dnl ===================================================================
7686 dnl we should rather be using
7687 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7688 dnl but the contribs-lib check seems tricky
7689 AC_MSG_CHECKING([which clucene to use])
7690 if test "$with_system_clucene" = "yes"; then
7691     AC_MSG_RESULT([external])
7692     SYSTEM_CLUCENE=TRUE
7693     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7694     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7695     AC_LANG_PUSH([C++])
7696     save_CXXFLAGS=$CXXFLAGS
7697     save_CPPFLAGS=$CPPFLAGS
7698     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7699     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7700     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7701     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7702     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7703                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7704     CXXFLAGS=$save_CXXFLAGS
7705     CPPFLAGS=$save_CPPFLAGS
7706     AC_LANG_POP([C++])
7708     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7709 else
7710     AC_MSG_RESULT([internal])
7711     SYSTEM_CLUCENE=
7712     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7714 AC_SUBST(SYSTEM_CLUCENE)
7715 AC_SUBST(CLUCENE_CFLAGS)
7716 AC_SUBST(CLUCENE_LIBS)
7718 dnl ===================================================================
7719 dnl Check for system expat
7720 dnl ===================================================================
7721 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7722 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7723 AC_MSG_CHECKING([which expat to use])
7724 if test "$with_system_expat" = "yes"; then
7725     AC_MSG_RESULT([external])
7726     SYSTEM_EXPAT=TRUE
7727     AC_CHECK_HEADER(expat.h, [],
7728         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7729     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7730         [AC_MSG_RESULT(expat library not found or functional.)], [])
7731     libo_MINGW_CHECK_DLL([libexpat])
7732 else
7733     AC_MSG_RESULT([internal])
7734     SYSTEM_EXPAT=
7735     BUILD_TYPE="$BUILD_TYPE EXPAT"
7737 AC_SUBST(SYSTEM_EXPAT)
7739 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7740 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7741     ENABLE_EOT="TRUE"
7742     AC_DEFINE([ENABLE_EOT])
7743     AC_MSG_RESULT([yes])
7745     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7746 else
7747     ENABLE_EOT=
7748     AC_MSG_RESULT([no])
7750 AC_SUBST([ENABLE_EOT])
7752 dnl ===================================================================
7753 dnl Check for system librevenge
7754 dnl ===================================================================
7755 AS_IF([test "$COM" = "MSC"],
7756       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7757       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7759 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7761 dnl ===================================================================
7762 dnl Check for system libe-book
7763 dnl ===================================================================
7764 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7766 dnl ===================================================================
7767 dnl Check for system libetonyek
7768 dnl ===================================================================
7769 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.1])
7771 dnl ===================================================================
7772 dnl Check for system libfreehand
7773 dnl ===================================================================
7774 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7776 dnl ===================================================================
7777 dnl Check for system libodfgen
7778 dnl ===================================================================
7779 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7781 dnl ===================================================================
7782 dnl Check for system libcdr
7783 dnl ===================================================================
7784 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7786 dnl ===================================================================
7787 dnl Check for system libmspub
7788 dnl ===================================================================
7789 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7791 dnl ===================================================================
7792 dnl Check for system libmwaw
7793 dnl ===================================================================
7794 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7796 dnl ===================================================================
7797 dnl Check for system libvisio
7798 dnl ===================================================================
7799 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7801 dnl ===================================================================
7802 dnl Check for system libcmis
7803 dnl ===================================================================
7804 # libcmis requires curl and we can't build curl for iOS
7805 if test $_os != iOS; then
7806     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.4 >= 0.4.0])
7807     ENABLE_CMIS=TRUE
7808 else
7809     ENABLE_CMIS=
7811 AC_SUBST(ENABLE_CMIS)
7813 dnl ===================================================================
7814 dnl Check for system libwpd
7815 dnl ===================================================================
7816 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs -lwpd-0.10"])
7818 dnl ===================================================================
7819 dnl Check for system lcms2
7820 dnl ===================================================================
7821 if test "$with_system_lcms2" = "yes"; then
7822     libo_MINGW_CHECK_DLL([liblcms2])
7823 else
7824     SYSTEM_LCMS2=
7826 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7827 if test "$GCC" = "yes"; then
7828     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7830 if test "$COM" = "MSC"; then # override the above
7831     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7834 dnl ===================================================================
7835 dnl Check for system cppunit
7836 dnl ===================================================================
7837 if test "$cross_compiling" != "yes"; then
7838     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7841 dnl ===================================================================
7842 dnl Check whether freetype is available
7843 dnl ===================================================================
7844 if test  "$test_freetype" = "yes"; then
7845     AC_MSG_CHECKING([whether freetype is available])
7846     # FreeType has 3 different kinds of versions
7847     # * release, like 2.4.10
7848     # * libtool, like 13.0.7 (this what pkg-config returns)
7849     # * soname
7850     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7851     #
7852     # 9.9.3 is 2.2.0
7853     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7854     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7855     SYSTEM_FREETYPE=TRUE
7856     _save_libs="$LIBS"
7857     _save_cflags="$CFLAGS"
7858     LIBS="$LIBS $FREETYPE_LIBS"
7859     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7860     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7861     LIBS="$_save_libs"
7862     CFLAGS="$_save_cflags"
7864 AC_SUBST(FREETYPE_CFLAGS)
7865 AC_SUBST(FREETYPE_LIBS)
7866 AC_SUBST([SYSTEM_FREETYPE])
7868 dnl ===================================================================
7869 dnl Check for system libabw
7870 dnl ===================================================================
7871 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7873 dnl ===================================================================
7874 dnl Check for system libwps
7875 dnl ===================================================================
7876 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.3])
7878 dnl ===================================================================
7879 dnl Check for system libwpg
7880 dnl ===================================================================
7881 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7883 # ===================================================================
7884 # Check for system libxslt
7885 # to prevent incompatibilities between internal libxml2 and external libxslt,
7886 # or vice versa, use with_system_libxml here
7887 # ===================================================================
7888 if test "$with_system_libxml" = "auto"; then
7889     case "$_os" in
7890     WINNT|iOS|Android)
7891         with_system_libxml="$with_system_libs"
7892         ;;
7893     *)
7894         if test "$_os" = "Darwin" -a $MAC_OS_X_VERSION_MAX_ALLOWED -lt 1060; then
7895             with_system_libxml=no
7896         else
7897             with_system_libxml=yes
7898         fi
7899         ;;
7900     esac
7903 AC_MSG_CHECKING([which libxslt to use])
7904 if test "$with_system_libxml" = "yes"; then
7905     AC_MSG_RESULT([external])
7906     SYSTEM_LIBXSLT=TRUE
7907     if test "$_os" = "Darwin"; then
7908         dnl make sure to use SDK path
7909         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7910         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7911         dnl omit -L/usr/lib
7912         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7913         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7914     else
7915         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7916         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7917         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7918         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7919     fi
7921     dnl Check for xsltproc
7922     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7923     if test "$XSLTPROC" = "no"; then
7924         AC_MSG_ERROR([xsltproc is required])
7925     fi
7927     libo_MINGW_CHECK_DLL([libxslt])
7928     libo_MINGW_CHECK_DLL([libexslt])
7929     libo_MINGW_TRY_DLL([iconv])
7930 else
7931     AC_MSG_RESULT([internal])
7932     SYSTEM_LIBXSLT=
7933     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7935     if test "$cross_compiling" = "yes"; then
7936         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7937         if test "$XSLTPROC" = "no"; then
7938             AC_MSG_ERROR([xsltproc is required])
7939         fi
7940     fi
7942 AC_SUBST(SYSTEM_LIBXSLT)
7943 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7944     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7946 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7948 AC_SUBST(LIBEXSLT_CFLAGS)
7949 AC_SUBST(LIBEXSLT_LIBS)
7950 AC_SUBST(LIBXSLT_CFLAGS)
7951 AC_SUBST(LIBXSLT_LIBS)
7952 AC_SUBST(XSLTPROC)
7954 # ===================================================================
7955 # Check for system libxml
7956 # ===================================================================
7957 AC_MSG_CHECKING([which libxml to use])
7958 if test "$with_system_libxml" = "yes"; then
7959     AC_MSG_RESULT([external])
7960     SYSTEM_LIBXML=TRUE
7961     if test "$_os" = "Darwin"; then
7962         dnl make sure to use SDK path
7963         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7964         dnl omit -L/usr/lib
7965         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7966     elif test $_os = iOS; then
7967         dnl make sure to use SDK path
7968         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7969         LIBXML_CFLAGS="-I$usr/include/libxml2"
7970         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7971     else
7972         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7973         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7974     fi
7976     dnl Check for xmllint
7977     AC_PATH_PROG(XMLLINT, xmllint, no)
7978     if test "$XMLLINT" = "no"; then
7979         AC_MSG_ERROR([xmllint is required])
7980     fi
7982     libo_MINGW_CHECK_DLL([libxml2])
7983     libo_MINGW_TRY_DLL([zlib1])
7984 else
7985     AC_MSG_RESULT([internal])
7986     SYSTEM_LIBXML=
7987     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7988     if test "$COM" = "MSC"; then
7989         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7990     fi
7991     if test "$COM" = "MSC"; then
7992         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7993     else
7994         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7995     fi
7996     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7998 AC_SUBST(SYSTEM_LIBXML)
7999 AC_SUBST(LIBXML_CFLAGS)
8000 AC_SUBST(LIBXML_LIBS)
8001 AC_SUBST(XMLLINT)
8003 # =====================================================================
8004 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
8005 # runtime requires Python 3 compatible version (>= 2.6)
8006 # Optionally user can pass an option to configure, i. e.
8007 # ./configure PYTHON=/usr/bin/python
8008 # =====================================================================
8009 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8010     # This allows a lack of system python with no error, we use internal one in that case.
8011     AM_PATH_PYTHON([2.5],, [:])
8012     # Clean PYTHON_VERSION checked below if cross-compiling
8013     PYTHON_VERSION=""
8014     if test "$PYTHON" != ":"; then
8015         PYTHON_FOR_BUILD=$PYTHON
8016     fi
8018 AC_SUBST(PYTHON_FOR_BUILD)
8020 # Checks for Python to use for Pyuno
8021 AC_MSG_CHECKING([which Python to use for Pyuno])
8022 case "$enable_python" in
8023 no|disable)
8024     if test -z $PYTHON_FOR_BUILD; then
8025         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8026         # requirement from the choice whether to include Python stuff in the installer, but why
8027         # bother?
8028         AC_MSG_ERROR([Python is required at build time.])
8029     fi
8030     enable_python=no
8031     AC_MSG_RESULT([none])
8032     ;;
8033 ""|yes|auto)
8034     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8035         AC_MSG_RESULT([no, overridden by --disable-scripting])
8036         enable_python=no
8037     elif test $build_os = cygwin; then
8038         dnl When building on Windows we don't attempt to use any installed
8039         dnl "system"  Python.
8040         dnl
8041         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8042         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8043         dnl MinGW cross-compilation setups.)
8044         AC_MSG_RESULT([fully internal])
8045         enable_python=internal
8046     elif test "$cross_compiling" = yes; then
8047         AC_MSG_RESULT([system])
8048         enable_python=system
8049     else
8050         # Unset variables set by the above AM_PATH_PYTHON so that
8051         # we actually do check anew.
8052         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
8053         AM_PATH_PYTHON([3.3],, [:])
8054         if test "$PYTHON" = :; then
8055             AC_MSG_RESULT([internal])
8056             enable_python=internal
8057         else
8058             AC_MSG_RESULT([system])
8059             enable_python=system
8060         fi
8061     fi
8062     ;;
8063 internal)
8064     AC_MSG_RESULT([internal])
8065     ;;
8066 fully-internal)
8067     AC_MSG_RESULT([fully internal])
8068     enable_python=internal
8069     ;;
8070 system)
8071     AC_MSG_RESULT([system])
8072     ;;
8074     AC_MSG_ERROR([Incorrect --enable-python option])
8075     ;;
8076 esac
8078 if test $enable_python != no; then
8079     BUILD_TYPE="$BUILD_TYPE PYUNO"
8082 if test $enable_python = system; then
8083     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8084         # We already have logic above to make sure the system Python
8085         # is used only when building against SDK 10.6 or newer.
8087         # Make sure we use the 2.6 Python when building against the
8088         # 10.6 SDK.
8089         case $with_macosx_sdk in
8090         10.6)
8091             python_version=2.6;;
8092         10.7|10.8)
8093             python_version=2.7;;
8094         *)
8095             # ???
8096             python_version=2.7;;
8097         esac
8098         PYTHON=python$python_version
8099         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
8100         PYTHON_LIBS="-framework Python"
8101     fi
8102     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8103         # Fallback: Accept these in the environment, or as set above
8104         # for MacOSX.
8105         :
8106     elif test "$cross_compiling" != yes; then
8107         # Unset variables set by the above AM_PATH_PYTHON so that
8108         # we actually do check anew.
8109         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
8110         # This causes an error if no python command is found
8111         AM_PATH_PYTHON([3.3])
8112         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8113         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8114         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8115         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8116         if test -z "$PKG_CONFIG"; then
8117             PYTHON_CFLAGS="-I$python_include"
8118             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8119         elif $PKG_CONFIG --exists python-$python_version; then
8120             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8121             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8122         else
8123             PYTHON_CFLAGS="-I$python_include"
8124             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8125         fi
8126     else
8127         dnl How to find out the cross-compilation Python installation path?
8128         dnl Let's hardocode what we know for different distributions for now...
8129         for python_version in 2.6; do
8130             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8131                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8132                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8133                 AC_MSG_CHECKING([for python.exe])
8134                 libo_MINGW_CHECK_DLL([libpython$python_version])
8135                 libo_MINGW_CHECK_DLL([libreadline6])
8136                 libo_MINGW_CHECK_DLL([libtermcap])
8137                 # could we somehow extract the really mingw python version from
8138                 # actual distro package?
8139                 # 2.6.2 currently on OpenSUSE 12.1?
8140                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8141                 PYTHON_VERSION=$python_version.2
8142                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8143                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8144                 break
8145             fi
8146         done
8147         AC_MSG_CHECKING([for python version])
8148         AS_IF([test -n "$PYTHON_VERSION"],
8149               [AC_MSG_RESULT([$PYTHON_VERSION])],
8150               [AC_MSG_RESULT([not found])
8151                AC_MSG_ERROR([no usable python found])])
8152         test -n "$PYTHON_CFLAGS" && break
8153     fi
8154     # let the PYTHON_FOR_BUILD match the same python installation that
8155     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8156     # better for PythonTests.
8157     PYTHON_FOR_BUILD=$PYTHON
8160 dnl By now enable_python should be "system", "internal" or "no"
8161 case $enable_python in
8162 system)
8163     SYSTEM_PYTHON=TRUE
8165     if test "$CROSS_COMPILING" != TRUE; then
8166         dnl Check if the headers really work
8167         save_CPPFLAGS="$CPPFLAGS"
8168         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8169         AC_CHECK_HEADER(Python.h, [],
8170            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8171            [])
8172         CPPFLAGS="$save_CPPFLAGS"
8174         AC_LANG_PUSH(C)
8175         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8176         AC_MSG_CHECKING([for correct python library version])
8177            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8178 #include <Python.h>
8180 int main(int argc, char **argv) {
8181        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8182            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8183        else return 1;
8185            ]])],[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])],[])
8186         CFLAGS=$save_CFLAGS
8187         AC_LANG_POP(C)
8189         dnl FIXME Check if the Python library can be linked with, too?
8190     fi
8191     ;;
8193 internal)
8194     SYSTEM_PYTHON=
8195     PYTHON_VERSION_MAJOR=3
8196     PYTHON_VERSION_MINOR=3
8197     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8198     BUILD_TYPE="$BUILD_TYPE PYTHON"
8199     # Embedded Python dies without Home set
8200     if test "$HOME" = ""; then
8201         export HOME=""
8202     fi
8203     # bz2 tarball and bzip2 is not standard
8204     if test -z "$BZIP2"; then
8205         AC_PATH_PROG( BZIP2, bzip2)
8206         if test -z "$BZIP2"; then
8207             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8208         fi
8209     fi
8210     ;;
8212     DISABLE_PYTHON=TRUE
8213     SYSTEM_PYTHON=
8214     ;;
8216     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8217     ;;
8218 esac
8220 AC_SUBST(DISABLE_PYTHON)
8221 AC_SUBST(SYSTEM_PYTHON)
8222 AC_SUBST(PYTHON_CFLAGS)
8223 AC_SUBST(PYTHON_LIBS)
8224 AC_SUBST(PYTHON_VERSION)
8225 AC_SUBST(PYTHON_VERSION_MAJOR)
8226 AC_SUBST(PYTHON_VERSION_MINOR)
8228 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8229 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8230     AC_MSG_RESULT([yes])
8231     ENABLE_MARIADBC=TRUE
8232     MARIADBC_MAJOR=1
8233     MARIADBC_MINOR=0
8234     MARIADBC_MICRO=2
8235     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8236 else
8237     AC_MSG_RESULT([no])
8238     ENABLE_MARIADBC=
8240 AC_SUBST(ENABLE_MARIADBC)
8241 AC_SUBST(MARIADBC_MAJOR)
8242 AC_SUBST(MARIADBC_MINOR)
8243 AC_SUBST(MARIADBC_MICRO)
8245 if test "$ENABLE_MARIADBC" = "TRUE"; then
8247     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8249     dnl ===================================================================
8250     dnl Check for system MariaDB
8251     dnl ===================================================================
8252     AC_MSG_CHECKING([which MariaDB to use])
8253     if test "$with_system_mariadb" = "yes"; then
8254         AC_MSG_RESULT([external])
8255         SYSTEM_MARIADB=TRUE
8256         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8257         if test -z "$MARIADBCONFIG"; then
8258             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8259             if test -z "$MARIADBCONFIG"; then
8260                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8261                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8262             fi
8263         fi
8264         AC_MSG_CHECKING([MariaDB version])
8265         MARIADB_VERSION=`$MARIADBCONFIG --version`
8266         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8267         if test "$MARIADB_MAJOR" -ge "5"; then
8268             AC_MSG_RESULT([OK])
8269         else
8270             AC_MSG_ERROR([too old, use 5.0.x or later])
8271         fi
8272         AC_MSG_CHECKING([for MariaDB Client library])
8273         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8274         if test "$COM_GCC_IS_CLANG" = TRUE; then
8275             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8276         fi
8277         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8278         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8279         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8280         dnl linux32:
8281         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8282             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8283             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8284                 | sed -e 's|/lib64/|/lib/|')
8285         fi
8286         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8287         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8288         if test "$enable_bundle_mariadb" = "yes"; then
8289             AC_MSG_RESULT([yes])
8290             BUNDLE_MARIADB=TRUE
8291             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8292             if test "$_os" = "Darwin"; then
8293                 LIBMARIADB=${LIBMARIADB}.dylib
8294             elif test "$_os" = "WINNT"; then
8295                 LIBMARIADB=${LIBMARIADB}.dll
8296             else
8297                 LIBMARIADB=${LIBMARIADB}.so
8298             fi
8299             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8300             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8301             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8302                 AC_MSG_RESULT([found.])
8303                 PathFormat "$LIBMARIADB_PATH"
8304                 LIBMARIADB_PATH="$formatted_path"
8305             else
8306                 AC_MSG_ERROR([not found.])
8307             fi
8308         else
8309             AC_MSG_RESULT([no])
8310             BUNDLE_MARIADB=
8311         fi
8312     else
8313         AC_MSG_RESULT([internal])
8314         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8315         SYSTEM_MARIADB=
8316         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8317         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8318         BUILD_TYPE="$BUILD_TYPE MARIADB"
8319     fi
8321     AC_SUBST(SYSTEM_MARIADB)
8322     AC_SUBST(MARIADB_CFLAGS)
8323     AC_SUBST(MARIADB_LIBS)
8324     AC_SUBST(LIBMARIADB)
8325     AC_SUBST(LIBMARIADB_PATH)
8326     AC_SUBST(BUNDLE_MARIADB)
8328     AC_LANG_PUSH([C++])
8329     dnl ===================================================================
8330     dnl Check for system MySQL C++ Connector
8331     dnl ===================================================================
8332     # FIXME!
8333     # who thought this too-generic cppconn dir was a good idea?
8334     AC_MSG_CHECKING([MySQL Connector/C++])
8335     if test "$with_system_mysql_cppconn" = "yes"; then
8336         AC_MSG_RESULT([external])
8337         SYSTEM_MYSQL_CPPCONN=TRUE
8338         AC_LANG_PUSH([C++])
8339         AC_CHECK_HEADER(mysql_driver.h, [],
8340                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8341         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8342                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8343         save_LIBS=$LIBS
8344         LIBS="$LIBS -lmysqlcppconn"
8345         AC_MSG_CHECKING([version])
8346         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8347 #include <mysql_driver.h>
8349 int main(int argc, char **argv) {
8350     sql::Driver *driver;
8351     driver = get_driver_instance();
8352     if (driver->getMajorVersion() > 1 || \
8353        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8354        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8355         return 0;
8356       else
8357         return 1;
8359       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8361         AC_LANG_POP([C++])
8362         LIBS=$save_LIBS
8363     else
8364         AC_MSG_RESULT([internal])
8365         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8366         SYSTEM_MYSQL_CPPCONN=
8367     fi
8368     AC_LANG_POP([C++])
8370 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8372 dnl ===================================================================
8373 dnl Check for system hsqldb
8374 dnl ===================================================================
8375 if test "$with_java" != "no"; then
8376 HSQLDB_USE_JDBC_4_1=
8377 AC_MSG_CHECKING([which hsqldb to use])
8378 if test "$with_system_hsqldb" = "yes"; then
8379     AC_MSG_RESULT([external])
8380     SYSTEM_HSQLDB=TRUE
8381     if test -z $HSQLDB_JAR; then
8382         HSQLDB_JAR=/usr/share/java/hsqldb.jar
8383     fi
8384     AC_CHECK_FILE($HSQLDB_JAR, [],
8385                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8386     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8387     export HSQLDB_JAR
8388     if $PERL -e 'use Archive::Zip;
8389             my $file = "$ENV{'HSQLDB_JAR'}";
8390             my $zip = Archive::Zip->new( $file );
8391             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8392             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
8393                push @l, split(/\n/, $mf);
8394                foreach my $line (@l) {
8395                   if ($line =~ m/Specification-Version:/) {
8396                       ($t, $version) = split (/:/,$line);
8397                       $version =~ s/^\s//;
8398                       ($a, $b, $c, $d) = split (/\./,$version);
8399                       if ($c == "0" && $d > "8")  {
8400                           exit 0;
8401                       } else {
8402                           exit 1;
8403                       }
8404                   }
8405                }
8406             } else {
8407                 exit 1;
8408             }'; then
8409         AC_MSG_RESULT([yes])
8410     else
8411         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8412     fi
8413 else
8414     AC_MSG_RESULT([internal])
8415     SYSTEM_HSQLDB=
8416     BUILD_TYPE="$BUILD_TYPE HSQLDB"
8417     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8418     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8419     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8420         AC_MSG_RESULT([yes])
8421         HSQLDB_USE_JDBC_4_1=TRUE
8422     else
8423         AC_MSG_RESULT([no])
8424     fi
8426 AC_SUBST(SYSTEM_HSQLDB)
8427 AC_SUBST(HSQLDB_JAR)
8428 AC_SUBST([HSQLDB_USE_JDBC_4_1])
8431 dnl ===================================================================
8432 dnl Check for PostgreSQL stuff
8433 dnl ===================================================================
8434 if test "x$enable_postgresql_sdbc" != "xno"; then
8435     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8437     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8438         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8439     fi
8440     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8441         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8442     fi
8444     AC_MSG_CHECKING([PostgreSQL C interface])
8445     if test "$with_system_postgresql" = "yes"; then
8446         AC_MSG_RESULT([external PostgreSQL])
8447         SYSTEM_POSTGRESQL=TRUE
8448         if test "$_os" = Darwin; then
8449             supp_path=''
8450             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8451                 pg_supp_path="$P_SEP$d$pg_supp_path"
8452             done
8453         fi
8454         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8455         if test -z "$PGCONFIG"; then
8456             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8457         fi
8458         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8459         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8460     else
8461         # if/when anything else than PostgreSQL uses Kerberos,
8462         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8463         WITH_KRB5=
8464         WITH_GSSAPI=
8465         case "$_os" in
8466         Darwin)
8467             # MacOS X has system MIT Kerberos 5 since 10.4
8468             if test "$with_krb5" != "no"; then
8469                 WITH_KRB5=TRUE
8470                 save_LIBS=$LIBS
8471                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8472                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8473                 KRB5_LIBS=$LIBS
8474                 LIBS=$save_LIBS
8475                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8476                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8477                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8478                 LIBS=$save_LIBS
8479             fi
8480             if test "$with_gssapi" != "no"; then
8481               WITH_GSSAPI=TRUE
8482               save_LIBS=$LIBS
8483               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8484                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8485               GSSAPI_LIBS=$LIBS
8486               LIBS=$save_LIBS
8487             fi
8488             ;;
8489         WINNT)
8490             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8491                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8492             fi
8493             ;;
8494         Linux|GNU|*BSD|DragonFly)
8495             if test "$with_krb5" != "no"; then
8496                 WITH_KRB5=TRUE
8497                 save_LIBS=$LIBS
8498                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8499                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8500                 KRB5_LIBS=$LIBS
8501                 LIBS=$save_LIBS
8502                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8503                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8504                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8505                 LIBS=$save_LIBS
8506             fi
8507             if test "$with_gssapi" != "no"; then
8508                 WITH_GSSAPI=TRUE
8509                 save_LIBS=$LIBS
8510                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8511                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8512                 GSSAPI_LIBS=$LIBS
8513                 LIBS=$save_LIBS
8514             fi
8515             ;;
8516         *)
8517             if test "$with_krb5" = "yes"; then
8518                 WITH_KRB5=TRUE
8519                 save_LIBS=$LIBS
8520                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8521                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8522                 KRB5_LIBS=$LIBS
8523                 LIBS=$save_LIBS
8524                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8525                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8526                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8527                 LIBS=$save_LIBS
8528             fi
8529             if test "$with_gssapi" = "yes"; then
8530                 WITH_GSSAPI=TRUE
8531                 save_LIBS=$LIBS
8532                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8533                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8534                 LIBS=$save_LIBS
8535                 GSSAPI_LIBS=$LIBS
8536             fi
8537         esac
8539         if test -n "$with_libpq_path"; then
8540             SYSTEM_POSTGRESQL=TRUE
8541             AC_MSG_RESULT([external libpq])
8542             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8543             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8544         else
8545             SYSTEM_POSTGRESQL=
8546             AC_MSG_RESULT([internal])
8547             POSTGRESQL_LIB=""
8548             POSTGRESQL_INC="%OVERRIDE_ME%"
8549             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8550         fi
8551     fi
8552     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8553         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8554         save_CFLAGS=$CFLAGS
8555         save_CPPFLAGS=$CPPFLAGS
8556         save_LIBS=$LIBS
8557         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8558         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8559         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8560         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8561             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8562         CFLAGS=$save_CFLAGS
8563         CPPFLAGS=$save_CPPFLAGS
8564         LIBS=$save_LIBS
8565     fi
8566     BUILD_POSTGRESQL_SDBC=TRUE
8568 AC_SUBST(WITH_KRB5)
8569 AC_SUBST(WITH_GSSAPI)
8570 AC_SUBST(GSSAPI_LIBS)
8571 AC_SUBST(KRB5_LIBS)
8572 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8573 AC_SUBST(SYSTEM_POSTGRESQL)
8574 AC_SUBST(POSTGRESQL_INC)
8575 AC_SUBST(POSTGRESQL_LIB)
8577 dnl ===================================================================
8578 dnl Check for Firebird stuff
8579 dnl ===================================================================
8580 ENABLE_FIREBIRD_SDBC=""
8581 if test "x$enable_firebird_sdbc" = "xyes"; then
8582     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8584     dnl ===================================================================
8585     dnl Check for system Firebird
8586     dnl ===================================================================
8587     AC_MSG_CHECKING([which Firebird to use])
8588     if test "$with_system_firebird" = "yes"; then
8589         AC_MSG_RESULT([external])
8590         SYSTEM_FIREBIRD=TRUE
8591         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8592         if test -z "$FIREBIRDCONFIG"; then
8593             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8594             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8595             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8596         else
8597             AC_MSG_NOTICE([fb_config found])
8598             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8599             AC_MSG_CHECKING([for Firebird Client library])
8600             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8601             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8602         fi
8603         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8604         AC_MSG_CHECKING([Firebird version])
8605         if test -n "${FIREBIRD_VERSION}"; then
8606             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8607             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8608             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8609                 AC_MSG_RESULT([OK])
8610             else
8611                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8612             fi
8613         else
8614             __save_CFLAGS="${CFLAGS}"
8615             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8616             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8617 #if defined(FB_API_VER) && FB_API_VER == 25
8618 #else
8619 #error "Wrong Firebird API version"
8620 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8621             CFLAGS="${__save_CFLAGS}"
8622         fi
8623         ENABLE_FIREBIRD_SDBC="TRUE"
8624     elif test "$enable_database_connectivity" != yes; then
8625         AC_MSG_RESULT([none])
8626     elif test "$cross_compiling" = "yes"; then
8627         AC_MSG_RESULT([none])
8628     else
8629         dnl We need libatomic-ops for any non X86/X64 system
8630         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8631             dnl ===================================================================
8632             dnl Check for system libatomic-ops
8633             dnl ===================================================================
8634             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8635             if test "$with_system_libatomic_ops" = "yes"; then
8636                 SYSTEM_LIBATOMIC_OPS=TRUE
8637                 AC_CHECK_HEADERS(atomic_ops.h, [],
8638                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8639             else
8640                 SYSTEM_LIBATOMIC_OPS=
8641                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8642                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8643                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8644             fi
8645         fi
8647         AC_MSG_RESULT([internal])
8648         SYSTEM_FIREBIRD=
8649         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8650         FIREBIRD_LIBS="-lfbembed"
8652         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8653         ENABLE_FIREBIRD_SDBC="TRUE"
8654     fi
8657 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8658 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8659 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8660 AC_SUBST(LIBATOMIC_OPS_LIBS)
8661 AC_SUBST(SYSTEM_FIREBIRD)
8662 AC_SUBST(FIREBIRD_CFLAGS)
8663 AC_SUBST(FIREBIRD_LIBS)
8664 dnl AC_SUBST([TOMMATH_CFLAGS])
8665 dnl AC_SUBST([TOMMATH_LIBS])
8667 dnl ===================================================================
8668 dnl Check for system curl
8669 dnl ===================================================================
8670 AC_MSG_CHECKING([which libcurl to use])
8671 if test "$with_system_curl" = "auto"; then
8672     with_system_curl="$with_system_libs"
8675 if test "$with_system_curl" = "yes"; then
8676     AC_MSG_RESULT([external])
8677     SYSTEM_CURL=TRUE
8679     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8681     # First try PKGCONFIG and then fall back
8682     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8684     if test -n "$CURL_PKG_ERRORS"; then
8685         AC_PATH_PROG(CURLCONFIG, curl-config)
8686         if test -z "$CURLCONFIG"; then
8687             AC_MSG_ERROR([curl developement files not found])
8688         fi
8689         CURL_LIBS=`$CURLCONFIG --libs`
8690         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8691         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8693         case $curl_version in
8694         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8695         dnl so they need to be doubled to end up in the configure script
8696         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8697             ;;
8698         *)
8699             AC_MSG_ERROR([no, you have $curl_version])
8700             ;;
8701         esac
8702     fi
8703     AC_MSG_RESULT([yes])
8705     libo_MINGW_CHECK_DLL([libcurl])
8706     libo_MINGW_TRY_DLL([libintl])
8707     libo_MINGW_TRY_DLL([libidn])
8708     libo_MINGW_TRY_DLL([libnspr4])
8709     libo_MINGW_TRY_DLL([nssutil3])
8710     libo_MINGW_TRY_DLL([libplc4])
8711     libo_MINGW_TRY_DLL([libplds4])
8712     libo_MINGW_TRY_DLL([nss3])
8713     libo_MINGW_TRY_DLL([ssl3])
8714     libo_MINGW_TRY_DLL([libgpg-error])
8715     libo_MINGW_TRY_DLL([libgcrypt])
8716     libo_MINGW_TRY_DLL([libssh2])
8717     ENABLE_CURL=TRUE
8718 elif test $_os = iOS; then
8719     # Let's see if we need curl, I think not?
8720     AC_MSG_RESULT([none])
8721     ENABLE_CURL=
8722 else
8723     AC_MSG_RESULT([internal])
8724     SYSTEM_CURL=
8725     BUILD_TYPE="$BUILD_TYPE CURL"
8726     ENABLE_CURL=TRUE
8728 AC_SUBST(SYSTEM_CURL)
8729 AC_SUBST(CURL_CFLAGS)
8730 AC_SUBST(CURL_LIBS)
8731 AC_SUBST(ENABLE_CURL)
8733 dnl ===================================================================
8734 dnl Check for system boost
8735 dnl ===================================================================
8736 AC_MSG_CHECKING([which boost to use])
8737 if test "$with_system_boost" = "yes"; then
8738     AC_MSG_RESULT([external])
8739     SYSTEM_BOOST=TRUE
8740     AX_BOOST_BASE(1.47)
8741     AX_BOOST_DATE_TIME
8742     AX_BOOST_IOSTREAMS
8743     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8744     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8745     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8746         # if not found, try again with 'lib' prefix
8747         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8748     fi
8749     AC_LANG_PUSH([C++])
8750     save_CXXFLAGS=$CXXFLAGS
8751     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8752     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8753        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8754     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8755        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8756     AC_CHECK_HEADER(boost/function.hpp, [],
8757        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8758     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8759     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8760     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8761 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8762     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8763         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8764     else
8765         AC_MSG_RESULT([yes])
8766     fi
8767     CXXFLAGS=$save_CXXFLAGS
8768     AC_LANG_POP([C++])
8769 else
8770     AC_MSG_RESULT([internal])
8771     BUILD_TYPE="$BUILD_TYPE BOOST"
8772     SYSTEM_BOOST=
8774 AC_SUBST(SYSTEM_BOOST)
8776 dnl ===================================================================
8777 dnl Check for system mdds
8778 dnl ===================================================================
8779 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.10.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8781 dnl ===================================================================
8782 dnl Check for system glm
8783 dnl ===================================================================
8784 AC_MSG_CHECKING([which glm to use])
8785 if test "$with_system_glm" = "yes"; then
8786     AC_MSG_RESULT([external])
8787     SYSTEM_GLM=TRUE
8788     AC_LANG_PUSH([C++])
8789     AC_CHECK_HEADER([glm/glm.hpp], [],
8790        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8791     AC_LANG_POP([C++])
8792 else
8793     AC_MSG_RESULT([internal])
8794     BUILD_TYPE="$BUILD_TYPE GLM"
8795     SYSTEM_GLM=
8797 AC_SUBST([SYSTEM_GLM])
8799 dnl ===================================================================
8800 dnl Check for system glew
8801 dnl ===================================================================
8802 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8804 dnl ===================================================================
8805 dnl Check for system vigra
8806 dnl ===================================================================
8807 AC_MSG_CHECKING([which vigra to use])
8808 if test "$with_system_vigra" = "yes"; then
8809     AC_MSG_RESULT([external])
8810     SYSTEM_VIGRA=TRUE
8811     AC_LANG_PUSH([C++])
8812     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8813        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8814     AC_LANG_POP([C++])
8815 else
8816     AC_MSG_RESULT([internal])
8817     BUILD_TYPE="$BUILD_TYPE VIGRA"
8818     SYSTEM_VIGRA=
8820 AC_SUBST(SYSTEM_VIGRA)
8822 dnl ===================================================================
8823 dnl Check for system odbc
8824 dnl ===================================================================
8825 AC_MSG_CHECKING([which odbc headers to use])
8826 if test "$with_system_odbc" = "yes"; then
8827     AC_MSG_RESULT([external])
8828     SYSTEM_ODBC_HEADERS=TRUE
8830     AC_CHECK_HEADER(sqlext.h, [],
8831       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8832 elif test "$enable_database_connectivity" != yes; then
8833     AC_MSG_RESULT([none])
8834 else
8835     AC_MSG_RESULT([internal])
8836     SYSTEM_ODBC_HEADERS=
8838 AC_SUBST(SYSTEM_ODBC_HEADERS)
8841 dnl ===================================================================
8842 dnl Check for system openldap
8843 dnl ===================================================================
8845 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8846 AC_MSG_CHECKING([which openldap library to use])
8847 if test "$with_system_openldap" = "yes"; then
8848     AC_MSG_RESULT([external])
8849     SYSTEM_OPENLDAP=TRUE
8850     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8851     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8852     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8853 else
8854     AC_MSG_RESULT([internal])
8855     SYSTEM_OPENLDAP=
8856     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8859 AC_SUBST(SYSTEM_OPENLDAP)
8861 dnl ===================================================================
8862 dnl Check for mozilla ab connectivity for windows
8863 dnl ===================================================================
8865 if test "$_os" = "WINNT"; then
8866     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8867     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8868         WITH_MOZAB4WIN=TRUE
8869         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8870         BUILD_TYPE="$BUILD_TYPE MOZ"
8871         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8872         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8873         for dll in $MSVC80_DLLS; do
8874             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8875                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8876             fi
8877         done
8878     else
8879         AC_MSG_RESULT([no])
8880         WITH_MOZAB4WIN=
8881     fi
8883 AC_SUBST(WITH_MOZAB4WIN)
8884 AC_SUBST(MSVC80_DLLS)
8885 AC_SUBST(MSVC80_DLL_PATH)
8887 dnl ===================================================================
8888 dnl Check for TLS/SSL and cryptographic implementation to use
8889 dnl ===================================================================
8890 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8891 if test -n "$with_tls"; then
8892     case $with_tls in
8893     openssl)
8894         AC_DEFINE(USE_TLS_OPENSSL)
8895         TLS=OPENSSL
8897         if test "$enable_openssl" != "yes"; then
8898             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8899         fi
8901         # warn that OpenSSL has been selected but not all TLS code has this option
8902         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8903         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8904         ;;
8905     nss)
8906         AC_DEFINE(USE_TLS_NSS)
8907         TLS=NSS
8908         ;;
8909     *)
8910         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8911 openssl - OpenSSL
8912 nss - Mozilla's Network Security Services (NSS)
8913     ])
8914         ;;
8915     esac
8916 elif test $_os = iOS -o $_os = Android; then
8917     # We don't build NSS for iOS and Android
8918     AC_DEFINE(USE_TLS_OPENSSL)
8919     TLS=OPENSSL
8920 else
8921     # default to using NSS, it results in smaller oox lib
8922     AC_DEFINE(USE_TLS_NSS)
8923     TLS=NSS
8925 AC_MSG_RESULT([$TLS])
8926 AC_SUBST(TLS)
8928 dnl ===================================================================
8929 dnl Check for system NSS
8930 dnl ===================================================================
8931 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8932 if test "$with_system_nss" = "yes"; then
8933     libo_MINGW_CHECK_DLL([libnspr4])
8934     libo_MINGW_CHECK_DLL([libplc4])
8935     libo_MINGW_CHECK_DLL([libplds4])
8936     libo_MINGW_CHECK_DLL([nss3])
8937     libo_MINGW_CHECK_DLL([nssutil3])
8938     libo_MINGW_CHECK_DLL([smime3])
8939     libo_MINGW_CHECK_DLL([ssl3])
8942 dnl ===================================================================
8943 dnl Check for system mozilla headers
8944 dnl ===================================================================
8945 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8946 AC_MSG_CHECKING([which NPAPI headers to use])
8948 if test "$with_system_npapi_headers" = "yes"; then
8949     AC_MSG_RESULT([external])
8950     SYSTEM_NPAPI_HEADERS=TRUE
8951     # First try npapi-sdk:
8952     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8953     # Then go with libxul:
8954     if test "x$LOCATED" != "xyes"; then
8955         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8956     fi
8957     if test "x$LOCATED" != "xyes"; then
8958         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8959     fi
8960     # if still not found bail out
8961     if test "x$LOCATED" != "xyes"; then
8962         AC_MSG_ERROR([npapi.h header file not found])
8963     fi
8965     AC_LANG_PUSH([C])
8966     save_CFLAGS=$CFLAGS
8967     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8968     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8969     AC_COMPILE_IFELSE(
8970         [AC_LANG_SOURCE([[
8971             #define XP_UNIX
8972             #include <npapi.h>
8973             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8974             ]])],
8975         [AC_MSG_RESULT([const char*])],
8976         [
8977         AC_MSG_RESULT([char*])
8978         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8979         ])
8980     CFLAGS=$save_CFLAGS
8981     AC_LANG_POP([C])
8982     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8983 else
8984     AC_MSG_RESULT([internal])
8985         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8986         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
8987     SYSTEM_NPAPI_HEADERS=
8989 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8990 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8991 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8993 dnl ===================================================================
8994 dnl Check for system sane
8995 dnl ===================================================================
8996 AC_MSG_CHECKING([which sane header to use])
8997 if test "$with_system_sane" = "yes"; then
8998     AC_MSG_RESULT([external])
8999     AC_CHECK_HEADER(sane/sane.h, [],
9000       [AC_MSG_ERROR(sane not found. install sane)], [])
9001 else
9002     AC_MSG_RESULT([internal])
9003     BUILD_TYPE="$BUILD_TYPE SANE"
9006 dnl ===================================================================
9007 dnl Check for system icu
9008 dnl ===================================================================
9009 SYSTEM_GENBRK=
9010 SYSTEM_GENCCODE=
9011 SYSTEM_GENCMN=
9013 ICU_MAJOR=53
9014 ICU_MINOR=1
9015 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
9016 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9017 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9018 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9019 AC_MSG_CHECKING([which icu to use])
9020 if test "$with_system_icu" = "yes"; then
9021     AC_MSG_RESULT([external])
9022     SYSTEM_ICU=TRUE
9023     AC_LANG_PUSH([C++])
9024     AC_MSG_CHECKING([for unicode/rbbi.h])
9025     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9026     AC_LANG_POP([C++])
9028     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9029         ICUPATH="$PATH"
9030         if test "$WITH_MINGW" = "yes"; then
9031             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9032         fi
9033         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9035         AC_MSG_CHECKING([ICU version])
9036         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9037         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9038         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9040         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
9041             AC_MSG_RESULT([OK, $ICU_VERSION])
9042         else
9043             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
9044         fi
9045     fi
9047     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9048         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9049         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9050         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9051         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9052         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9053         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9054             AC_MSG_RESULT([yes])
9055         else
9056             AC_MSG_RESULT([no])
9057             if test "$with_system_icu_for_build" != "force"; then
9058                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9059 You can use --with-system-icu-for-build=force to use it anyway.])
9060             fi
9061         fi
9062     fi
9064     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9065         # using the system icu tools can lead to version confusion, use the
9066         # ones from the build environment when cross-compiling
9067         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9068         if test -z "$SYSTEM_GENBRK"; then
9069             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9070         fi
9071         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9072         if test -z "$SYSTEM_GENCCODE"; then
9073             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9074         fi
9075         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9076         if test -z "$SYSTEM_GENCMN"; then
9077             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9078         fi
9079         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
9080             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
9081         else
9082             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
9083         fi
9084         if test "$ICU_MAJOR" -ge "49"; then
9085             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9086             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9087             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9088         else
9089             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9090             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9091             ICU_RECLASSIFIED_HEBREW_LETTER=
9092         fi
9093     fi
9095     if test "$cross_compiling" = "yes"; then
9096        if test "$ICU_MAJOR" -ge "50"; then
9097             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9098             ICU_MINOR=""
9099        fi
9100     fi
9102     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9103     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9104     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9105 else
9106     AC_MSG_RESULT([internal])
9107     SYSTEM_ICU=
9108     BUILD_TYPE="$BUILD_TYPE ICU"
9109     # surprisingly set these only for "internal" (to be used by various other
9110     # external libs): the system icu-config is quite unhelpful and spits out
9111     # dozens of weird flags and also default path -I/usr/include
9112     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9113     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9115 AC_SUBST(SYSTEM_ICU)
9116 AC_SUBST(SYSTEM_GENBRK)
9117 AC_SUBST(SYSTEM_GENCCODE)
9118 AC_SUBST(SYSTEM_GENCMN)
9119 AC_SUBST(ICU_MAJOR)
9120 AC_SUBST(ICU_MINOR)
9121 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9122 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9123 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9124 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9125 AC_SUBST(ICU_CFLAGS)
9126 AC_SUBST(ICU_LIBS)
9128 dnl ===================================================================
9129 dnl Graphite
9130 dnl ===================================================================
9132 AC_MSG_CHECKING([whether to enable graphite support])
9133 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9134     AC_MSG_RESULT([yes])
9135     ENABLE_GRAPHITE="TRUE"
9136     AC_DEFINE(ENABLE_GRAPHITE)
9137     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9138     if test "$with_system_graphite" = "yes"; then
9139         libo_MINGW_CHECK_DLL([libgraphite2])
9140     fi
9141 else
9142     AC_MSG_RESULT([no])
9144 AC_SUBST(ENABLE_GRAPHITE)
9146 dnl ===================================================================
9147 dnl Orcus
9148 dnl ===================================================================
9150 AC_MSG_CHECKING([whether to enable orcus])
9151 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9152     AC_MSG_RESULT([yes])
9153     ENABLE_ORCUS="TRUE"
9154     AC_DEFINE(ENABLE_ORCUS)
9156     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
9157     if test "$with_system_orcus" != "yes"; then
9158         if test "$SYSTEM_BOOST" = "TRUE"; then
9159             # ===========================================================
9160             # Determine if we are going to need to link with Boost.System
9161             # ===========================================================
9162             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9163             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9164             dnl in documentation has no effect.
9165             AC_MSG_CHECKING([if we need to link with Boost.System])
9166             AC_LANG_PUSH([C++])
9167             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9168                     @%:@include <boost/version.hpp>
9169                 ]],[[
9170                     #if BOOST_VERSION >= 105000
9171                     #   error yes, we need to link with Boost.System
9172                     #endif
9173                 ]])],[
9174                     AC_MSG_RESULT([no])
9175                 ],[
9176                     AC_MSG_RESULT([yes])
9177                     AX_BOOST_SYSTEM
9178             ])
9179             AC_LANG_POP([C++])
9180         fi
9181     fi
9182     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9183     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9184     AC_SUBST([BOOST_SYSTEM_LIB])
9185     AC_SUBST(SYSTEM_LIBORCUS)
9187 else
9188     AC_MSG_RESULT([no])
9190 AC_SUBST(ENABLE_ORCUS)
9192 dnl ===================================================================
9193 dnl HarfBuzz
9194 dnl ===================================================================
9195 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9196 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9197     AC_MSG_RESULT([yes])
9198     ENABLE_HARFBUZZ="TRUE"
9199     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9200         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"])
9201     else
9202         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9203     fi
9204 else
9205     AC_MSG_RESULT([no])
9207 AC_SUBST(ENABLE_HARFBUZZ)
9209 dnl ===================================================================
9210 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9211 dnl ===================================================================
9212 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9213 # Obviously no such thing on iOS or Android. Also not possible when building
9214 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9215 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9216         "$enable_headless" != yes -a "$enable_mpl_subset" != yes
9217 then
9218     AC_MSG_RESULT([yes])
9219     ENABLE_NPAPI_FROM_BROWSER=TRUE
9220 else
9221     AC_MSG_RESULT([no])
9222     ENABLE_NPAPI_FROM_BROWSER=
9224 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9226 dnl ===================================================================
9227 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9228 dnl ===================================================================
9229 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9230 if test "$enable_mpl_subset" != yes -a \( "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9231         "$enable_headless" != yes -a "$enable_gtk" != no \)
9232 then
9233     AC_MSG_RESULT([yes])
9234     ENABLE_NPAPI_INTO_BROWSER=TRUE
9235 else
9236     AC_MSG_RESULT([no])
9237     ENABLE_NPAPI_INTO_BROWSER=
9239 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9241 AC_MSG_CHECKING([whether to use X11])
9242 dnl ***************************************
9243 dnl testing for X libraries and includes...
9244 dnl ***************************************
9245 WANT_X11="no"
9246 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9247     WANT_X11="yes"
9248     AC_DEFINE(HAVE_FEATURE_X11)
9250 AC_MSG_RESULT([$WANT_X11])
9252 if test "$WANT_X11" = "yes"; then
9253     AC_PATH_X
9254     AC_PATH_XTRA
9255     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9257     if test -z "$x_includes"; then
9258         x_includes="default_x_includes"
9259     fi
9260     if test -z "$x_libraries"; then
9261         x_libraries="default_x_libraries"
9262     fi
9263     CFLAGS="$CFLAGS $X_CFLAGS"
9264     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9265     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9266 else
9267     x_includes="no_x_includes"
9268     x_libraries="no_x_libraries"
9271 if test "$WANT_X11" = "yes"; then
9272     dnl ===================================================================
9273     dnl Check for Composite.h for Mozilla plugin
9274     dnl ===================================================================
9275     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9276      [#include <X11/Intrinsic.h>])
9278     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9279     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9280         [AC_MSG_ERROR(Xt library not found)])
9282     dnl ===================================================================
9283     dnl Check for extension headers
9284     dnl ===================================================================
9285     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9286      [#include <X11/extensions/shape.h>])
9288     # vcl needs ICE and SM
9289     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9290     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9291         [AC_MSG_ERROR(ICE library not found)])
9292     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9293     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9294         [AC_MSG_ERROR(SM library not found)])
9297 dnl ===================================================================
9298 dnl Check for system Xrender
9299 dnl ===================================================================
9300 AC_MSG_CHECKING([whether to use Xrender])
9301 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9302     AC_MSG_RESULT([yes])
9303     PKG_CHECK_MODULES(XRENDER, xrender)
9304     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9305     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9306       [AC_MSG_ERROR(libXrender not found or functional)], [])
9307     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9308       [AC_MSG_ERROR(Xrender not found. install X)], [])
9309 else
9310     AC_MSG_RESULT([no])
9312 AC_SUBST(XRENDER_CFLAGS)
9313 AC_SUBST(XRENDER_LIBS)
9315 dnl ===================================================================
9316 dnl Check for XRandr
9317 dnl ===================================================================
9318 AC_MSG_CHECKING([whether to enable RandR support])
9319 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9320     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9321         XRANDR_DLOPEN="TRUE"
9322         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9323     else
9324         AC_MSG_RESULT([yes])
9325         XRANDR_DLOPEN="FALSE"
9326         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9327         if test "$ENABLE_RANDR" != "TRUE"; then
9328             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9329                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9330             XRANDR_CFLAGS=" "
9331             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9332               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9333             XRANDR_LIBS="-lXrandr "
9334             ENABLE_RANDR="TRUE"
9335         fi
9336         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9337     fi
9338 else
9339     ENABLE_RANDR=""
9340     AC_MSG_RESULT([no])
9342 AC_SUBST(XRANDR_DLOPEN)
9343 AC_SUBST(XRANDR_CFLAGS)
9344 AC_SUBST(XRANDR_LIBS)
9345 AC_SUBST(ENABLE_RANDR)
9347 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9348     WITH_WEBDAV="serf"
9350 if test $_os = iOS -o $_os = Android; then
9351     WITH_WEBDAV="no"
9353 AC_MSG_CHECKING([for webdav library])
9354 case "$WITH_WEBDAV" in
9355 serf)
9356     AC_MSG_RESULT([serf])
9357     # Check for system apr-util
9358     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9359                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9360                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9361     if test "$COM" = "MSC"; then
9362         APR_LIB_DIR="LibR"
9363         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9364         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9365     fi
9367     # Check for system serf
9368     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9369                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9370     if test "$COM" = "MSC"; then
9371         SERF_LIB_DIR="Release"
9372         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9373         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9374     fi
9375     ;;
9376 neon)
9377     AC_MSG_RESULT([neon])
9378     # Check for system neon
9379     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9380     if test "$with_system_neon" = "yes"; then
9381         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9382         libo_MINGW_CHECK_DLL([libneon])
9383         libo_MINGW_TRY_DLL([libtasn1])
9384         libo_MINGW_TRY_DLL([libgnutls])
9385     else
9386         NEON_VERSION=0295
9387     fi
9388     AC_SUBST(NEON_VERSION)
9389     ;;
9391     AC_MSG_RESULT([none, disabled])
9392     WITH_WEBDAV=""
9393     ;;
9394 esac
9395 AC_SUBST(WITH_WEBDAV)
9397 dnl ===================================================================
9398 dnl Check for disabling cve_tests
9399 dnl ===================================================================
9400 AC_MSG_CHECKING([whether to execute CVE tests])
9401 if test "$enable_cve_tests" = "no"; then
9402     AC_MSG_RESULT([no])
9403     DISABLE_CVE_TESTS=TRUE
9404     AC_SUBST(DISABLE_CVE_TESTS)
9405 else
9406     AC_MSG_RESULT([yes])
9409 dnl ===================================================================
9410 dnl Check for enabling chart XShape tests
9411 dnl ===================================================================
9412 AC_MSG_CHECKING([whether to execute chart XShape tests])
9413 if test "$enable_chart_tests" = "yes"; then
9414     AC_MSG_RESULT([yes])
9415     ENABLE_CHART_TESTS=TRUE
9416     AC_SUBST(ENABLE_CHART_TESTS)
9417 else
9418     AC_MSG_RESULT([no])
9421 dnl ===================================================================
9422 dnl Check for system openssl
9423 dnl ===================================================================
9424 DISABLE_OPENSSL=
9425 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9426 if test "$enable_openssl" = "yes"; then
9427     AC_MSG_RESULT([no])
9428     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9429         # OpenSSL is deprecated when building for 10.7 or later.
9430         #
9431         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9432         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9434         with_system_openssl=no
9435         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9436     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9437             && test "$with_system_openssl" != "no"; then
9438         with_system_openssl=yes
9439         SYSTEM_OPENSSL=TRUE
9440         OPENSSL_CFLAGS=
9441         OPENSSL_LIBS="-lssl -lcrypto"
9442     else
9443         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9444     fi
9445     if test "$with_system_openssl" = "yes"; then
9446         libo_MINGW_CHECK_DLL([libssl])
9447         libo_MINGW_CHECK_DLL([libcrypto])
9448         AC_MSG_CHECKING([whether openssl supports SHA512])
9449         AC_LANG_PUSH([C])
9450         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9451             SHA512_CTX context;
9452 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9453         AC_LANG_POP(C)
9454     fi
9455 else
9456     AC_MSG_RESULT([yes])
9457     DISABLE_OPENSSL=TRUE
9459     # warn that although OpenSSL is disabled, system libraries may be depending on it
9460     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9461     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9464 AC_SUBST([DISABLE_OPENSSL])
9466 dnl ===================================================================
9467 dnl Check for building gnutls
9468 dnl ===================================================================
9469 AC_MSG_CHECKING([whether to use gnutls])
9470 if test "$WITH_WEBDAV" = "neon" && test "$enable_openssl" = "no"; then
9471     AC_MSG_RESULT([yes])
9472     AM_PATH_LIBGCRYPT()
9473     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9474         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9475                       available in the system to use as replacement.]]))
9478 AC_SUBST([LIBGCRYPT_CFLAGS])
9479 AC_SUBST([LIBGCRYPT_LIBS])
9481 dnl ===================================================================
9482 dnl Check for system redland
9483 dnl ===================================================================
9484 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9485 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9486 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9487 if test "$with_system_redland" = "yes"; then
9488     libo_MINGW_CHECK_DLL([librdf])
9489     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9490             [AC_MSG_ERROR(librdf too old. Need >= 1.16)], [])
9491     libo_MINGW_TRY_DLL([libraptor])
9492     libo_MINGW_TRY_DLL([librasqal])
9493     libo_MINGW_TRY_DLL([libsqlite3])
9494 else
9495     RAPTOR_MAJOR="0"
9496     RASQAL_MAJOR="3"
9497     REDLAND_MAJOR="0"
9499 AC_SUBST(RAPTOR_MAJOR)
9500 AC_SUBST(RASQAL_MAJOR)
9501 AC_SUBST(REDLAND_MAJOR)
9503 dnl ===================================================================
9504 dnl Check for system hunspell
9505 dnl ===================================================================
9506 AC_MSG_CHECKING([which libhunspell to use])
9507 if test "$with_system_hunspell" = "yes"; then
9508     AC_MSG_RESULT([external])
9509     SYSTEM_HUNSPELL=TRUE
9510     AC_LANG_PUSH([C++])
9511     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9512     if test "$HUNSPELL_PC" != "TRUE"; then
9513         AC_CHECK_HEADER(hunspell.hxx, [],
9514             [
9515             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9516             [AC_MSG_ERROR(hunspell headers not found.)], [])
9517             ], [])
9518         AC_CHECK_LIB([hunspell], [main], [:],
9519            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9520         HUNSPELL_LIBS=-lhunspell
9521     fi
9522     AC_LANG_POP([C++])
9523     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9524     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9525 else
9526     AC_MSG_RESULT([internal])
9527     SYSTEM_HUNSPELL=
9528     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9529     if test "$COM" = "MSC"; then
9530         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9531     else
9532         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9533     fi
9534     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9536 AC_SUBST(SYSTEM_HUNSPELL)
9537 AC_SUBST(HUNSPELL_CFLAGS)
9538 AC_SUBST(HUNSPELL_LIBS)
9540 dnl ===================================================================
9541 dnl Checking for altlinuxhyph
9542 dnl ===================================================================
9543 AC_MSG_CHECKING([which altlinuxhyph to use])
9544 if test "$with_system_altlinuxhyph" = "yes"; then
9545     AC_MSG_RESULT([external])
9546     SYSTEM_HYPH=TRUE
9547     AC_CHECK_HEADER(hyphen.h, [],
9548        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9549     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9550        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9551        [#include <hyphen.h>])
9552     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9553         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9554     if test -z "$HYPHEN_LIB"; then
9555         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9556            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9557     fi
9558     if test -z "$HYPHEN_LIB"; then
9559         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9560            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9561     fi
9562     libo_MINGW_CHECK_DLL([libhyphen])
9563 else
9564     AC_MSG_RESULT([internal])
9565     SYSTEM_HYPH=
9566     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9567     if test "$COM" = "MSC"; then
9568         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9569     else
9570         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9571     fi
9573 AC_SUBST(SYSTEM_HYPH)
9574 AC_SUBST(HYPHEN_LIB)
9576 dnl ===================================================================
9577 dnl Checking for mythes
9578 dnl ===================================================================
9579 AC_MSG_CHECKING([which mythes to use])
9580 if test "$with_system_mythes" = "yes"; then
9581     AC_MSG_RESULT([external])
9582     SYSTEM_MYTHES=TRUE
9583     AC_LANG_PUSH([C++])
9584     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9585     if test "$MYTHES_PKGCONFIG" = "no"; then
9586         AC_CHECK_HEADER(mythes.hxx, [],
9587             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9588         AC_CHECK_LIB([mythes-1.2], [main], [:],
9589             [ MYTHES_FOUND=no], [])
9590     if test "$MYTHES_FOUND" = "no"; then
9591         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9592                 [ MYTHES_FOUND=no], [])
9593     fi
9594     if test "$MYTHES_FOUND" = "no"; then
9595         AC_MSG_ERROR([mythes library not found!.])
9596     fi
9597     fi
9598     AC_LANG_POP([C++])
9599     libo_MINGW_CHECK_DLL([libmythes-1.2])
9600     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9601 else
9602     AC_MSG_RESULT([internal])
9603     SYSTEM_MYTHES=
9604     BUILD_TYPE="$BUILD_TYPE MYTHES"
9605     if test "$COM" = "MSC"; then
9606         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9607     else
9608         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9609     fi
9611 AC_SUBST(SYSTEM_MYTHES)
9612 AC_SUBST(MYTHES_CFLAGS)
9613 AC_SUBST(MYTHES_LIBS)
9615 dnl ===================================================================
9616 dnl How should we build the linear programming solver ?
9617 dnl ===================================================================
9619 ENABLE_COINMP=
9620 AC_MSG_CHECKING([whether to build with CoinMP])
9621 if test "$enable_coinmp" != "no"; then
9622     ENABLE_COINMP=TRUE
9623     AC_MSG_RESULT([yes])
9624     # Should we check for system CoinMP ? How to do that ?
9625     BUILD_TYPE="$BUILD_TYPE COINMP"
9626 else
9627     AC_MSG_RESULT([no])
9629 AC_SUBST(ENABLE_COINMP)
9631 ENABLE_LPSOLVE=
9632 AC_MSG_CHECKING([whether to build with lpsolve])
9633 if test "$enable_lpsolve" != "no"; then
9634     ENABLE_LPSOLVE=TRUE
9635     AC_MSG_RESULT([yes])
9636 else
9637     AC_MSG_RESULT([no])
9639 AC_SUBST(ENABLE_LPSOLVE)
9641 if test "$ENABLE_LPSOLVE" = TRUE; then
9642     AC_MSG_CHECKING([which lpsolve to use])
9643     if test "$with_system_lpsolve" = "yes"; then
9644         AC_MSG_RESULT([external])
9645         SYSTEM_LPSOLVE=TRUE
9646         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9647            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9648         save_LIBS=$LIBS
9649         # some systems need this. Like Ubuntu....
9650         AC_CHECK_LIB(m, floor)
9651         AC_CHECK_LIB(dl, dlopen)
9652         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9653             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9654         LIBS=$save_LIBS
9655         libo_MINGW_CHECK_DLL([lpsolve55])
9656     else
9657         AC_MSG_RESULT([internal])
9658         SYSTEM_LPSOLVE=
9659         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9660     fi
9662 AC_SUBST(SYSTEM_LPSOLVE)
9664 dnl ===================================================================
9665 dnl Checking for libexttextcat
9666 dnl ===================================================================
9667 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9668 if test "$with_system_libexttextcat" = "yes"; then
9669     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9671 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9673 dnl ***************************************
9674 dnl testing libc version for Linux...
9675 dnl ***************************************
9676 if test "$_os" = "Linux"; then
9677     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9678     exec 6>/dev/null # no output
9679     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9680     exec 6>&1 # output on again
9681     if test "$HAVE_LIBC"; then
9682         AC_MSG_RESULT([yes])
9683     else
9684         AC_MSG_ERROR([no, upgrade libc])
9685     fi
9688 dnl =========================================
9689 dnl Check for the Windows  SDK.
9690 dnl =========================================
9691 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9692 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9693 if test "$_os" = "WINNT"; then
9694     AC_MSG_CHECKING([for Windows SDK])
9695     if test "$build_os" = "cygwin"; then
9696         find_winsdk
9697         WINDOWS_SDK_HOME=$winsdktest
9699         # normalize if found
9700         if test -n "$WINDOWS_SDK_HOME"; then
9701             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9702             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9703         fi
9704     fi
9706     if test -n "$WINDOWS_SDK_HOME"; then
9707         # Remove a possible trailing backslash
9708         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9710         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9711              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9712              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9713             have_windows_sdk_headers=yes
9714         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9715              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9716              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9717             have_windows_sdk_headers=yes
9718         else
9719             have_windows_sdk_headers=no
9720         fi
9722         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9723             have_windows_sdk_libs=yes
9724         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9725             have_windows_sdk_libs=yes
9726         else
9727             have_windows_sdk_libs=no
9728         fi
9730         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9731             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9732 the  Windows SDK are installed.])
9733         fi
9735         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9736              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9737              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9738              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9739         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9740              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9741              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9742              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9743         else
9744             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9745         fi
9746     fi
9748     if test -z "$WINDOWS_SDK_HOME"; then
9749         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9750     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9751         WINDOWS_SDK_VERSION=60
9752         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9753     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9754         WINDOWS_SDK_VERSION=61
9755         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9756     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9757         WINDOWS_SDK_VERSION=70
9758         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9759     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9760         WINDOWS_SDK_VERSION=80
9761         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9762         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9763         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9764             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9765             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9766             add_warning "If a build created with VS 2012 should run on Windows XP,"
9767             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9768         fi
9769     else
9770         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9771     fi
9772     PathFormat "$WINDOWS_SDK_HOME"
9773     WINDOWS_SDK_HOME="$formatted_path"
9774     if test "$build_os" = "cygwin"; then
9775         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9776         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9777             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9778         fi
9779     fi
9781     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9782     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9783     dnl but not in v8.0), so allow this to be overridden with a
9784     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9785     dnl and configuration error if no WiLangId.vbs is found would arguably be
9786     dnl better, but I do not know under which conditions exactly it is needed by
9787     dnl msiglobal.pm:
9788     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9789         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9790         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9791             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9792         fi
9793         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9794             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9795         fi
9796         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9797             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9798             add_warning "WiLangId.vbs not found - building translated packages will fail"
9799         fi
9800     fi
9802 AC_SUBST(WINDOWS_SDK_HOME)
9803 AC_SUBST(WINDOWS_SDK_VERSION)
9804 AC_SUBST(WINDOWS_SDK_WILANGID)
9806 dnl =========================================
9807 dnl Check for uuidgen
9808 dnl =========================================
9809 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9810     if test "$WITH_MINGW" = "yes"; then
9811         AC_PATH_PROG([UUIDGEN], [uuid])
9812         if test -z "$UUIDGEN"; then
9813             AC_MSG_WARN([uuid is needed for dev-install])
9814         fi
9815     else
9816         # presence is already tested above in the WINDOWS_SDK_HOME check
9817         UUIDGEN=uuidgen.exe
9818         AC_SUBST(UUIDGEN)
9819     fi
9820 else
9821     AC_PATH_PROG([UUIDGEN], [uuidgen])
9822     if test -z "$UUIDGEN"; then
9823         AC_MSG_WARN([uuid is needed for dev-install])
9824     fi
9827 dnl =========================================
9828 dnl Check for the Microsoft DirectX SDK.
9829 dnl =========================================
9830 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9831     AC_MSG_CHECKING([for DirectX SDK])
9832     if test "$build_os" = "cygwin"; then
9833         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9834         if test -n "$DXSDK_DIR"; then
9835             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9836             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9837         fi
9838         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9839         # the "DirectX SDK not found" error later.
9840         # (Where?)
9842         # Remove a possible trailing backslash
9843         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9844     fi
9846     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9847         HAVE_DIRECTXSDK_H="yes"
9848     else
9849         HAVE_DIRECTXSDK_H="no"
9850     fi
9852     if test "$BITNESS_OVERRIDE" = 64; then
9853         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9854     else
9855         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9856     fi
9857     PathFormat "$DIRECTXSDK_LIB"
9858     DIRECTXSDK_LIB="$formatted_path"
9860     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9861         HAVE_DIRECTXSDK_LIB="yes"
9862     else
9863         HAVE_DIRECTXSDK_LIB="no"
9864     fi
9866     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9867         AC_MSG_RESULT([found])
9868     else
9869         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9870     fi
9871     if test -n "$DIRECTXSDK_HOME"; then
9872         PathFormat "$DIRECTXSDK_HOME"
9873         DIRECTXSDK_HOME="$formatted_path"
9874         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9875     fi
9877 AC_SUBST(DIRECTXSDK_HOME)
9879 dnl ***************************************
9880 dnl Checking for bison and flex
9881 dnl ***************************************
9882 AC_PATH_PROG(BISON, bison)
9883 if test -z "$BISON"; then
9884     AC_MSG_ERROR([no bison found in \$PATH, install it])
9885 else
9886     AC_MSG_CHECKING([the bison version])
9887     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9888     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9889     # Accept newer than 2.0
9890     if test "$_bison_longver" -lt 2000; then
9891         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9892     fi
9895 AC_PATH_PROG(FLEX, flex)
9896 if test -z "$FLEX"; then
9897     AC_MSG_ERROR([no flex found in \$PATH, install it])
9898 else
9899     AC_MSG_CHECKING([the flex version])
9900     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9901     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9902         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9903     fi
9905 AC_SUBST([FLEX])
9906 dnl ***************************************
9907 dnl Checking for patch
9908 dnl ***************************************
9909 AC_PATH_PROG(PATCH, patch)
9910 if test -z "$PATCH"; then
9911     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9914 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9915 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9916     if test -z "$with_gnu_patch"; then
9917         GNUPATCH=$PATCH
9918     else
9919         if test -x "$with_gnu_patch"; then
9920             GNUPATCH=$with_gnu_patch
9921         else
9922             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9923         fi
9924     fi
9926     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9927     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9928         AC_MSG_RESULT([yes])
9929     else
9930         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9931     fi
9932 else
9933     GNUPATCH=$PATCH
9936 dnl We also need to check for --with-gnu-cp
9938 if test -z "$with_gnu_cp"; then
9939     # check the place where the good stuff is hidden on Solaris...
9940     if test -x /usr/gnu/bin/cp; then
9941         GNUCP=/usr/gnu/bin/cp
9942     else
9943         AC_PATH_PROGS(GNUCP, gnucp cp)
9944     fi
9945     if test -z $GNUCP; then
9946         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9947     fi
9948 else
9949     if test -x "$with_gnu_cp"; then
9950         GNUCP=$with_gnu_cp
9951     else
9952         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9953     fi
9956 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9957 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9958     AC_MSG_RESULT([yes])
9959 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9960     AC_MSG_RESULT([yes])
9961 else
9962     case "$build_os" in
9963     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9964         x_GNUCP=[\#]
9965         GNUCP=''
9966         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9967         ;;
9968     *)
9969         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9970         ;;
9971     esac
9974 AC_SUBST(GNUPATCH)
9975 AC_SUBST(GNUCP)
9976 AC_SUBST(x_GNUCP)
9978 dnl ***************************************
9979 dnl testing assembler path
9980 dnl ***************************************
9981 ML_EXE=""
9982 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9983     if test "$BITNESS_OVERRIDE" = ""; then
9984         assembler=ml.exe
9985         assembler_bin=bin
9986     else
9987         assembler=ml64.exe
9988         assembler_bin=bin/amd64
9989     fi
9991     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9992     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9993         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9994         AC_MSG_RESULT([found])
9995         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9996     else
9997         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9998     fi
10000     PathFormat "$ASM_HOME"
10001     ASM_HOME="$formatted_path"
10002 else
10003     ASM_HOME=""
10006 AC_SUBST(ML_EXE)
10008 dnl ===================================================================
10009 dnl We need zip and unzip
10010 dnl ===================================================================
10011 AC_PATH_PROG(ZIP, zip)
10012 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10013 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10014     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],,)
10017 AC_PATH_PROG(UNZIP, unzip)
10018 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10020 dnl ===================================================================
10021 dnl Zip must be a specific type for different build types.
10022 dnl ===================================================================
10023 if test $build_os = cygwin; then
10024     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10025         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10026     fi
10029 dnl ===================================================================
10030 dnl We need touch with -h option support.
10031 dnl ===================================================================
10032 AC_PATH_PROG(TOUCH, touch)
10033 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10034 touch warn
10035 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10036     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],,)
10039 dnl ===================================================================
10040 dnl Test which vclplugs have to be built.
10041 dnl ===================================================================
10042 R=""
10043 GTK3_CFLAGS=""
10044 GTK3_LIBS=""
10045 ENABLE_GTK3=""
10046 if test "x$enable_gtk3" = "xyes"; then
10047     if test "$with_system_cairo" = no; then
10048         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10049     fi
10050     : ${with_system_cairo:=yes}
10051     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="")
10052     if test "x$ENABLE_GTK3" = "xTRUE"; then
10053         R="gtk3"
10054     else
10055         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
10056     fi
10057     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10059 AC_SUBST(GTK3_LIBS)
10060 AC_SUBST(GTK3_CFLAGS)
10061 AC_SUBST(ENABLE_GTK3)
10063 AC_MSG_CHECKING([which VCLplugs shall be built])
10064 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
10065     enable_gtk=no
10067 ENABLE_GTK=""
10068 if test "x$enable_gtk" = "xyes"; then
10069     if test "$with_system_cairo" = no; then
10070         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10071     fi
10072     : ${with_system_cairo:=yes}
10073     ENABLE_GTK="TRUE"
10074     AC_DEFINE(ENABLE_GTK)
10075     R="gtk $R"
10077 AC_SUBST(ENABLE_GTK)
10079 ENABLE_TDE=""
10080 if test "x$enable_tde" = "xyes"; then
10081     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
10082     # are built from the same sources. So we only allow one of them.
10083     if test "x$enable_kde" = "xyes"; then
10084         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
10085     fi
10086     ENABLE_TDE="TRUE"
10087     AC_DEFINE(ENABLE_TDE)
10088     R="$R tde"
10090 AC_SUBST(ENABLE_TDE)
10092 ENABLE_KDE=""
10093 if test "x$enable_kde" = "xyes"; then
10094     ENABLE_KDE="TRUE"
10095     AC_DEFINE(ENABLE_KDE)
10096     R="$R kde"
10098 AC_SUBST(ENABLE_KDE)
10100 ENABLE_KDE4=""
10101 if test "x$enable_kde4" = "xyes"; then
10102     ENABLE_KDE4="TRUE"
10103     AC_DEFINE(ENABLE_KDE4)
10104     R="$R kde4"
10106 AC_SUBST(ENABLE_KDE4)
10108 ENABLE_HEADLESS=""
10109 if test "x$enable_headless" = "xyes"; then
10110     ENABLE_HEADLESS="TRUE"
10111     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10112     R="headless"
10114 AC_SUBST(ENABLE_HEADLESS)
10116 if test -z "$R"; then
10117     AC_MSG_RESULT([none])
10118 else
10119     AC_MSG_RESULT([$R])
10122 dnl ===================================================================
10123 dnl GCONF check
10124 dnl ===================================================================
10126 ENABLE_GCONF=
10127 AC_MSG_CHECKING([whether to enable GConf support])
10128 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
10129     ENABLE_GCONF="TRUE"
10130     AC_MSG_RESULT([yes])
10131     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
10132     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10133 else
10134     AC_MSG_RESULT([no])
10136 AC_SUBST(GCONF_LIBS)
10137 AC_SUBST(GCONF_CFLAGS)
10138 AC_SUBST(ENABLE_GCONF)
10140 dnl ===================================================================
10141 dnl Gnome VFS check
10142 dnl ===================================================================
10144 ENABLE_GNOMEVFS=""
10145 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10146 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10147     ENABLE_GNOMEVFS="TRUE"
10148     AC_MSG_RESULT([yes])
10149     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10150     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10151     AC_DEFINE(ENABLE_GNOME_VFS)
10152 else
10153     AC_MSG_RESULT([no])
10155 AC_SUBST(GNOMEVFS_LIBS)
10156 AC_SUBST(GNOMEVFS_CFLAGS)
10157 AC_SUBST(ENABLE_GNOMEVFS)
10159 dnl ===================================================================
10160 dnl check for dbus support
10161 dnl ===================================================================
10162 ENABLE_DBUS=""
10163 DBUS_CFLAGS=""
10164 DBUS_LIBS=""
10166 if test "$enable_dbus" = "no"; then
10167     test_dbus=no
10170 AC_MSG_CHECKING([whether to enable DBUS support])
10171 if test "$test_dbus" = "yes"; then
10172     ENABLE_DBUS="TRUE"
10173     AC_MSG_RESULT([yes])
10174     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10175     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10176 else
10177     AC_MSG_RESULT([no])
10180 AC_SUBST(ENABLE_DBUS)
10181 AC_SUBST(DBUS_CFLAGS)
10182 AC_SUBST(DBUS_LIBS)
10184 AC_MSG_CHECKING([whether to enable font install via packagekit])
10185 if test "$ENABLE_DBUS" = "TRUE"; then
10186     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10187         ENABLE_PACKAGEKIT=TRUE
10188         AC_MSG_RESULT([yes])
10189     else
10190         ENABLE_PACKAGEKIT=
10191         AC_MSG_RESULT([no])
10192     fi
10193 else
10194     AC_MSG_RESULT([no, dbus disabled.])
10196 AC_SUBST(ENABLE_PACKAGEKIT)
10198 AC_MSG_CHECKING([whether to enable Impress remote control])
10199 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10200     AC_MSG_RESULT([yes])
10201     ENABLE_SDREMOTE=TRUE
10202     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10204     # If not explicitly enabled or disabled, default
10205     if test -z "$enable_sdremote_bluetooth"; then
10206         case "$OS" in
10207         LINUX|MACOSX|WNT)
10208             # Default to yes for these
10209             enable_sdremote_bluetooth=yes
10210             ;;
10211         *)
10212             # otherwise no
10213             enable_sdremote_bluetooth=no
10214             ;;
10215         esac
10216     fi
10217     # $enable_sdremote_bluetooth is guaranteed non-empty now
10219     if test "$enable_sdremote_bluetooth" != "no"; then
10220         if test "$OS" = "LINUX"; then
10221             if test "$ENABLE_DBUS" = "TRUE"; then
10222                 AC_MSG_RESULT([yes])
10223                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10224                 dnl ===================================================================
10225                 dnl Check for system bluez
10226                 dnl ===================================================================
10227                 AC_MSG_CHECKING([which Bluetooth header to use])
10228                 if test "$with_system_bluez" = "yes"; then
10229                     AC_MSG_RESULT([external])
10230                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10231                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10232                     SYSTEM_BLUEZ=TRUE
10233                 else
10234                     AC_MSG_RESULT([internal])
10235                     SYSTEM_BLUEZ=
10236                 fi
10237             else
10238                 AC_MSG_RESULT([no, dbus disabled])
10239                 ENABLE_SDREMOTE_BLUETOOTH=
10240                 SYSTEM_BLUEZ=
10241             fi
10242         else
10243             AC_MSG_RESULT([yes])
10244             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10245             SYSTEM_BLUEZ=
10246         fi
10247     else
10248         AC_MSG_RESULT([no])
10249         ENABLE_SDREMOTE_BLUETOOTH=
10250         SYSTEM_BLUEZ=
10251     fi
10252 else
10253     ENABLE_SDREMOTE=
10254     SYSTEM_BLUEZ=
10255     AC_MSG_RESULT([no])
10257 AC_SUBST(ENABLE_SDREMOTE)
10258 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10259 AC_SUBST(SYSTEM_BLUEZ)
10261 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10262 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10263     AC_MSG_RESULT([yes])
10264     ENABLE_SDREMOTE_ANDROID=TRUE
10265 else
10266     AC_MSG_RESULT([no])
10267     ENABLE_SDREMOTE_ANDROID=
10269 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10271 dnl ===================================================================
10272 dnl Check whether the gtk 2.0 libraries are available.
10273 dnl ===================================================================
10275 GTK_CFLAGS=""
10276 GTK_LIBS=""
10277 ENABLE_SYSTRAY_GTK=""
10278 if test  "$test_gtk" = "yes"; then
10280     if test "$ENABLE_GTK" = "TRUE"; then
10281         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]))
10282         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10283         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]))
10284         BUILD_TYPE="$BUILD_TYPE GTK"
10285         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10287     AC_MSG_CHECKING([whether to enable the systray quickstarter])
10288         if test "x$enable_systray" = "xyes"; then
10289             AC_MSG_RESULT([yes])
10290             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10291                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10292                             [ ENABLE_SYSTRAY_GTK="" ])
10293         else
10294             AC_MSG_RESULT([no])
10295         fi
10297         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10298         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10299                           [ENABLE_GTK_PRINT="TRUE"],
10300                           [ENABLE_GTK_PRINT=""])
10301         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10303         AC_MSG_CHECKING([whether to enable GIO support])
10304         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10305             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10306                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10307             fi
10308             dnl Need at least 2.26 for the dbus support.
10309             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10310                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10311             if test "$ENABLE_GIO" = "TRUE"; then
10312                 AC_DEFINE(ENABLE_GIO)
10313                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10314             fi
10315         else
10316             AC_MSG_RESULT([no])
10317         fi
10318     fi
10320 AC_SUBST(ENABLE_GIO)
10321 AC_SUBST(GIO_CFLAGS)
10322 AC_SUBST(GIO_LIBS)
10323 AC_SUBST(ENABLE_SYSTRAY_GTK)
10324 AC_SUBST(GTK_CFLAGS)
10325 AC_SUBST(GTK_LIBS)
10326 AC_SUBST(GTHREAD_CFLAGS)
10327 AC_SUBST(GTHREAD_LIBS)
10328 AC_SUBST([ENABLE_GTK_PRINT])
10329 AC_SUBST([GTK_PRINT_CFLAGS])
10330 AC_SUBST([GTK_PRINT_LIBS])
10333 dnl ===================================================================
10334 dnl Check whether the Telepathy libraries are available.
10335 dnl ===================================================================
10337 ENABLE_TELEPATHY=""
10338 TELEPATHY_CFLAGS=""
10339 TELEPATHY_LIBS=""
10341 AC_MSG_CHECKING([whether to enable Telepathy support])
10342 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10343     ENABLE_TELEPATHY="TRUE"
10344     AC_DEFINE(ENABLE_TELEPATHY)
10345     AC_MSG_RESULT([yes])
10346     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 )
10347     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10348 else
10349     AC_MSG_RESULT([no])
10352 AC_SUBST(ENABLE_TELEPATHY)
10353 AC_SUBST(TELEPATHY_CFLAGS)
10354 AC_SUBST(TELEPATHY_LIBS)
10357 dnl ===================================================================
10359 SPLIT_APP_MODULES=""
10360 if test "$enable_split_app_modules" = "yes"; then
10361     SPLIT_APP_MODULES="TRUE"
10363 AC_SUBST(SPLIT_APP_MODULES)
10365 SPLIT_OPT_FEATURES=""
10366 if test "$enable_split_opt_features" = "yes"; then
10367     SPLIT_OPT_FEATURES="TRUE"
10369 AC_SUBST(SPLIT_OPT_FEATURES)
10371 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10372     if test "$enable_cairo_canvas" = yes; then
10373         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10374     fi
10375     enable_cairo_canvas=no
10376 elif test -z "$enable_cairo_canvas"; then
10377     enable_cairo_canvas=yes
10380 ENABLE_CAIRO_CANVAS=""
10381 if test "$enable_cairo_canvas" = "yes"; then
10382     test_cairo=yes
10383     ENABLE_CAIRO_CANVAS="TRUE"
10385 AC_SUBST(ENABLE_CAIRO_CANVAS)
10387 dnl ===================================================================
10388 dnl Check whether the GStreamer libraries are available.
10389 dnl ===================================================================
10391 ENABLE_GSTREAMER=""
10393 if test "$build_gstreamer" = "yes"; then
10395     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10396     if test "$enable_avmedia" = yes -a "$enable_gstreamer" != no; then
10397         ENABLE_GSTREAMER="TRUE"
10398         AC_MSG_RESULT([yes])
10399         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10400         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10401     else
10402         AC_MSG_RESULT([no])
10403     fi
10405 AC_SUBST(GSTREAMER_CFLAGS)
10406 AC_SUBST(GSTREAMER_LIBS)
10407 AC_SUBST(ENABLE_GSTREAMER)
10410 ENABLE_GSTREAMER_0_10=""
10411 if test "$build_gstreamer_0_10" = "yes"; then
10413     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10414     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10415         ENABLE_GSTREAMER_0_10="TRUE"
10416         AC_MSG_RESULT([yes])
10417         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10418             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10419         ])
10420         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10421     else
10422         AC_MSG_RESULT([no])
10423     fi
10426 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10427 AC_SUBST(GSTREAMER_0_10_LIBS)
10428 AC_SUBST(ENABLE_GSTREAMER_0_10)
10430 dnl ===================================================================
10431 dnl Check whether to build the VLC avmedia backend
10432 dnl ===================================================================
10434 ENABLE_VLC=""
10436 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10437 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10438     ENABLE_VLC="TRUE"
10439     AC_MSG_RESULT([yes])
10440 else
10441     AC_MSG_RESULT([no])
10443 AC_SUBST(ENABLE_VLC)
10445 dnl ===================================================================
10446 dnl Check whether the OpenGL libraries are available
10447 dnl ===================================================================
10449 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10450 ENABLE_OPENGL=
10452 if test -z "$enable_opengl"; then
10453     if test $_os = WINNT; then
10454         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10455         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10456         # code for Windows.
10457         enable_opengl=no
10458     elif test $_os = iOS; then
10459         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10460         # build fine for iOS, too, but let's leave that for later
10461         enable_opengl=no
10462     elif test "$enable_headless" = "yes"; then
10463         enable_opengl=no
10464     else
10465         enable_opengl=yes
10466     fi
10469 if test "x$enable_opengl" = "xno"; then
10470     AC_MSG_RESULT([no])
10471 elif test "$_os" = "Darwin"; then
10472     # We use frameworks on Mac OS X, no need for detail checks
10473     ENABLE_OPENGL=TRUE
10474     ENABLE_OPENGL_CANVAS=
10475     add_warning "openGL canvas not adapted for Mac yet - disabling"
10476     SYSTEM_MESA_HEADERS=TRUE
10477     AC_MSG_RESULT([yes])
10478 elif test $_os = WINNT; then
10479     # Experimental: try to use OpenGL on Windows
10480     ENABLE_OPENGL=TRUE
10481     ENABLE_OPENGL_CANVAS=TRUE
10482     # We need the internal "Mesa" headers.
10483     SYSTEM_MESA_HEADERS=
10484     BUILD_TYPE="$BUILD_TYPE MESA"
10485     AC_MSG_RESULT([yes])
10486 else
10487     save_LDFLAGS=$LDFLAGS
10488     LDFLAGS="$LDFLAGS -lm"
10489     AC_MSG_RESULT([yes])
10490     AC_CHECK_LIB([GL], [main],
10491         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10492             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10493              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10494              ENABLE_OPENGL_CANVAS=], [])],
10495         [AC_MSG_ERROR(libGL not installed or functional)], [])
10496     LDFLAGS="$LDFLAGS -lGL"
10497     AC_CHECK_LIB([GLU], [main], [:],
10498               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10499     ENABLE_OPENGL=TRUE
10500     LDFLAGS=$save_LDFLAGS
10502     dnl ===================================================================
10503     dnl Check for system Mesa
10504     dnl ===================================================================
10505     AC_MSG_CHECKING([which Mesa headers to use])
10506     if test "$with_system_mesa_headers" = "yes"; then
10507         AC_MSG_RESULT([external])
10508         SYSTEM_MESA_HEADERS=TRUE
10509         AC_LANG_PUSH(C)
10510         AC_CHECK_HEADER(GL/glxext.h, [],
10511            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10512         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10513         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10514         AC_LANG_POP(C)
10515     else
10516         AC_MSG_RESULT([internal])
10517         SYSTEM_MESA_HEADERS=
10518         BUILD_TYPE="$BUILD_TYPE MESA"
10519     fi
10522 AC_SUBST(SYSTEM_MESA_HEADERS)
10523 AC_SUBST(ENABLE_OPENGL)
10524 AC_SUBST(ENABLE_OPENGL_CANVAS)
10526 dnl =================================================
10527 dnl Check whether to build with OpenCL support.
10528 dnl =================================================
10530 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10531 ENABLE_OPENCL=
10533 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10534     if test $_os = Darwin -a "$with_macosx_sdk" = "10.5"; then
10535         AC_MSG_RESULT([disabled on OS X 10.5])
10536     else
10537         AC_MSG_RESULT([yes])
10538         ENABLE_OPENCL=TRUE
10539         AC_DEFINE(HAVE_FEATURE_OPENCL)
10540     fi
10541 else
10542     AC_MSG_RESULT([no])
10545 AC_SUBST(ENABLE_OPENCL)
10547 dnl ===================================================================
10548 dnl Check whether to enable glTF support
10549 dnl ===================================================================
10550 AC_MSG_CHECKING([whether to enable glTF support])
10551 ENABLE_GLTF=
10552 if test "x$enable_gltf" != "xno" -a $_os != Darwin -a $_os != iOS -a $_os != Android; then
10553     ENABLE_GLTF=TRUE
10554     AC_MSG_RESULT([yes])
10555     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10556     if test "$with_system_libgltf" = "yes"; then
10557         SYSTEM_LIBGLTF=TRUE
10558         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10559     else
10560         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10561     fi
10562 else
10563     AC_MSG_RESULT([no])
10565 AC_SUBST(ENABLE_GLTF)
10566 AC_SUBST(SYSTEM_LIBGLTF)
10567 AC_SUBST(LIBGLTF_CFLAGS)
10568 AC_SUBST(LIBGLTF_LIBS)
10570 dnl ===================================================================
10571 dnl Check whether to enable COLLADA support
10572 dnl ===================================================================
10573 AC_MSG_CHECKING([whether to enable COLLADA support])
10574 ENABLE_COLLADA=
10575 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10576     AC_MSG_RESULT([yes])
10577     ENABLE_COLLADA=TRUE
10578     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10579     BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10580 else
10581     AC_MSG_RESULT([no])
10583 AC_SUBST(ENABLE_COLLADA)
10585 # pdf import?
10586 AC_MSG_CHECKING([whether to build the PDF import feature])
10587 ENABLE_PDFIMPORT=
10588 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10589     AC_MSG_RESULT([yes])
10590     ENABLE_PDFIMPORT=TRUE
10592     dnl ===================================================================
10593     dnl Check for system poppler
10594     dnl ===================================================================
10595     AC_MSG_CHECKING([which PDF import backend to use])
10596     if test "$with_system_poppler" = "yes"; then
10597         AC_MSG_RESULT([external])
10598         SYSTEM_POPPLER=TRUE
10599         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10600         AC_LANG_PUSH([C++])
10601         save_CXXFLAGS=$CXXFLAGS
10602         save_CPPFLAGS=$CPPFLAGS
10603         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10604         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10605         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10606                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10607         CXXFLAGS=$save_CXXFLAGS
10608         CPPFLAGS=$save_CPPFLAGS
10609         AC_LANG_POP([C++])
10610         libo_MINGW_CHECK_DLL([libpoppler])
10611         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10612     else
10613         AC_MSG_RESULT([internal])
10614         SYSTEM_POPPLER=
10615         BUILD_TYPE="$BUILD_TYPE POPPLER"
10616     fi
10617 else
10618     AC_MSG_RESULT([no])
10620 AC_SUBST(ENABLE_PDFIMPORT)
10621 AC_SUBST(SYSTEM_POPPLER)
10622 AC_SUBST(POPPLER_CFLAGS)
10623 AC_SUBST(POPPLER_LIBS)
10625 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10626 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10627     AC_MSG_RESULT([yes])
10628     ENABLE_MEDIAWIKI=TRUE
10629     BUILD_TYPE="$BUILD_TYPE XSLTML"
10630     if test  "x$with_java" = "xno"; then
10631         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10632     fi
10633 else
10634     AC_MSG_RESULT([no])
10635     ENABLE_MEDIAWIKI=
10636     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10638 AC_SUBST(ENABLE_MEDIAWIKI)
10640 AC_MSG_CHECKING([whether to build the Report Builder])
10641 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10642     AC_MSG_RESULT([yes])
10643     ENABLE_REPORTBUILDER=TRUE
10644     AC_MSG_CHECKING([which jfreereport libs to use])
10645     if test "$with_system_jfreereport" = "yes"; then
10646         SYSTEM_JFREEREPORT=TRUE
10647         AC_MSG_RESULT([external])
10648         if test -z $SAC_JAR; then
10649             SAC_JAR=/usr/share/java/sac.jar
10650         fi
10651         AC_CHECK_FILE($SAC_JAR, [],
10652              [AC_MSG_ERROR(sac.jar not found.)], [])
10654         if test -z $LIBXML_JAR; then
10655             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10656                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10657                 [
10658                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10659                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10660                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10661                     )
10662                 ]
10663             )
10664         else
10665             AC_CHECK_FILE($LIBXML_JAR, [],
10666                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10667         fi
10669         if test -z $FLUTE_JAR; then
10670             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10671                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10672                 [
10673                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10674                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10675                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10676                     )
10677                 ]
10678             )
10679         else
10680             AC_CHECK_FILE($FLUTE_JAR, [],
10681                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10682         fi
10684         if test -z $JFREEREPORT_JAR; then
10685             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10686                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10687                 [
10688                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10689                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10690                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10691                     )
10692                 ]
10693             )
10694         else
10695             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10696                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10697         fi
10699         if test -z $LIBLAYOUT_JAR; then
10700             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10701                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10702                 [
10703                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10704                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10705                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10706                     )
10707                 ]
10708             )
10709         else
10710             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10711                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10712         fi
10714         if test -z $LIBLOADER_JAR; then
10715             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10716                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10717                 [
10718                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10719                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10720                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10721                     )
10722                 ]
10723             )
10724         else
10725             AC_CHECK_FILE($LIBLOADER_JAR, [],
10726                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10727         fi
10729         if test -z $LIBFORMULA_JAR; then
10730             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10731                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10732                  [
10733                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10734                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10735                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10736                      )
10737                  ]
10738             )
10739         else
10740             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10741                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10742         fi
10744         if test -z $LIBREPOSITORY_JAR; then
10745             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10746                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10747                 [
10748                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10749                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10750                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10751                     )
10752                 ]
10753             )
10754         else
10755             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10756                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10757         fi
10759         if test -z $LIBFONTS_JAR; then
10760             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10761                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10762                 [
10763                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10764                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10765                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10766                     )
10767                 ]
10768             )
10769         else
10770             AC_CHECK_FILE($LIBFONTS_JAR, [],
10771                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10772         fi
10774         if test -z $LIBSERIALIZER_JAR; then
10775             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10776                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10777                 [
10778                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10779                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10780                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10781                     )
10782                 ]
10783             )
10784         else
10785             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10786                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10787         fi
10789         if test -z $LIBBASE_JAR; then
10790             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10791                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10792                 [
10793                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10794                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10795                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10796                     )
10797                 ]
10798             )
10799         else
10800             AC_CHECK_FILE($LIBBASE_JAR, [],
10801                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10802         fi
10804     else
10805         AC_MSG_RESULT([internal])
10806         SYSTEM_JFREEREPORT=
10807         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10808     fi
10809 else
10810     AC_MSG_RESULT([no])
10811     ENABLE_REPORTBUILDER=
10812     SYSTEM_JFREEREPORT=
10814 AC_SUBST(ENABLE_REPORTBUILDER)
10815 AC_SUBST(SYSTEM_JFREEREPORT)
10816 AC_SUBST(SAC_JAR)
10817 AC_SUBST(LIBXML_JAR)
10818 AC_SUBST(FLUTE_JAR)
10819 AC_SUBST(JFREEREPORT_JAR)
10820 AC_SUBST(LIBBASE_JAR)
10821 AC_SUBST(LIBLAYOUT_JAR)
10822 AC_SUBST(LIBLOADER_JAR)
10823 AC_SUBST(LIBFORMULA_JAR)
10824 AC_SUBST(LIBREPOSITORY_JAR)
10825 AC_SUBST(LIBFONTS_JAR)
10826 AC_SUBST(LIBSERIALIZER_JAR)
10828 # this has to be here because both the Wiki Publisher and the SRB use
10829 # commons-logging
10830 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10831     AC_MSG_CHECKING([which Apache commons-* libs to use])
10832     if test "$with_system_apache_commons" = "yes"; then
10833         SYSTEM_APACHE_COMMONS=TRUE
10834         AC_MSG_RESULT([external])
10835         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10836             if test -z $COMMONS_CODEC_JAR; then
10837                 _commons_codec_path=""
10838                 if test "$HAVE_JAVA6" = "TRUE"; then
10839                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10840                 else
10841                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10842                 fi
10843                 AC_CHECK_FILE($_commons_codec_path,
10844                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10845                     [
10846                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10847                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10848                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10849                         )
10850                     ]
10851                 )
10852             else
10853                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10854                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10855             fi
10857             if test -z $COMMONS_LANG_JAR; then
10858                 _commons_lang_path=""
10859                 if test "$HAVE_JAVA6" = "TRUE"; then
10860                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10861                 else
10862                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10863                 fi
10864                 AC_CHECK_FILE($_commons_lang_path,
10865                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10866                     [
10867                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10868                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10869                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10870                             )
10871                     ]
10872                 )
10873             else
10874                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10875                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10876             fi
10878             if test -z $COMMONS_HTTPCLIENT_JAR; then
10879                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10880                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10881                     [
10882                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10883                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10884                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10885                         )
10886                     ]
10887                 )
10888             else
10889                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10890                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10891             fi
10892         fi
10893         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10894             if test -z $COMMONS_LOGGING_JAR; then
10895                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
10896                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
10897                    [
10898                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10899                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10900                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10901                         )
10902                     ]
10903                 )
10904             else
10905                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10906                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10907             fi
10908         fi
10909     else
10910         AC_MSG_RESULT([internal])
10911         SYSTEM_APACHE_COMMONS=
10912         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10913     fi
10915 AC_SUBST(SYSTEM_APACHE_COMMONS)
10916 AC_SUBST(COMMONS_CODEC_JAR)
10917 AC_SUBST(COMMONS_LANG_JAR)
10918 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10919 AC_SUBST(COMMONS_LOGGING_JAR)
10921 # scripting provider for BeanShell?
10922 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10923 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10924     AC_MSG_RESULT([yes])
10925     ENABLE_SCRIPTING_BEANSHELL=TRUE
10927     dnl ===================================================================
10928     dnl Check for system beanshell
10929     dnl ===================================================================
10930     AC_MSG_CHECKING([which beanshell to use])
10931     if test "$with_system_beanshell" = "yes"; then
10932         AC_MSG_RESULT([external])
10933         SYSTEM_BSH=TRUE
10934         if test -z $BSH_JAR; then
10935             BSH_JAR=/usr/share/java/bsh.jar
10936         fi
10937         AC_CHECK_FILE($BSH_JAR, [],
10938                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10939     else
10940         AC_MSG_RESULT([internal])
10941         SYSTEM_BSH=
10942         BUILD_TYPE="$BUILD_TYPE BSH"
10943     fi
10944 else
10945     AC_MSG_RESULT([no])
10946     ENABLE_SCRIPTING_BEANSHELL=
10947     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10949 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10950 AC_SUBST(SYSTEM_BSH)
10951 AC_SUBST(BSH_JAR)
10953 # scripting provider for JavaScript?
10954 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10955 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10956     AC_MSG_RESULT([yes])
10957     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10959     dnl ===================================================================
10960     dnl Check for system rhino
10961     dnl ===================================================================
10962     AC_MSG_CHECKING([which rhino to use])
10963     if test "$with_system_rhino" = "yes"; then
10964         AC_MSG_RESULT([external])
10965         SYSTEM_RHINO=TRUE
10966         if test -z $RHINO_JAR; then
10967             RHINO_JAR=/usr/share/java/js.jar
10968         fi
10969         AC_CHECK_FILE($RHINO_JAR, [],
10970                    [AC_MSG_ERROR(js.jar not found.)], [])
10971     else
10972         AC_MSG_RESULT([internal])
10973         SYSTEM_RHINO=
10974         BUILD_TYPE="$BUILD_TYPE RHINO"
10975     fi
10976 else
10977     AC_MSG_RESULT([no])
10978     ENABLE_SCRIPTING_JAVASCRIPT=
10979     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10981 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10982 AC_SUBST(SYSTEM_RHINO)
10983 AC_SUBST(RHINO_JAR)
10985 supports_multilib=
10986 case "$host_cpu" in
10987 x86_64 | powerpc64 | s390x)
10988     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10989         supports_multilib="yes"
10990     fi
10991     ;;
10993     ;;
10994 esac
10996 dnl ===================================================================
10997 dnl Check whether the TQt and TDE libraries are available.
10998 dnl ===================================================================
11000 TDE_CFLAGS=""
11001 TDE_LIBS=""
11002 if test "$_os" != "OpenBSD"; then
11003     MOC="moc"
11005 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
11006     dnl Search paths for TQt and TDE
11007     if test -z "$supports_multilib"; then
11008         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"
11009         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"
11010     else
11011         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"
11012         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"
11013     fi
11014     if test -n "$TQTDIR"; then
11015         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
11016         if test -z "$supports_multilib"; then
11017             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
11018         else
11019             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
11020         fi
11021     fi
11022     if test -z "$supports_multilib"; then
11023         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"
11024         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"
11025     else
11026         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"
11027         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"
11028     fi
11029     if test -n "$TDEDIR"; then
11030         tde_incdirs="$TDEDIR/include $tde_incdirs"
11031         if test -z "$supports_multilib"; then
11032             tde_libdirs="$TDEDIR/lib $tde_libdirs"
11033         else
11034             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
11035         fi
11036     fi
11038     dnl What to test
11039     tqt_test_include="ntqstyle.h"
11040     tde_test_include="kapp.h"
11042     if test "$_os" != "OpenBSD"; then
11043         tqt_test_library="libtqt-mt.so"
11044         tde_test_library="libDCOP.so"
11045     else
11046         tqt_test_library="libtqt-mt.so*"
11047         tde_test_library="libDCOP.so*"
11048     fi
11050     dnl Check for TQt headers
11051     AC_MSG_CHECKING([for TQt headers])
11052     tqt_incdir="no"
11053     for tde_check in $tqt_incdirs; do
11054         if test -r "$tde_check/$tqt_test_include"; then
11055             tqt_incdir="$tde_check"
11056             break
11057         fi
11058     done
11059     AC_MSG_RESULT([$tqt_incdir])
11060     if test "x$tqt_incdir" = "xno"; then
11061         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
11062 your TQt installation by exporting TQTDIR before running "configure".])
11063     fi
11065     dnl Check for TQt libraries
11066     AC_MSG_CHECKING([for TQt libraries])
11067     tqt_libdir="no"
11068     for tqt_check in $tqt_libdirs; do
11069         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11070             tqt_libdir="$tqt_check"
11071             break
11072         fi
11073     done
11074     AC_MSG_RESULT([$tqt_libdir])
11075     if test "x$tqt_libdir" = "xno"; then
11076         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11077 your TQt installation by exporting TQTDIR before running "configure".])
11078     fi
11080     dnl Check for Meta Object Compiler
11081     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11082     if test "$MOC" = "no"; then
11083         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11084 the root of your TQt installation by exporting TQTDIR before running "configure".])
11085     fi
11087     dnl Check for TDE headers
11088     AC_MSG_CHECKING([for TDE headers])
11089     tde_incdir="no"
11090     for tde_check in $tde_incdirs; do
11091         if test -r "$tde_check/$tde_test_include"; then
11092             tde_incdir="$tde_check"
11093             break
11094         fi
11095     done
11096     AC_MSG_RESULT([$tde_incdir])
11097     if test "x$tde_incdir" = "xno"; then
11098         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11099 your TDE installation by exporting TDEDIR before running "configure".])
11100     fi
11102     dnl Check for TDE libraries
11103     AC_MSG_CHECKING([for TDE libraries])
11104     tde_libdir="no"
11105     for tde_check in $tde_libdirs; do
11106         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11107             tde_libdir="$tde_check"
11108             break
11109         fi
11110     done
11111     AC_MSG_RESULT([$tde_libdir])
11112     if test "x$tde_libdir" = "xno"; then
11113         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11114 your TDE installation by exporting TDEDIR before running "configure".])
11115     fi
11117     dnl Set the variables
11118     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11119     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11121 AC_SUBST(TDE_CFLAGS)
11122 AC_SUBST(TDE_LIBS)
11123 AC_SUBST(MOC)
11125 dnl ===================================================================
11126 dnl Check whether the Qt3 and KDE3 libraries are available.
11127 dnl ===================================================================
11129 KDE_CFLAGS=""
11130 KDE_LIBS=""
11131 if test "$_os" != "OpenBSD"; then
11132     MOC="moc"
11134 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
11135     dnl Search paths for Qt3 and KDE3
11136     if test -z "$supports_multilib"; then
11137         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"
11138         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"
11139     else
11140         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"
11141         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"
11142     fi
11143     if test -n "$QTDIR"; then
11144         qt_incdirs="$QTDIR/include $qt_incdirs"
11145         if test -z "$supports_multilib"; then
11146             qt_libdirs="$QTDIR/lib $qt_libdirs"
11147         else
11148             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11149         fi
11150     fi
11151     if test -z "$supports_multilib"; then
11152         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"
11153         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"
11154     else
11155         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"
11156         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"
11157     fi
11158     if test -n "$KDEDIR"; then
11159         kde_incdirs="$KDEDIR/include $kde_incdirs"
11160         if test -z "$supports_multilib"; then
11161             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11162         else
11163             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11164         fi
11165     fi
11167     dnl What to test
11168     qt_test_include="qstyle.h"
11169     kde_test_include="kapp.h"
11171     if test "$_os" != "OpenBSD"; then
11172         qt_test_library="libqt-mt.so"
11173         kde_test_library="libDCOP.so"
11174     else
11175         qt_test_library="libqt-mt.so*"
11176         kde_test_library="libDCOP.so*"
11177     fi
11179     dnl Check for Qt3 headers
11180     AC_MSG_CHECKING([for Qt3 headers])
11181     qt_incdir="no"
11182     for kde_check in $qt_incdirs; do
11183         if test -r "$kde_check/$qt_test_include"; then
11184             qt_incdir="$kde_check"
11185             break
11186         fi
11187     done
11188     AC_MSG_RESULT([$qt_incdir])
11189     if test "x$qt_incdir" = "xno"; then
11190         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11191 your Qt3 installation by exporting QTDIR before running "configure".])
11192     fi
11194     dnl Check for Qt3 libraries
11195     AC_MSG_CHECKING([for Qt3 libraries])
11196     qt_libdir="no"
11197     for qt_check in $qt_libdirs; do
11198         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11199             qt_libdir="$qt_check"
11200             break
11201         fi
11202     done
11203     AC_MSG_RESULT([$qt_libdir])
11204     if test "x$qt_libdir" = "xno"; then
11205         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11206 your Qt3 installation by exporting QTDIR before running "configure".])
11207     fi
11209     dnl Check for Meta Object Compiler
11210     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11211     if test "$MOC" = "no"; then
11212         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11213 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11214     fi
11216     dnl Check for KDE3 headers
11217     AC_MSG_CHECKING([for KDE3 headers])
11218     kde_incdir="no"
11219     for kde_check in $kde_incdirs; do
11220         if test -r "$kde_check/$kde_test_include"; then
11221             kde_incdir="$kde_check"
11222             break
11223         fi
11224     done
11225     AC_MSG_RESULT([$kde_incdir])
11226     if test "x$kde_incdir" = "xno"; then
11227         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11228 your KDE3 installation by exporting KDEDIR before running "configure".])
11229     fi
11231     dnl Check for KDE3 libraries
11232     AC_MSG_CHECKING([for KDE3 libraries])
11233     kde_libdir="no"
11234     for kde_check in $kde_libdirs; do
11235         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11236             kde_libdir="$kde_check"
11237             break
11238         fi
11239     done
11240     AC_MSG_RESULT([$kde_libdir])
11241     if test "x$kde_libdir" = "xno"; then
11242         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11243 your KDE3 installation by exporting KDEDIR before running "configure".])
11244     fi
11246     dnl Set the variables
11247     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11248     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11249     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11251 AC_SUBST(KDE_CFLAGS)
11252 AC_SUBST(KDE_LIBS)
11253 AC_SUBST(MOC)
11255 dnl ===================================================================
11256 dnl KDE4 Integration
11257 dnl ===================================================================
11259 KDE4_CFLAGS=""
11260 KDE4_LIBS=""
11261 QMAKE4="qmake"
11262 MOC4="moc"
11263 KDE_GLIB_CFLAGS=""
11264 KDE_GLIB_LIBS=""
11265 KDE_HAVE_GLIB=""
11266 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11267     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11268     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11270     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11271     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11273     if test -n "$supports_multilib"; then
11274         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11275         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11276     fi
11278     if test -n "$QTDIR"; then
11279         qt_incdirs="$QTDIR/include $qt_incdirs"
11280         if test -z "$supports_multilib"; then
11281             qt_libdirs="$QTDIR/lib $qt_libdirs"
11282         else
11283             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11284         fi
11285     fi
11286     if test -n "$QT4DIR"; then
11287         qt_incdirs="$QT4DIR/include $qt_incdirs"
11288         if test -z "$supports_multilib"; then
11289             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11290         else
11291             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11292         fi
11293     fi
11295     if test -n "$KDEDIR"; then
11296         kde_incdirs="$KDEDIR/include $kde_incdirs"
11297         if test -z "$supports_multilib"; then
11298             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11299         else
11300             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11301         fi
11302     fi
11303     if test -n "$KDE4DIR"; then
11304         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11305         if test -z "$supports_multilib"; then
11306             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11307         else
11308             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11309         fi
11310     fi
11312     qt_test_include="Qt/qobject.h"
11313     qt_test_library="libQtNetwork.so"
11314     kde_test_include="kwindowsystem.h"
11315     kde_test_library="libsolid.so"
11317     AC_MSG_CHECKING([for Qt4 headers])
11318     qt_header_dir="no"
11319     for inc_dir in $qt_incdirs; do
11320         if test -r "$inc_dir/$qt_test_include"; then
11321             qt_header_dir="$inc_dir"
11322             break
11323         fi
11324     done
11326     AC_MSG_RESULT([$qt_header_dir])
11327     if test "x$qt_header_dir" = "xno"; then
11328         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11329     fi
11331     dnl Check for qmake
11332     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11333     QMAKE4="$QMAKEQT4"
11334     if test "$QMAKE4" = "no"; then
11335         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11336         if test "$QMAKE4" = "no"; then
11337             AC_MSG_ERROR([Qmake not found.  Please specify
11338 the root of your Qt installation by exporting QT4DIR before running "configure".])
11339         fi
11340     fi
11342     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11343     AC_MSG_CHECKING([for Qt4 libraries])
11344     qt_lib_dir="no"
11345     for lib_dir in $qt_libdirs; do
11346         if test -r "$lib_dir/$qt_test_library"; then
11347             qt_lib_dir="$lib_dir"
11348             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11349             break
11350         fi
11351     done
11353     AC_MSG_RESULT([$qt_lib_dir])
11355     if test "x$qt_lib_dir" = "xno"; then
11356         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11357     fi
11359     dnl Check for Meta Object Compiler
11361     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11362     MOC4="$MOCQT4"
11363     if test "$MOC4" = "no"; then
11364         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11365         if test "$MOC4" = "no"; then
11366             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11367 the root of your Qt installation by exporting QT4DIR before running "configure".])
11368         fi
11369     fi
11371     dnl Check for KDE4 headers
11372     AC_MSG_CHECKING([for KDE4 headers])
11373     kde_incdir="no"
11374     for kde_check in $kde_incdirs; do
11375         if test -r "$kde_check/$kde_test_include"; then
11376             kde_incdir="$kde_check"
11377             break
11378         fi
11379     done
11380     AC_MSG_RESULT([$kde_incdir])
11381     if test "x$kde_incdir" = "xno"; then
11382         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11383     fi
11385     dnl Check for KDE4 libraries
11386     AC_MSG_CHECKING([for KDE4 libraries])
11387     kde_libdir="no"
11388     for kde_check in $kde_libdirs; do
11389         if test -r "$kde_check/$kde_test_library"; then
11390             kde_libdir="$kde_check"
11391             break
11392         fi
11393     done
11395     AC_MSG_RESULT([$kde_libdir])
11396     if test "x$kde_libdir" = "xno"; then
11397         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11398     fi
11400     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11401     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11402     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11403     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11405     AC_LANG_PUSH([C++])
11406     save_CXXFLAGS=$CXXFLAGS
11407     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11408     AC_MSG_CHECKING([whether KDE is >= 4.2])
11409        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11410 #include <kdeversion.h>
11412 int main(int argc, char **argv) {
11413        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11414        else return 1;
11416        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11417     CXXFLAGS=$save_CXXFLAGS
11418     AC_LANG_POP([C++])
11420     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11421     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11422     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11423         [
11424             KDE_HAVE_GLIB=1
11425             AC_DEFINE(KDE_HAVE_GLIB,1)
11426             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11428             qt4_fix_warning=
11430             AC_LANG_PUSH([C++])
11431             save_CXXFLAGS=$CXXFLAGS
11432             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11433             save_LIBS=$LIBS
11434             LIBS="$LIBS $KDE4_LIBS"
11435             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11437             # Prepare meta object data
11438             TSTBASE="tst_exclude_socket_notifiers"
11439             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11440             ln -fs "${TSTMOC}.hxx"
11441             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11443             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11444 #include "tst_exclude_socket_notifiers.moc"
11446 int main(int argc, char *argv[])
11448     QCoreApplication app(argc, argv);
11449     exit(tst_processEventsExcludeSocket());
11450     return 0;
11452             ]])],[
11453                 AC_MSG_RESULT([yes])
11454             ],[
11455                 AC_MSG_RESULT([no])
11456                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11457                 if test -z "$qt4_fix_warning"; then
11458                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11459                 fi
11460                 qt4_fix_warning=1
11461                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11462             ])
11464             # Remove meta object data
11465             rm -f "${TSTBASE}."*
11467             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11469             # Prepare meta object data
11470             TSTBASE="tst_exclude_posted_events"
11471             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11472             ln -fs "${TSTMOC}.hxx"
11473             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11475             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11476 #include "tst_exclude_posted_events.moc"
11478 int main(int argc, char *argv[])
11480     QCoreApplication app(argc, argv);
11481     exit(tst_excludePostedEvents());
11482     return 0;
11484             ]])],[
11485                 AC_MSG_RESULT([yes])
11486             ],[
11487                 AC_MSG_RESULT([no])
11488                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11489                 if test -z "$qt4_fix_warning"; then
11490                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11491                 fi
11492                 qt4_fix_warning=1
11493                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11494             ])
11496             # Remove meta object data
11497             rm -f "${TSTBASE}."*
11499             if test -n "$qt4_fix_warning"; then
11500                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11501             fi
11503             LIBS=$save_LIBS
11504             CXXFLAGS=$save_CXXFLAGS
11505             AC_LANG_POP([C++])
11506         ],
11507         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11509 AC_SUBST(KDE4_CFLAGS)
11510 AC_SUBST(KDE4_LIBS)
11511 AC_SUBST(MOC4)
11512 AC_SUBST(KDE_GLIB_CFLAGS)
11513 AC_SUBST(KDE_GLIB_LIBS)
11514 AC_SUBST(KDE_HAVE_GLIB)
11516 dnl ===================================================================
11517 dnl Test for the enabling the lockdown pieces
11518 dnl ===================================================================
11519 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11520 ENABLE_LOCKDOWN=
11521 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11522     ENABLE_LOCKDOWN=TRUE
11523     AC_MSG_RESULT([yes])
11524 else
11525     AC_MSG_RESULT([no])
11527 AC_SUBST(ENABLE_LOCKDOWN)
11529 dnl ===================================================================
11530 dnl Test whether to include Evolution 2 support
11531 dnl ===================================================================
11532 AC_MSG_CHECKING([whether to enable evolution 2 support])
11533 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11534     AC_MSG_RESULT([yes])
11535     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11536     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11537     ENABLE_EVOAB2="TRUE"
11538 else
11539     ENABLE_EVOAB2=""
11540     AC_MSG_RESULT([no])
11542 AC_SUBST(ENABLE_EVOAB2)
11543 AC_SUBST(GOBJECT_CFLAGS)
11544 AC_SUBST(GOBJECT_LIBS)
11546 dnl ===================================================================
11547 dnl Test whether to include TDE AB support
11548 dnl ===================================================================
11549 AC_MSG_CHECKING([whether to enable TDE address book support])
11550 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11551     AC_MSG_RESULT([yes])
11552     AC_LANG_PUSH([C++])
11553     save_CXXFLAGS=$CXXFLAGS
11554     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11555     AC_MSG_CHECKING([whether TDE is at least R14.0])
11556        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11557 #include <tdeversion.h>
11559 int main(int argc, char **argv) {
11560        if (TDE_VERSION_MAJOR >= 14) return 0;
11561        else return 1;
11563        ]])],[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])],[])
11564     CXXFLAGS=$save_CXXFLAGS
11565     AC_LANG_POP([C++])
11566     ENABLE_TDEAB=TRUE
11567 else
11568     AC_MSG_RESULT([no])
11569     ENABLE_TDEAB=
11571 AC_SUBST(ENABLE_TDEAB)
11573 dnl ===================================================================
11574 dnl Test whether to include KDE AB support
11575 dnl ===================================================================
11576 AC_MSG_CHECKING([whether to enable KDE address book support])
11577 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11578     AC_MSG_RESULT([yes])
11579     AC_LANG_PUSH([C++])
11580     save_CXXFLAGS=$CXXFLAGS
11581     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11582     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11583        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11584 #include <kdeversion.h>
11586 int main(int argc, char **argv) {
11587        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11588        else return 1;
11590        ]])],[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])],[])
11591     CXXFLAGS=$save_CXXFLAGS
11592     AC_LANG_POP([C++])
11593     ENABLE_KAB=TRUE
11594 else
11595     AC_MSG_RESULT([no])
11596     ENABLE_KAB=
11598 AC_SUBST(ENABLE_KAB)
11600 dnl ===================================================================
11601 dnl Test which themes to include
11602 dnl ===================================================================
11603 AC_MSG_CHECKING([which themes to include])
11604 # if none given use default subset of available themes
11605 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11606     with_theme="crystal default galaxy hicontrast oxygen tango sifr"
11607     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11610 WITH_THEMES=""
11611 if test "x$with_theme" != "xno"; then
11612     for theme in $with_theme; do
11613         case $theme in
11614         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11615         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11616         esac
11617         WITH_THEMES="$WITH_THEMES $theme"
11618     done
11620 AC_MSG_RESULT([$WITH_THEMES])
11621 AC_SUBST([WITH_THEMES])
11623 dnl ===================================================================
11624 dnl Test whether to integrate helppacks into the product's installer
11625 dnl ===================================================================
11626 AC_MSG_CHECKING([for helppack integration])
11627 if test "$with_helppack_integration" = "no"; then
11628     WITH_HELPPACK_INTEGRATION=
11629     AC_MSG_RESULT([no integration])
11630 else
11631     WITH_HELPPACK_INTEGRATION=TRUE
11632     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11633     AC_MSG_RESULT([integration])
11635 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11637 ###############################################################################
11638 # Extensions checking
11639 ###############################################################################
11640 AC_MSG_CHECKING([for extensions integration])
11641 if test "x$enable_extension_integration" != "xno"; then
11642     WITH_EXTENSION_INTEGRATION=TRUE
11643     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11644     AC_MSG_RESULT([yes, use integration])
11645 else
11646     WITH_EXTENSION_INTEGRATION=
11647     AC_MSG_RESULT([no, do not integrate])
11649 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11651 dnl Should any extra extensions be included?
11652 dnl There are standalone tests for each of these below.
11653 WITH_EXTRA_EXTENSIONS=
11654 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11656 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11657 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11658 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11659 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11660 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11661 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11662 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11663 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11664 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11665 if test "x$with_java" != "xno"; then
11666     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11667     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11670 dnl ===================================================================
11671 dnl Test whether to include Sun Professional Template Pack
11672 dnl ===================================================================
11673 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11674 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11675     AC_MSG_RESULT([no integration])
11676 else
11677     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11678     sun_supported_langs="en-US de it fr es hu"
11679     if test "$with_sun_templates" = "yes"; then
11680         wanted_sun_templates="$sun_supported_langs"
11681     else
11682         # check whether the langs are supported by Sun
11683         wanted_sun_templates=
11684         for lang in $with_sun_templates; do
11685             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11686                 wanted_sun_templates="$wanted_sun_templates $lang"
11687             fi
11688         done
11689     fi
11690     SUNTEMPLATES_LANG=
11691     SUNTEMPLATES_DE_PACK=
11692     SUNTEMPLATES_EN_US_PACK=
11693     SUNTEMPLATES_ES_PACK=
11694     SUNTEMPLATES_FR_PACK=
11695     SUNTEMPLATES_HU_PACK=
11696     SUNTEMPLATES_IT_PACK=
11697     # check whether the langs are requested at all
11698     for lang in $wanted_sun_templates; do
11699     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11700         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11701         case $lang in
11702         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11703         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11704         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11705         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11706         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11707         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11708         esac
11709     fi
11710     done
11711     WITH_EXTRA_EXTENSIONS=TRUE
11712     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11714 AC_SUBST(SUNTEMPLATES_DE_PACK)
11715 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11716 AC_SUBST(SUNTEMPLATES_ES_PACK)
11717 AC_SUBST(SUNTEMPLATES_FR_PACK)
11718 AC_SUBST(SUNTEMPLATES_HU_PACK)
11719 AC_SUBST(SUNTEMPLATES_IT_PACK)
11721 TEST_FONTS_MISSING=0
11723 # $1  = font family
11724 # $2+ = accepted font mappings
11725 test_font_map()
11727     FONT="$1" ; shift
11728     AC_MSG_CHECKING([font mapping for '$FONT'])
11729     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11730     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11732     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11733     while true ; do
11734         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11735         test -n "$MAPPING" || break
11736         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11737     done
11738     if test $TESTEXPR
11739     then
11740         AC_MSG_RESULT([ok])
11741     else
11742         AC_MSG_RESULT([unknown ($FONTFILE)])
11743         TEST_FONTS_MISSING=1
11744     fi
11747 dnl ===================================================================
11748 dnl Test whether to include fonts
11749 dnl ===================================================================
11750 AC_MSG_CHECKING([whether to include third-party fonts])
11751 if test "$with_fonts" != "no"; then
11752     AC_MSG_RESULT([yes])
11753     WITH_FONTS=TRUE
11754     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11755 else
11756     AC_MSG_RESULT([no])
11757     WITH_FONTS=
11758     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11759     if test "$test_fontconfig" = "yes"; then
11760         AC_PATH_PROG([FCMATCH], [fc-match])
11761         if test -z "$FCMATCH"; then
11762             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11763             TEST_FONTS_MISSING=1
11764         else
11765             test_font_map 'Calibri' 'Carlito'
11766             if test ${TEST_FONTS_MISSING} -eq 1
11767             then
11768                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11769             fi
11770         fi
11771     else
11772         TEST_FONTS_MISSING=0
11773     fi
11775 AC_SUBST(WITH_FONTS)
11776 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11778 dnl ===================================================================
11779 dnl Test whether to include ppds
11780 dnl ===================================================================
11781 AC_MSG_CHECKING([whether to include PPDs])
11782 if test "$with_ppds" != "no"; then
11783     AC_MSG_RESULT([yes])
11784     WITHOUT_PPDS=
11785 else
11786     AC_MSG_RESULT([no])
11787     WITHOUT_PPDS=TRUE
11788     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11790 AC_SUBST(WITHOUT_PPDS)
11792 dnl ===================================================================
11793 dnl Test whether to include extra galleries
11794 dnl ===================================================================
11795 AC_MSG_CHECKING([whether to include extra galleries])
11796 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11797     AC_MSG_RESULT([no])
11798     WITH_EXTRA_GALLERY=
11799     OOOP_GALLERY_PACK=""
11800 else
11801     AC_MSG_RESULT([yes])
11802     WITH_EXTRA_GALLERY=TRUE
11803     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11804     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11805     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11807 AC_SUBST(WITH_EXTRA_GALLERY)
11808 AC_SUBST(OOOP_GALLERY_PACK)
11810 dnl ===================================================================
11811 dnl Test whether to include extra templates
11812 dnl ===================================================================
11813 AC_MSG_CHECKING([whether to include extra templates])
11814 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11815     AC_MSG_RESULT([no])
11816     WITH_EXTRA_TEMPLATE=
11817     OOOP_TEMPLATES_PACK=""
11818 else
11819     AC_MSG_RESULT([yes])
11820     WITH_EXTRA_TEMPLATE=TRUE
11821     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11822     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11823     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11825 AC_SUBST(WITH_EXTRA_TEMPLATE)
11826 AC_SUBST(OOOP_TEMPLATES_PACK)
11828 dnl ===================================================================
11829 dnl Test whether to include extra samples
11830 dnl ===================================================================
11831 AC_MSG_CHECKING([whether to include extra samples])
11832 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11833     AC_MSG_RESULT([no])
11834     WITH_EXTRA_SAMPLE=
11835     OOOP_SAMPLES_PACK=""
11836 else
11837     AC_MSG_RESULT([yes])
11838     WITH_EXTRA_SAMPLE=TRUE
11839     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11840     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11841     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11843 AC_SUBST(WITH_EXTRA_SAMPLE)
11844 AC_SUBST(OOOP_SAMPLES_PACK)
11846 dnl ===================================================================
11847 dnl Test whether to include extra fonts
11848 dnl ===================================================================
11849 AC_MSG_CHECKING([whether to include extra fonts])
11850 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11851     AC_MSG_RESULT([no])
11852     WITH_EXTRA_FONT=
11853     OOOP_FONTS_PACK=""
11854 else
11855     AC_MSG_RESULT([yes])
11856     WITH_EXTRA_FONT=TRUE
11857     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11858     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11859     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11861 AC_SUBST(WITH_EXTRA_FONT)
11862 AC_SUBST(OOOP_FONTS_PACK)
11864 dnl ===================================================================
11865 dnl Test whether to enable online update service
11866 dnl ===================================================================
11867 AC_MSG_CHECKING([whether to enable online update])
11868 ENABLE_ONLINE_UPDATE=
11869 if test "$enable_online_update" = ""; then
11870     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11871         AC_MSG_RESULT([yes])
11872         ENABLE_ONLINE_UPDATE="TRUE"
11873     else
11874         AC_MSG_RESULT([no])
11875     fi
11876 else
11877     if test "$enable_online_update" = "yes"; then
11878         AC_MSG_RESULT([yes])
11879         ENABLE_ONLINE_UPDATE="TRUE"
11880     else
11881         AC_MSG_RESULT([no])
11882     fi
11884 AC_SUBST(ENABLE_ONLINE_UPDATE)
11886 dnl ===================================================================
11887 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11888 dnl ===================================================================
11889 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11890 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11891     AC_MSG_RESULT([no])
11892     ENABLE_SILENT_MSI=
11893 else
11894     AC_MSG_RESULT([yes])
11895     ENABLE_SILENT_MSI=TRUE
11896     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11898 AC_SUBST(ENABLE_SILENT_MSI)
11900 AC_MSG_CHECKING([whether and how to use Xinerama])
11901 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11902     if test "$x_libraries" = "default_x_libraries"; then
11903         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11904         if test "x$XINERAMALIB" = x; then
11905            XINERAMALIB="/usr/lib"
11906         fi
11907     else
11908         XINERAMALIB="$x_libraries"
11909     fi
11910     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11911         # we have both versions, let the user decide but use the dynamic one
11912         # per default
11913         USE_XINERAMA=TRUE
11914         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11915             XINERAMA_LINK=dynamic
11916         else
11917             XINERAMA_LINK=static
11918         fi
11919     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11920         # we have only the dynamic version
11921         USE_XINERAMA=TRUE
11922         XINERAMA_LINK=dynamic
11923     elif test -e "$XINERAMALIB/libXinerama.a"; then
11924         # static version
11925         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11926             USE_XINERAMA=TRUE
11927             XINERAMA_LINK=static
11928         else
11929             USE_XINERAMA=
11930             XINERAMA_LINK=none
11931         fi
11932     else
11933         # no Xinerama
11934         USE_XINERAMA=
11935         XINERAMA_LINK=none
11936     fi
11937     if test "$USE_XINERAMA" = "TRUE"; then
11938         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11939         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11940             [AC_MSG_ERROR(Xinerama header not found.)], [])
11941         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11942         if test "x$XEXTLIB" = x; then
11943            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11944         fi
11945         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11946         if test "$_os" = "FreeBSD"; then
11947             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11948         fi
11949         if test "$_os" = "Linux"; then
11950             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11951         fi
11952         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11953             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11954     else
11955         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11956     fi
11957 else
11958     USE_XINERAMA=
11959     XINERAMA_LINK=none
11960     AC_MSG_RESULT([no])
11962 AC_SUBST(USE_XINERAMA)
11963 AC_SUBST(XINERAMA_LINK)
11965 dnl ===================================================================
11966 dnl Test whether to build cairo or rely on the system version
11967 dnl ===================================================================
11969 if test "$GUIBASE" = "unx"; then
11970     # Used in vcl/Library_vclplug_gen.mk
11971     test_cairo=yes
11974 if test "$test_cairo" = "yes"; then
11975     AC_MSG_CHECKING([whether to use the system cairo])
11977     : ${with_system_cairo:=$with_system_libs}
11978     if test "$with_system_cairo" = "yes"; then
11979         SYSTEM_CAIRO=TRUE
11980         AC_MSG_RESULT([yes])
11982         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11983         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11985         if test "$test_xrender" = "yes"; then
11986             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11987             AC_LANG_PUSH([C])
11988             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11989 #ifdef PictStandardA8
11990 #else
11991       return fail;
11992 #endif
11993 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11995             AC_LANG_POP([C])
11996         fi
11997         libo_MINGW_CHECK_DLL([libcairo])
11998         libo_MINGW_TRY_DLL([libfontconfig])
11999         libo_MINGW_TRY_DLL([libfreetype])
12000         libo_MINGW_TRY_DLL([libpixman])
12001         libo_MINGW_TRY_DLL([libpng15])
12002     else
12003         SYSTEM_CAIRO=
12004         AC_MSG_RESULT([no])
12006         BUILD_TYPE="$BUILD_TYPE CAIRO"
12007         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
12008     fi
12011 AC_SUBST(SYSTEM_CAIRO)
12012 AC_SUBST(CAIRO_CFLAGS)
12013 AC_SUBST(CAIRO_LIBS)
12015 dnl ===================================================================
12016 dnl Test whether to use avahi
12017 dnl ===================================================================
12018 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12019     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12020                       [ENABLE_AVAHI="TRUE"])
12021     AC_DEFINE(HAVE_FEATURE_AVAHI)
12022     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12025 AC_SUBST(ENABLE_AVAHI)
12026 AC_SUBST(AVAHI_CFLAGS)
12027 AC_SUBST(AVAHI_LIBS)
12029 dnl ===================================================================
12030 dnl Test whether to use liblangtag
12031 dnl ===================================================================
12032 ENABLE_LIBLANGTAG=
12033 SYSTEM_LIBLANGTAG=
12034 AC_MSG_CHECKING([whether to use liblangtag])
12035 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
12036     ENABLE_LIBLANGTAG=TRUE
12037     AC_MSG_RESULT([yes])
12038     AC_MSG_CHECKING([whether to use system liblangtag])
12039     if test "$with_system_liblangtag" = yes; then
12040         SYSTEM_LIBLANGTAG=TRUE
12041         AC_MSG_RESULT([yes])
12042         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12043         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12044         libo_MINGW_CHECK_DLL([liblangtag])
12045     else
12046         SYSTEM_LIBLANGTAG=
12047         AC_MSG_RESULT([no])
12048         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12049         if test "$COM" = "MSC"; then
12050             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
12051         else
12052             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
12053         fi
12054     fi
12055 else
12056     AC_MSG_RESULT([no])
12058 AC_SUBST(ENABLE_LIBLANGTAG)
12059 AC_SUBST(SYSTEM_LIBLANGTAG)
12060 AC_SUBST(LIBLANGTAG_CFLAGS)
12061 AC_SUBST(LIBLANGTAG_LIBS)
12063 dnl ===================================================================
12064 dnl Test whether to build libpng or rely on the system version
12065 dnl ===================================================================
12067 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
12069 dnl ===================================================================
12070 dnl Check for runtime JVM search path
12071 dnl ===================================================================
12072 if test "$ENABLE_JAVA" != ""; then
12073     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12074     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12075         AC_MSG_RESULT([yes])
12076         if ! test -d "$with_jvm_path"; then
12077             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12078         fi
12079         if ! test -d "$with_jvm_path"jvm; then
12080             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12081         fi
12082         JVM_ONE_PATH_CHECK="$with_jvm_path"
12083         AC_SUBST(JVM_ONE_PATH_CHECK)
12084     else
12085         AC_MSG_RESULT([no])
12086     fi
12089 dnl ===================================================================
12090 dnl Test for the presence of Ant and that it works
12091 dnl ===================================================================
12093 if test "$ENABLE_JAVA" != ""; then
12094     ANT_HOME=; export ANT_HOME
12095     WITH_ANT_HOME=; export WITH_ANT_HOME
12096     if test -z "$with_ant_home"; then
12097         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
12098     else
12099         if test "$_os" = "WINNT"; then
12100             with_ant_home=`cygpath -u "$with_ant_home"`
12101         fi
12102         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12103         WITH_ANT_HOME=$with_ant_home
12104         ANT_HOME=$with_ant_home
12105     fi
12107     if test -z "$ANT"; then
12108         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12109     else
12110         # resolve relative or absolute symlink
12111         while test -h "$ANT"; do
12112             a_cwd=`pwd`
12113             a_basename=`basename "$ANT"`
12114             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12115             cd "`dirname "$ANT"`"
12116             cd "`dirname "$a_script"`"
12117             ANT="`pwd`"/"`basename "$a_script"`"
12118             cd "$a_cwd"
12119         done
12121         AC_MSG_CHECKING([if $ANT works])
12122         cat > conftest.java << EOF
12123         public class conftest {
12124             int testmethod(int a, int b) {
12125                     return a + b;
12126             }
12127         }
12130         cat > conftest.xml << EOF
12131         <project name="conftest" default="conftest">
12132         <target name="conftest">
12133             <javac srcdir="." includes="conftest.java">
12134             </javac>
12135         </target>
12136         </project>
12139         oldJAVA_HOME=$JAVA_HOME
12140         if test "$JAVACISGCJ" = "yes"; then
12141             JAVA_HOME=; export JAVA_HOME
12142             ant_gcj="-Dbuild.compiler=gcj"
12143         fi
12144         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12145         if test $? = 0 -a -f ./conftest.class; then
12146             AC_MSG_RESULT([Ant works])
12147             if test -z "$WITH_ANT_HOME"; then
12148                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12149                 if test -z "$ANT_HOME"; then
12150                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12151                 fi
12152             else
12153                 ANT_HOME="$WITH_ANT_HOME"
12154             fi
12155         else
12156             echo "configure: Ant test failed" >&5
12157             cat conftest.java >&5
12158             cat conftest.xml >&5
12159             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12160             ANT_HOME=""
12161             add_warning "Ant does not work - Some Java projects will not build!"
12162         fi
12163         JAVA_HOME=$oldJAVA_HOME
12164         rm -f conftest* core core.* *.core
12165     fi
12166     if test -z "$ANT_HOME"; then
12167         ANT_HOME="NO_ANT_HOME"
12168     else
12169         PathFormat "$ANT_HOME"
12170         ANT_HOME="$formatted_path"
12171         PathFormat "$ANT"
12172         ANT="$ANT"
12173     fi
12174     AC_SUBST(ANT_HOME)
12175     AC_SUBST(ANT)
12177     dnl Checking for ant.jar
12178     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12179         AC_MSG_CHECKING([Ant lib directory])
12180         if test -f $ANT_HOME/lib/ant.jar; then
12181             ANT_LIB="$ANT_HOME/lib"
12182         else
12183             if test -f $ANT_HOME/ant.jar; then
12184                 ANT_LIB="$ANT_HOME"
12185             else
12186                 if test -f /usr/share/java/ant.jar; then
12187                     ANT_LIB=/usr/share/java
12188                 else
12189                     if test -f /usr/share/ant-core/lib/ant.jar; then
12190                         ANT_LIB=/usr/share/ant-core/lib
12191                     else
12192                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12193                             ANT_LIB="$ANT_HOME/lib/ant"
12194                         else
12195                             if test -f /usr/share/lib/ant/ant.jar; then
12196                                 ANT_LIB=/usr/share/lib/ant
12197                             else
12198                                 AC_MSG_ERROR([Ant libraries not found!])
12199                             fi
12200                         fi
12201                     fi
12202                 fi
12203             fi
12204         fi
12205         PathFormat "$ANT_LIB"
12206         ANT_LIB="$formatted_path"
12207         AC_MSG_RESULT([Ant lib directory found.])
12208     fi
12209     AC_SUBST(ANT_LIB)
12211     ant_minver=1.6.0
12212     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12214     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12215     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12216     ant_version_major=`echo $ant_version | cut -d. -f1`
12217     ant_version_minor=`echo $ant_version | cut -d. -f2`
12218     echo "configure: ant_version $ant_version " >&5
12219     echo "configure: ant_version_major $ant_version_major " >&5
12220     echo "configure: ant_version_minor $ant_version_minor " >&5
12221     if test "$ant_version_major" -ge "2"; then
12222         AC_MSG_RESULT([yes, $ant_version])
12223     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12224         AC_MSG_RESULT([yes, $ant_version])
12225     else
12226         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12227     fi
12229     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
12230         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
12231         rm -rf confdir
12232         mkdir confdir
12233         cat > conftest.java << EOF
12234             public class conftest {
12235                 int testmethod(int a, int b) {
12236                     return a + b;
12237                 }
12238             }
12241         cat > conftest.xml << EOF
12242             <project name="conftest" default="conftest">
12243             <target name="conftest" depends="copytest">
12244                 <javac srcdir="." includes="conftest.java">
12245                 </javac>
12246             </target>
12247             <target name="copytest">
12248                  <copy todir="confdir">
12249                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
12250                  <filterset/>
12251                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
12252                  </copy>
12253             </target>
12254             </project>
12257         if test "$JAVACISGCJ" = "yes"; then
12258             JAVA_HOME=; export JAVA_HOME
12259             ant_gcj="-Dbuild.compiler=gcj"
12260         fi
12261         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12262         if test $? = 0 -a -f ./conftest.class; then
12263             AC_MSG_RESULT([yes])
12264             rm -rf confdir
12265         else
12266             echo "configure: Ant test failed" >&5
12267             cat conftest.java >&5
12268             cat conftest.xml >&5
12269             rm -rf confdir
12270             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
12271         fi
12272     fi
12273     rm -f conftest* core core.* *.core
12276 OOO_JUNIT_JAR=
12277 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12278     AC_MSG_CHECKING([for JUnit 4])
12279     if test "$with_junit" = "yes"; then
12280         if test -e /usr/share/java/junit4.jar; then
12281             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12282         else
12283            if test -e /usr/share/lib/java/junit.jar; then
12284               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12285            else
12286               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12287            fi
12288         fi
12289     else
12290         OOO_JUNIT_JAR=$with_junit
12291     fi
12292     if test "$_os" = "WINNT"; then
12293         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12294     fi
12295     printf 'import org.junit.Before; import org.hamcrest.BaseDescription;' \
12296         > conftest.java
12297     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12298         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12299     else
12300         AC_MSG_ERROR(
12301 [cannot find JUnit 4 jar, or JUnit 4 jar does not provide Hamcrest; please
12302 install one in the default location (/usr/share/java), specify its pathname via
12303 --with-junit=..., or disable it via --without-junit])
12304     fi
12305     rm -f conftestj.class conftestj.java
12306     if test $OOO_JUNIT_JAR != ""; then
12307     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12308     fi
12310 AC_SUBST(OOO_JUNIT_JAR)
12313 AC_SUBST(SCPDEFS)
12316 # check for wget and curl
12318 WGET=
12319 CURL=
12321 if test "$enable_fetch_external" != "no"; then
12323 CURL=`which curl 2>/dev/null`
12325 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12326     eval "$i --version" > /dev/null 2>&1
12327     ret=$?
12328     if test $ret -eq 0; then
12329         WGET=$i
12330         break
12331     fi
12332 done
12334 if test -z "$WGET" -a -z "$CURL"; then
12335     AC_MSG_ERROR([neither wget nor curl found!])
12340 AC_SUBST(WGET)
12341 AC_SUBST(CURL)
12344 # check for md5sum
12346 MD5SUM=
12348 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12349     if test "$i" = "md5"; then
12350         eval "$i -x" > /dev/null 2>&1
12351     else
12352         eval "$i --version" > /dev/null 2>&1
12353     fi
12354     ret=$?
12355     if test $ret -eq 0; then
12356         MD5SUM=$i
12357         break
12358     fi
12359 done
12361 if test "$MD5SUM" = "md5"; then
12362     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12363         MD5SUM="$MD5SUM -r"
12364     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12365         MD5SUM="$MD5SUM -n"
12366     fi
12369 if test -z "$MD5SUM"; then
12370     AC_MSG_ERROR([no md5sum: found!])
12373 AC_SUBST(MD5SUM)
12375 dnl ===================================================================
12376 dnl Dealing with l10n options
12377 dnl ===================================================================
12378 AC_MSG_CHECKING([which languages to be built])
12379 # get list of all languages
12380 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12381 # the sed command does the following:
12382 #   + if a line ends with a backslash, append the next line to it
12383 #   + adds " on the beginning of the value (after =)
12384 #   + adds " at the end of the value
12385 #   + removes en-US; we want to put it on the beginning
12386 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12387 [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)]
12388 ALL_LANGS="en-US $completelangiso"
12389 # check the configured localizations
12390 WITH_LANG="$with_lang"
12391 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12392     AC_MSG_RESULT([en-US])
12393 else
12394     AC_MSG_RESULT([$WITH_LANG])
12395     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12397 # check that the list is valid
12398 for lang in $WITH_LANG; do
12399     test "$lang" = "ALL" && continue
12400     # need to check for the exact string, so add space before and after the list of all languages
12401     for vl in $ALL_LANGS; do
12402         if test "$vl" = "$lang"; then
12403            break
12404         fi
12405     done
12406     if test "$vl" != "$lang"; then
12407         # if you're reading this - you prolly quoted your languages remove the quotes ...
12408         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12409     fi
12410 done
12411 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12412     echo $WITH_LANG | grep -q en-US
12413     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12415 # list with substituted ALL
12416 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12417 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12418 test "$WITH_LANG" = "en-US" && WITH_LANG=
12419 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12420     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12421     ALL_LANGS=`echo $ALL_LANGS qtz`
12423 AC_SUBST(ALL_LANGS)
12424 AC_SUBST(WITH_LANG)
12425 AC_SUBST(WITH_LANG_LIST)
12426 AC_SUBST(GIT_NEEDED_SUBMODULES)
12428 WITH_POOR_HELP_LOCALIZATIONS=
12429 if test -d "$SRC_ROOT/translations/source"; then
12430     for l in `ls -1 $SRC_ROOT/translations/source`; do
12431         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12432             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12433         fi
12434     done
12436 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12438 if test -n "$with_locales"; then
12439     WITH_LOCALES="$with_locales"
12441     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12442     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12443     # config_host/config_locales.h.in
12444     for locale in $WITH_LOCALES; do
12445         lang=${locale%_*}
12447         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12449         case $lang in
12450         hi|mr*ne)
12451             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12452             ;;
12453         bg|ru)
12454             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12455             ;;
12456         esac
12457     done
12458 else
12459     AC_DEFINE(WITH_LOCALE_ALL)
12461 AC_SUBST(WITH_LOCALES)
12463 dnl git submodule update --reference
12464 dnl ===================================================================
12465 if test -n "${GIT_REFERENCE_SRC}"; then
12466     for repo in ${GIT_NEEDED_SUBMODULES}; do
12467         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12468             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12469         fi
12470     done
12472 AC_SUBST(GIT_REFERENCE_SRC)
12474 dnl git submodules linked dirs
12475 dnl ===================================================================
12476 if test -n "${GIT_LINK_SRC}"; then
12477     for repo in ${GIT_NEEDED_SUBMODULES}; do
12478         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12479             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12480         fi
12481     done
12483 AC_SUBST(GIT_LINK_SRC)
12485 dnl branding
12486 dnl ===================================================================
12487 AC_MSG_CHECKING([for alternative branding images directory])
12488 # initialize mapped arrays
12489 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12490 brand_files="$BRAND_INTRO_IMAGES about.svg"
12492 if test -z "$with_branding" -o "$with_branding" = "no"; then
12493     AC_MSG_RESULT([none])
12494     DEFAULT_BRAND_IMAGES="$brand_files"
12495 else
12496     if ! test -d $with_branding ; then
12497         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12498     else
12499         AC_MSG_RESULT([$with_branding])
12500         CUSTOM_BRAND_DIR="$with_branding"
12501         for lfile in $brand_files
12502         do
12503             if ! test -f $with_branding/$lfile ; then
12504                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12505                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12506             else
12507                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12508             fi
12509         done
12510         check_for_progress="yes"
12511     fi
12513 AC_SUBST([BRAND_INTRO_IMAGES])
12514 AC_SUBST([CUSTOM_BRAND_DIR])
12515 AC_SUBST([CUSTOM_BRAND_IMAGES])
12516 AC_SUBST([DEFAULT_BRAND_IMAGES])
12519 AC_MSG_CHECKING([for 'intro' progress settings])
12520 PROGRESSBARCOLOR=
12521 PROGRESSSIZE=
12522 PROGRESSPOSITION=
12523 PROGRESSFRAMECOLOR=
12524 PROGRESSTEXTCOLOR=
12525 PROGRESSTEXTBASELINE=
12527 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12528     source "$with_branding/progress.conf"
12529     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12530 else
12531     AC_MSG_RESULT([none])
12534 AC_SUBST(PROGRESSBARCOLOR)
12535 AC_SUBST(PROGRESSSIZE)
12536 AC_SUBST(PROGRESSPOSITION)
12537 AC_SUBST(PROGRESSFRAMECOLOR)
12538 AC_SUBST(PROGRESSTEXTCOLOR)
12539 AC_SUBST(PROGRESSTEXTBASELINE)
12542 AC_MSG_CHECKING([for extra build ID])
12543 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12544     EXTRA_BUILDID="$with_extra_buildid"
12546 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12547 if test -n "$EXTRA_BUILDID" ; then
12548     AC_MSG_RESULT([$EXTRA_BUILDID])
12549 else
12550     AC_MSG_RESULT([not set])
12552 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12554 OOO_VENDOR=
12555 AC_MSG_CHECKING([for vendor])
12556 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12557     OOO_VENDOR="$USERNAME"
12559     if test -z "$OOO_VENDOR"; then
12560         OOO_VENDOR="$USER"
12561     fi
12563     if test -z "$OOO_VENDOR"; then
12564         OOO_VENDOR="`id -u -n`"
12565     fi
12567     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12568 else
12569     OOO_VENDOR="$with_vendor"
12570     AC_MSG_RESULT([$OOO_VENDOR])
12572 AC_SUBST(OOO_VENDOR)
12574 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12575 if test "$with_compat_oowrappers" = "yes"; then
12576     WITH_COMPAT_OOWRAPPERS=TRUE
12577     AC_MSG_RESULT(yes)
12578 else
12579     WITH_COMPAT_OOWRAPPERS=
12580     AC_MSG_RESULT(no)
12582 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12584 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12585 AC_MSG_CHECKING([for install dirname])
12586 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12587     INSTALLDIRNAME="$with_install_dirname"
12589 AC_MSG_RESULT([$INSTALLDIRNAME])
12590 AC_SUBST(INSTALLDIRNAME)
12592 AC_MSG_CHECKING([for prefix])
12593 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12594 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12595 PREFIXDIR="$prefix"
12596 AC_MSG_RESULT([$PREFIXDIR])
12597 AC_SUBST(PREFIXDIR)
12599 LIBDIR=[$(eval echo $(eval echo $libdir))]
12600 AC_SUBST(LIBDIR)
12602 DATADIR=[$(eval echo $(eval echo $datadir))]
12603 AC_SUBST(DATADIR)
12605 MANDIR=[$(eval echo $(eval echo $mandir))]
12606 AC_SUBST(MANDIR)
12608 DOCDIR=[$(eval echo $(eval echo $docdir))]
12609 AC_SUBST(DOCDIR)
12611 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12612 AC_SUBST(INSTALLDIR)
12614 TESTINSTALLDIR="${BUILDDIR}/test-install"
12615 AC_SUBST(TESTINSTALLDIR)
12618 # ===================================================================
12619 # OAuth2 id and secrets
12620 # ===================================================================
12622 AC_MSG_CHECKING([for Google Drive client id and secret])
12623 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12624 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12625 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12626     GDRIVE_CLIENT_ID="\"\""
12629 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12630     GDRIVE_CLIENT_SECRET="\"\""
12633 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12634     AC_MSG_RESULT([not set])
12635 else
12636     AC_MSG_RESULT([set])
12639 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12640 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12642 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12643 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12644 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12645 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12646     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12649 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12650     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12653 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12654     AC_MSG_RESULT([not set])
12655 else
12656     AC_MSG_RESULT([set])
12658 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12659 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12661 # ===================================================================
12662 # De- or increase default verbosity of build process
12663 # ===================================================================
12664 AC_MSG_CHECKING([build verbosity])
12665 if test -n "$enable_verbose"; then
12666     if test "$enable_verbose" = "yes"; then
12667         VERBOSE="TRUE"
12668         AC_MSG_RESULT([high])
12669     fi
12670     if test "$enable_verbose" = "no"; then
12671         VERBOSE="FALSE"
12672         AC_MSG_RESULT([low])
12673     fi
12674 else
12675     AC_MSG_RESULT([not set])
12677 AC_SUBST(VERBOSE)
12679 dnl ===================================================================
12680 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12681 dnl --enable-dependency-tracking configure option
12682 dnl ===================================================================
12683 AC_MSG_CHECKING([whether to enable dependency tracking])
12684 if test "$enable_dependency_tracking" = "no"; then
12685     nodep=TRUE
12686     AC_MSG_RESULT([no])
12687 else
12688     AC_MSG_RESULT([yes])
12690 AC_SUBST(nodep)
12692 dnl ===================================================================
12693 dnl Number of CPUs to use during the build
12694 dnl ===================================================================
12695 AC_MSG_CHECKING([for number of processors to use])
12696 # plain --with-parallelism is just the default
12697 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12698     if test "$with_parallelism" = "no"; then
12699         PARALLELISM=0
12700     else
12701         PARALLELISM=$with_parallelism
12702     fi
12703 else
12704     if test "$enable_icecream" = "yes"; then
12705         PARALLELISM="10"
12706     else
12707         case `uname -s` in
12709         Darwin|FreeBSD|NetBSD|OpenBSD)
12710             PARALLELISM=`sysctl -n hw.ncpu`
12711             ;;
12713         Linux)
12714             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12715         ;;
12716         # what else than above does profit here *and* has /proc?
12717         *)
12718             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12719             ;;
12720         esac
12722         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12723         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12724     fi
12727 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12728     if test -z "$with_parallelism"; then
12729             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12730             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12731             PARALLELISM="1"
12732     else
12733         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."
12734     fi
12737 if test $PARALLELISM -eq 0; then
12738     AC_MSG_RESULT([explicit make -j option needed])
12739 else
12740     AC_MSG_RESULT([$PARALLELISM])
12742 AC_SUBST(PARALLELISM)
12745 # Set up ILIB for MSVC build
12747 if test "$build_os" = "cygwin"; then
12748     ILIB="."
12749     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12750         ILIB="$ILIB;$JAVA_HOME/lib"
12751     fi
12752     if test "$BITNESS_OVERRIDE" = 64; then
12753         ILIB="$ILIB;$COMPATH/lib/amd64"
12754         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12755         if test "$WINDOWS_SDK_VERSION" = "80"; then
12756             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12757         fi
12758     else
12759         ILIB="$ILIB;$COMPATH/lib"
12760         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12761         if test "$WINDOWS_SDK_VERSION" = "80"; then
12762             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12763         fi
12764     fi
12765     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12767     if test "$ENABLE_DIRECTX" = "TRUE"; then
12768         ILIB="$ILIB;$DIRECTXSDK_LIB"
12769     fi
12770     AC_SUBST(ILIB)
12774 # ===================================================================
12775 # Creating bigger shared library to link against
12776 # ===================================================================
12777 AC_MSG_CHECKING([whether to create huge library])
12778 MERGELIBS=
12780 if test $_os = iOS -o $_os = Android; then
12781     # Never any point in mergelibs for these as we build just static
12782     # libraries anyway...
12783     enable_mergelibs=no
12786 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12787     if test $_os != Linux -a $_os != WINNT; then
12788         add_warning "--enable-mergelibs is not tested for this platform"
12789     fi
12790     if test "$enable_mergelibs" = "all"; then
12791         MERGELIBS="ALL"
12792         URELIBS="TRUE"
12793         AC_DEFINE(STATIC_LINKING)
12794     else
12795         MERGELIBS="CORE"
12796     fi
12797     AC_MSG_RESULT([yes])
12798 else
12799     AC_MSG_RESULT([no])
12801 AC_SUBST([MERGELIBS])
12802 AC_SUBST([URELIBS])
12804 # ===================================================================
12805 # Create hardlinks on deliver instead of copying for smaller size and speed up
12806 # ===================================================================
12807 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12808 HARDLINKDELIVER=
12809 if test "$enable_hardlink_deliver" = "yes"; then
12810     HARDLINKDELIVER="TRUE"
12811     AC_MSG_RESULT([yes])
12812 else
12813     AC_MSG_RESULT([no])
12815 AC_SUBST(HARDLINKDELIVER)
12817 dnl ===================================================================
12818 dnl icerun is a wrapper that stops us spawning tens of processes
12819 dnl locally - for tools that can't be executed on the compile cluster
12820 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12821 dnl ===================================================================
12822 AC_MSG_CHECKING([whether to use icerun wrapper])
12823 ICECREAM_RUN=
12824 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12825     ICECREAM_RUN=icerun
12826     AC_MSG_RESULT([yes])
12827 else
12828     AC_MSG_RESULT([no])
12830 AC_SUBST(ICECREAM_RUN)
12832 dnl ===================================================================
12834 AC_MSG_CHECKING([MPL subset])
12835 MPL_SUBSET=
12837 if test "$enable_mpl_subset" = "yes"; then
12838     warn_report=false
12839     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12840         warn_report=true
12841     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12842         warn_report=true
12843     fi
12844     if test "$warn_report" = "true"; then
12845         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12846     fi
12847     if test "x$enable_postgresql_sdbc" != "xno"; then
12848         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12849     fi
12850     if test "$enable_lotuswordpro" = "yes"; then
12851         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12852     fi
12853     if test "$WITH_WEBDAV" = "neon"; then
12854         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12855     fi
12856     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12857         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12858     fi
12859     if test -n "$ENABLE_PDFIMPORT"; then
12860         if test "x$SYSTEM_POPPLER" = "x"; then
12861             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12862         fi
12863     fi
12864     # cf. m4/libo_check_extension.m4
12865     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12866         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12867     fi
12868     for theme in $WITH_THEMES; do
12869         case $theme in
12870         crystal|default|hicontrast|human|oxygen|sifr)
12871             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12872         *) : ;;
12873         esac
12874     done
12875     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12876         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12877     fi
12878     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12879         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12880     fi
12882     MPL_SUBSET="TRUE"
12883     AC_DEFINE(MPL_HAVE_SUBSET)
12884     AC_MSG_RESULT([only])
12885 else
12886     AC_MSG_RESULT([no restrictions])
12888 AC_SUBST(MPL_SUBSET)
12891 dnl ===================================================================
12892 dnl Setting up the environment.
12893 dnl ===================================================================
12894 echo "setting up the build environment variables..."
12896 AC_SUBST(COMPATH)
12898 if test "$build_os" = "cygwin"; then
12899     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12900         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12901         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12902     else
12903         ATL_LIB="$COMPATH/atlmfc/lib"
12904         ATL_INCLUDE="$COMPATH/atlmfc/include"
12905     fi
12906     if test "$BITNESS_OVERRIDE" = 64; then
12907         ATL_LIB="$ATL_LIB/amd64"
12908     fi
12909     PathFormat "/usr/bin/grep.exe"
12910     WIN_GREP="$formatted_path"
12911     PathFormat "/usr/bin/find.exe"
12912     WIN_FIND="$formatted_path"
12913     PathFormat "/usr/bin/ls.exe"
12914     WIN_LS="$formatted_path"
12915     PathFormat "/usr/bin/touch.exe"
12916     WIN_TOUCH="$formatted_path"
12919 AC_SUBST(ATL_INCLUDE)
12920 AC_SUBST(ATL_LIB)
12921 AC_SUBST(WIN_FIND)
12922 AC_SUBST(WIN_GREP)
12923 AC_SUBST(WIN_LS)
12924 AC_SUBST(WIN_TOUCH)
12926 AC_SUBST(BUILD_TYPE)
12928 AC_SUBST(SOLARINC)
12930 PathFormat "$PERL"
12931 PERL="$formatted_path"
12932 AC_SUBST(PERL)
12934 if test -n "$TMPDIR"; then
12935     TEMP_DIRECTORY="$TMPDIR"
12936 else
12937     TEMP_DIRECTORY="/tmp"
12939 if test "$build_os" = "cygwin"; then
12940     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12942 AC_SUBST(TEMP_DIRECTORY)
12944 # setup the PATH for the environment
12945 if test -n "$LO_PATH_FOR_BUILD"; then
12946     LO_PATH="$LO_PATH_FOR_BUILD"
12947 else
12948     LO_PATH="$PATH"
12950     case "$host_os" in
12952     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12953         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12954             pathmunge "$JAVA_HOME/bin" "after"
12955         fi
12956         ;;
12958     cygwin*)
12959         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12960         pathmunge "$ASM_HOME" "before"
12961         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12962         pathmunge "$CSC_PATH" "before"
12963         pathmunge "$MIDL_PATH" "before"
12964         pathmunge "$AL_PATH" "before"
12965         pathmunge "$MSPDB_PATH" "before"
12966         if test "$BITNESS_OVERRIDE" = 64; then
12967             pathmunge "$COMPATH/bin/amd64" "before"
12968             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12969         else
12970             pathmunge "$COMPATH/bin" "before"
12971             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12972         fi
12973         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12974             if test -d "$JAVA_HOME/jre/bin/client"; then
12975                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12976             fi
12977             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12978                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12979             fi
12980             pathmunge "$JAVA_HOME/bin" "before"
12981         fi
12982         ;;
12984     solaris*)
12985         pathmunge "/usr/css/bin" "before"
12986         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12987             pathmunge "$JAVA_HOME/bin" "after"
12988         fi
12989         ;;
12990     esac
12992     pathmunge "$SRC_ROOT/solenv/bin" "before"
12993     pathmunge "." "before"
12996 AC_SUBST(LO_PATH)
12998 # Generate a configuration md5 we can use for deps
12999 if test -f config_host.mk; then
13000     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
13003 AC_CONFIG_FILES([config_host.mk
13004                  Makefile
13005                  lo.xcent
13006                  instsetoo_native/util/openoffice.lst
13007                  sysui/desktop/macosx/Info.plist
13008                  ios/lo.xcconfig
13009                  ure/source/unorc])
13010 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13011 AC_CONFIG_HEADERS([config_host/config_clang.h])
13012 AC_CONFIG_HEADERS([config_host/config_eot.h])
13013 AC_CONFIG_HEADERS([config_host/config_features.h])
13014 AC_CONFIG_HEADERS([config_host/config_folders.h])
13015 AC_CONFIG_HEADERS([config_host/config_gcc.h])
13016 AC_CONFIG_HEADERS([config_host/config_global.h])
13017 AC_CONFIG_HEADERS([config_host/config_graphite.h])
13018 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13019 AC_CONFIG_HEADERS([config_host/config_locales.h])
13020 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13021 AC_CONFIG_HEADERS([config_host/config_orcus.h])
13022 AC_CONFIG_HEADERS([config_host/config_kde4.h])
13023 AC_CONFIG_HEADERS([config_host/config_mingw.h])
13024 AC_CONFIG_HEADERS([config_host/config_oox.h])
13025 AC_CONFIG_HEADERS([config_host/config_options.h])
13026 AC_CONFIG_HEADERS([config_host/config_test.h])
13027 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
13028 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13029 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13030 AC_CONFIG_HEADERS([config_host/config_version.h])
13031 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13032 AC_OUTPUT
13034 if test "$CROSS_COMPILING" = TRUE; then
13035     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13038 # touch the config timestamp file
13039 if test ! -f config_host.mk.stamp; then
13040     echo > config_host.mk.stamp
13041 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
13042     echo "Configuration unchanged - avoiding scp2 stamp update"
13043 else
13044     echo > config_host.mk.stamp
13048 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13049 cat << _EOS
13050 ****************************************************************************
13051 WARNING:
13052 Your make version is known to be horribly slow, and hard to debug
13053 problems with. To get a reasonably functional make please do:
13055 to install a pre-compiled binary make for cygwin
13057 mkdir -p /opt/lo/bin
13058 cd /opt/lo/bin
13059 wget http://dev-www.libreoffice.org/bin/cygwin/make
13060 chmod +x make
13062 to install from source:
13063 place yourself in a working directory of you choice.
13065 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
13066 cd dev-tools/make-3.82-gbuild
13067 ./configure --prefix=/opt/lo
13068 make
13069 make install
13071 Then re-run autogen.sh
13073 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13074 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13076 _EOS
13079 cat << _EOF
13080 ****************************************************************************
13082 To build, issue:
13083 $GNUMAKE
13085 For details, run:
13086 $GNUMAKE help
13088 _EOF
13090 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13091     cat << _EOF
13092 After the build has finished, you can immediately run it using:
13093 instdir/program/soffice
13095 If you want to run the smoketest, issue:
13096 $GNUMAKE check
13098 _EOF
13101 if test -f warn; then
13102     cat warn
13103     rm warn
13106 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: