Copy the gcc's stdlibs to solver even if not packaging them
[LibreOffice.git] / configure.in
blob4667f0b4cda7bb6396610f5347251568e09451aa
1 dnl -*- Mode: Autoconf; tab-width: 8; indent-tabs-mode: nil -*-
2 dnl configure.in serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 AC_INIT([LibreOffice],[3.5],[],[],[http://documentfoundation.org/])
6 AC_PREREQ([2.59])
8 save_CC=$CC
9 save_CXX=$CXX
11 BUILD_TYPE="LibO"
12 SCPDEFS=""
13 GIT_REPO_NAMES=""
14 MINGW_EXTERNAL_DLLS=""
16 if test -n "$SOLARENV" ; then
17     AC_MSG_ERROR([You have sourced Env.Host.sh in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 echo "********************************************************************"
21 echo "*"
22 echo "*   Running ${PACKAGE_NAME} build configuration."
23 echo "*"
24 echo "********************************************************************"
25 echo ""
27 dnl ===================================================================
28 dnl checks build and host OSes
29 dnl do this before argument processing to allow for platform dependent defaults
30 dnl ===================================================================
31 AC_CANONICAL_HOST
33 if test "$cross_compiling" = "yes"; then
34     CROSS_COMPILING=YES
35 else
36     CROSS_COMPILING=
37     BUILD_TYPE="$BUILD_TYPE NATIVE"
39 AC_SUBST(CROSS_COMPILING)
41 if test "$build_os" = "cygwin"; then
42     EXEEXT_FOR_BUILD=.exe
43     SRC_ROOT=`pwd`
44     SRC_ROOT=`cygpath -d "$SRC_ROOT"`
45     SRC_ROOT=`cygpath -u "$SRC_ROOT"`
46 else
47     EXEEXT_FOR_BUILD=
48     SRC_ROOT=`pwd`
50 AC_SUBST(SRC_ROOT)
51 AC_SUBST(EXEEXT_FOR_BUILD)
53 cat /dev/null > warn
55 if test "z$EUID" = "z0" -a "z`uname -o 2>/dev/null`" = "zCygwin"; then
56     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
59 # need sed in os checks...
60 AC_PATH_PROGS(SED, sed)
61 if test -z "$SED"; then
62     AC_MSG_ERROR([install sed to run this script])
65 dnl ===================================================================
66 dnl The following is a list of supported systems.
67 dnl Sequential to keep the logic very simple
68 dnl These values may be checked and reset later.
69 dnl ===================================================================
70 #defaults unless the os test overrides this:
71 test_randr=yes
72 test_xrender=yes
73 test_cups=yes
74 test_fontconfig=yes
76 case "$host_os" in
78 solaris*)
79     test_gtk=yes
80     build_gstreamer=yes
81     test_kde=yes
82     test_freetype=yes
83     test_gstreamer=yes
84     _os=SunOS
86     dnl ===========================================================
87     dnl Check whether we're using Solaris 10 - SPARC or Intel.
88     dnl ===========================================================
89     AC_MSG_CHECKING([the Solaris operating system release])
90     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
91     if test "$_os_release" -lt "10"; then
92         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
93     else
94         AC_MSG_RESULT([ok ($_os_release)])
95     fi
97     dnl Check whether we're using a SPARC or i386 processor
98     AC_MSG_CHECKING([the processor type])
99     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
100         AC_MSG_RESULT([ok ($host_cpu)])
101     else
102         AC_MSG_ERROR([only SPARC and i386 processors are supported])
103     fi
104     ;;
106 linux-gnu*|k*bsd*-gnu*)
107     test_gtk=yes
108     build_gstreamer=yes
109     test_kde=yes
110     test_kde4=yes
111     test_freetype=yes
112     test_unix_quickstarter=yes
113     _os=Linux
114     ;;
116 gnu)
117     test_randr=no
118     test_xrender=no
119     _os=GNU
120      ;;
122 cygwin*|interix*|mingw32*)
124     # When building on Windows normally with MSVC under Cygwin,
125     # configure thinks that the host platform (the platform the
126     # built code will run on) is Cygwin, even if it obviously is
127     # Windows, which in Autoconf terminology is called
128     # "mingw32". (Which is misleading as MinGW is the name of the
129     # tool-chain, not an operating system.)
131     # Somewhat confusing, yes. But this configure script doesn't
132     # look at $host etc that much, it mostly uses its own $_os
133     # variable, set here in this case statement.
135     # When cross-compiling to Windows from Unix, the host platform
136     # is "mingw32" (because in that case it is the MinGW
137     # tool-chain that is used).
139     test_cups=no
140     test_randr=no
141     test_xrender=no
142     test_freetype=no
143     test_fontconfig=no
144     _os=WINNT
146     # If the host OS matches "mingw32*", that means we are using the
147     # MinGW cross-compiler, because we don't see the point in building
148     # LibreOffice using MinGW on Windows. If you want to build on
149     # Windows, use MSVC. If you want to use MinGW, surely you want to
150     # cross-compile (from Linux or some other Unix).
152     case "$host_os" in
153     mingw32*)
154         WITH_MINGW=yes
155         if test -z "$CC" ; then
156             CC="$host_cpu-$host_vendor-$host_os-gcc"
157         fi
158         if test -z "$CXX" ; then
159             CXX="$host_cpu-$host_vendor-$host_os-g++"
160         fi
161         ;;
162     esac
164     if test "$build_os" = "cygwin" ; then
165         SCPDEFS="$SCPDEFS -D_MSC_VER"
166     fi
167     ;;
169 darwin*) # Mac OS X or iOS
170     test_gtk=yes
171     test_randr=no
172     test_xrender=no
173     test_freetype=no
174     test_fontconfig=no
175     if test "$host_cpu" = "arm"; then
176         _os=iOS
177         test_gtk=no
178         test_cups=no
179     else
180         _os=Darwin
181     fi
182     enable_systray=no
185 freebsd*)
186     test_gtk=yes
187     build_gstreamer=yes
188     test_kde=yes
189     test_kde4=yes
190     test_freetype=yes
191     AC_MSG_CHECKING([the FreeBSD operating system release])
192     if test -n "$with_os_version"; then
193         OSVERSION="$with_os_version"
194     else
195         OSVERSION=`/sbin/sysctl -n kern.osreldate`
196     fi
197     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
198     AC_MSG_CHECKING([which thread library to use])
199     if test "$OSVERSION" -lt "500016"; then
200         PTHREAD_CFLAGS="-D_THREAD_SAFE"
201         PTHREAD_LIBS="-pthread"
202     elif test "$OSVERSION" -lt "502102"; then
203         PTHREAD_CFLAGS="-D_THREAD_SAFE"
204         PTHREAD_LIBS="-lc_r"
205     else
206         PTHREAD_CFLAGS=""
207         PTHREAD_LIBS="-pthread"
208     fi
209     AC_MSG_RESULT([$PTHREAD_LIBS])
210     _os=FreeBSD
211     ;;
213 *netbsd*)
214     test_gtk=yes
215     build_gstreamer=yes
216     test_kde=no
217     test_kde4=yes
218     test_freetype=yes
219     PTHREAD_LIBS="-pthread -lpthread"
220     _os=NetBSD
221     ;;
223 aix*)
224     test_randr=no
225     test_freetype=yes
226     PTHREAD_LIBS=-pthread
227     _os=AIX
228     ;;
230 openbsd*)
231     test_gtk=yes
232     test_kde=yes
233     test_freetype=yes
234     PTHREAD_CFLAGS="-D_THREAD_SAFE"
235     PTHREAD_LIBS="-pthread"
236     _os=OpenBSD
237     ;;
239 dragonfly*)
240     test_gtk=yes
241     build_gstreamer=yes
242     test_kde=yes
243     test_kde4=yes
244     test_freetype=yes
245     PTHREAD_LIBS="-pthread"
246     _os=DragonFly
247     ;;
249 linux-androideabi*)
250     build_gstreamer=no
251     test_cups=no
252     test_fontconfig=no
253     test_freetype=no
254     test_gtk=no
255     test_kde=no
256     test_kde4=no
257     test_randr=no
258     test_xrender=no
259     test_unix_quickstarter=no
260     _os=Android
262     # Make sure env vars pointing to where to find the cross-build
263     # toolchain are set. There aren't really any sensible
264     # guesstimates.
265     for var in CC CXX AR NM OBJDUMP RANLIB STRIP; do
266         if test -z "`eval echo '$'$var`"; then
267             AC_MSG_ERROR([You need to set the $var environment variable in a cross-compilation for Android. See README.cross for an example.])
268         fi
269     done
270     ;;
273     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
274     ;;
275 esac
277 if test "$_os" = "AIX"; then
278     AC_PATH_PROG(GAWK, gawk)
279     if test -z "$GAWK"; then
280         AC_MSG_ERROR([gawk not found in \$PATH])
281     fi
284 AC_SUBST(WITH_MINGW)
285 AC_SUBST(OSVERSION)
286 AC_SUBST(PTHREAD_CFLAGS)
287 AC_SUBST(PTHREAD_LIBS)
290 ###############################################################################
291 # Extensions switches --enable/--disable
292 ###############################################################################
293 # By default these should be enabled unless having extra dependencies.
294 # If there is extra dependency over configure options then the enable should
295 # be automagic based on wether the requiring feature is enabled or not.
296 # All this options change anything only with --enable-extension-integration.
297 AC_ARG_ENABLE(extension-integration,
298     AS_HELP_STRING([--disable-extension-integration],
299         [Disable integration of the builded extensions to the installer of the
300          product. Use this switch to disable the integration.])
303 AC_ARG_ENABLE(ext-barcode,
304     AS_HELP_STRING([--enable-ext-barcode],
305         [Enable the Barcode extension.])
308 AC_ARG_ENABLE(ext-diagram,
309     AS_HELP_STRING([--enable-ext-diagram],
310         [Enable the SmART Gallery (Diagram) extension.])
313 AC_ARG_ENABLE(ext-google-docs,
314     AS_HELP_STRING([--enable-ext-google-docs],
315         [Enable the Google Documents extension.])
318 AC_ARG_ENABLE(ext-hunart,
319     AS_HELP_STRING([--enable-ext-hunart],
320         [Enable the Hungarian Cross-reference Toolbar extension.])
323 AC_ARG_ENABLE(ext-languagetool,
324     AS_HELP_STRING([--enable-ext-languagetool],
325         [Enable the LanguageTool extension.])
328 AC_ARG_ENABLE(ext-mysql-connector,
329     AS_HELP_STRING([--enable-ext-mysql-connector],
330         [Enable the build of the MySQL Connector extension.])
333 AC_ARG_ENABLE(ext-nlpsolver,
334     AS_HELP_STRING([--enable-ext-nlpsolver],
335         [Enable the NLPSolver extension.])
338 AC_ARG_ENABLE(ext-ct2n,
339     AS_HELP_STRING([--enable-ext-ct2n],
340         [Enable the ConvertTextToNumber extension.])
343 AC_ARG_ENABLE(ext-numbertext,
344     AS_HELP_STRING([--enable-ext-numbertext],
345         [Enable the Numbertext extension.])
348 AC_ARG_ENABLE(ext-oooblogger,
349     AS_HELP_STRING([--enable-ext-oooblogger],
350         [Enable the OOo Blogger extension.])
353 AC_ARG_ENABLE(ext-pdfimport,
354     AS_HELP_STRING([--disable-ext-pdfimport],
355         [Disable the PDF Import extension.])
358 AC_ARG_ENABLE(ext-presenter-console,
359     AS_HELP_STRING([--disable-ext-presenter-console],
360         [Disable the Presenter Console extension.])
363 AC_ARG_ENABLE(ext-presenter-minimizer,
364     AS_HELP_STRING([--disable-ext-presenter-minimizer],
365         [Disable the Presentation Minimizer extension.])
368 AC_ARG_ENABLE(ext-report-builder,
369     AS_HELP_STRING([--disable-ext-report-builder],
370         [Disable the Report Builder extension.])
373 AC_ARG_ENABLE(ext-scripting-beanshell,
374     AS_HELP_STRING([--enable-ext-scripting-beanshell],
375         [Enable support for scripts in BeanShell.])
378 AC_ARG_ENABLE(ext-scripting-javascript,
379     AS_HELP_STRING([--enable-ext-scripting-javascript],
380         [Enable support for scripts in JavaScript.])
383 AC_ARG_ENABLE(ext-typo,
384     AS_HELP_STRING([--enable-ext-typo],
385         [Enable the Typography Toolbar extension.])
388 AC_ARG_ENABLE(ext-validator,
389     AS_HELP_STRING([--enable-ext-validator],
390         [Enable the Validator extension.])
393 AC_ARG_ENABLE(ext-watch-window,
394     AS_HELP_STRING([--enable-ext-watch-window],
395         [Enable the Watch Window extension to Calc.])
398 AC_ARG_ENABLE(ext-wiki-publisher,
399     AS_HELP_STRING([--enable-ext-wiki-publisher],
400         [Enable the Wiki Publisher extension.])
402 ###############################################################################
404 dnl ---------- *** ----------
406 AC_ARG_ENABLE(mergelibs,
407     AS_HELP_STRING([--enable-mergelibs],
408         [Enables linking of big merged library used for better performance.])
411 AC_ARG_ENABLE(graphite,
412     AS_HELP_STRING([--enable-graphite],
413         [Enables the compilation of Graphite smart font rendering.])
416 AC_ARG_ENABLE(ldap,
417     AS_HELP_STRING([--disable-ldap],
418         [Disables the use of LDAP backend via Netscape/Mozilla or OpenLDAP LDAP SDK])
421 AC_ARG_ENABLE(fetch-external,
422     AS_HELP_STRING([--disable-fetch-external],
423         [Disables fetching external tarballs from web sources.])
426 AC_ARG_ENABLE(lockdown,
427     AS_HELP_STRING([--disable-lockdown],
428         [Disables the gconf integration work in LibreOffice.]),
431 AC_ARG_ENABLE(vba,
432     AS_HELP_STRING([--disable-vba],
433         [Disables the vba compatibility feature.])
436 AC_ARG_ENABLE(pch,
437     AS_HELP_STRING([--enable-pch],
438         [DEPRECATED : is ignored])
441 AC_ARG_ENABLE(mozilla,
442     AS_HELP_STRING([--disable-mozilla],
443         [LibreOffice usually includes a strangely hacked up Mozilla binary for your
444          platform, to build without this version, use this option.])
447 AC_ARG_ENABLE(epm,
448     AS_HELP_STRING([--enable-epm],
449         [LibreOffice includes self-packaging code, that requires epm, however epm is
450          useless for large scale package building.])
453 AC_ARG_ENABLE(activex_component,
454     AS_HELP_STRING([--disable-activex-component],
455         [Remove support for ActiveX embedding of LibreOffice.])
458 AC_ARG_ENABLE(odk,
459     AS_HELP_STRING([--disable-odk],
460         [LibreOffice includes an ODK, office development kit which some packagers may
461          wish to build without.])
464 AC_ARG_ENABLE(mathmldtd,
465     AS_HELP_STRING([--disable-mathmldtd],
466         [Disable mathmldtd (useful for distributions that want to avoid
467          packaging it).])
470 AC_ARG_ENABLE(evolution2,
471     AS_HELP_STRING([--enable-evolution2],
472         [Allows the built-in evolution 2 addressbook connectivity build to be
473          enabled.])
476 AC_ARG_ENABLE(directx,
477     AS_HELP_STRING([--disable-directx],
478         [Remove DirectX implementation for the new XCanvas interface.
479          The DirectX support requires more stuff installed on Windows to
480          compile. (DirectX SDK, GDI+ libs)])
483 AC_ARG_ENABLE(activex,
484     AS_HELP_STRING([--disable-activex],
485         [Disable the use of ActiveX for a Windows build.
486         This switch is mandatory when using VC++ 2008 Express.])
489 AC_ARG_ENABLE(atl,
490     AS_HELP_STRING([--disable-atl],
491         [Disable the use of ATL for a Windows build.])
492     [
493                           This switch is mandatory when using VC++ 2008 Express.
494     ],
497 AC_ARG_ENABLE(symbols,
498     AS_HELP_STRING([--enable-symbols],
499         [Include debugging symbols in output. WARNING - a complete build needs
500          8 Gb of space and takes much longer (enables -g compiler flag).])
501     [
502                           Enabling symbols disables the stripping of the solver
503                           (--disable-strip-solver).
504     ],
507 AC_ARG_ENABLE(strip-solver,
508     AS_HELP_STRING([--disable-strip-solver],
509         [Disable the stripping of the solver. By default the solver is stripped
510          unless a build with debugging symbols (--enable-symbols) is requested.])
511     [
512                           This switch allows to override this setting.
513     ],
516 AC_ARG_ENABLE(werror,
517     AS_HELP_STRING([--enable-werror],
518         [Turn warnings to errors. (Has no effect in modules where the treating
519          of warnings as errors is disabled explicitly.)]),
522 AC_ARG_ENABLE(debug,
523     AS_HELP_STRING([--enable-debug],
524         [Include debugging symbols from --enable-symbols plus extra debugging
525          code. Extra large build! (enables -g compiler flag and dmake debug=true)
526          If you need even more verbose output, build a module with
527          "build -- debug=true dbglevel=2".]))
529 AC_ARG_ENABLE(dbgutil,
530     AS_HELP_STRING([--enable-dbgutil],
531         [Include additional debugging utilities, such as assertions, object
532          counting, etc. Larger build. Independent from --enable-debug]))
534 AC_ARG_ENABLE(linkoo,
535     AS_HELP_STRING([--disable-linkoo],
536         [Disable linkoo for the smoketest installation.]))
538 AC_ARG_ENABLE(lto,
539     AS_HELP_STRING([--enable-lto],
540         [Enable link-time optimization. Suitable for product builds.
541          Building takes longer but libraries are optimized for speed.
542          (possible only with gcc-4.5 or later,
543           better to use gcc-4.6 and 'gold' as linker)]))
545 AC_ARG_ENABLE(crashdump,
546     AS_HELP_STRING([--enable-crashdump],
547         [Enable the crashdump feature.]))
549 AC_ARG_ENABLE(python,
550     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
551         [Enables or disables Python support at run-time and build-time.
552          Also specifies what Python to use. 'auto' is the
553          default. Note that Python can be disabled with
554          --disable-python or --enable-python=no only if no
555          translations are required.]))
557 AC_ARG_ENABLE(gtk,
558     AS_HELP_STRING([--disable-gtk],
559         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
560 ,enable_gtk=yes)
562 AC_ARG_ENABLE(gtk3,
563     AS_HELP_STRING([--disable-gtk3],
564         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
565 ,enable_gtk3=no)
567 AC_ARG_ENABLE(systray,
568     AS_HELP_STRING([--disable-systray],
569         [Determines whether to build the systray quickstarter.]),
570 ,enable_systray=yes)
572 AC_ARG_ENABLE(split-app-modules,
573     AS_HELP_STRING([--enable-split-app-modules],
574         [Split file lists for app modules, e.g. base, calc.
575          Has effect only with make distro-pack-install]),
578 AC_ARG_ENABLE(split-opt-features,
579     AS_HELP_STRING([--enable-split-opt-features],
580         [Split file lists for some optional features, .e.g. pyuno, testtool.
581          Has effect only with make distro-pack-install]),
584 AC_ARG_ENABLE(cairo-canvas,
585 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
586                           platforms where Cairo is available.
587 ],,enable_cairo_canvas=yes)
589 AC_ARG_ENABLE(librsvg,
590     AS_HELP_STRING([--enable-librsvg=<no/auto/system/internal>],
591         [Enables or disables use of librsvg to render SVG at run-time.
592          Also specificed what librsvg to use. 'auto' is the default.]))
594 AC_ARG_ENABLE(opengl,
595     AS_HELP_STRING([--disable-opengl],
596         [Determines whether to build the OpenGL 3D slide transitions component.]),
597 ,enable_opengl=yes)
599 AC_ARG_ENABLE(dbus,
600     AS_HELP_STRING([--enable-dbus],
601         [Determines whether to enable presentation mode screensaver control
602          under GNOME via DBUS.]),
603 ,enable_dbus=no)
605 AC_ARG_ENABLE(gconf,
606     AS_HELP_STRING([--disable-gconf],
607         [Determines whether to use the GConf support.]),
608 ,enable_gconf=yes)
610 AC_ARG_ENABLE(gnome-vfs,
611     AS_HELP_STRING([--disable-gnome-vfs],
612         [Determines whether to use the Gnome Virtual Filing System on platforms
613          where that VFS is available.]),
614 ,enable_gnome_vfs=yes)
616 AC_ARG_ENABLE(gio,
617     AS_HELP_STRING([--enable-gio],
618         [Determines whether to use the GIO support.]),
619 ,enable_gio=no)
621 AC_ARG_ENABLE(static-gtk,
622     AS_HELP_STRING([--enable-static-gtk],
623         [Modules that are linked against GTK+ libraries use the static libraries
624          instead of the dynamic ones. (Enables -Bstatic linker flag for GTK+ libraries.)]),
627 AC_ARG_ENABLE(build-mozilla,
628     AS_HELP_STRING([--disable-build-mozilla],
629         [Use this option if you do not want to build the Mozilla components from
630          the Mozilla source code but take precompiled zips.]),
633 AC_ARG_ENABLE(xmlsec,
634     AS_HELP_STRING([--disable-xmlsec],
635         [Whether to enable XMLsec for open document signing.]),
638 AC_ARG_ENABLE(kde,
639     AS_HELP_STRING([--enable-kde],
640         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
641          KDE3 are available.]),
644 AC_ARG_ENABLE(kdeab,
645     AS_HELP_STRING([--disable-kdeab],
646         [Disable the KDE3 address book support.]),
648     if test "$enable_kde" = "yes"; then
649         enable_kdeab=yes;
650     fi
653 AC_ARG_ENABLE(kde4,
654     AS_HELP_STRING([--enable-kde4],
655         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
656          KDE4 are available. May be used with --enable-kde if you want to support
657          both KDE3 and KDE4.]),
660 AC_ARG_ENABLE(unix-qstart-libpng,
661     AS_HELP_STRING([--disable-unix-qstart-libpng],
662         [On UNIX systems, we have a faster splash app, that can use libpng to
663          render its splash, if we can safely link to the system libpng then
664          enabling this is a good idea (ie. for Linux Distro packaging).]),
665 ,enable_unix_qstart_libpng=yes)
667 AC_ARG_ENABLE(binfilter,
668     AS_HELP_STRING([--enable-binfilter],
669         [Enable legacy binary file formats filters build.]),
670 ,enable_binfilter=no
673 AC_ARG_ENABLE(ugly,
674     AS_HELP_STRING([--enable-ugly],
675         [Enables ugly pieces of functionality.]),
676 ,enable_ugly=no
679 AC_ARG_ENABLE(rpath,
680     AS_HELP_STRING([--disable-rpath],
681         [Disable the use of relative paths in shared libraries.]),
684 AC_ARG_ENABLE(randr,
685     AS_HELP_STRING([--disable-randr],
686         [Disable RandR support in the vcl project.]),
687 ,enable_randr=yes)
689 AC_ARG_ENABLE(randr-link,
690     AS_HELP_STRING([--disable-randr-link],
691         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
692 ,enable_randr_link=yes)
694 AC_ARG_ENABLE(gstreamer,
695     AS_HELP_STRING([--disable-gstreamer],
696         [Disable building the gstreamer avmedia backend.]),
697 ,enable_gstreamer=yes)
699 AC_ARG_ENABLE(neon,
700     AS_HELP_STRING([--disable-neon],
701         [Disable neon and the compilation of webdav binding.]),
704 AC_ARG_ENABLE(build-unowinreg,
705     AS_HELP_STRING([--enable-build-unowinreg],
706         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
707          compiler is needed on Linux.])
708     [
709                           Usage:     --enable-build-unowinreg
710     ],
713 AC_ARG_ENABLE(verbose,
714     AS_HELP_STRING([--enable-verbose],
715         [Increase build verbosity.])[
716   --disable-verbose       Decrease build verbosity.],
719 AC_ARG_ENABLE(dependency-tracking,
720     AS_HELP_STRING([--enable-dependency-tracking],
721         [Do not reject slow dependency extractors.])[
722   --disable-dependency-tracking
723                           Disables generation of dependency information.
724                           Speed up one-time builds.],
727 AC_ARG_ENABLE(icecream,
728     AS_HELP_STRING([--enable-icecream],
729         [Use the 'icecream' distributed compiling tool to speedup the compilation.
730          It defaults to /opt/icecream for the location of the icecream gcc/g++
731          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
734 AC_ARG_ENABLE(zenity,
735     AS_HELP_STRING([--disable-zenity],
736         [Do not display a build icon in the notification area (on unix) during build.]),
737 ,enable_zenity=yes)
739 AC_ARG_ENABLE(nsplugin,
740     AS_HELP_STRING([--disable-nsplugin],
741         [Do not build nsplugin extension for browser embedding.])
744 AC_ARG_ENABLE(ccache,
745     AS_HELP_STRING([--disable-ccache],
746         [Do not try to use ccache automatically.
747          By default, we will try to detect if ccache is available; in that case if
748          CC/CXX are not yet set, and --enable-icecream is not given, we
749          attempt to use ccache. --disable-ccache disables ccache completely.
753 AC_ARG_ENABLE(cl-x64,
754     AS_HELP_STRING([--enable-cl-x64],
755         [Build a 64-bit LibreOffice using the Microsoft C/C++ x64 compiler.]),
758 AC_ARG_ENABLE(extra-gallery,
759     AS_HELP_STRING([--enable-extra-gallery],
760         [Add extra gallery content.]),
763 AC_ARG_ENABLE(extra-template,
764     AS_HELP_STRING([--enable-extra-template],
765         [Add extra template content.]),
768 AC_ARG_ENABLE(extra-sample,
769     AS_HELP_STRING([--enable-extra-sample],
770         [Add extra sample content.]),
773 AC_ARG_ENABLE(extra-font,
774     AS_HELP_STRING([--enable-extra-font],
775         [Add extra font content.]),
778 AC_ARG_ENABLE(oxygenoffice,
779     AS_HELP_STRING([--enable-oxygenoffice],
780         [Download OxygenOffice branding and set custom settings.]),
783 AC_ARG_ENABLE(lomenubar,
784     AS_HELP_STRING([--enable-lomenubar],
785         [Enable global menu support.]),
788 AC_ARG_ENABLE(online-update,
789     AS_HELP_STRING([--enable-online-update],
790         [Enable the online update service that will check for new versions of
791          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
794 AC_ARG_ENABLE(release-build,
795     AS_HELP_STRING([--enable-release-build],
796         [Enable release build.
797          See http://wiki.documentfoundation.org/DevBuild]),
800 AC_ARG_ENABLE(silent-msi,
801     AS_HELP_STRING([--enable-silent-msi],
802         [Enable MSI with LIMITUI=1 (silent install).]),
805 AC_ARG_ENABLE(postgresql-sdbc,
806     AS_HELP_STRING([--disable-postgresql-sdbc],
807         [Disable the build of the PostgreSQL-SDBC driver.])
810 dnl ===================================================================
811 dnl Optional Packages (--with/without-)
812 dnl ===================================================================
813 AC_ARG_WITH(gnu-patch,
814     AS_HELP_STRING([--with-gnu-patch],
815         [Specify location of GNU patch on Solaris or FreeBSD.]),
818 AC_ARG_WITH(gnu-cp,
819     AS_HELP_STRING([--with-gnu-cp],
820         [Specify location of GNU cp on Solaris or FreeBSD.]),
823 AC_ARG_WITH(external-tar,
824     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
825         [Specify path to tarfiles manually.]),
826     TARFILE_LOCATION=$withval ,
829 AC_ARG_WITH(linked-git,
830     AS_HELP_STRING([--with-linked-git=<OTHER_CLONE_DIR>],
831         [Specify another checkout's clonedir to re-use. This makes use of
832                  git-new-workdir, and saves a lot of diskspace when having multiple
833                  trees side-by-side.]),
834     GIT_LINK_SRC=$withval ,
837 AC_ARG_WITH(openldap,
838     AS_HELP_STRING([--with-openldap],
839         [Enables the use of the OpenLDAP LDAP SDK instead of the Netscape/Mozilla one.]),
842 AC_ARG_WITH(vba-package-format,
843     AS_HELP_STRING([--with-vba-package-format],
844         [Specify package format for vba compatibility api. Specifying  "builtin"
845          means the api component and associated type library are  part of the
846          installation set. Specifying "extn" creates an uno extension that is
847          part of the installation set (located in the program directory) that
848          MUST be optionly registered using either the unopkg executeable or the
849          extension manager gui.])
850     [
851                           Note: "builtin" is the default, "extn" can cause
852                           problems.
854                           Usage:     --with-vba-package-format="builtin" or
855                                      --with-vba-package-format="extn"
856     ],
859 AC_ARG_WITH(theme,
860     AS_HELP_STRING([--with-theme="theme1 theme2..."],
861         [Choose which themes to include. By default those themes with an '*' are included.
862          Possible choices: *default, *crystal, *hicontrast, *oxygen, *tango, classic, industrial, human.]),
865 AC_ARG_WITH(helppack-integration,
867   --without-helppack-integration      It will not integrate the helppacks to the installer
868                           of the product.
869                           Please use this switch to use the online help or separate help packages.],
872 AC_ARG_WITH(fonts,
873     AS_HELP_STRING([--without-fonts],
874         [LibreOffice includes some third-party fonts to provide a reliable basis for
875          help content, templates, samples, etc. When these fonts are already
876          known to be available on the system then you should use this option.]),
879 AC_ARG_WITH(ppds,
880     AS_HELP_STRING([--without-ppds],
881         [Removes Postscript Printer definition files from LibreOffice
882          installation set, for people building for specific distributions where
883          PPDs are known to be already available (every recent distro with CUPS backend).]),
886 AC_ARG_WITH(afms,
887     AS_HELP_STRING([--without-afms],
888         [Removes bitmap font files from LibreOffice installation set, for people
889          building for specific distributions where AFM files or TrueType Fonts
890          are known to be available.]),
893 AC_ARG_WITH(agfa-monotype-fonts,
894      AS_HELP_STRING([--with-agfa-monotype-fonts],
895           [This switch should only be enabled for those who have the right
896            to use or distribute the proprietary Agfa Monotype
897            fonts.])
900 AC_ARG_WITH(epm,
901     AS_HELP_STRING([--with-epm],
902         [Decides which epm to use. Default is to use the one from the system if
903          one is built. When either this is not there or you say =internal epm
904          will be built.]),
907 AC_ARG_WITH(package-format,
908     AS_HELP_STRING([--with-package-format],
909         [Specify package format(s) for LibreOffice installsets. Default is the
910          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
911          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
912           installed, msi. Example: --with-package-format="deb dmg"]),
915 AC_ARG_WITH(system-libs,
916     AS_HELP_STRING([--with-system-libs],
917         [Use libraries already on system -- enables all --with-system-* flags except
918          mozilla.]),
921 AC_ARG_WITH(system-headers,
922     AS_HELP_STRING([--with-system-headers],
923         [Use headers already on system -- enables all --with-system-* flags for
924          external packages whose headers are the only entities used i.e.
925          boost/vigra/odbc/sane-header(s).]),
928 AC_ARG_WITH(system-jars,
929     AS_HELP_STRING([--without-system-jars],
930         [When building with --with-system-libs, also the needed jars are expected
931          on the system. Use this to disable that (except for the db case where
932          --with-system-db *has to* imply using the db.jar from there, too).]),
935 AC_ARG_WITH(system-stdlibs,
936     AS_HELP_STRING([--without-system-stdlibs],
937         [Bundle the used libstdc++/libgcc_s into the installation set.]),,
938     [with_system_stdlibs="$with_system_libs"])
940 AC_ARG_WITH(system-cairo,
941     AS_HELP_STRING([--with-system-cairo],
942         [Use Cairo libraries already on system.]),,
943     [with_system_cairo="$with_system_libs"])
945 AC_ARG_WITH(system-graphite,
946     AS_HELP_STRING([--with-system-graphite],
947         [Use graphite library already installed on system.]),,
948     [with_system_graphite="$with_system_libs"])
950 AC_ARG_WITH(system-nss,
951     AS_HELP_STRING([--with-system-nss],
952         [Use NSS/nspr libraries already on system.]),,
953     [with_system_nss="$with_system_libs"])
955 AC_ARG_WITH(system-sampleicc,
956     AS_HELP_STRING([--with-system-sampleicc],
957         [Use SampleICC libraries already on system (used only during build).]),,
958     [with_system_sampleicc="$with_system_libs"])
960 AC_ARG_WITH(mozilla-version,
961     AS_HELP_STRING([--with-mozilla-version],
962         [Choose which version of Mozilla to use while building Mozilla.
963          (default=1.7.5) Note that not all versions are supported.]),
966 AC_ARG_WITH(mozilla-toolkit,
967     AS_HELP_STRING([--with-mozilla-toolkit],
968         [Choose which GUI toolkit to use while building Mozilla components. (default=gtk2)]),
971 AC_ARG_WITH(myspell-dicts,
972     AS_HELP_STRING([--without-myspell-dicts],
973         [Removes myspell dictionaries from LibreOffice installation set, for
974          people building for specific distributions where the myspell dictionaries
975          are installed from other sources.]),
978 AC_ARG_WITH(system-dicts,
979     AS_HELP_STRING([--with-system-dicts],
980         [Use dictionaries from system paths- Specify them via
981          --with-{dict,hyph,thes}-path=/path if you want to override the default ones.]),
984 AC_ARG_WITH(external-dict-dir,
985     AS_HELP_STRING([--with-external-dict-dir],
986         [Specify external dictionary dir.]),
989 AC_ARG_WITH(external-hyph-dir,
990     AS_HELP_STRING([--with-external-hyph-dir],
991         [Specify external hyphenation pattern dir.]),
994 AC_ARG_WITH(external-thes-dir,
995     AS_HELP_STRING([--with-external-thes-dir],
996         [Specify external thesaurus dir.]),
999 AC_ARG_WITH(system-zlib,
1000     AS_HELP_STRING([--with-system-zlib],
1001         [Use zlib already on system.]),,
1002  [if test "$_os" != "WINNT"; then
1003     with_system_zlib=yes
1004   else
1005     with_system_zlib="$with_system_libs"
1006   fi])
1008 AC_ARG_WITH(system-openssl,
1009     AS_HELP_STRING([--with-system-openssl],
1010         [Use OpenSSL already on system.]),,
1011     [with_system_openssl="$with_system_libs"])
1013 AC_ARG_WITH(system-jpeg,
1014     AS_HELP_STRING([--with-system-jpeg],
1015         [Use jpeg already on system.]),,
1016  [if test "$_os" = "Linux"; then
1017     with_system_jpeg=yes
1018   else
1019     with_system_jpeg="$with_system_libs"
1020   fi])
1022 AC_ARG_WITH(system-expat,
1023     AS_HELP_STRING([--with-system-expat],
1024         [Use expat already on system.]),,
1025     [with_system_expat="$with_system_libs"])
1027 AC_ARG_WITH(system-libcmis,
1028     AS_HELP_STRING([--with-system-libcmis],
1029         [Use libcmis already on system.]),,
1030     [with_system_libcmis="$with_system_libs"])
1032 AC_ARG_WITH(system-libvisio,
1033     AS_HELP_STRING([--with-system-libvisio],
1034         [Use libvisio already on system.]),,
1035     [with_system_libvisio="$with_system_libs"])
1037 AC_ARG_WITH(system-libwpd,
1038     AS_HELP_STRING([--with-system-libwpd],
1039         [Use libwpd already on system.]),,
1040     [with_system_libwpd="$with_system_libs"])
1042 AC_ARG_WITH(system-libwps,
1043     AS_HELP_STRING([--with-system-libwps],
1044         [Use libwps already on system.]),,
1045     [with_system_libwps="$with_system_libs"])
1047 AC_ARG_WITH(system-libwpg,
1048     AS_HELP_STRING([--with-system-libwpg],
1049         [Use libwpg already on system.]),,
1050     [with_system_libwpg="$with_system_libs"])
1052 AC_ARG_WITH(system-libxml,
1053     AS_HELP_STRING([--with-system-libxml],
1054         [Use libxml/libxslt already on system.]),,
1055  [if test "$_os" = "Darwin"; then
1056     with_system_libxml=yes
1057   else
1058     with_system_libxml="$with_system_libs"
1059   fi])
1061 AC_ARG_WITH(system-icu,
1062     AS_HELP_STRING([--with-system-icu],
1063         [Use icu already on system.]),,
1064     [with_system_icu="$with_system_libs"])
1066 AC_ARG_WITH(system-poppler,
1067     AS_HELP_STRING([--with-system-poppler],
1068         [Use system poppler. (only needed for pdfimport extension)]),,
1069     [with_system_poppler="$with_system_libs"])
1071 AC_ARG_WITH(system-db,
1072     AS_HELP_STRING([--with-system-db],
1073         [Use Berkeley db already on system.]),,
1074     [with_system_db="$with_system_libs"])
1076 AC_ARG_WITH(system-lucene,
1077     AS_HELP_STRING([--with-system-lucene],
1078         [Use Lucene already on system.]),,
1079     [with_system_lucene="$with_system_jars"])
1081 AC_ARG_WITH(system-apache-commons,
1082     AS_HELP_STRING([--with-system-apache-commons],
1083         [Use Apache commons libraries already on system.]),,
1084     [with_system_apache_commons="$with_system_jars"])
1086 AC_ARG_WITH(lucene-core-jar,
1087     AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
1088         [Specify path to jarfile manually.]),
1089     LUCENE_CORE_JAR=$withval)
1091 AC_ARG_WITH(lucene-analyzers-jar,
1092     AS_HELP_STRING([--with-lucene-analyzers-jar=JARFILE],
1093         [Specify path to jarfile manually.]),
1094     LUCENE_ANALYZERS_JAR=$withval ,)
1096 AC_ARG_WITH(system-mysql,
1097     AS_HELP_STRING([--with-system-mysql],
1098         [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice
1099          extension. If the the mysql_config executable is not in PATH, use MYSQLCONFIG to
1100          point to it.]),,
1101     [with_system_mysql="$with_system_libs"])
1103 AC_ARG_WITH(libmysql-path,
1104     AS_HELP_STRING([--with-libmysql-path],
1105         [Use Connector/C (libmysql) installation for building the MySQL
1106          Connector/LibreOffice extension.])
1107     [
1108                           Usage:     --with-libmysql-path=<absolute path to
1109                                                   your Connector/C installation>
1110     ],
1113 AC_ARG_WITH(system-mysql-cppconn,
1114     AS_HELP_STRING([--with-system-mysql-cppconn],
1115         [Use MySQL C++ Connector libraries already on system.]),,
1116     [with_system_mysql_cppconn="$with_system_libs"])
1118 AC_ARG_WITH(system-postgresql,
1119     AS_HELP_STRING([--with-system-postgresql],
1120         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1121          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1122     [with_system_postgresql="$with_system_libs"])
1124 AC_ARG_WITH(libpq-path,
1125     AS_HELP_STRING([--with-libpq-path],
1126         [Use this PostgreSQL C interface (libpq) installation for building
1127          the PostgreSQL-SDBC extension.])
1128     [
1129                           Usage:     --with-libpq-path=<absolute path to
1130                                                   your libq installation>
1131     ],
1134 AC_ARG_WITH(system-hsqldb,
1135     AS_HELP_STRING([--with-system-hsqldb],
1136         [Use hsqldb already on system.]),,
1137     [with_system_hsqldb="$with_system_jars"])
1139 AC_ARG_WITH(hsqldb-jar,
1140     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1141         [Specify path to jarfile manually.]),
1142     HSQLDB_JAR=$withval)
1144 AC_ARG_WITH(system-beanshell,
1145     AS_HELP_STRING([--with-system-beanshell],
1146         [Use beanshell already on system.]),,
1147     [with_system_beanshell="$with_system_jars"])
1149 AC_ARG_WITH(beanshell-jar,
1150     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1151         [Specify path to jarfile manually.]),
1152     BSH_JAR=$withval)
1154 AC_ARG_WITH(commons-codec-jar,
1155     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1156         [Specify path to jarfile manually.]),
1157     COMMONS_CODEC_JAR=$withval)
1159 AC_ARG_WITH(commons-lang-jar,
1160     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1161         [Specify path to jarfile manually.]),
1162     COMMONS_LANG_JAR=$withval)
1164 AC_ARG_WITH(commons-httpclient-jar,
1165     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1166         [Specify path to jarfile manually.]),
1167     COMMONS_HTTPCLIENT_JAR=$withval)
1169 AC_ARG_WITH(commons-logging-jar,
1170     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1171         [Specify path to jarfile manually.]),
1172     COMMONS_LOGGING_JAR=$withval)
1174 AC_ARG_WITH(system-servlet-api,
1175     AS_HELP_STRING([--with-system-servlet-api],
1176         [Use servlet-api already on system.]),,
1177     [with_system_servlet_api="$with_system_jars"])
1179 AC_ARG_WITH(servlet-api-jar,
1180     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1181         [Specify path to jarfile manually.]),
1182     SERVLETAPI_JAR=$withval)
1184 AC_ARG_WITH(system-jfreereport,
1185     AS_HELP_STRING([--with-system-jfreereport],
1186         [Use JFreeReport already on system.]),,
1187     [with_system_jfreereport="$with_system_jars"])
1189 AC_ARG_WITH(sac-jar,
1190     AS_HELP_STRING([--with-sac-jar=JARFILE],
1191         [Specify path to jarfile manually.]),
1192     SAC_JAR=$withval)
1194 AC_ARG_WITH(libxml-jar,
1195     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1196         [Specify path to jarfile manually.]),
1197     LIBXML_JAR=$withval)
1199 AC_ARG_WITH(flute-jar,
1200     AS_HELP_STRING([--with-flute-jar=JARFILE],
1201         [Specify path to jarfile manually.]),
1202     FLUTE_JAR=$withval)
1204 AC_ARG_WITH(jfreereport-jar,
1205     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1206         [Specify path to jarfile manually.]),
1207     JFREEREPORT_JAR=$withval)
1209 AC_ARG_WITH(liblayout-jar,
1210     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1211         [Specify path to jarfile manually.]),
1212     LIBLAYOUT_JAR=$withval)
1214 AC_ARG_WITH(libloader-jar,
1215     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1216         [Specify path to jarfile manually.]),
1217     LIBLOADER_JAR=$withval)
1219 AC_ARG_WITH(libloader-jar,
1220     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1221         [Specify path to jarfile manually.]),
1222     LIBLOADER_JAR=$withval)
1224 AC_ARG_WITH(libformula-jar,
1225     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1226         [Specify path to jarfile manually.]),
1227     LIBFORMULA_JAR=$withval)
1229 AC_ARG_WITH(librepository-jar,
1230     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1231         [Specify path to jarfile manually.]),
1232     LIBREPOSITORY_JAR=$withval)
1234 AC_ARG_WITH(libfonts-jar,
1235     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1236         [Specify path to jarfile manually.]),
1237     LIBFONTS_JAR=$withval)
1239 AC_ARG_WITH(libserializer-jar,
1240     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1241         [Specify path to jarfile manually.]),
1242     LIBSERIALIZER_JAR=$withval)
1244 AC_ARG_WITH(libbase-jar,
1245     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1246         [Specify path to jarfile manually.]),
1247     LIBBASE_JAR=$withval)
1249 AC_ARG_WITH(system-saxon,
1250     AS_HELP_STRING([--with-system-saxon],
1251         [Use saxon already on system.]),,
1252     [with_system_saxon="$with_system_jars"])
1254 AC_ARG_WITH(saxon-jar,
1255     AS_HELP_STRING([--with-saxon-jar=JARFILE],
1256         [Specify path to jarfile manually.]),
1257     SAXON_JAR=$withval)
1259 AC_ARG_WITH(system-odbc,
1260     AS_HELP_STRING([--with-system-odbc],
1261         [Use the odbc headers already on system.]),,
1262     [with_system_odbc="$with_system_headers"])
1264 AC_ARG_WITH(system-sane,
1265     AS_HELP_STRING([--with-system-sane],
1266         [Use sane.h already on system.]),,
1267     [with_system_sane="$with_system_headers"])
1269 AC_ARG_WITH(system-xextensions-headers,
1270     AS_HELP_STRING([--with-system-xextensions-headers],
1271         [To build without system X11 extensions headers, use
1272          --without-system-xextensions-headers. This is possibly
1273          useful on legacy unix systems which ship with the libs
1274          but without the headers.]))
1276 AC_ARG_WITH(system-mesa-headers,
1277     AS_HELP_STRING([--with-system-mesa-headers],
1278         [Use Mesa headers already on system.]),,
1279     [with_system_mesa_headers="$with_system_headers"])
1281 AC_ARG_WITH(system-curl,
1282     AS_HELP_STRING([--with-system-curl],
1283         [Use curl already on system.]),,
1284  [if test "$_os" = "Darwin"; then
1285     with_system_curl=yes
1286   else
1287     with_system_curl="$with_system_libs"
1288   fi])
1290 AC_ARG_WITH(system-boost,
1291     AS_HELP_STRING([--with-system-boost],
1292         [Use boost already on system.]),,
1293     [with_system_boost="$with_system_headers"])
1295 AC_ARG_WITH(system-mdds,
1296     AS_HELP_STRING([--with-system-mdds],
1297         [Use mdds already on system.]),,
1298     [with_system_mdds="$with_system_headers"])
1300 AC_ARG_WITH(system-vigra,
1301     AS_HELP_STRING([--with-system-vigra],
1302         [Use vigra already on system.]),,
1303     [with_system_vigra="$with_system_headers"])
1305 AC_ARG_WITH(system-neon,
1306     AS_HELP_STRING([--with-system-neon],
1307         [Use neon already on system.]),,
1308     [with_system_neon="$with_system_libs"])
1310 AC_ARG_WITH(system-hunspell,
1311     AS_HELP_STRING([--with-system-hunspell],
1312         [Use libhunspell already on system.]),,
1313     [with_system_hunspell="$with_system_libs"])
1315 AC_ARG_WITH(system-mythes,
1316     AS_HELP_STRING([--with-system-mythes],
1317         [Use mythes already on system.]),,
1318     [with_system_mythes="$with_system_libs"])
1320 AC_ARG_WITH(system-altlinuxhyph,
1321     AS_HELP_STRING([--with-system-altlinuxhyph],
1322         [Use ALTLinuxhyph already on system.]),,
1323     [with_system_altlinuxhyph="$with_system_libs"])
1325 AC_ARG_WITH(system-lpsolve,
1326     AS_HELP_STRING([--with-system-lpsolve],
1327         [Use lpsolve already on system.]),,
1328     [with_system_lpsolve="$with_system_libs"])
1330 AC_ARG_WITH(system-libexttextcat,
1331     AS_HELP_STRING([--with-system-libexttextcat],
1332         [Use libexttextcat already on system.]),,
1333     [with_system_libexttextcat="$with_system_libs"])
1335 AC_ARG_WITH(system-cppunit,
1336     AS_HELP_STRING([--with-system-cppunit],
1337         [Use cppunit already on system.]),,
1338     [with_system_cppunit="$with_system_libs"])
1340 AC_ARG_WITH(system-redland,
1341     AS_HELP_STRING([--with-system-redland],
1342         [Use redland library already on system.]),,
1343     [with_system_redland="$with_system_libs"])
1345 AC_ARG_WITH(system-mozilla,
1346     AS_HELP_STRING([--with-system-mozilla],
1347         [Use Mozilla already on system. Note that some components cannot be built
1348          against a contemporary Mozilla. The flavour used can be specified by
1349          --with-system-mozilla=<flavour>. Supported are: libxul (default),
1350          xulrunner, firefox, seamonkey, mozilla, iceape.]),
1351     WITH_SYSTEM_MOZILLA=$withval ,
1352 WITH_SYSTEM_MOZILLA=no)
1354 AC_ARG_WITH(system-mozilla-headers,
1355     AS_HELP_STRING([--with-system-mozilla-headers],
1356         [Use mozilla headers provided by system instead of bundled ones. Used in
1357          nsplugin]),,
1358     [with_system_mozilla_headers="$with_system_headers"]
1361 AC_ARG_WITH(system-gettext,
1362     AS_HELP_STRING([--with-system-gettext],
1363         [Use gettext runtime library already on system.]),,
1364     [with_system_gettext="$with_system_libs"])
1366 AC_ARG_WITH(system-libpng,
1367     AS_HELP_STRING([--with-system-libpng],
1368         [Use libpng already on system.]),,
1369     [with_system_libpng="$with_system_libs"])
1371 AC_ARG_WITH(linker-hash-style,
1372     AS_HELP_STRING([--with-linker-hash-style],
1373         [Use linker with --hash-style=<style> when linking shared objects.
1374          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1375          if supported on the build system, and "sysv" otherwise.]))
1377 AC_ARG_WITH(stlport,
1378     AS_HELP_STRING([--with-stlport],
1379         [Build the STLPort library for compatibility with old extensions for
1380          architectures where STLPort used to be used.]),
1381     with_stlport=$withval ,
1382 with_stlport=auto)
1384 AC_ARG_WITH(jdk-home,
1385     AS_HELP_STRING([--with-jdk-home],
1386         [If you have installed JDK 1.3 or later on your system please supply the
1387          path here. Note that this is not the location of the java command but the
1388          location of the entire distribution.])
1389     [
1390                           Usage:     --with-jdk-home=<absolute path to JDK home>
1391     ],
1394 AC_ARG_WITH(gxx_include_path,
1395     AS_HELP_STRING([--with-gxx-include-path],
1396         [If you want to override the autodetected g++ include path.])
1397     [
1398                           Usage:     --with-gxx-include-path=<absolute path to
1399                                                                 g++ include dir>
1400     ],
1403 AC_ARG_WITH(help,
1404     AS_HELP_STRING([--with-help],
1405         [Enable the build of help.
1407          To build without help, use --without-help.]))
1409 AC_ARG_WITH(java,
1410     AS_HELP_STRING([--with-java],
1411         [Specify the name of the Java interpreter command. Typically "java"
1412          which is the default.
1414          To build without support for Java components, applets, accessibility
1415          or the XML filters written in Java, use --without-java or --with-java=no.])
1416     [
1417                           Usage:     --with-java==<java command>
1418                                      --without-java
1419     ],
1420     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1421     [ with_java=java ]
1424 AC_ARG_WITH(java_target_version,
1425     AS_HELP_STRING([--with-java-target-version],
1426         [Generate class files that will work on JVMs with the specified version.
1427          For example, use --with-java-target-version=1.4 to make sure that the
1428          application will work with JVM 1.4 even when compiled with JDK 1.5.])
1429     [
1430                           This option is ignored when you compile with gcj/gij.
1432                           Usage:     --with-java-target-version=<jvm version>
1433     ],
1436 AC_ARG_WITH(jvm-path,
1437     AS_HELP_STRING([--with-jvm-path],
1438         [Use a specific JVM search path at runtime.])
1439     [
1440                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1442                           e. g.: --with-jvm-path=/usr/lib/
1443                                  to find JRE/JDK in /usr/lib/jvm/
1444     ],
1447 AC_ARG_WITH(ant-home,
1448     AS_HELP_STRING([--with-ant-home],
1449         [If you have installed Jakarta Ant on your system, please supply the path here.
1450          Note that this is not the location of the Ant binary but the location
1451          of the entire distribution.])
1452     [
1453                           Usage:     --with-ant-home=<absolute path to Ant home>
1454     ],
1457 AC_ARG_WITH(junit,
1458     AS_HELP_STRING([--with-junit],
1459         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1460          --without-junit disables those tests. Not relevant in the --without-java case.])
1461     [
1462                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1463     ],
1464 ,with_junit=yes)
1466 AC_ARG_WITH(perl-home,
1467     AS_HELP_STRING([--with-perl-home],
1468         [If you have installed Perl 5 Distribution, on your system, please
1469          supply the path here. Note that this is not the location of the Perl
1470          binary but the location of the entire distribution.])
1471     [
1472                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1473     ],
1476 AC_ARG_WITH(cl-home,
1477     AS_HELP_STRING([--with-cl-home],
1478         [For Windows NT users, please supply the path for the Microsoft C/C++
1479          compiler. Note that this is not the location of the compiler binary but
1480          the location of the entire distribution.])
1481     [
1482                           Usage:     --with-cl-home=<absolute path to Microsoft
1483                                                             C/C++ compiler home>
1484     ],
1487 AC_ARG_WITH(mspdb-path,
1488     AS_HELP_STRING([--with-mspdb-path],
1489         [For Microsoft C/C++ compiler users, please supply the path pointing to
1490          the mspdb80.dll (if using Visual Studio 2008) or mspdb100.dll (if using
1491          Visual Studio 2010).])
1492     [
1493                           Usage:     --with-mspdb-path=<path to
1494                                                        mspdb80.dll/mspdb100.dll>
1495     ],
1498 AC_ARG_WITH(midl-path,
1499     AS_HELP_STRING([--with-midl-path],
1500         [For Microsoft compiler users, please supply the path pointing to the midl.exe.])
1501     [
1502                           Usage:     --with-midl-path=<abs. path to midl.exe>
1503     ],
1506 AC_ARG_WITH(csc-path,
1507     AS_HELP_STRING([--with-csc-path],
1508         [For Windows builds, please supply the path pointing to the csc.exe.
1509          Usually found automatically when building on Windows.])
1510     [
1511                           Usage:     --with-csc-path=<abs. path to csc.exe>
1512     ],
1515 AC_ARG_WITH(dotnet-framework-home,
1516     AS_HELP_STRING([--with-dotnet-framework-home],
1517         [For Microsoft compiler users, please supply the path pointing to
1518          lib/mscoree.lib, usually something like:
1519          "/cygdrive/c/Program Files/Windows SDKs/Windows/v7.0"])
1520     [
1521                           Note that in most cases it will be automatically
1522                           found, though.
1524                           Usage:     --with-dotnet-framework-home=<absolute path to .NET
1525                                                           Framework>
1526     ],
1529 AC_ARG_WITH(windows-sdk-home,
1530     AS_HELP_STRING([--with-windows-sdk-home],
1531         [For Windows builds, please supply the path to the Windows SDK.
1532          Usually found automatically when building on Windows.])
1533     [
1534                           Usage:     --with-windows-sdk-home=<absolute path to Windows SDK>
1535     ],
1538 AC_ARG_WITH(directx-home,
1539     AS_HELP_STRING([--with-directx-home],
1540         [For Windows users, please supply the path to the Microsoft DirectX SDK.])
1541     [
1542                           Usage:     --with-directx-home=<absolute path to
1543                                                           Microsoft DirectX SDK>
1544     ],
1547 AC_ARG_WITH(mozilla-build,
1548     AS_HELP_STRING([--with-mozilla-build],
1549         [For Windows users, please supply the path to the Mozilla build tools.])
1550     [
1551                           Usage:     --with-mozilla-build=<absolute path to
1552                                                           Mozilla build tools>
1554                           At the moment of this writing, an installer for the
1555                           mozilla build tools can be obtained from http://ftp.
1556                           mozilla.org/pub/mozilla.org/mozilla/libraries/win32.
1557     ],
1558     MOZILLABUILD=$withval ,
1561 AC_ARG_WITH(local-solver,
1562     AS_HELP_STRING([--with-local-solver],
1563         [If you have solver in a location other than ./solver, please supply the path here.])
1564     [
1565                           Usage:     --with-local-solver=<abs. path to solver>
1566     ],
1569 AC_ARG_WITH(lang,
1570     AS_HELP_STRING([--with-lang],
1571         [Use this option to build LibreOffice with additional language support.
1572          English (US) is always included by default.
1573          Separate multiple languages with space.
1574          For all languages, use --with-lang=ALL.])
1575     [
1576                           Usage:     --with-lang="es sw tu cs sk"
1577     ],
1580 dnl ===================================================================
1581 dnl Branding
1582 dnl ===================================================================
1584 AC_ARG_WITH(branding,
1585 [  --with-branding        Use given path to retrieve all branding images.
1586                           Expects /path/intro.png ...
1587                           /path/backing_rtl_right.png to be there. Individual
1588                           images can be overridden via --with-intro-bitmap ...
1589                           --with-startcenter-rtl-left-bitmap switches.
1591                           Usage:     --with-branding=/path/to/images
1592 ],,)
1594 AC_ARG_WITH(intro-bitmap,
1595 [  --with-intro-bitmap    Prefer the specified intro bitmap over the
1596                           the default one.
1598                           Usage:     --with-intro-bitmap=/path/my_ooo_intro.png
1599 ],,)
1601 AC_ARG_WITH(intro-progressbar-color,
1602 [  --with-intro-progressbar-color    Set color of progress bar on intro screen.
1603                                      Comma separated RGB values in decimal format.
1605                           Usage: --with-intro-progressbar-color=126,170,23
1606 ],,)
1608 AC_ARG_WITH(intro-progressbar-size,
1609 [  --with-intro-progressbar-size     Set size of progress bar on intro screen.
1610                                      Comma separated values in decimal format.
1612                           Usage: --with-intro-progressbar-size=319,10
1613 ],,)
1615 AC_ARG_WITH(intro-progressbar-position,
1616 [  --with-intro-progressbar-position Set position of progress bar on intro screen.
1617                                      Comma separated values in decimal format.
1619                           Usage: --with-intro-progressbar-position=164,225
1620 ],,)
1622 AC_ARG_WITH(intro-progressbar-frame-color,
1623 [  --with-intro-progressbar-frame-color    Set color of progress bar frame on intro screen.
1624                                            Comma separated RGB values in decimal format.
1626                           Usage: --with-intro-progressbar-frame-color=207,208,211
1627 ],,)
1629 AC_ARG_WITH(about-bitmap,
1630 [  --with-about-bitmap    Similarly to --with-intro-bitmap, this allows
1631                           specification of bitmap for the About box.
1633                           Usage:     --with-about-bitmap=/path/my_ooo_about.png
1634 ],,)
1636 AC_ARG_WITH(startcenter-left-bitmap,
1637 [  --with-startcenter-left-bitmap    Similarly to --with-intro-bitmap, this allows
1638                                      specification of bitmap for the Start center.
1640                           Usage: --with-startcenter-left-bitmap=/path/my_backing_left.png
1641 ],,)
1643 AC_ARG_WITH(startcenter-right-bitmap,
1644 [  --with-startcenter-right-bitmap    Similarly to --with-intro-bitmap, this allows
1645                                       specification of bitmap for the Start center.
1647                           Usage: --with-startcenter-right-bitmap=/path/my_backing_right.png
1648 ],,)
1650 AC_ARG_WITH(startcenter-rtl-left-bitmap,
1651 [  --with-startcenter-rtl-left-bitmap    Similarly to --with-intro-bitmap, this allows
1652                                          specification of bitmap for the Start center.
1654                           Usage: --with-startcenter-rtl-left-bitmap=/path/my_backing_rtl_left.png
1655 ],,)
1657 AC_ARG_WITH(startcenter-rtl-right-bitmap,
1658 [  --with-startcenter-rtl-right-bitmap    Similarly to --with-intro-bitmap, this allows
1659                                           specification of bitmap for the Start center.
1661                           Usage: --with-startcenter-rtl-right-bitmap=/path/my_backing_rtl_right.png
1662 ],,)
1664 AC_ARG_WITH(startcenter-space-bitmap,
1665 [  --with-startcenter-space-bitmap    Similarly to --with-intro-bitmap, this allows
1666                                       specification of bitmap for the Start center.
1668                           Usage: --with-startcenter-space-bitmap=/path/my_backing_space.png
1669 ],,)
1671 AC_ARG_WITH(vendor,
1672     AS_HELP_STRING([--with-vendor],
1673         [Set vendor of the build.])
1674     [
1675                           Usage:     --with-vendor="John the Builder"
1676     ],
1679 AC_ARG_WITH(unix-wrapper,
1680     AS_HELP_STRING([--with-unix-wrapper],
1681         [Redefines the name of the UNIX wrapper that will be used in the desktop
1682          files and in the desktop-integration RPMs.])
1683     [
1684                           Usage:     --with-unix-wrapper=ooffice
1685     ],
1688 AC_ARG_WITH(compat-oowrappers,
1689     AS_HELP_STRING([--with-compat-oowrappers],
1690         [Install oo* wrappers in parallel with
1691          lo* ones to keep backward compatibility.
1692          Has effect only with make distro-pack-install]),
1695 AC_ARG_WITH(asm-home,
1696     AS_HELP_STRING([--with-asm-home],
1697         [For Windows, please supply the path for the ml.exe or ml64.exe assembler.])
1698     [
1699                           Usage:     --with-asm-home=<path to assembler directory>
1700     ],
1703 AC_ARG_WITH(os-version,
1704     AS_HELP_STRING([--with-os-version],
1705         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1706     [
1707                           Usage:     --with-os-version=<OSVERSION>
1708     ],
1711 AC_ARG_WITH(mingw-cross-compiler,
1712     AS_HELP_STRING([--with-mingw-cross-compiler],
1713         [Specify the MinGW cross-compiler to use.])
1714     [
1715                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1717                           When building on the ODK on Unix and building unowinreg.dll,
1718                           specify the MinGW C++ cross-compiler.
1719     ],
1722 AC_ARG_WITH(build-version,
1723     AS_HELP_STRING([--with-build-version],
1724         [Allows the builder to add a custom version tag that will appear in the
1725          Help/About box for QA purposes.])
1726     [
1727                           Usage:     --with-build-version="Built by Jim"
1728     ],
1729     with_build_version=$withval ,
1732 AC_ARG_WITH(alloc,
1733     AS_HELP_STRING([--with-alloc],
1734         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1735          Note that on FreeBSD/NetBSD system==jemalloc]),
1738 AC_ARG_WITH(sun-templates,
1739     AS_HELP_STRING([--with-sun-templates],
1740         [Integrate Sun template packages.]),
1743 AC_ARG_WITH(num-cpus,
1744     AS_HELP_STRING([--with-num-cpus],
1745         [Number of build processes/cpus to use (number of projects that will build at the same time).
1746          Multi-process/multi-cpu builds can save a lot of time on multi-cpu machines.
1747          Defaults to the number of CPUs on the machine.]),
1750 AC_ARG_WITH(max-jobs,
1751     AS_HELP_STRING([--with-max-jobs],
1752         [Maximum number of jobs that will be issued at the same time per dmake or gbuild subproject.
1753          The real number of the jobs is affected by the --with-num-cpus too, it can get up to CPUS*max_jobs.
1754          Defaults to 1, unless you configure --enable-icecream - then to 10.]),
1757 dnl ===================================================================
1758 dnl MacOSX build and runtime environment options
1759 dnl ===================================================================
1761 AC_ARG_WITH(macosx-sdk,
1762     AS_HELP_STRING([--with-macosx-sdk],
1763         [Use a specific SDK for building.])
1764     [
1765                           Usage:     --with-macosx-sdk=<version>
1767                           e. g.: --with-macosx-sdk=10.4
1769                           there are 3 options to controle the MacOSX build:
1770                           --with-macosx-sdk (refered as 'sdl' below)
1771                           --with-macosx-version-min-required (refered as 'min' below)
1772                           --with-macosx-version-max-allowed (refered as 'max' below)
1774                           the connection between these value and the default they take is as follow:
1775                           ( ? means not specified on the command line, constraint: x <= y <= z)
1777                           ==========================================
1778                            command line      || config result
1779                           ==========================================
1780                           min  | max  | sdk  || min  | max  | sdk  |
1781                           ?    | ?    | ?    || 10.4 | 10.4 | 10.4 |
1782                           ?    | ?    | 10.x || 10.4 | 10.4 | 10.x |
1783                           ?    | 10.x | ?    || 10.4 | 10.x | 10.x |
1784                           ?    | 10.x | 10.y || 10.4 | 10.x | 10.y |
1785                           10.x | ?    | ?    || 10.x | 10.x | 10.x |
1786                           10.x | ?    | 10.y || 10.x | 10.x | 10.y |
1787                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1788                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1791                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1792                           for a detailled technical explanation of these variables
1794                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1796     ],
1799 AC_ARG_WITH(macosx-version-min-required,
1800     AS_HELP_STRING([--with-macosx-version-min-required],
1801         [set the minimum OS version needed to run the built LibreOffice])
1802     [
1803                           Usage:     --with-macosx-version-min-required=<version>
1805                           e. g.: --with-macos-version-min-required=10.4
1806                           see --with-macosx-sdk for more info
1807     ],
1810 AC_ARG_WITH(macosx-version-max-allowed,
1811     AS_HELP_STRING([--with-macosx-version-max-allowed],
1812         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1813     [
1814                           Usage:     --with-macosx-version-max-allowed=<version>
1816                           e. g.: --with-macos-version-max-allowed=10.6
1817                           see --with-macosx-sdk for more info
1818     ],
1822 dnl ===================================================================
1823 dnl check for required programs (grep, awk, sed, bash)
1824 dnl ===================================================================
1825 AC_PROG_EGREP
1826 AC_PROG_AWK
1827 AC_PATH_PROG( AWK, $AWK)
1828 if test -z "$AWK"; then
1829     AC_MSG_ERROR([install awk to run this script])
1832 AC_PATH_PROG(BASH, bash)
1833 if test -z "$BASH"; then
1834     AC_MSG_ERROR([bash not found in \$PATH])
1836 AC_SUBST(BASH)
1838 AC_MSG_CHECKING([for GNU or BSD tar])
1839 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
1840     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
1841     if test $? -eq 0;  then
1842         GNUTAR=$a
1843         break
1844     fi
1845 done
1846 AC_MSG_RESULT($GNUTAR)
1847 if test -z "$GNUTAR"; then
1848     AC_MSG_ERROR([not found. install GNU or BSD tar.])
1850 AC_SUBST(GNUTAR)
1852 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
1853 dnl desktop OSes from "mobile" ones.
1855 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
1856 dnl In other words, that when building for an OS that is not a
1857 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
1859 dnl Note the direction of the implication; there is no assumption that
1860 dnl cross-compiling would imply a non-desktop OS.
1862 if test $_os != iOS -a $_os != Android; then
1863     BUILD_TYPE="$BUILD_TYPE DESKTOP"
1866 dnl ===================================================================
1867 dnl Extra check for Windows. Cygwin builds need gcc to build dmake
1868 dnl although MSVC is used to build other build-time tools and 
1869 dnl LibreOffice itself.
1870 dnl ===================================================================
1871 if test "$build_os" = "cygwin" ; then
1872     AC_MSG_CHECKING([for Cygwin gcc/g++])
1873     if which gcc > /dev/null && which g++ > /dev/null ; then
1874         AC_MSG_RESULT([found])
1875     else
1876         AC_MSG_ERROR([Cygwin gcc and g++ are needed, please install them.])
1877     fi
1882 dnl ===================================================================
1883 dnl  Checks if ccache is available
1884 dnl ===================================================================
1885 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \) ; then
1886     if test -z "$CC" ; then
1887         if test -z "$CXX" ; then
1888             AC_PATH_PROG([CCACHE],[ccache],[not found])
1889             if test "$CCACHE" = "not found" ; then
1890                 CCACHE=""
1891             else
1892                 CCACHE="ccache"
1893                 # need to check for ccache version: otherwise prevents
1894                 # caching of the results (like "-x objective-c++" for Mac)
1895                 if test $_os = Darwin -o $_os = iOS; then
1896                     # check ccache version
1897                     AC_MSG_CHECKING([whether version of ccache is suitable])
1898                     CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
1899                     CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1900                     if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
1901                         AC_MSG_RESULT([yes])
1902                     else
1903                         AC_MSG_RESULT([no])
1904                         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. ccache will not be used.])
1905                         CCACHE=""
1906                     fi
1907                 fi
1908             fi
1909         else
1910             AC_MSG_NOTICE([Automatic ccache detection ingored: CXX is pre-defined])
1911             CCACHE=""
1912         fi
1913     else
1914         AC_MSG_NOTICE([Automatic ccache detection ingored: CC is pre-defined])
1915         CCACHE=""
1916     fi
1917 else
1918     CCACHE=""
1921 if test "$CCACHE" != "" ; then
1922     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
1923     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
1924     if test "$ccache_size" = "" ; then
1925         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
1926         if test "$ccache_size" = "" ; then
1927             ccache_size=0
1928         fi
1929         # we could not determine the size or it was less than 1GB -> disable auto-ccache
1930         if test $ccache_size -lt 1024 ; then
1931             CCACHE=""
1932             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
1933             echo "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled" >> warn
1934         else
1935             # warn that ccache may be too small for debug build
1936             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1937             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1938         fi
1939     else
1940         if test $ccache_size -lt 5  ; then
1941             #warn that ccache may be too small for debug build
1942             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1943             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1944         fi
1945     fi
1948 dnl ===================================================================
1949 dnl  Checks for C compiler,
1950 dnl  The check for the C++ compiler is later on.
1951 dnl ===================================================================
1952 GCC_HOME_SET="true"
1953 AC_MSG_CHECKING([gcc home])
1954 if test -z "$with_gcc_home"; then
1955     if test "$enable_icecream" = "yes" ; then
1956         GCC_HOME="/opt/icecream"
1957     else
1958         GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1959         GCC_HOME_SET="false"
1960     fi
1961 else
1962     GCC_HOME="$with_gcc_home"
1964 AC_MSG_RESULT($GCC_HOME)
1965 AC_SUBST(GCC_HOME)
1967 if test "$GCC_HOME_SET" = "true" ; then
1968     if test -z "$CC"; then
1969         CC="$GCC_HOME/bin/gcc"
1970     fi
1971     if test -z "$CXX"; then
1972         CXX="$GCC_HOME/bin/g++"
1973     fi
1976 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1977 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
1978     AC_PROG_CC
1981 COMPATH=`dirname "$CC"`
1982 if test "$COMPATH" = "." ; then
1983     AC_PATH_PROGS(COMPATH, $CC)
1984     dnl double square bracket to get single because of M4 quote...
1985     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1987 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1992 dnl ===================================================================
1993 dnl  Test MacOSX sdk and version requirement
1994 dnl ===================================================================
1995 if test "$_os" = "Darwin" ; then
1997     if test "$with_macosx_version_min_required" = "" ; then
1998         with_macosx_version_min_required="10.4"
1999     fi
2001     if test "$with_macosx_version_max_allowed" = "" ; then
2002         with_macosx_version_max_allowed="$with_macosx_version_min_required"
2003     fi
2005     if test "$with_macosx_sdk" = "" ; then
2006         with_macosx_sdk="$with_macosx_version_max_allowed"
2007     fi
2009     case "$with_macosx_sdk" in
2011     10.4)
2012         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.4u.sdk"
2013         if test ! -d "$MACOSX_SDK_PATH"; then
2014           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.4u.sdk"
2015         fi
2016         macosx_sdk_value="1040"
2017         ;;
2018     10.5)
2019         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"
2020         if test ! -d "$MACOSX_SDK_PATH"; then
2021           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.5.sdk"
2022         fi
2023         macosx_sdk_value="1050"
2024         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
2025         echo "Building with a SDK > 10.4 is experimental" >> warn
2026         ;;
2027     10.6)
2028         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk"
2029         macosx_sdk_value="1060"
2030         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
2031         echo "Building with a SDK > 10.4 is experimental" >> warn
2032         ;;
2033     10.7)
2034         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.7.sdk"
2035         macosx_sdk_value="1070"
2036         AC_MSG_WARN([Building with SDK 10.7 is known to fail in vcl])
2037         echo "Building with SDK 10.7 is known to fail in vcl" >> warn
2038         ;;
2039     *)
2040         AC_MSG_ERROR([$with_macosx_sdk is not a supported SDK value, supported value are 10.4, 10.5, 10.6 and 10.7])
2041         ;;
2042     esac
2043     AC_MSG_CHECKING([the presence of the SDK $with_macosx_sdk])
2044     if test -d "$MACOSX_SDK_PATH" ; then
2045         AC_MSG_RESULT([$MACOSX_SDK_PATH ok])
2046     else
2047         AC_MSG_ERROR([$MACOSX_SDK_PATH not found])
2048     fi
2049     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2051     case "$with_macosx_version_min_required" in
2053     10.4)
2054         MAC_OS_X_VERSION_MIN_REQUIRED="1040"
2055         ;;
2056     10.5)
2057         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2058         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2059         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2060         if test -z "$save_CC" ; then
2061             CC="gcc-4.2 -m32"
2062             CXX="g++-4.2 -m32"
2063         fi
2064         ;;
2065     10.6)
2066         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2067         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2068         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2069         if test -z "$save_CC" ; then
2070             CC="gcc-4.2 -m32"
2071             CXX="g++-4.2 -m32"
2072         fi
2073         ;;
2074     10.7)
2075         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2076         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2077         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2078         if test -z "$save_CC" ; then
2079             CC="gcc-4.2 -m32"
2080             CXX="g++-4.2 -m32"
2081         fi
2082         ;;
2083     *)
2084         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.4, 10.5, 10.6 and 10.7])
2085         ;;
2086     esac
2088     case "$with_macosx_version_max_allowed" in
2090     10.4)
2091         MAC_OS_X_VERSION_MAX_ALLOWED="1040"
2092         ;;
2093     10.5)
2094         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2095         ;;
2096     10.6)
2097         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2098         ;;
2099     10.7)
2100         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2101         ;;
2102     *)
2103         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.4, 10.5, 10.6 and 10.7])
2104         ;;
2105     esac
2107     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2108     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED ; then
2109         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2110     else
2111         AC_MSG_RESULT([ok])
2112     fi
2114     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent macos-with-sdk])
2115     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $macosx_sdk_value ; then
2116         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2117     else
2118         AC_MSG_RESULT([ok])
2119     fi
2120     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2121     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2123 AC_SUBST(MACOSX_SDK_PATH)
2124 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2125 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2126 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2128 dnl ===================================================================
2129 dnl  Test the gcc version,  3 is OK
2130 dnl ===================================================================
2131 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) -a "$GCC" = "yes"; then
2132     AC_MSG_CHECKING([the GNU C compiler version])
2133     _gcc_version=`$CC -dumpversion`
2134     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2135     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2137     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$GCCVER" -ge "040100" ; then
2138         if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
2139             export CC="$GCC_HOME/bin/gcc-4.0"
2140             #  export CC to have it available in set_soenv -> config.guess
2141             GCCVER2=`$CC -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2142             if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
2143                 GCCVER=$GCCVER2
2144             fi
2145         fi
2146         if test "$GCCVER" -ge "040100" ; then
2147             AC_MSG_ERROR([You need to use the gcc-4.0 compiler (gcc $_gcc_version won't work with the MacOSX10.4u.sdk) - set CC accordingly])
2148         else
2149             AC_MSG_RESULT([implicitly using CC=$CC])
2150         fi
2151     else
2152         AC_MSG_RESULT([checked (gcc $_gcc_version)])
2153     fi
2158 # prefix C with ccache if needed
2160 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" ; then
2161     if test "$CCACHE" != "" ; then
2162         AC_MSG_CHECKING([whether $CC is already ccached])
2165         AC_LANG_PUSH([C])
2166         save_CFLAGS=$CFLAGS
2167         CFLAGS="$CFLAGS --ccache-skip -O2"
2168         dnl an empty program will do, we're checking the compiler flags
2169         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2170                           [use_ccache=yes], [use_ccache=no])
2171         if test $use_ccache = yes ; then
2172             AC_MSG_RESULT([yes])
2173         else
2174             CC="$CCACHE $CC"
2175             AC_MSG_RESULT([no])
2176         fi
2177         CFLAGS=$save_CFLAGS
2178         AC_LANG_POP([C])
2179     fi
2183 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2184 if test "$GCC" = "yes"; then
2185     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2186     bsymbolic_functions_ldflags_save=$LDFLAGS
2187     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2188     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2189 #include <stdio.h>
2190         ],[
2191 printf ("hello world\n");
2192         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2193     if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
2194         AC_MSG_RESULT( found )
2195     else
2196         AC_MSG_RESULT( not found )
2197     fi
2198     LDFLAGS=$bsymbolic_functions_ldflags_save
2200 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2202 dnl ===================================================================
2203 dnl Set up a different compiler to produce tools to run on the build
2204 dnl machine when doing cross-compilation
2205 dnl ===================================================================
2207 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
2208 if test "$cross_compiling" = "yes"; then
2209     AC_MSG_CHECKING([for BUILD platform configuration])
2210     echo
2211     rm -rf CONF-FOR-BUILD Env.Build.sh
2212     mkdir CONF-FOR-BUILD
2213     tar cf - \
2214         Makefile.in \
2215         bin/repo-list.in \
2216         build_env.in \
2217         config.guess \
2218         configure \
2219         ooo.lst.in \
2220         oowintool \
2221         post_download.in \
2222         set_soenv.in \
2223         solenv/inc/langlist.mk \
2224         solenv/inc/postset.mk \
2225         desktop/scripts/soffice.sh.in \
2226     | (cd CONF-FOR-BUILD && tar xf -)
2227     (
2228     unset COM GUI GUIBASE OS CPU CPUNAME
2229     unset CC CXX SYSBASE CFLAGS
2230     unset PYTHON_CFLAGS PYTHON_LIBS
2231     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
2232     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
2233     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
2234     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
2235     cd CONF-FOR-BUILD
2236     sub_conf_opts=""
2237     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
2238     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
2239     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
2240     ./configure \
2241         --disable-mozilla \
2242         --disable-build-mozilla \
2243         --disable-zenity \
2244         --with-num-cpus="$with_num_cpus" \
2245         --with-max-jobs="$with_max_jobs" \
2246         $sub_conf_opts \
2247         2>&1 | sed -e 's/^/    /'
2248     test -f ./Env.Host.sh 2>/dev/null || exit
2249     cp Env.Host.sh ../Env.Build.sh
2250     . ./Env.Host.sh
2251     for V in COM GUI GUIBASE OS CPU CPUNAME CC CXX GXX_INCLUDE_PATH MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
2252              SYSTEM_LIBXSLT; do
2253         VV='$'$V
2254         VV=`eval "echo $VV"`
2255         if test -n "$VV"; then
2256             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
2257             echo "$line" >>build-config
2258         fi
2259     done
2261     for V in OUTDIR PATH SOLARINC SOLARLIB WORKDIR; do
2262         VV='$'$V
2263         VV=`eval "echo $VV"`
2264         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
2265         if test -n "$VV"; then
2266             line="${V}_FOR_BUILD='$VV'"
2267             echo "$line" >>build-config
2268         fi
2269     done
2270     )
2271     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
2272     test -f Env.Build.sh || AC_MSG_ERROR([A file called Env.Build.sh was supposed to have been copied here, but it isn't found])
2273     perl -pi -e 's,/CONF-FOR-BUILD,,g' Env.Build.sh
2274     eval `cat CONF-FOR-BUILD/build-config`
2275     AC_MSG_RESULT([checking for BUILD platform configuration... done])
2276     rm -rf CONF-FOR-BUILD
2277 else
2278     CC_FOR_BUILD="$CC"
2279     CXX_FOR_BUILD="$CXX"
2281 AC_SUBST(COM_FOR_BUILD)
2282 AC_SUBST(GUI_FOR_BUILD)
2283 AC_SUBST(GUIBASE_FOR_BUILD)
2284 AC_SUBST(OS_FOR_BUILD)
2285 AC_SUBST(CPU_FOR_BUILD)
2286 AC_SUBST(CPUNAME_FOR_BUILD)
2287 AC_SUBST(CC_FOR_BUILD)
2288 AC_SUBST(CXX_FOR_BUILD)
2289 AC_SUBST(GXX_INCLUDE_PATH_FOR_BUILD)
2290 AC_SUBST(INPATH_FOR_BUILD)
2291 AC_SUBST(OUTPATH_FOR_BUILD)
2292 AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD)
2293 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
2295 AC_SUBST(OUTDIR_FOR_BUILD)
2296 AC_SUBST(PATH_FOR_BUILD)
2297 AC_SUBST(SOLARINC_FOR_BUILD)
2298 AC_SUBST(SOLARLIB_FOR_BUILD)
2299 AC_SUBST(WORKDIR_FOR_BUILD)
2301 UPD="`echo AC_PACKAGE_VERSION | sed "s/\.//"`0"
2302 SOURCEVERSION="OOO$UPD"
2303 AC_SUBST(UPD)
2304 AC_SUBST(SOURCEVERSION)
2306 dnl ===================================================================
2307 dnl Set the ENABLE_CRASHDUMP variable.
2308 dnl ===================================================================
2309 AC_MSG_CHECKING([whether to enable crashdump feature])
2310 if test "$enable_crashdump" = "yes"; then
2311     ENABLE_CRASHDUMP="TRUE"
2312     BUILD_TYPE="$BUILD_TYPE CRASHREP"
2313     AC_MSG_RESULT([yes])
2314 else
2315     ENABLE_CRASHDUMP=""
2316     AC_MSG_RESULT([no])
2318 AC_SUBST(ENABLE_CRASHDUMP)
2321 dnl ===================================================================
2322 dnl Windows specific tests and stuff
2323 dnl ===================================================================
2324 if test "$_os" = "WINNT"; then
2326     dnl Include twain scanners
2327     BUILD_TYPE="$BUILD_TYPE TWAIN"
2329     dnl Set the CL_X64 variable if we are building a 64-bit LibreOffice.
2330     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2331     if test "z$enable_cl_x64" = "z" -o "$enable_cl_x64" = "no"; then
2332         CL_X64=""
2333         AC_MSG_RESULT([no])
2334     else
2335         CL_X64="TRUE"
2336         AC_MSG_RESULT([yes])
2337     fi
2338     AC_SUBST(CL_X64)
2340     AC_MSG_CHECKING([whether to use DirectX])
2341     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2342         ENABLE_DIRECTX="TRUE"
2343         AC_MSG_RESULT([yes])
2344     else
2345         ENABLE_DIRECTX=""
2346         AC_MSG_RESULT([no])
2347     fi
2348     AC_SUBST(ENABLE_DIRECTX)
2350     AC_MSG_CHECKING([whether to use ActiveX])
2351     if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
2352         DISABLE_ACTIVEX=""
2353         AC_MSG_RESULT([yes])
2354     else
2355         DISABLE_ACTIVEX="TRUE"
2356         AC_MSG_RESULT([no])
2357     fi
2358     AC_SUBST(DISABLE_ACTIVEX)
2360     AC_MSG_CHECKING([whether to use ATL])
2361     if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE"; then
2362         DISABLE_ATL=""
2363         AC_MSG_RESULT([yes])
2364     elif test "$enable_atl" = ""; then
2365         if test "$WITH_MINGW" = "yes"; then
2366             DISABLE_ATL="TRUE"
2367             AC_MSG_RESULT([no])
2368         else
2369             DISABLE_ATL=""
2370             AC_MSG_RESULT([yes])
2371         fi
2372     else
2373         DISABLE_ATL="TRUE"
2374         AC_MSG_RESULT([no])
2375     fi
2376     AC_SUBST(DISABLE_ATL)
2379 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
2380 dnl ===================================================================
2381 AC_MSG_CHECKING([whether to turn warnings to errors])
2382 if test -n "$enable_werror" && test "$enable_werror" != "no"; then
2383     ENABLE_WERROR="TRUE"
2384     AC_MSG_RESULT([yes])
2385 else
2386     ENABLE_WERROR="FALSE"
2387     AC_MSG_RESULT([no])
2389 AC_SUBST(ENABLE_WERROR)
2391 dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
2392 dnl ===================================================================
2393 AC_MSG_CHECKING([whether to do a debug build])
2394 if test -n "$enable_debug" && test "$enable_debug" != "no"; then
2395     ENABLE_DEBUG="TRUE"
2396     enable_symbols="yes"
2397     AC_MSG_RESULT([yes])
2398 else
2399     ENABLE_DEBUG="FALSE"
2400     AC_MSG_RESULT([no])
2402 AC_SUBST(ENABLE_DEBUG)
2404 dnl Set the ENABLE_DBGUTIL variable
2405 dnl ===================================================================
2406 AC_MSG_CHECKING([whether to build with additional debug utilities])
2407 if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2408     PROEXT=""
2409     PRODUCT=""
2411     # Compiling with MSVC using --enable-dbgutil (i.e. using the
2412     # debugging runtime, and defining _DEBUG when compiling) just
2413     # causes too many compilation errors. After having spent some
2414     # months slowly fixing them one by one, having reached sw, I give
2415     # up. Feel free to try again.
2416     if test "$_os" = WINNT -a "$WITH_MINGW" != yes; then
2417         AC_MSG_ERROR([Sorry, --enable-dbgutil won't work with MSVC])
2418     fi
2420     AC_MSG_RESULT([yes])
2421     # cppunit and graphite expose STL in public headers
2422     if test "$with_system_cppunit" = "yes"; then
2423         AC_MSG_ERROR([--with-system-cppunit conflicts with DBG_UTIL build])
2424     else
2425         with_system_cppunit=no
2426     fi
2427     if test "$with_system_graphite" = "yes"; then
2428         AC_MSG_ERROR([--with-system-graphite conflicts with DBG_UTIL build])
2429     else
2430         with_system_graphite=no
2431     fi
2432     if test "$with_system_mysql_cppconn" = "yes"; then
2433         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with DBG_UTIL build])
2434     else
2435         with_system_mysql_cppconn=no
2436     fi
2437     if test $_os = WINNT -a \
2438             \( "$enable_mozilla" != no -o \
2439                "$enable_build_mozilla" != no \); then
2440         # We can't build against the Mozilla stuff if using _DEBUG, will get linking errors
2441         # See connectivity/drivers/mozab
2442         AC_MSG_WARN([Also disabling Mozilla stuff then])
2443         enable_mozilla=no
2444         enable_build_mozilla=no
2445     fi
2446 else
2447     PRODUCT="full"
2448     PROEXT=".pro"
2449     AC_MSG_RESULT([no, full product build])
2451 AC_SUBST(PRODUCT)
2452 AC_SUBST(PROEXT)
2454 dnl Determine whether to use linkoo for the smoketest installation
2455 dnl ===================================================================
2456 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
2457 if test "$enable_linkoo" = "no"; then
2458     DISABLE_LINKOO="TRUE"
2459     AC_MSG_RESULT([no])
2460 else
2461     DISABLE_LINKOO=
2462     AC_MSG_RESULT([yes])
2464 AC_SUBST(DISABLE_LINKOO)
2466 # Set the ENABLE_LTO variable
2467 # ===================================================================
2468 AC_MSG_CHECKING([whether to use link-time optimization])
2469 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2470     ENABLE_LTO="TRUE"
2471     AC_MSG_RESULT([yes])
2472 else
2473     ENABLE_LTO=""
2474     AC_MSG_RESULT([no])
2476 AC_SUBST(ENABLE_LTO)
2478 dnl whether to include symbols into final build.
2479 dnl ===================================================================
2480 AC_MSG_CHECKING([whether to include symbols])
2481 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
2482     ENABLE_SYMBOLS="TRUE"
2483     AC_MSG_RESULT([yes])
2484 else
2485     ENABLE_SYMBOLS=
2486     AC_MSG_RESULT([no])
2488 AC_SUBST(ENABLE_SYMBOLS)
2490 dnl Determine if the solver is to be stripped or not.
2491 dnl ===================================================================
2492 AC_MSG_CHECKING([whether to strip the solver or not.])
2493 if test "z$enable_strip_solver" = "zno"; then
2494     DISABLE_STRIP="TRUE"
2495     AC_MSG_RESULT([no])
2496 else
2497     if test -n "$ENABLE_SYMBOLS"; then
2498         DISABLE_STRIP="TRUE"
2499         AC_MSG_RESULT([no])
2500     else
2501         DISABLE_STRIP=
2502         AC_MSG_RESULT([yes])
2503     fi
2505 AC_SUBST(DISABLE_STRIP)
2507 dnl check for cups support
2508 dnl ===================================================================
2509 if test "$test_cups" = "yes"; then
2510     AC_MSG_CHECKING([whether cups support is present])
2511     AC_CHECK_LIB(cups, cupsPrintFiles)
2512     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
2513     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
2514         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
2515     fi
2519 # check for fontconfig support
2520 AC_MSG_CHECKING([whether we need fontconfig])
2521 if test "z$test_fontconfig" = "zyes"; then
2522     ENABLE_FONTCONFIG="TRUE"
2523     AC_MSG_RESULT([yes])
2524     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
2525 else
2526     ENABLE_FONTCONFIG=""
2527     AC_MSG_RESULT([no])
2529 AC_SUBST(ENABLE_FONTCONFIG)
2530 AC_SUBST(FONTCONFIG_CFLAGS)
2531 AC_SUBST(FONTCONFIG_LIBS)
2533 dnl whether to find & fetch external tarballs?
2534 dnl ===================================================================
2535 if test -z "$TARFILE_LOCATION"; then
2536     TARFILE_LOCATION="DEFAULT"
2538 AC_SUBST(TARFILE_LOCATION)
2540 AC_MSG_CHECKING([whether we want to fetch tarballs])
2541 if test "z$enable_fetch_external" != "zno" ; then
2542     AC_MSG_RESULT([yes])
2543     DO_FETCH_TARBALLS="YES"
2544 else
2545     AC_MSG_RESULT([no])
2546     DO_FETCH_TARBALLS="NO"
2548 AC_SUBST(DO_FETCH_TARBALLS)
2551 dnl Disable legacy binary file formats filters
2552 dnl ===================================================================
2553 AC_MSG_CHECKING([whether to enable filters for legacy binary file formats (StarOffice 5.2)])
2554 if test "$enable_binfilter" = "no"; then
2555     WITH_BINFILTER="NO"
2556     AC_MSG_RESULT([no])
2557 else
2558     WITH_BINFILTER="YES"
2559     BUILD_TYPE="$BUILD_TYPE BINFILTER"
2560     GIT_REPO_NAMES="$GIT_REPO_NAMES binfilter"
2561     AC_MSG_RESULT([yes])
2563 AC_SUBST(WITH_BINFILTER)
2565 AC_MSG_CHECKING([whether to build help])
2566 if test "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
2567     AC_MSG_RESULT([yes])
2568     BUILD_TYPE="$BUILD_TYPE HELP"
2569     SCPDEFS="$SCPDEFS -DWITH_HELP"
2570     GIT_REPO_NAMES="$GIT_REPO_NAMES help"
2571 else
2572     AC_MSG_RESULT([no])
2575 dnl Enable ugly pieces of code we're better off without
2576 dnl ===================================================================
2577 if test "$enable_ugly" = "yes"; then
2578     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2579     SCPDEFS="$SCPDEFS -DWITH_UGLY"
2580     ENABLE_UGLY=YES
2581 else
2582     ENABLE_UGLY=NO
2584 AC_SUBST(ENABLE_UGLY)
2586 dnl ===================================================================
2587 dnl Disable rpath in shared libraries?
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([whether to use RPATH in shared libraries])
2590 if test "$enable_rpath" = "no"; then
2591     ENABLE_RPATH="no"
2592 else
2593     ENABLE_RPATH="yes"
2595 AC_MSG_RESULT([$ENABLE_RPATH])
2596 AC_SUBST(ENABLE_RPATH)
2598 dnl Test whether to include MySpell dictionaries
2599 dnl ===================================================================
2600 AC_MSG_CHECKING([whether to include MySpell dictionaries])
2601 if test -z "$with_myspell_dicts" || test "$with_myspell_dicts" = "yes"; then
2602     AC_MSG_RESULT([yes])
2603     WITH_MYSPELL_DICTS=YES
2604     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2605     GIT_REPO_NAMES="$GIT_REPO_NAMES dictionaries"
2606 else
2607     AC_MSG_RESULT([no])
2608     WITH_MYSPELL_DICTS=NO
2610 AC_SUBST(WITH_MYSPELL_DICTS)
2612 AC_MSG_CHECKING([whether to use dicts from external paths])
2613 if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
2614     AC_MSG_RESULT([yes])
2615     SYSTEM_DICTS=YES
2616     AC_MSG_CHECKING([for spelling dictionary directory])
2617     if test -n "$with_external_dict_dir"; then
2618         DICT_SYSTEM_DIR=file://$with_external_dict_dir
2619     else
2620         DICT_SYSTEM_DIR=file:///usr/share/hunspell
2621     fi
2622     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
2623     AC_MSG_CHECKING([for hyphenation patterns directory])
2624     if test -n "$with_external_hyph_dir"; then
2625         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
2626     else
2627         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
2628     fi
2629     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
2630     AC_MSG_CHECKING([for thesaurus directory])
2631     if test -n "$with_external_thes_dir"; then
2632         THES_SYSTEM_DIR=file://$with_external_thes_dir
2633     else
2634         THES_SYSTEM_DIR=file:///usr/share/mythes
2635     fi
2636     AC_MSG_RESULT([$THES_SYSTEM_DIR])
2637 else
2638     AC_MSG_RESULT([no])
2639     SYSTEM_DICTS=NO
2641 AC_SUBST(SYSTEM_DICTS)
2642 AC_SUBST(DICT_SYSTEM_DIR)
2643 AC_SUBST(HYPH_SYSTEM_DIR)
2644 AC_SUBST(THES_SYSTEM_DIR)
2646 dnl ===================================================================
2647 dnl ENABLE_PCH i now a no-op
2648 dnl ===================================================================
2649 AC_MSG_CHECKING([whether to enable pch feature])
2650 AC_MSG_RESULT([no, obsolete])
2652 dnl ===================================================================
2653 dnl Search all the common names for GNU make
2654 dnl ===================================================================
2655 AC_MSG_CHECKING([for GNU make])
2657 # try to use our own make if it is available and GNUMAKE was not already defined
2658 if test -z "$GNUMAKE"; then
2659     if test -x "/opt/lo/bin/make"; then
2660         GNUMAKE="/opt/lo/bin/make"
2661     fi
2664 for a in "$MAKE" $GNUMAKE make gmake gnumake; do
2665     $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
2666     if test $? -eq 0;  then
2667         GNUMAKE=$a
2668         break
2669     fi
2670 done
2671 AC_MSG_RESULT($GNUMAKE)
2672 if test -z "$GNUMAKE"; then
2673     AC_MSG_ERROR([not found. install GNU make.])
2676 AC_MSG_CHECKING([the GNU make version])
2677 _make_version=`$GNUMAKE --version | grep GNU | grep -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
2678 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2679 if test "$_make_longver" -ge "038200" ; then
2680     AC_MSG_RESULT([$GNUMAKE $_make_version])
2682 elif test "$_make_longver" -ge "038100" ; then
2683     AC_MSG_RESULT([$GNUMAKE $_make_version])
2684     AC_MSG_CHECKING([for GNU make bug 20033])
2685     TESTGMAKEBUG20033=`mktemp -d`
2686     cat > $TESTGMAKEBUG20033/Makefile << EOF
2687 A := \$(wildcard *.a)
2689 .PHONY: all
2690 all: \$(A:.a=.b)
2691         @echo survived bug20033. #dont kill these tabs, you will break the Makefile!!!!
2693 .PHONY: setup
2694 setup:
2695         @touch 1.a 2.a 3.a 4.a 5.a 6.a
2697 define d1
2698 @echo lala \$(1)
2699 @sleep 1
2700 endef
2702 define d2
2703 @echo tyty \$(1)
2704 @sleep 1
2705 endef
2707 %.b : %.a
2708         \$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | sha1sum))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
2709         \$(call d1,\$(CHECKSUM)),\
2710         \$(call d2,\$(CHECKSUM)))
2712     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
2713         no_parallelism_make="YES"
2714         AC_MSG_RESULT([yes, disable parallelism])
2715     else
2716         AC_MSG_RESULT([no, keep parallelism enabled])
2717     fi
2718     rm -rf $TESTGMAKEBUG20033
2719 else
2720     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
2722 AC_SUBST(GNUMAKE)
2724 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`;
2725 STALE_MAKE=
2726 make_warning=
2727 if test "z$_make_ver_check" = "z"; then
2728    STALE_MAKE=TRUE
2730 AC_SUBST(STALE_MAKE)
2732 dnl ===================================================================
2733 dnl  Test the Solaris compiler version
2734 dnl ===================================================================
2735 if test "$_os" = "SunOS"; then
2736     if test "$CC" = "cc"; then
2737         AC_PATH_PROGS(_cc, cc)
2738         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2739         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2740         dnl cc -V outputs to standard error!!!!
2741         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2742         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2743         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2744         if test "$_sunstudio_major" != "5"; then
2745             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2746         else
2747             _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" }'`
2748             if test "$_sunstudio_minor" = "false"; then
2749                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2750             else
2751                 dnl compiler will do
2752                 AC_MSG_RESULT([checked])
2753             fi
2754         fi
2755     fi
2758 HAVE_LD_HASH_STYLE=FALSE
2759 WITH_LINKER_HASH_STYLE=
2760 AC_MSG_CHECKING( for --hash-style gcc linker support )
2761 if test "$GCC" = "yes" ; then
2762     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes" ; then
2763         hash_styles="gnu sysv"
2764     elif test "$with_linker_hash_style" = "no" ; then
2765         hash_styles=
2766     else
2767         hash_styles="$with_linker_hash_style"
2768     fi
2770     for hash_style in $hash_styles ; do
2771         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
2772         hash_style_ldflags_save=$LDFLAGS
2773         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
2775         AC_LINK_IFELSE([AC_LANG_PROGRAM(
2776             [
2777 #include <stdio.h>
2778             ],[
2779 printf ("");
2780             ])],
2781             [ if ./conftest$EXEEXT; then
2782                   HAVE_LD_HASH_STYLE=TRUE
2783                   WITH_LINKER_HASH_STYLE=$hash_style
2784               fi],
2785             [HAVE_LD_HASH_STYLE=FALSE])
2786         LDFLAGS=$hash_style_ldflags_save
2787     done
2789     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
2790         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
2791     else
2792         AC_MSG_RESULT( no )
2793     fi
2794     LDFLAGS=$hash_style_ldflags_save
2795 else
2796     AC_MSG_RESULT( no )
2798 AC_SUBST(HAVE_LD_HASH_STYLE)
2799 AC_SUBST(WITH_LINKER_HASH_STYLE)
2801 dnl ===================================================================
2802 dnl Check whether there's a Perl version available.
2803 dnl ===================================================================
2804 if test -z "$with_perl_home"; then
2805     AC_PATH_PROG(PERL, perl)
2806 else
2807     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
2808     _perl_path="$with_perl_home/bin/perl"
2809     if test -x "$_perl_path"; then
2810         PERL=$_perl_path
2811     else
2812         AC_MSG_ERROR([$_perl_path not found])
2813     fi
2816 dnl ===================================================================
2817 dnl Testing for Perl version 5 or greater.
2818 dnl $] is the Perl version variable, it is returned as an integer
2819 dnl ===================================================================
2820 if test "$PERL"; then
2821     AC_MSG_CHECKING([the Perl version])
2822     ${PERL} -e "exit($]);"
2823     _perl_version=$?
2824     if test "$_perl_version" -lt 5; then
2825         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2826     fi
2827     AC_MSG_RESULT([checked (perl $_perl_version)])
2828 else
2829     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2831 AC_SUBST(PERL)
2833 dnl ===================================================================
2834 dnl Testing for required Perl modules
2835 dnl ===================================================================
2837 AC_MSG_CHECKING([for required Perl modules])
2838 if `$PERL -e 'use Archive::Zip; use Cwd;'`; then
2839     AC_MSG_RESULT([all modules found])
2840 else
2841     AC_MSG_ERROR([Failed to find some modules])
2844 dnl ===================================================================
2845 dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2846 dnl ===================================================================
2847 SHOWINCLUDES_PREFIX=
2848 if test "$_os" = "WINNT"; then
2849     if test "$WITH_MINGW" != "yes"; then
2850         AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
2851         if test -z "$with_cl_home"; then
2852             vctest=`./oowintool --msvc-productdir`;
2853             if test "$CL_X64" = ""; then
2854                 if test -x "$vctest/bin/cl.exe"; then
2855                     with_cl_home=$vctest;
2856                 fi
2857             else
2858                 if test -x "$vctest/bin/amd64/cl.exe"; then
2859                     with_cl_home=$vctest;
2860                 fi
2861             fi
2862         else
2863             with_cl_home=`cygpath -u "$with_cl_home"`
2864         fi
2865         with_cl_home=`cygpath -d "$with_cl_home"`
2866         with_cl_home=`cygpath -u "$with_cl_home"`
2867         AC_MSG_RESULT([$with_cl_home])
2869         dnl ===========================================================
2870         dnl  Check for mspdb80.dll/mspdb100.dll
2871         dnl ===========================================================
2872         dnl MSVS 2008/10 Compiler
2873         if test -n "$with_mspdb_path";then
2874             with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2875         fi
2876         if test -e "$with_mspdb_path/mspdb80.dll" -o -e "$with_mspdb_path/mspdb100.dll"; then
2877             MSPDB_PATH="$with_mspdb_path"
2878         fi
2879         dnl MSVS 2008 case
2880         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2881             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2882         fi
2883         dnl Windows SDK 6.0 case
2884         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2885             MSPDB_PATH="$with_cl_home/bin"
2886         fi
2887         dnl MSVS 2010 case
2888         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb100.dll"; then
2889             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2890         fi
2892         if test -z "$MSPDB_PATH";then
2893             dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2894             AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2895             AC_PATH_PROG(MSPDB_PATH, mspdb100.dll)
2896             MSPDB_PATH=`dirname "$MSPDB_PATH"`
2897         fi
2899         if test -z "$MSPDB_PATH"; then
2900             AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
2901         fi
2902         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2903         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2904         dnl The path needs to be added before cl is called
2905         PATH="$MSPDB_PATH:$PATH"
2907         AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2908         if test -z "$CC"; then
2909             if test "$CL_X64" = ""; then
2910                 if test -x "$with_cl_home/bin/cl.exe"; then
2911                     CC="$with_cl_home/bin/cl.exe"
2912                 fi
2913             else
2914                 if test -x "$with_cl_home/bin/amd64/cl.exe"; then
2915                     CC="$with_cl_home/bin/amd64/cl.exe"
2916                 fi
2917             fi
2918             if test -z "$CC"; then
2919                 AC_PATH_PROG(CC, cl.exe)
2920             fi
2921             # This gives us a posix path with 8.3 filename restrictions
2922             CC=`cygpath -d "$CC"`
2923             CC=`cygpath -u "$CC"`
2924         fi
2926         if test -n "$CC"; then
2927             # Remove /cl.exe from CC case insensitive
2928             AC_MSG_RESULT([found ($CC)])
2929             if test "$CL_X64" = ""; then
2930                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
2931             else
2932                 if test -n "$with_cl_home"; then
2933                     COMPATH=`echo $with_cl_home`
2934                 fi
2935             fi
2936             export INCLUDE=`cygpath -d "$COMPATH/Include"`
2937             dnl  Check which Microsoft C/C++ compiler is found
2938             AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2939             # The following finds Microsoft, matches nn.nn.nnnn then pulls numbers out.
2940             CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft/ && /..\\...\\...../ {
2941                             x = match( \\\$0, /..\\...\\...../ )
2942                             CCversion = substr( \\\$0, RSTART, RLENGTH)
2943                             tokencount = split (CCversion,vertoken,\".\")
2944                             for ( i = 1 ; i <= tokencount ; i++ ) {
2945                                 printf (\"%04d\",vertoken[[i]] )
2946                             }
2947                             }"`
2948             if test "$CCNUMVER" -ge "001600000000"; then
2949                 COMEX=13
2950                 MSVSVER=2010
2951             elif test "$CCNUMVER" -ge "001500000000"; then
2952                 COMEX=12
2953                 MSVSVER=2008
2954             else
2955                 AC_MSG_ERROR([Compiler too old. Use Microsoft Visual Studio 2008 or 2010.])
2956             fi
2957             AC_MSG_RESULT([found compiler version $CCNUMVER (MSVS $MSVSVER).])
2958         else
2959             AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
2960         fi
2962         dnl We need to guess the prefix of the -showIncludes output, it can be
2963         dnl localized
2964         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
2965         echo "#include <stdlib.h>" > conftest.c
2966         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
2967             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
2968         rm -f conftest.c conftest.obj
2969         if test -z "$SHOWINCLUDES_PREFIX" ; then
2970             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
2971         else
2972             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
2973         fi
2975         # Check for 64-bit (cross-)compiler to use to build the 64-bit
2976         # version of the Explorer extension (and maybe other small
2977         # bits, too) needed when installing a 32-bit LibreOffice on a
2978         # 64-bit OS. The 64-bit Explorer extension is a feature that
2979         # has been present since long in OOo. Don't confuse it with
2980         # building LibreOffice itself as 64-bit code, which is
2981         # unfished work and highly experimental.
2983         BUILD_X64=
2984         CC_X64_BINARY=
2985         LINK_X64_BINARY=
2986         LIBMGR_X64_BINARY=
2988         AC_MSG_CHECKING([for a x64 compiler and libraries for 64bit ActiveX component])
2989         if test "$CL_X64" = "" -a -f "$with_cl_home/atlmfc/lib/amd64/atls.lib"; then
2990             # Prefer native x64 compiler to cross-compiler, in case we are running
2991             # the build on a 64-bit OS.
2992             if "$with_cl_home/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2993                 BUILD_X64=TRUE
2994                 CC_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
2995                 CXX_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
2996                 LINK_X64_BINARY="$with_cl_home/bin/amd64/link.exe"
2997                 LIBMGR_X64_BINARY="$with_cl_home/bin/amd64/lib.exe"
2998             elif "$with_cl_home/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2999                 BUILD_X64=TRUE
3000                 CC_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
3001                 CXX_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
3002                 LINK_X64_BINARY="$with_cl_home/bin/x86_amd64/link.exe"
3003                 LIBMGR_X64_BINARY="$with_cl_home/bin/x86_amd64/lib.exe"
3004             fi
3005         fi
3006         if test "$BUILD_X64" = TRUE; then
3007             AC_MSG_RESULT([found])
3008         else
3009             AC_MSG_RESULT([not found])
3010             AC_MSG_WARN([Installation set will not contain the 64-bit Explorer extension])
3011         fi
3012         AC_SUBST(BUILD_X64)
3014         # These are passed to the environment through set_soenv.in as usual, and then
3015         # used in set_wntx64.mk
3016         AC_SUBST(CC_X64_BINARY)
3017         AC_SUBST(CXX_X64_BINARY)
3018         AC_SUBST(LINK_X64_BINARY)
3019         AC_SUBST(LIBMGR_X64_BINARY)
3021     else
3022         AC_MSG_CHECKING([the compiler is MinGW])
3023         MACHINE_PREFIX=`$CC -dumpmachine`
3024         if echo $MACHINE_PREFIX | grep -q mingw32; then
3025             AC_MSG_RESULT([yes])
3026         else
3027             AC_MSG_ERROR([Compiler is not MinGW.])
3028         fi
3029     fi
3031 AC_SUBST(COMEX)
3032 AC_SUBST(MSPDB_PATH)
3033 AC_SUBST(SHOWINCLUDES_PREFIX)
3035 dnl ===================================================================
3036 dnl Check for pkg-config
3037 dnl ===================================================================
3038 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3039     PKG_PROG_PKG_CONFIG
3042 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3044     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
3045     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
3046     # explicitly. Or put /path/to/compiler in PATH yourself.
3048     AC_CHECK_TOOL(AR,ar)
3049     AC_CHECK_TOOL(NM,nm)
3050     AC_CHECK_TOOL(OBJDUMP,objdump)
3051     AC_CHECK_TOOL(RANLIB,ranlib)
3052     AC_CHECK_TOOL(STRIP,strip)
3053     if test "$_os" = "WINNT"; then
3054         AC_CHECK_TOOL(DLLTOOL,dlltool)
3055         AC_CHECK_TOOL(WINDRES,windres)
3056     fi
3058 AC_SUBST(AR)
3059 AC_SUBST(DLLTOOL)
3060 AC_SUBST(NM)
3061 AC_SUBST(OBJDUMP)
3062 AC_SUBST(PKG_CONFIG)
3063 AC_SUBST(RANLIB)
3064 AC_SUBST(STRIP)
3065 AC_SUBST(WINDRES)
3067 dnl ===================================================================
3068 dnl pkg-config checks on Mac OS X
3069 dnl ===================================================================
3071 if test $_os = Darwin; then
3072     AC_MSG_CHECKING([for bogus pkg-config])
3073     if test -n "$PKG_CONFIG"; then
3074         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | grep -q Mono.framework; then
3075             AC_MSG_RESULT([yes, from Mono])
3076         else
3077             AC_MSG_RESULT([yes, from unknown origin])
3078         fi
3079         AC_MSG_WARN([This might have unexpected consequences, please consider hiding $PKG_CONFIG])
3080         echo "Having a $PKG_CONFIG might have unexpected consequences, please consider hiding it" >>warn
3081     else
3082         AC_MSG_RESULT([no])
3083     fi
3086 dnl ===================================================================
3087 dnl  .NET needs special treatment
3088 dnl (does the above comment really mean .NET, or is it misusing
3089 dnl that to mean Visual Studio .NET 2003 ? And does this also
3090 dnl in fact apply equally to what we actually support, i.e.
3091 dnl Visual Studio 2008 and 2010?)
3092 dnl ===================================================================
3093 if test "$build_os" = "cygwin"; then
3094     dnl Check midl.exe
3095     AC_PATH_PROG(MIDL_PATH, midl.exe)
3096     if test -n "$MIDL_PATH";then
3097         MIDL_PATH=`dirname "$MIDL_PATH"`
3098     fi
3099     if test -n "$with_midl_path";then
3100         with_midl_path=`cygpath -u "$with_midl_path"`
3101     fi
3102     if test -x "$with_midl_path/midl.exe"; then
3103         MIDL_PATH="$with_midl_path"
3104     fi
3105     if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
3106         MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
3107     fi
3108     if test -z "$MIDL_PATH" ; then
3109         vstest=`./oowintool --msvs-productdir`;
3110         if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
3111             MIDL_PATH="$vstest/Common7/Tools/Bin"
3112         fi
3113     fi
3114     if test -z "$MIDL_PATH" ; then
3115         winsdktest=`./oowintool --windows-sdk-home`
3116         if test -x "$winsdktest/Bin/midl.exe" ; then
3117             MIDL_PATH="$winsdktest/Bin"
3118         fi
3119     fi
3120     if test ! -x "$MIDL_PATH/midl.exe"; then
3121         AC_MSG_ERROR([midl.exe not found. Make sure it's in PATH or use --with-midl-path])
3122     fi
3123     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3124     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
3125     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
3127     dnl Check csc.exe
3128     AC_PATH_PROG(CSC_PATH, csc.exe)
3129     if test -n "$CSC_PATH";then
3130         CSC_PATH=`dirname "$CSC_PATH"`
3131     fi
3132     if test -n "$with_csc_path";then
3133         with_csc_path=`cygpath -u "$with_csc_path"`
3134     fi
3135     if test -x "$with_csc_path/csc.exe"; then
3136         CSC_PATH="$with_csc_path"
3137     else
3138        csctest=`./oowintool --csc-compilerdir`;
3139        if test -x "$csctest/csc.exe"; then
3140            CSC_PATH="$csctest"
3141        fi
3142     fi
3143     if test ! -x "$CSC_PATH/csc.exe"; then
3144         AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
3145     fi
3146     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3147     CSC_PATH=`cygpath -d "$CSC_PATH"`
3148     CSC_PATH=`cygpath -u "$CSC_PATH"`
3150     dnl Check mscoree.lib / .NET Framework dir
3151     AC_MSG_CHECKING(.NET Framework)
3152     if test -n "$with_dotnet_framework_home"; then
3153         with_dotnet_framework_home=`cygpath -u "$with_dotnet_framework_home"`
3154     fi
3155     if test -f "$with_dotnet_framework_home/lib/mscoree.lib"; then
3156         DOTNET_FRAMEWORK_HOME="$with_dotnet_framework_home"
3157     fi
3158     if test -z "$DOTNET_FRAMEWORK_HOME" ; then
3159         frametest=`./oowintool --dotnetsdk-dir`
3160         if test -f "$frametest/lib/mscoree.lib"; then
3161             DOTNET_FRAMEWORK_HOME="$frametest"
3162         else
3163             frametest=`./oowintool --windows-sdk-home`
3164             if test -f "$frametest/lib/mscoree.lib"; then
3165                 DOTNET_FRAMEWORK_HOME="$frametest"
3166             fi
3167         fi
3168     fi
3169     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
3170         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-dotnet-framework-home])
3171     fi
3172     AC_MSG_RESULT(found)
3173     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3174     DOTNET_FRAMEWORK_HOME=`cygpath -d "$DOTNET_FRAMEWORK_HOME"`
3175     DOTNET_FRAMEWORK_HOME=`cygpath -u "$DOTNET_FRAMEWORK_HOME"`
3176     AC_SUBST(MIDL_PATH)
3177     AC_SUBST(CSC_PATH)
3178     AC_SUBST(DOTNET_FRAMEWORK_HOME)
3181 dnl ===================================================================
3182 dnl Check if stdc headers are available excluding MSVC.
3183 dnl ===================================================================
3184 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3185     AC_HEADER_STDC
3188 dnl ===================================================================
3189 dnl Testing for C++ compiler and version...
3190 dnl ===================================================================
3192 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3193     AC_PROG_CXX
3194 else
3195     if test -n "$CC" -a -z "$CXX"; then
3196         CXX="$CC"
3197     fi
3200 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
3201 if test "$GXX" = "yes"; then
3202     AC_MSG_CHECKING([the GNU C++ compiler version])
3204     _gpp_version=`$CXX -dumpversion`
3205     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
3207     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$_gpp_majmin" -ge "401" ; then
3208         if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
3209             export CXX="$GCC_HOME/bin/g++-4.0"
3210             _gpp_majmin_2=`$CXX -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
3211             if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
3212                 _gpp_majmin=$_gpp_majmin_2
3213             fi
3214         fi
3215         if test "$_gpp_majmin" -ge "401" ; then
3216             AC_MSG_ERROR([You need to use the g++-4.0 compiler (g++ $_gpp_version won't work with the MacOSX10.4u.sdk) - set CXX accordingly])
3217         else
3218             AC_MSG_RESULT([implicitly using CXX=$CXX])
3219         fi
3220     else
3221         AC_MSG_RESULT([checked (g++ $_gpp_version)])
3222     fi
3224     if test "$_gpp_majmin" = "304"; then
3225         AC_MSG_CHECKING([whether $CXX has the enum bug])
3226         AC_RUN_IFELSE([AC_LANG_SOURCE([[
3227             extern "C" void abort (void);
3228             extern "C" void exit (int status);
3230             enum E { E0, E1, E2, E3, E4, E5 };
3232             void test (enum E e)
3233             {
3234                 if (e == E2 || e == E3 || e == E1)
3235                     exit (1);
3236             }
3238             int main (void)
3239             {
3240                 test (E4);
3241                 test (E5);
3242                 test (E0);
3243                 return 0;
3244             }
3245             ]])],[AC_MSG_ERROR([your version of the GNU C++ compile has a bug which prevents LibreOffice from being compiled correctly - please check http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00968.html for details.])],[AC_MSG_RESULT([no])],[])
3246     fi
3250 # prefx CXX with ccache if needed
3252 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3253     if test "$CCACHE" != "" ; then
3254         AC_MSG_CHECKING([whether $CXX is already ccached])
3255         AC_LANG_PUSH([C++])
3256         save_CXXFLAGS=$CXXFLAGS
3257         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
3258         dnl an empty program will do, we're checking the compiler flags
3259         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3260                           [use_ccache=yes], [use_ccache=no])
3261         if test $use_ccache = yes ; then
3262             AC_MSG_RESULT([yes])
3263         else
3264             CXX="$CCACHE $CXX"
3265             AC_MSG_RESULT([no])
3266         fi
3267         CXXFLAGS=$save_CXXFLAGS
3268         AC_LANG_POP([C++])
3269     fi
3272 dnl ===================================================================
3273 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
3274 dnl ===================================================================
3276 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3277     AC_PROG_CXXCPP
3279     dnl Check whether there's a C pre-processor.
3280     dnl ===================================================================
3281     dnl When using SunStudio compiler, there is a bug with the cc
3282     dnl preprocessor, so use CC preprocessor as the cc preprocessor
3283     dnl See Issuezilla #445.
3284     dnl ===================================================================
3285     if test "$_os" = "SunOS"; then
3286         CPP=$CXXCPP
3287     else
3288         AC_PROG_CPP
3289     fi
3293 dnl ===================================================================
3294 dnl Find integral type sizes and alignments
3295 dnl ===================================================================
3297 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3299     AC_CHECK_SIZEOF(long)
3300     AC_CHECK_SIZEOF(short)
3301     AC_CHECK_SIZEOF(int)
3302     AC_CHECK_SIZEOF(long long)
3303     AC_CHECK_SIZEOF(double)
3304     AC_CHECK_SIZEOF(void*)
3306     SIZEOF_SHORT=$ac_cv_sizeof_short
3307     SIZEOF_INT=$ac_cv_sizeof_int
3308     SIZEOF_LONG=$ac_cv_sizeof_long
3309     SIZEOF_LONGLONG=$ac_cv_sizeof_long_long
3310     SIZEOF_DOUBLE=$ac_cv_sizeof_double
3311     SIZEOF_POINTER=$ac_cv_sizeof_voidp
3313     dnl Allow build without AC_CHECK_ALIGNOF, grrr
3314     m4_pattern_allow([AC_CHECK_ALIGNOF])
3315     m4_ifdef([AC_CHECK_ALIGNOF],
3316       ,
3317       [
3318          dnl We know that the ALIGNOF_ variables are used only when cross-compiling
3319          dnl in sal/typesconfig/makefile.mk...
3320          if test "$cross_compiling" = "yes"; then
3321             AC_MSG_ERROR([When cross-compiling you must use a recent Autoconf with [AC_][CHECK_ALIGNOF]])
3322          fi
3323          m4_define([AC_CHECK_ALIGNOF],
3324             [
3325                AC_MSG_WARN([Cannot determine alignment of $1])
3326                AS_TR_SH([ac_cv_alignof_$3])=unknown
3327             ])
3328       ])
3330     AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
3331     AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
3332     AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
3333     AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
3335     ALIGNOF_SHORT=$ac_cv_alignof_short
3336     ALIGNOF_INT=$ac_cv_alignof_int
3337     ALIGNOF_LONG=$ac_cv_alignof_long
3338     ALIGNOF_DOUBLE=$ac_cv_alignof_double
3340     AC_C_BIGENDIAN
3341     WORDS_BIGENDIAN=$ac_cv_c_bigendian
3343     dnl Check for large file support
3344     AC_SYS_LARGEFILE
3345     if test -n "$ac_cv_sys_file_offset_bits"; then
3346         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
3347     fi
3348     if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
3349         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
3350     fi
3351 else
3352     # Hardcode for MSVC
3353     SIZEOF_SHORT=2
3354     SIZEOF_INT=4
3355     SIZEOF_LONG=4
3356     SIZEOF_LONGLONG=8
3357     if test "$CL_X64" = ""; then
3358         SIZEOF_POINTER=4
3359     else
3360         SIZEOF_POINTER=8
3361     fi
3362     ALIGNOF_SHORT=2
3363     ALIGNOF_INT=4
3364     ALIGNOF_LONG=4
3365     ALIGNOF_DOUBLE=8
3366     WORDS_BIGENDIAN=no
3367     LFS_CFLAGS=''
3369 AC_SUBST(WORDS_BIGENDIAN)
3370 AC_SUBST(LFS_CFLAGS)
3372 AC_SUBST(SIZEOF_SHORT)
3373 AC_SUBST(SIZEOF_INT)
3374 AC_SUBST(SIZEOF_LONG)
3375 AC_SUBST(SIZEOF_LONGLONG)
3376 AC_SUBST(SIZEOF_DOUBLE)
3377 AC_SUBST(SIZEOF_POINTER)
3378 AC_SUBST(ALIGNOF_SHORT)
3379 AC_SUBST(ALIGNOF_INT)
3380 AC_SUBST(ALIGNOF_LONG)
3381 AC_SUBST(ALIGNOF_DOUBLE)
3383 dnl ===================================================================
3384 dnl Check if valgrind.h is available
3385 dnl ===================================================================
3386 if test "$cross_compiling" != "yes" -a "$enable_dbgutil" != "no" -a \
3387         -z "$VALGRIND_CFLAGS"; then
3388     dnl Test $prefix (currently only testing for /usr and /usr/local)
3389     dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
3390     prev_cppflags=$CPPFLAGS
3391     CPPFLAGS="-I/usr/include/valgrind"
3392     AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
3393     if test -z "$VALGRIND_CFLAGS"; then
3394         CPPFLAGS="-I/usr/local/include/valgrind"
3395         AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
3396     fi
3397     if test -n "$VALGRIND_CFLAGS"; then
3398         CPPFLAGS=$VALGRIND_CFLAGS
3399         AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
3400     fi
3401     CPPFLAGS=$prev_cppflags
3403 AC_SUBST([VALGRIND_CFLAGS])
3405 dnl ===================================================================
3406 dnl Set the gcc/gxx include directories
3407 dnl ===================================================================
3408 # Removed the special FreeBSD treatment. The problem was that with_gxx_include_path
3409 # often contains an i386 which is expanded as a macro.
3410 if test "$GXX" = "yes"; then
3411     AC_MSG_CHECKING([for g++ include path])
3412     if test -z "$with_gxx_include_path"; then
3413         with_gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
3414         if test "$with_gxx_include_path" = "/usr/libexec/(null)/include"; then
3415             with_gxx_include_path="/usr/include"
3416         fi
3417         if echo $with_gxx_include_path | grep -q linux; then
3418             # workaround for Mandriva - issue 100049
3419             with_gxx_include_path=`cd $with_gxx_include_path && pwd`
3420         fi
3421     fi
3422     dnl This is the original code...
3423     dnl with_gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include
3424     if test -z "$with_gxx_include_path"; then
3425         with_gxx_include_path="NO_GXX_INCLUDE"
3426         AC_MSG_RESULT([none])
3427     else
3428         AC_MSG_RESULT([$with_gxx_include_path])
3429     fi
3430 else
3431     with_gxx_include_path="NO_GXX_INCLUDE"
3433 GXX_INCLUDE_PATH="$with_gxx_include_path"
3434 AC_SUBST(GXX_INCLUDE_PATH)
3436 dnl ===================================================================
3437 dnl Set the MinGW include directories
3438 dnl ===================================================================
3439 if test "$WITH_MINGW" = "yes"; then
3440     AC_MSG_CHECKING([for MinGW include path])
3441     cat >conftest.$ac_ext <<_ACEOF
3442 #include <stddef.h>
3443 #include <bits/c++config.h>
3444 _ACEOF
3445     _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`
3446     rm conftest.$ac_ext
3447     if test -z "$_mingw_lib_include_path"; then
3448         _mingw_lib_include_path="NO_LIB_INCLUDE"
3449         AC_MSG_RESULT([no MinGW include path])
3450     else
3451         AC_MSG_RESULT([$_mingw_lib_include_path])
3452     fi
3453     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
3454     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
3456     mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
3457     MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
3459     AC_LANG_PUSH([C++])
3461     AC_MSG_CHECKING([for dynamic libgcc])
3462     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3463 #include <iostream>
3464 using namespace std;
3465 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[   
3466             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
3467             if test -n "$MINGW_GCCDLL"; then
3468                 MINGW_SHARED_GCCLIB=YES
3469                 AC_MSG_RESULT([ $MINGW_GCCDLL])
3470             else
3471                 MINGW_SHARED_GCCLIB=NO
3472                 AC_MSG_RESULT([no])
3473             fi
3474        ],[ AC_MSG_RESULT([no])
3475        
3476     ])
3478     AC_MSG_CHECKING([for dynamic libstdc++])
3479     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3480 #include <iostream>
3481 using namespace std;
3482 ]], [[ cout << "Hello there." << endl; ]])],[   
3483             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
3484             if test -n "$MINGW_GXXDLL"; then
3485                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
3486                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
3487                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
3488                 MINGW_SHARED_GXXLIB=YES
3489                 AC_MSG_RESULT([$MINGW_GXXDLL])
3490             else
3491                 MINGW_SHARED_GXXLIB=NO
3492                 AC_MSG_RESULT([no])
3493             fi
3494        ],[ AC_MSG_RESULT([no])
3495        
3496     ])
3498     AC_LANG_POP([C++])
3500     AC_SUBST(MINGW_CLIB_DIR)
3501     AC_SUBST(MINGW_SHARED_GCCLIB)
3502     AC_SUBST(MINGW_SHARED_GXXLIB)
3503     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
3504     AC_SUBST(MINGW_GCCDLL)
3505     AC_SUBST(MINGW_GXXDLL)
3508 dnl ===================================================================
3509 dnl Extra checking for the SunOS compiler
3510 dnl ===================================================================
3511 if test "$_os" = "SunOS"; then
3512     dnl SunStudio C++ compiler packaged with SunStudio C compiler
3513     if test "$CC" = "cc"; then
3514     AC_MSG_CHECKING([SunStudio C++ Compiler])
3515         if test "$CXX" != "CC"; then
3516             AC_MSG_WARN([SunStudio C++ was not found])
3517             echo "SunStudio C++ was not found" >> warn
3518         else
3519             AC_MSG_RESULT([checked])
3520         fi
3521     fi
3524 dnl *************************************************************
3525 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
3526 dnl *************************************************************
3527 if test "$WITH_MINGW" = "yes"; then
3528     AC_MSG_CHECKING([exception type])
3529     AC_LANG_PUSH([C++])
3530     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
3532         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
3534         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
3535     ])
3536     AC_MSG_RESULT($exceptions_type)
3537     AC_LANG_POP([C++])
3540 EXCEPTIONS="$exceptions_type"
3541 AC_SUBST(EXCEPTIONS)
3543 dnl ===================================================================
3544 dnl Checks for what the default STL should be
3545 dnl ===================================================================
3546 AC_MSG_CHECKING([Whether building STLPort library makes sense])
3547 BUILD_STLPORT="no"
3548 if test "$_os" = "Linux"; then
3549     case "$host_cpu" in
3550     i?86)
3551         case "$host_os" in
3552         k*bsd*-gnu*)
3553             BUILD_STLPORT="no"
3554             ;;
3555         *)
3556             BUILD_STLPORT="yes"
3557             ;;
3558         esac
3559         ;;
3560     *)
3561         BUILD_STLPORT="no"
3562         ;;
3563     esac
3564 elif test "$_os" = "SunOS"; then
3565     BUILD_STLPORT="yes"
3566 elif test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
3567     BUILD_STLPORT="yes"
3568 elif test "$_os" = "FreeBSD"; then
3569     BUILD_STLPORT="yes"
3571 if test "$BUILD_STLPORT" = "yes" ; then
3572     AC_MSG_RESULT([yes])
3573 else
3574     AC_MSG_RESULT([no])
3577 AC_MSG_CHECKING([Whether STLPort library will be actually built])
3578 if test "$with_stlport" = "auto" -o "$BUILD_STLPORT" = "no"; then
3579     with_stlport=$BUILD_STLPORT
3581 if test "$with_stlport" = "yes" ; then
3582     AC_MSG_RESULT([yes])
3583     WITH_STLPORT=YES
3584     SCPDEFS="$SCPDEFS -DWITH_STLPORT"
3585     BUILD_TYPE="$BUILD_TYPE STLPORT"
3586 else
3587     WITH_STLPORT=NO
3588     AC_MSG_RESULT([no])
3591 AC_SUBST(WITH_STLPORT)
3593 dnl ===================================================================
3594 dnl thread-safe statics
3595 dnl ===================================================================
3596 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
3597 unset HAVE_THREADSAFE_STATICS
3598 if test "$GCC" = "yes"; then
3599     save_CXXFLAGS=$CXXFLAGS
3600     CXXFLAGS="$CXXFLAGS -fthreadsafe-statics"
3601     AC_LANG_PUSH([C++])
3602     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)],[HAVE_THREADSAFE_STATICS=TRUE],[])
3603     AC_LANG_POP([C++])
3604     CXXFLAGS=$save_CXXFLAGS
3605     if test "$HAVE_THREADSAFE_STATICS" = "TRUE"; then
3606         dnl Some C++ runtimes use a single lock for all static variables, which
3607         dnl can cause deadlock in multi-threaded applications.  This is not
3608         dnl easily tested here; for POSIX-based systems, if executing the
3609         dnl following C++ program does not terminate then the tool chain
3610         dnl apparently has this problem:
3611         dnl
3612         dnl   #include <pthread.h>
3613         dnl   int h() { return 0; }
3614         dnl   void * g(void * unused) {
3615         dnl     static int n = h();
3616         dnl     return &n;
3617         dnl   }
3618         dnl   int f() {
3619         dnl     pthread_t t;
3620         dnl     pthread_create(&t, 0, g, 0);
3621         dnl     pthread_join(t, 0);
3622         dnl     return 0;
3623         dnl   }
3624         dnl   int main() {
3625         dnl     static int n = f();
3626         dnl     return n;
3627         dnl   }
3628         dnl
3629         dnl Mac OS X up to at least 10.7.1 is known to have this problem:
3630         if test "$_os" = "Darwin"; then
3631             unset HAVE_THREADSAFE_STATICS
3632             AC_MSG_RESULT([broken (i.e., no)])
3633         else
3634             AC_MSG_RESULT([yes])
3635         fi
3636     else
3637         AC_MSG_RESULT([no])
3638     fi
3639 else
3640     AC_MSG_RESULT([unknown (assuming no)])
3642 AC_SUBST(HAVE_THREADSAFE_STATICS)
3644 dnl ===================================================================
3645 dnl visibility and c++0x features
3646 dnl ===================================================================
3647 if test "$GCC" = "yes"; then
3648     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
3649     save_CFLAGS=$CFLAGS
3650     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
3651     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
3652     CFLAGS=$save_CFLAGS
3653     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3654         AC_MSG_RESULT([yes])
3655     else
3656         AC_MSG_RESULT([no])
3657     fi
3659     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
3660     save_CFLAGS=$CFLAGS
3661     CFLAGS="$CFLAGS -Werror -Wno-long-double"
3662     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
3663     CFLAGS=$save_CFLAGS
3664     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
3665         AC_MSG_RESULT([yes])
3666     else
3667         AC_MSG_RESULT([no])
3668     fi
3670     AC_MSG_CHECKING([whether $CC supports -mno-avx])
3671     save_CFLAGS=$CFLAGS
3672     CFLAGS="$CFLAGS -Werror -mno-avx"
3673     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
3674     CFLAGS=$save_CFLAGS
3675     if test "$HAVE_GCC_AVX" = "TRUE"; then
3676         AC_MSG_RESULT([yes])
3677     else
3678         AC_MSG_RESULT([no])
3679     fi
3681     AC_MSG_CHECKING([whether $CC supports -std=c++0x without Language Defect 757])
3682     save_CXXFLAGS=$CXXFLAGS
3683     CXXFLAGS="$CXXFLAGS -std=c++0x"
3684     AC_LANG_PUSH([C++])
3686     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3687 #include <stddef.h>
3689 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
3691 namespace
3693         struct b
3694         {
3695                 int i;
3696                 int j;
3697         };
3699 ]], [[
3700 struct a
3702         int i;
3703         int j;
3705 a thinga[]={{0,0}, {1,1}};
3706 b thingb[]={{0,0}, {1,1}};
3707 size_t i = sizeof(sal_n_array_size(thinga));
3708 size_t j = sizeof(sal_n_array_size(thingb));
3709 return !(i != 0 && j != 0);
3710 ]])],[HAVE_CXX0X=TRUE],[])
3712     AC_LANG_POP([C++])
3713     CXXFLAGS=$save_CXXFLAGS
3714     if test "$HAVE_CXX0X" = "TRUE"; then
3715         AC_MSG_RESULT([yes])
3716     else
3717         AC_MSG_RESULT([no])
3718     fi
3721 AC_SUBST(HAVE_CXX0X)
3722 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
3723 AC_SUBST(HAVE_GCC_AVX)
3725 dnl ===================================================================
3726 dnl system stl sanity tests
3727 dnl ===================================================================
3728 HAVE_GCC_VISIBILITY_BROKEN=
3729 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) ; then
3731     AC_LANG_PUSH([C++])
3733     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3734         AC_MSG_CHECKING([if STL headers are visibility safe])
3735         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
3736         AC_MSG_RESULT([$stlvisok])
3737         if test "$stlvisok" = "no"; then
3738             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
3739             echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
3740             unset HAVE_GCC_VISIBILITY_FEATURE
3741         fi
3742     fi
3744     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3745         sharedlink_ldflags_save=$LDFLAGS
3746         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
3748         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
3749         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3750 #include <sstream>
3751 using namespace std;
3752             ]], [[
3753 istringstream strm( "test" ); return 0;
3754             ]])],[$EGREP -q  unresolvable conftest.err;
3755             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
3756         ])
3757         AC_MSG_RESULT([$gccvisok])
3758         if test "$gccvisok" = "no"; then
3759             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
3760             echo "Your gcc is not -fvisibility-inlines-hidden safe, disabling that." >> warn
3761             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
3762         fi
3764         LDFLAGS=$sharedlink_ldflags_save
3765     fi
3767     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3768         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
3769         cat >visibility.cxx <<_ACEOF
3770 #pragma GCC visibility push(hidden)
3771 struct __attribute__ ((visibility ("default"))) TestStruct {
3772   static void Init();
3774 __attribute__ ((visibility ("default"))) void TestFunc() {
3775   TestStruct::Init();
3777 _ACEOF
3778         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
3779             gccvisbroken=yes
3780         else
3781             case "$host_cpu" in
3782             i?86|x86_64)
3783                 if test "$_os" = "Darwin"; then
3784                     gccvisbroken=no
3785                 else
3786                     if $EGREP -q '@PLT' visibility.s; then
3787                         gccvisbroken=no
3788                     else
3789                         gccvisbroken=yes
3790                     fi
3791                 fi
3792                 ;;
3793             *)
3794                 gccvisbroken=no
3795                 ;;
3796             esac
3797         fi
3798         rm -f visibility.s visibility.cxx
3800         AC_MSG_RESULT([$gccvisbroken])
3801         if test "$gccvisbroken" = "yes"; then
3802             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
3803             echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
3804             unset HAVE_GCC_VISIBILITY_FEATURE
3805         fi
3806     fi
3808     AC_LANG_POP([C++])
3811 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3812 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
3814 dnl ===================================================================
3815 dnl allocator
3816 dnl ===================================================================
3817 AC_MSG_CHECKING([which memory allocator to use])
3818 if test "$with_alloc" = "system"; then
3819     AC_MSG_RESULT([system])
3820     ALLOC="SYS_ALLOC";
3821     AC_CHECK_FUNCS([malloc realloc calloc free])
3823 if test "$with_alloc" = "tcmalloc"; then
3824     AC_MSG_RESULT(tcmalloc)
3825     if ! echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3826         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3827     fi
3828     AC_CHECK_LIB(tcmalloc, malloc, [],
3829         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3830     ALLOC="TCMALLOC";
3832 if test "$with_alloc" = "jemalloc"; then
3833     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3834         AC_MSG_RESULT(jemalloc)
3835         save_CFLAGS=$CFLAGS
3836         CFLAGS="$CFLAGS -pthread"
3837         AC_CHECK_LIB(jemalloc, malloc, [],
3838             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3839         ALLOC="JEMALLOC";
3840         CFLAGS=$save_CFLAGS
3841     else
3842         AC_MSG_RESULT([system])
3843         ALLOC="SYS_ALLOC";
3844         AC_CHECK_FUNCS([malloc realloc calloc free])
3845     fi
3847 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3848     AC_MSG_RESULT([internal])
3850 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
3851 AC_SUBST(HAVE_POSIX_FALLOCATE)
3852 AC_SUBST(ALLOC)
3854 dnl ===================================================================
3855 dnl Custom build version
3856 dnl ===================================================================
3858 AC_MSG_CHECKING([whether to add custom build version])
3859 if test "z$with_build_version" != "z"; then
3860     BUILD_VER_STRING=$with_build_version
3861     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3862 else
3863     BUILD_VER_STRING=
3864     AC_MSG_RESULT([no])
3866 AC_SUBST(BUILD_VER_STRING)
3868 dnl ===================================================================
3869 dnl Java support enable
3870 dnl ===================================================================
3871 AC_MSG_CHECKING([whether to build with Java support])
3872 if test "$with_java" != "no"; then
3873     AC_MSG_RESULT([yes])
3874     SOLAR_JAVA="TRUE"
3875 else
3876     AC_MSG_RESULT([no])
3877     SOLAR_JAVA=""
3880 AC_SUBST(SOLAR_JAVA)
3882 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
3883 dnl want there to be *run-time* (and build-time) support for Java extensions in the
3884 dnl built LibreOffice.
3886 dnl SOLAR_JAVA="BUILD" is claimed to indicate build-time only support
3887 dnl (no runtime support). It doesn't seem to ever be set to this
3888 dnl value, though, and everywhere SOLAR_JAVA is only checked for being
3889 dnl empty or non-empty.
3891 dnl SOLAR_JAVA="" indicate no java support at all
3893 if test "$_os" = "Linux" && test "$host_cpu" = "powerpc"; then
3894     # IBMs JDK needs this...
3895     JITC_PROCESSOR_TYPE=6
3896     export JITC_PROCESSOR_TYPE
3897     JITC_PROCESSOR_TYPE_EXPORT="export JITC_PROCESSOR_TYPE=$JITC_PROCESSOR_TYPE"
3899 AC_SUBST([JITC_PROCESSOR_TYPE_EXPORT])
3901 if test $_os = "WINNT"; then
3902     WITH_VC_REDIST="TRUE"
3904 AC_SUBST(WITH_VC_REDIST)
3906 dnl ===================================================================
3907 dnl Checks for Java
3908 dnl ===================================================================
3909 if test "$SOLAR_JAVA" != ""; then
3911     # Windows-specific tests
3912     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3913         if test "$CL_X64" != ""; then
3914             bitness="64-bit"
3915             otherbitness="32-bit"
3916         else
3917             bitness="32-bit"
3918             otherbitness="64-bit"
3919         fi
3921         if test -z "$with_jdk_home"; then
3923             # Unfortunately apparently no way to find, if needed, the 64-bit
3924             # JDK in the Registry from the 32-bit Perl oowintool
3926             _jdk_home=`./oowintool --jdk-home`
3927             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
3928                 with_jdk_home="$_jdk_home"
3929                 howfound="found by oowintool"
3930             else
3931                 AC_MSG_ERROR([No JDK found by oowintool, pass the --with-jdk-home option pointing to a $bitness JDK])
3932             fi
3933         else
3934             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
3935             howfound="you passed"
3936         fi
3937     fi
3939     JAVA_HOME=; export JAVA_HOME
3940     if test -z "$with_jdk_home"; then
3941         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
3942     else
3943         _java_path="$with_jdk_home/bin/$with_java"
3944         dnl Check if there is a Java interpreter at all.
3945         if test -x "$_java_path"; then
3946             JAVAINTERPRETER=$_java_path
3947         else
3948             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
3949         fi
3950     fi
3952     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3953         # Check that the JDK found is correct architecture
3954         # Why is this necessary, we don't link with any library from the JDK I think,
3956         shortjdkhome=`cygpath -d "$with_jdk_home"`
3957         if test "$CL_X64" != "" -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | grep -i 64-bit`" = "" >/dev/null; then
3958             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
3959             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
3960         elif test "$CL_X64" = "" -a -f "$_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | grep -i 64-bit`" != ""  >/dev/null; then
3961             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
3962             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
3963         fi
3965         if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
3966             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3967         fi
3968         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3969         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3970     elif test "$_os" = "Darwin"; then
3971         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
3972         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
3973         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
3974         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
3975         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
3976             AC_MSG_RESULT([yes])
3977             JAVAIFLAGS=-d32
3978         else
3979             AC_MSG_RESULT([no])
3980         fi
3981     fi
3984 dnl ===================================================================
3985 dnl Checks for JDK.
3986 dnl ===================================================================
3988 # Note that JAVA_HOME as for now always means the *build* platform's
3989 # JAVA_HOME. Whether all the complexity here actually is needed any
3990 # more or not, no idea.
3992 if test "$SOLAR_JAVA" != ""; then
3993     _gij_longver=0
3994     AC_MSG_CHECKING([the installed JDK])
3995     if test -n "$JAVAINTERPRETER"; then
3996         dnl java -version sends output to stderr!
3997         if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3998             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3999         elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
4000             JDK=gcj
4001             AC_MSG_RESULT([checked (gcj)])
4002             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
4003             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4005         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "BEA"` -gt 0; then
4006             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
4007         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "IBM"` -gt 0; then
4008             JDK=ibm
4010             dnl IBM JDK specific tests
4011             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
4012             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
4014             if test "$_jdk_ver" -lt 10500; then
4015                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
4016             fi
4018             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
4020             if test "$with_jdk_home" = ""; then
4021                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
4022 you must use the "--with-jdk-home" configure option explicitly])
4023             fi
4025            JAVA_HOME=$with_jdk_home
4027         else
4028             JDK=sun
4030             dnl Sun JDK specific tests
4031             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
4032             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
4034             if test "$_jdk_ver" -lt 10500; then
4035                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
4036             fi
4037             AC_MSG_RESULT([checked (JDK $_jdk)])
4038             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
4039             if test "$_os" = "WINNT"; then
4040                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
4041             fi
4042         fi
4043     else
4044         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
4045     fi
4046 else
4047     dnl Java disabled
4048     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
4051 _java_target_ver="1.5"
4052 dnl ===================================================================
4053 dnl Check for target Java bytecode version
4054 dnl ===================================================================
4055 if test "$SOLAR_JAVA" != ""; then
4056     AC_MSG_CHECKING([for target Java bytecode version])
4057     if test "$JDK" = "gcj" -o "$JDK" = "kaffe"; then
4058     AC_MSG_RESULT([default by $JDK])
4059     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
4060         AC_MSG_WARN([Value defined by --with-java-target-version is ignored!])
4061     fi
4062     else
4063     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
4064         _java_target_ver="$with_java_target_version"
4065         AC_MSG_RESULT([$_java_target_ver])
4066     elif test $_jdk_ver -gt 10000 ; then
4067         _java_target_ver=`echo "$_jdk_ver" | $AWK '{ maj=substr($0,1,1); min=substr($0,2,2); print int(maj)"."int(min) }'`
4068         AC_MSG_RESULT([$_java_target_ver])
4069     else
4070         AC_MSG_ERROR([Unable to guess Java bytecode version from Java version!])
4071     fi
4072     fi
4074     if ! test -z "$_java_target_ver" -o \
4075         "$_java_target_ver" = "1.1" -o \
4076             "$_java_target_ver" = "1.2" -o \
4077         "$_java_target_ver" = "1.3" -o \
4078         "$_java_target_ver" = "1.4" -o \
4079         "$_java_target_ver" = "1.5" -o \
4080         "$_java_target_ver" = "1.6" -o \
4081         "$_java_target_ver" = "5" ; then
4082         AC_MSG_ERROR([$_java_target_ver is not a supported Java bytecode version!])
4083     fi
4085     JAVA_SOURCE_VER="$_java_target_ver"
4086     JAVA_TARGET_VER="$_java_target_ver"
4089 dnl ===================================================================
4090 dnl Checks for javac
4091 dnl ===================================================================
4092 if test "$SOLAR_JAVA" != ""; then
4093     if test "$JDK" = "gcj"; then
4094         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
4095     else
4096         javacompiler="javac"
4097     fi
4098     if test -z "$with_jdk_home"; then
4099         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
4100     else
4101         _javac_path="$with_jdk_home/bin/$javacompiler"
4102         dnl Check if there is a Java compiler at all.
4103         if test -x "$_javac_path"; then
4104             JAVACOMPILER=$_javac_path
4105         fi
4106     fi
4107     if test -z "$JAVACOMPILER"; then
4108         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
4109     fi
4110     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4111         if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
4112             JAVACOMPILER="${JAVACOMPILER}.exe"
4113         fi
4114         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
4115         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
4116     fi
4118     if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
4119         AC_MSG_CHECKING([re-checking JDK])
4120         JDK=gcj
4121         AC_MSG_RESULT([checked (ecj)])
4122         #TODO: what's to do here? some switch to do 1.5 compiling?
4123         JAVAFLAGS="-source 1.5 -target 1.5"
4124         _gij_longver="40200"
4125     fi
4128 JAVACISGCJ=""
4129 dnl ===================================================================
4130 dnl Checks that javac is gcj
4131 dnl ===================================================================
4132 if test "$SOLAR_JAVA" != ""; then
4133     if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
4134         JAVACISGCJ="yes"
4135     fi
4137 AC_SUBST(JAVACISGCJ)
4139 JAVACISKAFFE=""
4140 dnl ===================================================================
4141 dnl Checks that javac is kaffe
4142 dnl ===================================================================
4143 if test "$SOLAR_JAVA" != ""; then
4144     if test `$JAVACOMPILER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
4145         JAVACISKAFFE="yes"
4146     fi
4148 AC_SUBST(JAVACISKAFFE)
4150 dnl ===================================================================
4151 dnl Checks for javadoc
4152 dnl ===================================================================
4153 if test "$SOLAR_JAVA" != ""; then
4154     if test -z "$with_jdk_home"; then
4155         AC_PATH_PROG(JAVADOC, javadoc)
4156     else
4157         _javadoc_path="$with_jdk_home/bin/javadoc"
4158         dnl Check if there is a javadoc at all.
4159         if test -x "$_javadoc_path"; then
4160             JAVADOC=$_javadoc_path
4161         else
4162             AC_PATH_PROG(JAVADOC, javadoc)
4163         fi
4164     fi
4165     if test -z "$JAVADOC"; then
4166         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
4167     fi
4168     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4169         if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
4170             JAVADOC="${JAVADOC}.exe"
4171         fi
4172         JAVADOC=`cygpath -d "$JAVADOC"`
4173         JAVADOC=`cygpath -u "$JAVADOC"`
4174     fi
4177 if test "$SOLAR_JAVA" != ""; then
4178     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
4179     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
4180         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
4181            # try to recover first by looking whether we have a alternatives
4182            # system as in Debian or newer SuSEs where following /usr/bin/javac
4183            # over /etc/alternatives/javac leads to the right bindir where we
4184            # just need to strip a bit away to get a valid JAVA_HOME
4185            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
4186         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
4187             # maybe only one level of symlink (e.g. on Mac)
4188             JAVA_HOME=$(readlink $JAVACOMPILER)
4189             if test "$(dirname $JAVA_HOME)" = "."; then
4190                 # we've got no path to trim back
4191                 JAVA_HOME=""
4192             fi
4193         else
4194             # else warn
4195             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
4196             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
4197             echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
4198             echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
4199         fi
4200         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
4201         if test "$JAVA_HOME" != "/usr"; then
4202             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
4203                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
4204                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
4205                 dnl Tiger already returns a JDK path..
4206                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
4207             else
4208                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
4209             fi
4210         fi
4211     fi
4212     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
4214     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
4215     if test -z "$JAVA_HOME"; then
4216         if test "x$with_jdk_home" = "x"; then
4217             cat > findhome.java <<_ACEOF
4218 [import java.io.File;
4220 class findhome
4222     public static void main(String args[])
4223     {
4224         String jrelocation = System.getProperty("java.home");
4225         File jre = new File(jrelocation);
4226         System.out.println(jre.getParent());
4227     }
4229 _ACEOF
4230             AC_MSG_CHECKING([if javac works])
4231             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
4232             AC_TRY_EVAL(javac_cmd)
4233             if test $? = 0 && test -f ./findhome.class ; then
4234                 AC_MSG_RESULT([javac works])
4235             else
4236                 echo "configure: javac test failed" >&5
4237                 cat findhome.java >&5
4238                 AC_MSG_ERROR([javac does not work - java projects will not build!])
4239             fi
4240             AC_MSG_CHECKING([if gij knows its java.home])
4241             JAVA_HOME=`$JAVAINTERPRETER findhome`
4242             if test $? = 0 && test "$JAVA_HOME" != "" ; then
4243                 AC_MSG_RESULT([$JAVA_HOME])
4244             else
4245                 echo "configure: java test failed" >&5
4246                 cat findhome.java >&5
4247                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
4248             fi
4249             # clean-up after ourselves
4250             rm -f ./findhome.java ./findhome.class
4251         else
4252             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
4253         fi
4254     fi
4256     dnl second sanity check JAVA_HOME if possible
4257     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
4258         # now check if $JAVA_HOME is really valid
4259         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
4260             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
4261                 JAVA_HOME_OK="NO"
4262             fi
4263         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
4264             JAVA_HOME_OK="NO"
4265         fi
4266         if test "$JAVA_HOME_OK" = "NO"; then
4267             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
4268             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
4269             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
4270             echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
4271             echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
4272             echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
4273         fi
4274     fi
4277 AWTLIB=
4279 if test "$SOLAR_JAVA" != ""; then
4280     AC_MSG_CHECKING([for jawt lib name])
4281     if test "$JDK" = "gcj"; then
4282         save_CFLAGS=$CFLAGS
4283         save_LDFLAGS=$LDFLAGS
4284         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4285         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
4286         exec 6>/dev/null # no output
4287         AC_CHECK_HEADER(jni.h, [],
4288                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
4289         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
4290         exec 6>&1 # output on again
4291         CFLAGS=$save_CFLAGS
4292         LDFLAGS=$save_LDFLAGS
4293     fi
4294     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
4295     # A workaround is to link also against libpmawt.so
4296     if test "$JDK" = "ibm" ; then
4297         save_CFLAGS=$CFLAGS
4298         save_LDFLAGS=$LDFLAGS
4299         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
4300         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4301         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
4302         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
4303         export LD_LIBRARY_PATH
4304         exec 6>/dev/null # no output
4305         AC_CHECK_HEADER(jni.h, [],
4306                     [AC_MSG_ERROR([jni.h could not be found.])], [])
4307         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
4308         if test -z "$AWTLIB"; then
4309             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
4310             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
4311         fi
4312         exec 6>&1 # output on again
4313         CFLAGS=$save_CFLAGS
4314         LDFLAGS=$save_LDFLAGS
4315         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
4316     fi
4317     if test -z "$AWTLIB"; then
4318         AWTLIB=-ljawt
4319     fi
4320     AC_MSG_RESULT([$AWTLIB])
4321     AC_SUBST(AWTLIB)
4324 AC_SUBST(JAVA_HOME)
4325 AC_SUBST(JDK)
4326 AC_SUBST(JAVAFLAGS)
4327 AC_SUBST(JAVA_SOURCE_VER)
4328 AC_SUBST(JAVA_TARGET_VER)
4329 AC_SUBST(JAVAINTERPRETER)
4330 AC_SUBST(JAVAIFLAGS)
4331 AC_SUBST(JAVACOMPILER)
4332 AC_SUBST(JAVADOC)
4334 dnl ===================================================================
4335 dnl Checks for specific files.
4336 dnl ===================================================================
4338 dnl ===================================================================
4339 dnl Checks for programs.
4340 dnl ===================================================================
4342 dnl ===================================================================
4343 dnl Check whether we already have dmake
4344 dnl ===================================================================
4345 AC_PATH_PROG(DMAKE, dmake, no)
4346 if test "$DMAKE" = "no"; then
4347     BUILD_DMAKE=YES
4348     echo "dmake will be built on ./bootstrap"
4349 else
4350     AC_MSG_CHECKING([whether the found dmake is the right dmake])
4351     # we need to find out whether that dmake we found is "our" dmake
4352     # or the dmake from Sun's SunStudio Compiler which is something
4353     # different
4354     # This test _should_ work because the one accepts -V (ours) and one
4355     # (the other) not...
4356     $DMAKE -V 2>/dev/null | grep 'dmake .* Version .*' >/dev/null
4357     if test $? -eq 0; then
4358         BUILD_DMAKE=NO
4359         AC_MSG_RESULT([yes])
4360         AC_MSG_CHECKING([the dmake version])
4361         DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
4362         if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
4363             AC_MSG_RESULT([OK, >= 4.11])
4364         elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
4365             test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
4366             AC_MSG_RESULT([OK, >= 4.11])
4367         else
4368             AC_MSG_RESULT([too old. >= 4.11 is needed])
4369             echo "A newer dmake will be built on ./bootstrap"
4370             BUILD_DMAKE=YES
4371         fi
4372     else
4373         AC_MSG_RESULT([no])
4374         echo "dmake will be built on ./bootstrap"
4375         BUILD_DMAKE=YES
4376     fi
4378 AC_SUBST(BUILD_DMAKE)
4380 AC_MSG_CHECKING([whether to enable EPM for packing])
4381 BUILD_EPM=NO
4382 if test "$enable_epm" = "yes"; then
4383     AC_MSG_RESULT([yes])
4384     dnl ===================================================================
4385     dnl Check for epm - not needed for Windows
4386     dnl ===================================================================
4387     if test "$_os" != "WINNT"; then
4388         if test -n "$with_epm"; then
4389             EPM=$with_epm
4390         else
4391             AC_PATH_PROG(EPM, epm, no)
4392         fi
4393         if test "$EPM" = "no" || test "$EPM" = "internal"; then
4394             echo "EPM will be built."
4395             BUILD_EPM=YES
4396             BUILD_TYPE="$BUILD_TYPE EPM"
4397         else
4398             # Gentoo has some epm which is something different...
4399             AC_MSG_CHECKING([whether the found epm is the right epm])
4400             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
4401                 AC_MSG_RESULT([yes])
4402             else
4403                 AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
4404             fi
4405             AC_MSG_CHECKING([epm version])
4406             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
4407             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
4408                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
4409                 AC_MSG_RESULT([OK, >= 3.7])
4410                 BUILD_EPM=NO
4411                 if test "$_os" = "Darwin"; then
4412                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
4413                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
4414                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4415                         AC_MSG_ERROR([$_pm; PackageMaker expected in wrong path. Either patch your epm with the right path (/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker) or use internal patched epm (--with-epm=internal)])
4416                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4417                         AC_MSG_RESULT([$_pm, ok])
4418                     else # we never should get here, but go safe
4419                         AC_MSG_ERROR([$_pm; PackageMaker expected in unknown path. Either patch your epm with the right path (/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker) or use internal patched epm (--with-epm=internal)])
4420                     fi
4421                 fi
4422             else
4423                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
4424                 echo "EPM will be built."
4425                 BUILD_EPM=YES
4426                 BUILD_TYPE="$BUILD_TYPE EPM"
4427             fi
4428         fi
4429     fi
4431     # test which package format to use
4432     AC_MSG_CHECKING([which package format to use])
4434     # defaults
4435     case "$_os" in
4436     Darwin)
4437         PKGFORMAT=dmg
4438         ;;
4439     SunOS)
4440         PKGFORMAT=pkg
4441         ;;
4442     Linux)
4443         # if building on Debian, default should be deb...
4444         if test -e /etc/debian_version; then
4445             PKGFORMAT=deb
4446         else
4447             PKGFORMAT=rpm
4448         fi
4449         ;;
4450     AIX)
4451         PKGFORMAT=rpm
4452         ;;
4453     OpenBSD|DragonFly)
4454         PKGFORMAT=portable
4455         ;;
4456     *BSD)
4457         PKGFORMAT=bsd
4458         ;;
4459     WINNT)
4460         PKGFORMAT=msi
4461         ;;
4462     # we never should get here since we check the arciecture/os at the beginning,
4463     # but go sure...
4464     *)
4465         AC_MSG_ERROR([unknown system])
4466     esac
4467     if test -n "$with_package_format"; then
4468         for i in $with_package_format; do
4469             case "$i" in
4470             aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4471                 ;;
4472             *)
4473                 AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4474 aix - AIX software distribution
4475 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4476 deb - Debian software distribution
4477 inst or tardist - IRIX software distribution
4478 osx - MacOS X software distribution
4479 pkg - Solaris software distribution
4480 rpm - RedHat software distribution
4481 setld - Tru64 (setld) software distribution
4482 native - "Native" software distribution for the platform
4483 portable - Portable software distribution
4484 LibreOffice additionally supports:
4485 archive - .tar.gz or .zip
4486 dmg - Mac OS X .dmg
4487 installed - installation tree
4488 msi - Windows .msi
4489             ])
4490                 ;;
4491             esac
4492         done
4493         PKGFORMAT="$with_package_format"
4494     fi
4495     AC_MSG_RESULT([$PKGFORMAT])
4496     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
4497         AC_MSG_CHECKING([for rpm])
4498         for a in "$RPM" rpmbuild rpm; do
4499             $a --usage >/dev/null 2> /dev/null
4500             if test $? -eq 0; then
4501                 RPM=$a
4502                 break
4503             else
4504                 $a --version >/dev/null 2> /dev/null
4505                 if test $? -eq 0; then
4506                     RPM=$a
4507                     break
4508                 fi
4509             fi
4510         done
4511         if test -z "$RPM" ; then
4512             AC_MSG_ERROR([not found])
4513         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
4514             RPM_PATH=`which $RPM`
4515             AC_MSG_RESULT([$RPM_PATH])
4516         else
4517             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
4518         fi
4519     fi
4520     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
4521         AC_PATH_PROG(DPKG, dpkg, no)
4522         if test "$DPKG" = "no"; then
4523             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
4524         fi
4525     fi
4526     if echo "PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
4527         if test "$_os" = "Darwin"; then
4528             AC_MSG_CHECKING([for PackageMaker availability])
4529             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
4530                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
4531             else
4532                 AC_MSG_RESULT([ok])
4533             fi
4534         else
4535             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
4536         fi
4537     fi
4538     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
4539        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4540         if test "$EPM" != "no" && test "$EPM" != "internal"; then
4541             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
4542                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
4543                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
4544                     AC_MSG_RESULT([yes])
4545                 else
4546                     AC_MSG_RESULT([no])
4547                     if echo "$PKGFORMAT" | grep -q rpm; then
4548                         _pt="rpm"
4549                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
4550                         echo "the rpms will need to be installed with --nodeps" >> warn
4551                     else
4552                         _pt="pkg"
4553                     fi
4554                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
4555                     echo "the ${_pt}s will not be relocateable" >> warn
4556                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
4557                                  relocation will work, you need to patch your epm with the
4558                                  patch in epm/epm-3.7.patch or build with
4559                                  --with-epm=internal which will build a suitable epm])
4560                 fi
4561             fi
4562         fi
4563     fi
4564     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4565         AC_PATH_PROG(PKGMK, pkgmk, no)
4566         if test "$PKGMK" = "no"; then
4567             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
4568         fi
4569     fi
4570     AC_SUBST(RPM)
4571     AC_SUBST(DPKG)
4572     AC_SUBST(PKGMK)
4573 else
4574     AC_MSG_RESULT([no])
4575     EPM=NO
4576     PKGFORMAT=native
4578 AC_SUBST(EPM)
4579 AC_SUBST(BUILD_EPM)
4580 AC_SUBST(PKGFORMAT)
4582 dnl ===================================================================
4583 dnl Check for gperf
4584 dnl ===================================================================
4585 AC_PATH_PROG(GPERF, gperf)
4586 if test -z "$GPERF"; then
4587     AC_MSG_ERROR([gperf not found but needed. Install it.])
4589 AC_MSG_CHECKING([gperf version])
4590 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
4591     AC_MSG_RESULT([OK])
4592 else
4593     AC_MSG_ERROR([too old, you need at least 3.0.0])
4595 AC_SUBST(GPERF)
4597 dnl ===================================================================
4598 dnl Check for building ODK
4599 dnl ===================================================================
4600 AC_MSG_CHECKING([whether to build the ODK])
4601 if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
4602     AC_MSG_RESULT([yes])
4604     if test "$with_java" != "no"; then
4605         AC_MSG_CHECKING([whether to build unowinreg.dll])
4606         if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
4607             # build on Win by default
4608             enable_build_unowinreg=yes
4609         fi
4610         if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
4611             AC_MSG_RESULT([no])
4612             BUILD_UNOWINREG=NO
4613         else
4614             AC_MSG_RESULT([yes])
4615             BUILD_UNOWINREG=YES
4616         fi
4617         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
4618             if test -z "$with_mingw_cross_compiler"; then
4619                 dnl Guess...
4620                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
4621             elif test -x "$with_mingw_cross_compiler"; then
4622                  MINGWCXX="$with_mingw_cross_compiler"
4623             else
4624                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
4625             fi
4627             if test "$MINGWCXX" = "false"; then
4628                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
4629             fi
4631             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
4632             if test -x "$mingwstrip_test"; then
4633                 MINGWSTRIP="$mingwstrip_test"
4634             else
4635                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
4636             fi
4638             if test "$MINGWSTRIP" = "false"; then
4639                 AC_MSG_ERROR(MinGW32 binutils not found.)
4640             fi
4641         fi
4642     fi
4643     BUILD_TYPE="$BUILD_TYPE ODK"
4644 else
4645     AC_MSG_RESULT([no])
4646     BUILD_UNOWINREG=NO
4648 AC_SUBST(BUILD_UNOWINREG)
4649 AC_SUBST(MINGWCXX)
4650 AC_SUBST(MINGWSTRIP)
4652 dnl ===================================================================
4653 dnl Check for system stdlibs
4654 dnl ===================================================================
4655 AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
4656 if test "$with_system_stdlibs" != "no"; then
4657     AC_MSG_RESULT([no])
4658     SYSTEM_STDLIBS=YES
4659 else
4660     AC_MSG_RESULT([yes])
4661     SYSTEM_STDLIBS=NO
4663 AC_SUBST(SYSTEM_STDLIBS)
4665 dnl ===================================================================
4666 dnl Check for system zlib
4667 dnl ===================================================================
4668 AC_MSG_CHECKING([which zlib to use])
4669 if test "$with_system_zlib" = "yes"; then
4670     AC_MSG_RESULT([external])
4671     SYSTEM_ZLIB=YES
4672     AC_CHECK_HEADER(zlib.h, [],
4673         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
4674     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
4675         [AC_MSG_ERROR(zlib not found or functional)], [])
4676 else
4677     AC_MSG_RESULT([internal])
4678     SYSTEM_ZLIB=NO
4679     BUILD_TYPE="$BUILD_TYPE ZLIB"
4681 AC_SUBST(SYSTEM_ZLIB)
4683 dnl ===================================================================
4684 dnl Check for system jpeg
4685 dnl ===================================================================
4686 AC_MSG_CHECKING([which jpeg to use])
4687 if test "$with_system_jpeg" = "yes"; then
4688     AC_MSG_RESULT([external])
4689     SYSTEM_JPEG=YES
4690     AC_CHECK_HEADER(jpeglib.h, [],
4691         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
4692     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
4693     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
4694 else
4695     AC_MSG_RESULT([internal])
4696     SYSTEM_JPEG=NO
4697     BUILD_TYPE="$BUILD_TYPE JPEG"
4699 AC_SUBST(SYSTEM_JPEG)
4701 dnl ===================================================================
4702 dnl Check for system expat
4703 dnl ===================================================================
4704 AC_MSG_CHECKING([which expat to use])
4705 if test "$with_system_expat" = "yes"; then
4706     AC_MSG_RESULT([external])
4707     SYSTEM_EXPAT=YES
4708     AC_CHECK_HEADER(expat.h, [],
4709         [AC_MSG_ERROR(expat.h not found. install expat)], [])
4710     AC_CHECK_LIB(expat, XML_ParserCreate, [],
4711     [AC_MSG_RESULT(expat library not found or functional.)], [])
4712     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libexpat-1.dll"
4713 else
4714     AC_MSG_RESULT([internal])
4715     SYSTEM_EXPAT=NO
4716     BUILD_TYPE="$BUILD_TYPE EXPAT"
4718 AC_SUBST(SYSTEM_EXPAT)
4720 dnl ===================================================================
4721 dnl Check for system libvisio
4722 dnl ===================================================================
4723 AC_MSG_CHECKING([which libvisio to use])
4724 if test "$with_system_libvisio" = "yes"; then
4725     AC_MSG_RESULT([external])
4726     SYSTEM_LIBVISIO=YES
4727     PKG_CHECK_MODULES( VISIO, libvisio-0.0 )
4728 else
4729     AC_MSG_RESULT([internal])
4730     SYSTEM_LIBVISIO=NO
4731     BUILD_TYPE="$BUILD_TYPE LIBVISIO"
4733 AC_SUBST(SYSTEM_LIBVISIO)
4734 AC_SUBST(VISIO_CFLAGS)
4735 AC_SUBST(VISIO_LIBS)
4737 dnl ===================================================================
4738 dnl Check for system libcmis
4739 dnl ===================================================================
4740 AC_MSG_CHECKING([which libcmis to use])
4741 if test "$with_system_libcmis" = "yes"; then
4742     AC_MSG_RESULT([external])
4743     SYSTEM_LIBCMIS=YES
4744     PKG_CHECK_MODULES( LIBCMIS, libcmis-0.2 )
4745 else
4746     AC_MSG_RESULT([internal])
4747     SYSTEM_LIBCMIS=NO
4748     BUILD_TYPE="$BUILD_TYPE LIBCMIS"
4750 AC_SUBST(SYSTEM_LIBCMIS)
4751 AC_SUBST(LIBCMIS_CFLAGS)
4752 AC_SUBST(LIBCMIS_LIBS)
4755 dnl ===================================================================
4756 dnl Check for system libwpd
4757 dnl ===================================================================
4758 AC_MSG_CHECKING([which libwpd to use])
4759 if test "$with_system_libwpd" = "yes"; then
4760     AC_MSG_RESULT([external])
4761     SYSTEM_LIBWPD=YES
4762     PKG_CHECK_MODULES( WPD, libwpd-0.9 libwpd-stream-0.9 )
4763 else
4764     AC_MSG_RESULT([internal])
4765     SYSTEM_LIBWPD=NO
4766     BUILD_TYPE="$BUILD_TYPE LIBWPD"
4768 AC_SUBST(SYSTEM_LIBWPD)
4769 AC_SUBST(WPD_CFLAGS)
4770 AC_SUBST(WPD_LIBS)
4772 dnl ===================================================================
4773 dnl Check for system cppunit
4774 dnl ===================================================================
4775 AC_MSG_CHECKING([which cppunit to use])
4776 if test "$with_system_cppunit" = "yes"; then
4777     AC_MSG_RESULT([external])
4778     SYSTEM_CPPUNIT=YES
4779     # might work for earlier, too but go sure:
4780     PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
4781 else
4782     AC_MSG_RESULT([internal])
4783     SYSTEM_CPPUNIT=NO
4784     BUILD_TYPE="$BUILD_TYPE CPPUNIT"
4786 AC_SUBST(SYSTEM_CPPUNIT)
4787 AC_SUBST(CPPUNIT_CFLAGS)
4788 AC_SUBST(CPPUNIT_LIBS)
4790 dnl ===================================================================
4791 dnl Check whether freetype is available
4792 dnl ===================================================================
4793 if test  "$test_freetype" = "yes"; then
4794     AC_MSG_CHECKING([whether freetype is available])
4795     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
4797 AC_SUBST(FREETYPE_CFLAGS)
4798 AC_SUBST(FREETYPE_LIBS)
4800 dnl ===================================================================
4801 dnl Check for system libwps
4802 dnl ===================================================================
4803 AC_MSG_CHECKING([which libwps to use])
4804 if test "$with_system_libwps" = "yes"; then
4805     AC_MSG_RESULT([external])
4806     SYSTEM_LIBWPS=YES
4807     PKG_CHECK_MODULES( WPS, libwps-0.2 )
4808 else
4809     AC_MSG_RESULT([internal])
4810     SYSTEM_LIBWPS=NO
4811     BUILD_TYPE="$BUILD_TYPE LIBWPS"
4813 AC_SUBST(SYSTEM_LIBWPS)
4814 AC_SUBST(WPS_CFLAGS)
4815 AC_SUBST(WPS_LIBS)
4817 dnl ===================================================================
4818 dnl Check for system libwpg
4819 dnl ===================================================================
4820 AC_MSG_CHECKING([which libwpg to use])
4821 if test "$with_system_libwpg" = "yes"; then
4822     AC_MSG_RESULT([external])
4823     SYSTEM_LIBWPG=YES
4824     PKG_CHECK_MODULES( WPG, libwpg-0.2 )
4825 else
4826     AC_MSG_RESULT([internal])
4827     SYSTEM_LIBWPG=NO
4828     BUILD_TYPE="$BUILD_TYPE LIBWPG"
4830 AC_SUBST(SYSTEM_LIBWPG)
4831 AC_SUBST(WPG_CFLAGS)
4832 AC_SUBST(WPG_LIBS)
4834 dnl ===================================================================
4835 dnl Check whether freetype2 supports emboldening
4836 dnl ===================================================================
4837 if test  "$test_freetype" = "yes"; then
4838     save_CPPFLAGS="$CPPFLAGS"
4839     save_LDFLAGS="$LDFLAGS"
4840     save_LIBS="$LIBS"
4841     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
4842     LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
4843     AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
4844                  [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4845     LDFLAGS="$save_LDFLAGS"
4846     CPPFLAGS="$save_CPPFLAGS"
4847     LIBS="$save_LIBS"
4849 AC_SUBST(USE_FT_EMBOLDEN)
4851 # ===================================================================
4852 # Check for system libxslt
4853 # to prevent incompatibilities between internal libxml2 and external libxslt,
4854 # or vice versa, use with_system_libxml here
4855 # ===================================================================
4856 AC_MSG_CHECKING([which libxslt to use])
4857 if test "$with_system_libxml" = "yes"; then
4858     AC_MSG_RESULT([external])
4859     SYSTEM_LIBXSLT=YES
4860     if test "$_os" = "Darwin"; then
4861         dnl make sure to use SDK path
4862         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4863         dnl omit -L/usr/lib
4864         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
4865     else
4866         PKG_CHECK_MODULES(LIBXSLT, libxslt)
4867     fi
4869     dnl Check for xsltproc
4870     AC_PATH_PROG(XSLTPROC, xsltproc, no)
4871     if test "$XSLTPROC" = "no"; then
4872         AC_MSG_ERROR([xsltproc is required])
4873     fi
4875     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libxslt-1.dll"
4876 else
4877     AC_MSG_RESULT([internal])
4878     SYSTEM_LIBXSLT=NO
4879     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4881     if test "$cross_compiling" = "yes"; then
4882         AC_PATH_PROG(XSLTPROC, xsltproc, no)
4883         if test "$XSLTPROC" = "no"; then
4884             AC_MSG_ERROR([xsltproc is required])
4885         fi
4886     fi
4888 AC_SUBST(SYSTEM_LIBXSLT)
4889 AC_SUBST(LIBXSLT_CFLAGS)
4890 AC_SUBST(LIBXSLT_LIBS)
4891 AC_SUBST(XSLTPROC)
4893 # ===================================================================
4894 # Check for system libxml
4895 # ===================================================================
4896 AC_MSG_CHECKING([which libxml to use])
4897 if test "$with_system_libxml" = "yes"; then
4898     AC_MSG_RESULT([external])
4899     SYSTEM_LIBXML=YES
4900     if test "$_os" = "Darwin"; then
4901         dnl make sure to use SDK path
4902         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4903         dnl omit -L/usr/lib
4904         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
4905     elif test $_os = iOS; then
4906         dnl make sure to use SDK path
4907         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
4908         LIBXML_CFLAGS="-I$usr/include/libxml2"
4909         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
4910     else
4911         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4912     fi
4913     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS zlib1.dll libxml2-2.dll"
4914 else
4915     AC_MSG_RESULT([internal])
4916     SYSTEM_LIBXML=NO
4917     BUILD_TYPE="$BUILD_TYPE LIBXML2"
4919 AC_SUBST(SYSTEM_LIBXML)
4920 AC_SUBST(LIBXML_CFLAGS)
4921 AC_SUBST(LIBXML_LIBS)
4923 dnl ===================================================================
4924 dnl Checks for Python
4925 dnl ===================================================================
4927 AC_MSG_CHECKING([which Python to use])
4929 case "$enable_python" in
4930 no|disable)
4931     enable_python=no
4932     AC_MSG_RESULT([none])
4933     DISABLE_PYTHON=TRUE
4934     ;;
4935 ""|yes|auto)
4936     if test $build_os = cygwin; then
4937         dnl When building on Windows we don't attempt to use any installed
4938         dnl "system"  Python.
4939         dnl
4940         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
4941         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
4942         dnl MinGW cross-compilation setups.)
4943         AC_MSG_RESULT([internal])
4944         enable_python=internal
4945     elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4946         AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4947         enable_python=internal
4948     else
4949         AC_MSG_RESULT([checking below])
4950         enable_python=auto
4951     fi
4952     ;;
4953 internal)
4954     AC_MSG_RESULT([internal])
4955     ;;
4956 system)
4957     if test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4958         AC_MSG_ERROR([Cannot use "system" Python, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4959     fi
4960     AC_MSG_RESULT([system])
4961     ;;
4963     AC_MSG_ERROR([Incorrect --enable-python option])
4964     ;;
4965 esac
4967 AC_SUBST(DISABLE_PYTHON)
4969 if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then
4970     AC_MSG_ERROR([Must use internal Python when building with MSVC])
4973 if test $enable_python != no; then
4974     BUILD_TYPE="$BUILD_TYPE PYUNO"
4977 if test "$cross_compiling" = yes; then
4978     if test $enable_python = auto; then
4979         enable_python=system
4980     fi
4981 else
4982     if test $enable_python = system; then
4983         # This causes an error if no python command is found
4984         # Note that this takes the system python called just "python",
4985         # which isn't actually what we want on MacOSX when building
4986         # against the 10.6 SDK. But that shouldn't matter, we
4987         # select the correct python command manually below anyway.
4988         AM_PATH_PYTHON([2.6])
4989     elif test $enable_python = auto; then
4990         dnl This allows lack of system Python
4991         AM_PATH_PYTHON([2.6],, [:])
4993         if test "$PYTHON" = :; then
4994             enable_python=internal
4995         else
4996             enable_python=system
4997         fi
4998     fi
5001 if test $enable_python = system; then
5002     if test $_os = Darwin; then
5003         # We already have logic above to make sure the system Python
5004         # is used only when building against SDK 10.6 or newer.
5006         # Make sure we use the 2.6 Python when building against the
5007         # 10.6 SDK.
5008         case $with_macosx_sdk in
5009         10.6)
5010             python_version=2.6;;
5011         10.7)
5012             python_version=2.7;;
5013         *)
5014             # ???
5015             python_version=2.7;;
5016         esac
5017         PYTHON=python$python_version
5019         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
5020         PYTHON_LIBS="-framework Python"
5021     fi
5022     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
5023         # Fallback: Accept these in the environment, or as set above
5024         # for MacOSX.
5025         :
5026     elif test "$cross_compiling" != yes; then
5027         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
5028         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
5029         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
5030         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
5031         if $PKG_CONFIG --exists python-$python_version; then
5032             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
5033             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version`"
5034         else
5035             PYTHON_CFLAGS="-I$python_include"
5036             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
5037         fi
5038     elif test "$cross_compiling" = yes; then
5039         dnl How to find out the cross-compilation Python installation path?
5040         dnl Let's hardocode what we know for different distributions for now...
5042         for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw ; do
5043             for python_version in 2.6 ; do
5044                 if test -f ${python_sysroot}/include/python${python_version}/Python.h; then
5045                     PYTHON_CFLAGS="-I ${python_sysroot}/include/python$python_version"
5046                     PYTHON_LIBS="-L ${python_sysroot}lib -lpython$python_version $python_libs"
5047                     break
5048                 fi
5049             done
5050             test -n "$PYTHON_CFLAGS" && break
5051         done
5052     fi
5055 dnl By now enable_python should be "system", "internal" or "no"
5056 case $enable_python in
5057 system)
5058     SYSTEM_PYTHON=YES
5060     dnl Check if the headers really work
5061     save_CPPFLAGS="$CPPFLAGS"
5062     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
5063     AC_CHECK_HEADER(Python.h, [],
5064        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
5065        [])
5066     CPPFLAGS="$save_CPPFLAGS"
5068     dnl FIXME Check if the Python library can be linked with, too?
5069     ;;
5071 internal)
5072     SYSTEM_PYTHON=NO
5073     BUILD_TYPE="$BUILD_TYPE PYTHON"
5074     # Embedded Python dies without Home set
5075     if test "z$HOME" = "z"; then
5076         export HOME="";
5077     fi
5078     # bz2 tarball and bzip2 is not standard
5079     if test -z "$BZIP2"; then
5080         AC_PATH_PROG( BZIP2, bzip2)
5081         if test -z "$BZIP2"; then
5082             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
5083         fi
5084     fi
5085     ;;
5087     SYSTEM_PYTHON=NO
5088     ;;
5090     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
5091     ;;
5092 esac
5094 AC_SUBST(SYSTEM_PYTHON)
5095 AC_SUBST(PYTHON_CFLAGS)
5096 AC_SUBST(PYTHON_LIBS)
5098 dnl ===================================================================
5099 dnl Check for system Berkeley db
5100 dnl ===================================================================
5101 AC_MSG_CHECKING([which db to use])
5102 if test "$with_system_db" = "yes"; then
5103     SYSTEM_DB=YES
5104     AC_MSG_RESULT([external])
5106     db_header=
5107     for dbver in 5.1 5.0 5 4.8 4.7 4; do
5108         for dash in - ''; do
5109             AC_CHECK_HEADER([db$dash$dbver/db.h],
5110                 [ db_header="db$dash$dbver/db.h"; break 2 ])
5111         done
5112     done
5114     if test -z "$db_header"; then
5115         AC_CHECK_HEADER([db/db.h], [db_header='db/db.h'; dbver=''])
5116     fi
5118     if test -z "$db_header"; then
5119        AC_CHECK_HEADER(db.h, [ db_header='db.h'; dbver='' ])
5120     fi
5122     if test -z "$db_header"; then
5123         AC_MSG_ERROR([db.h not found. Use the correct -I flag, or install the Berkeley db development package.])
5124     fi
5126     AC_MSG_CHECKING([whether db is at least 4.1])
5127     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$db_header>]], [[int array[(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1))-1];]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no. you need at least db 4.1])])
5129     SYSTEM_DB_CFLAGS="-DSYSTEM_DB_HEADER='<$db_header>'"
5131     DB_LIB=
5132     dnl At least on OpenBSD dbver is not appended to the library
5133     if test "$_os" = "OpenBSD"; then
5134         dbver=''
5135     fi
5136     for dash in - ''; do
5137         AC_CHECK_LIB(db$dash$dbver, dbopen,
5138             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5139         AC_CHECK_LIB(db$dash$dbver, __db185_open,
5140             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5141     done
5143     if test -z "$DB_LIB" ; then
5144         AC_MSG_ERROR([db library not found. Use the correct -L flag,
5145 or install the Berkeley db development package.])
5146     fi
5148     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
5149     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libdb-4.8.dll"
5150 else
5151     AC_MSG_RESULT([internal])
5152     SYSTEM_DB=NO
5153     BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
5155 AC_SUBST(SYSTEM_DB)
5156 AC_SUBST(SYSTEM_DB_CFLAGS)
5157 AC_SUBST(DB_LIB)
5158 AC_SUBST(DB_CPPLIB)
5160 dnl ===================================================================
5161 dnl Check for system lucene
5162 dnl ===================================================================
5163 if test "$with_java" != "no"; then
5164 AC_MSG_CHECKING([which lucene to use])
5165 if test "$with_system_lucene" = "yes"; then
5166     AC_MSG_RESULT([external])
5167     SYSTEM_LUCENE=YES
5168     if test -z $LUCENE_CORE_JAR; then
5169          AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
5170             [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
5171             [
5172               AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
5173                 [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
5174                 [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
5175                    [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
5176                    [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
5177                   )
5178                 ]
5179               )
5180             ]
5181          )
5182     else
5183         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5184                [AC_MSG_ERROR(lucene-core.jar not found.)], [])
5185     fi
5187     if test -z $LUCENE_ANALYZERS_JAR; then
5188         AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
5189             [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
5190             [
5191               AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
5192                 [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
5193                 [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
5194               )
5195             ]
5196         )
5197     else
5198         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5199                [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
5200     fi
5201     AC_MSG_CHECKING([whether lucene is version 2.x])
5202     export LUCENE_CORE_JAR
5203     if $PERL -e 'use Archive::Zip;
5204             my $file = "$ENV{'LUCENE_CORE_JAR'}";
5205             my $zip = Archive::Zip->new( $file );
5206             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5207             if ( $mf =~ m/Specification-Version: 2.*/ ) {
5208                 exit 0;
5209             } else {
5210                 exit 1;
5211             }'; then
5212         AC_MSG_RESULT([yes])
5213     else
5214         AC_MSG_ERROR([no, you need lucene 2])
5215     fi
5217 else
5218     AC_MSG_RESULT([internal])
5219     SYSTEM_LUCENE=NO
5220     BUILD_TYPE="$BUILD_TYPE LUCENE"
5223 AC_SUBST(SYSTEM_LUCENE)
5224 AC_SUBST(LUCENE_CORE_JAR)
5225 AC_SUBST(LUCENE_ANALYZERS_JAR)
5227 AC_MSG_CHECKING([whether to build the MySQL Connector extension])
5228 if test "x$enable_ext_mysql_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
5229     AC_MSG_RESULT([yes])
5230     ENABLE_MYSQLC=YES
5231     BUILD_TYPE="$BUILD_TYPE MYSQLC"
5232 else
5233     AC_MSG_RESULT([no])
5234     ENABLE_MYSQLC=NO
5236 AC_SUBST(ENABLE_MYSQLC)
5238 if test "$ENABLE_MYSQLC" = "YES"; then
5240     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MYSQLC"
5242     dnl ===================================================================
5243     dnl Check for system MySQL
5244     dnl ===================================================================
5245     AC_MSG_CHECKING([for MySQL prerequisites])
5246     if test "$with_system_mysql" = "yes"; then
5247         AC_MSG_RESULT([external MySQL])
5248         SYSTEM_MYSQL=YES
5249         AC_PATH_PROG( MYSQLCONFIG, mysql_config)
5250         AC_MSG_CHECKING([MySQL version])
5251         MYSQL_VERSION=`$MYSQLCONFIG --version`
5252         MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
5253         if test "$MYSQL_MAJOR" -ge "5"; then
5254             AC_MSG_RESULT([OK])
5255         else
5256             AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
5257         fi
5258         AC_MSG_CHECKING([for MySQL Client library])
5259         MYSQL_INC=`$MYSQLCONFIG --include`
5260         MYSQL_LIB=`$MYSQLCONFIG --libs`
5261         MYSQL_DEFINES=`$MYSQLCONFIG --cflags | $SED -e s,$MYSQL_INC,,`
5262         AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
5263     else
5264         SYSTEM_MYSQL=NO
5265         if test -n "$with_libmysql_path"; then
5266             AC_MSG_RESULT([external Connector/C (libmysql)])
5267             LIBMYSQL=libmysql.so
5268             if test "$_os" = "Darwin"; then
5269                 LIBMYSQL=libmysql.dylib
5270             elif test "$_os" = "WINNT"; then
5271                 LIBMYSQL=libmysql.dll
5272             fi
5273             AC_MSG_CHECKING([for $LIBMYSQL])
5274             if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
5275                 AC_MSG_RESULT([found.])
5276                 LIBMYSQL_PATH=$with_libmysql_path
5277             else
5278                 AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
5279             fi
5280         else
5281             AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
5282         fi
5283     fi
5284     AC_SUBST(SYSTEM_MYSQL)
5285     AC_SUBST(MYSQL_INC)
5286     AC_SUBST(MYSQL_LIB)
5287     AC_SUBST(MYSQL_DEFINES)
5288     AC_SUBST(LIBMYSQL_PATH)
5290     AC_LANG_PUSH([C++])
5291     dnl ===================================================================
5292     dnl Check for system MySQL C++ Connector
5293     dnl ===================================================================
5294     # FIXME!
5295     # who thought this too-generic cppconn dir was a good idea?
5296     AC_MSG_CHECKING([MySQL Connector/C++])
5297     if test "$with_system_mysql_cppconn" = "yes"; then
5298         AC_MSG_RESULT([external])
5299         SYSTEM_MYSQL_CPPCONN=YES
5300         AC_LANG_PUSH([C++])
5301         AC_CHECK_HEADER(mysql_driver.h, [],
5302                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
5303         AC_CHECK_LIB(mysqlcppconn, main, [],
5304                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
5305         AC_MSG_CHECKING([version])
5306         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5307 #include <mysql_driver.h>
5309 int main(int argc, char **argv) {
5310     sql::Driver *driver;
5311     driver = get_driver_instance();
5312     if (driver->getMajorVersion() > 1 || \
5313        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
5314        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
5315         return 0;
5316       else
5317         return 1;
5319       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
5321         AC_LANG_POP([C++])
5323     else
5324         AC_MSG_RESULT([internal])
5325         AC_MSG_CHECKING([for mysqlcppconn module])
5326         if test -d mysqlcppconn; then
5327             AC_MSG_RESULT([OK])
5328         else
5329             AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
5330         fi
5331         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
5332         SYSTEM_MYSQL_CPPCONN=NO
5333     fi
5334     AC_LANG_POP([C++])
5335     AC_SUBST(SYSTEM_MYSQL_CPPCONN)
5338 dnl ===================================================================
5339 dnl Check for system hsqldb
5340 dnl ===================================================================
5341 if test "$with_java" != "no"; then
5342 AC_MSG_CHECKING([which hsqldb to use])
5343 if test "$with_system_hsqldb" = "yes"; then
5344     AC_MSG_RESULT([external])
5345     SYSTEM_HSQLDB=YES
5346     if test -z $HSQLDB_JAR; then
5347         HSQLDB_JAR=/usr/share/java/hsqldb.jar
5348     fi
5349     AC_CHECK_FILE($HSQLDB_JAR, [],
5350                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
5351     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
5352     export HSQLDB_JAR
5353     if $PERL -e 'use Archive::Zip;
5354             my $file = "$ENV{'HSQLDB_JAR'}";
5355             my $zip = Archive::Zip->new( $file );
5356             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5357             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
5358                push @l, split(/\n/, $mf);
5359                foreach my $line (@l) {
5360                   if ($line =~ m/Specification-Version:/) {
5361                       ($t, $version) = split (/:/,$line);
5362                       $version =~ s/^\s//;
5363                       ($a, $b, $c, $d) = split (/\./,$version);
5364                       if ($c == "0" && $d > "8")  {
5365                           exit 0;
5366                       } else {
5367                           exit 1;
5368                       }
5369                   }
5370                }
5371             } else {
5372                 exit 1;
5373             }'; then
5374         AC_MSG_RESULT([yes])
5375     else
5376         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
5377     fi
5378 else
5379     AC_MSG_RESULT([internal])
5380     SYSTEM_HSQLDB=NO
5381     BUILD_TYPE="$BUILD_TYPE HSQLDB"
5383 AC_SUBST(SYSTEM_HSQLDB)
5384 AC_SUBST(HSQLDB_JAR)
5387 dnl ===================================================================
5388 dnl Check for PostgreSQL stuff
5389 dnl ===================================================================
5391 if test "x$enable_postgresql_sdbc" != "xno"; then
5392     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
5393     AC_MSG_CHECKING([PostgreSQL C interface])
5394     if test "$with_system_postgresql" = "yes"; then
5395         AC_MSG_RESULT([external PostgreSQL])
5396         SYSTEM_POSTGRESQL=YES
5397         if test "$_os" = Darwin; then
5398            supp_path=''
5399            for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
5400             pg_supp_path="$PATH_SEPARATOR$d$pg_supp_path"
5401            done
5402         fi
5403         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
5404         if test -z "$PGCONFIG"; then
5405            AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
5406         fi
5407         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
5408         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
5409     else
5410         if test -n "$with_libpq_path"; then
5411             SYSTEM_POSTGRESQL=YES
5412             AC_MSG_RESULT([external libpq])
5413             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
5414             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
5415         else
5416             SYSTEM_POSTGRESQL=NO
5417             AC_MSG_RESULT([internal])
5418             POSTGRESQL_LIB=""
5419             POSTGRESQL_INC="%OVERRIDE_ME%"
5420             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
5421         fi
5422     fi
5423     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
5424         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
5425         save_CFLAGS=$CFLAGS
5426         save_CPPFLAGS=$CPPFLAGS
5427         save_LIBS=$LIBS
5428         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
5429         LIBS="${LIBS} ${POSTGRESQL_LIB}"
5430         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
5431         AC_CHECK_LIB(pq, PQconnectdbParams, [],
5432             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
5433         CFLAGS=$save_CFLAGS
5434         CPPFLAGS=$save_CPPFLAGS
5435         LIBS=$save_LIBS
5436     fi
5437     BUILD_POSTGRESQL_SDBC=YES
5439 AC_SUBST(BUILD_POSTGRESQL_SDBC)
5440 AC_SUBST(SYSTEM_POSTGRESQL)
5441 AC_SUBST(POSTGRESQL_INC)
5442 AC_SUBST(POSTGRESQL_LIB)
5444 dnl ===================================================================
5445 dnl Check for system beanshell
5446 dnl ===================================================================
5447 if test "$with_java" != "no"; then
5448 AC_MSG_CHECKING([which beanshell to use])
5449 if test "$with_system_beanshell" = "yes"; then
5450     AC_MSG_RESULT([external])
5451     SYSTEM_BSH=YES
5452     if test -z $BSH_JAR; then
5453         BSH_JAR=/usr/share/java/bsh.jar
5454     fi
5455     AC_CHECK_FILE($BSH_JAR, [],
5456                [AC_MSG_ERROR(bsh.jar not found.)], [])
5457 else
5458     AC_MSG_RESULT([internal])
5459     SYSTEM_BSH=NO
5460     BUILD_TYPE="$BUILD_TYPE BSH"
5463 AC_SUBST(SYSTEM_BSH)
5464 AC_SUBST(BSH_JAR)
5467 dnl ===================================================================
5468 dnl Check for system saxon
5469 dnl ===================================================================
5470 if test "$with_java" != "no"; then
5471 AC_MSG_CHECKING([which saxon to use])
5472 if test "$with_system_saxon" = "yes"; then
5473     AC_MSG_RESULT([external])
5474     SYSTEM_SAXON=YES
5475     if test -z $SAXON_JAR; then
5476         AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5477             [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5478             [
5479               AC_CHECK_FILE(/usr/share/java/saxon.jar,
5480                 [ SAXON_JAR=/usr/share/java/saxon.jar ],
5481                 [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5482                     [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5483                     [ AC_MSG_ERROR(saxon.jar replacement not found)]
5484                   )
5485                 ]
5486               )
5487             ]
5488           )
5489     else
5490         AC_CHECK_FILE($SAXON_JAR, [],
5491                [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
5492     fi
5493     if test -n "$SERIALIZER_JAR"; then
5494         AC_CHECK_FILE($SERIALIZER_JAR, [],
5495                [AC_MSG_ERROR(serializer.jar not found.)], [])
5496         AC_SUBST(SERIALIZER_JAR)
5497     fi
5499     dnl Saxon comes in two practically available versions, the out-of-date saxonb which
5500     dnl supports the Java extensions that LibreOffice uses, and the up-to-date saxon he
5501     dnl "home edition" version, which is crippled to not support those Java extensions.
5502     dnl And as an aside the he one also needs to be tweaked to include
5503     dnl a META-INF/services to broadcast that it supports the jaxp transform factory
5505     AC_MSG_CHECKING([if saxon works])
5506     cat > saxontest.java <<_ACEOF
5507 [import javax.xml.transform.TransformerFactory;
5508 import javax.xml.transform.Transformer;
5509 import javax.xml.transform.stream.StreamSource;
5510 import java.io.*;
5512 import net.sf.saxon.FeatureKeys;
5514 class saxontest {
5515     public static void main(String[] args) {
5516       System.setProperty("javax.xml.transform.TransformerFactory",
5517         "net.sf.saxon.TransformerFactoryImpl");
5518       try {
5519         TransformerFactory tfactory = TransformerFactory.newInstance();
5520     // some external saxons (Debian, Ubuntu, ...) have this disabled
5521     // per default
5522     tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
5523         System.out.println("TransformerFactory is" +
5524           tfactory.getClass().getName());
5525         Transformer transformer = tfactory.newTransformer(
5526           new StreamSource(new File(args[0])));
5527       } catch(Exception e){
5528         e.printStackTrace(System.err);
5529         System.exit(-1);
5530       }
5531       System.exit(0);
5532     }
5535 _ACEOF
5537     cat > saxontest.xsl<<_ACEOF
5538 [<?xml version="1.0" encoding="UTF-8"?>
5539 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5540  <xsl:template match="/">
5541   <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
5542  </xsl:template>
5543 </xsl:stylesheet>
5545 _ACEOF
5547     javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
5548     AC_TRY_EVAL(javac_cmd)
5549     if test $? = 0 && test -f ./saxontest.class ; then
5550         java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
5551         AC_TRY_EVAL(java_cmd)
5552         if test $? = 0; then
5553             AC_MSG_RESULT([yes])
5554         else
5555             cat saxontest.java >&5
5556             AC_MSG_RESULT([no])
5557             AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
5558         fi
5559     else
5560         AC_MSG_RESULT([no])
5561         cat saxontest.java >&5
5562         AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
5563     fi
5564 else
5565     AC_MSG_RESULT([internal])
5566     SYSTEM_SAXON=NO
5567     NEED_SAXON=TRUE
5570 AC_SUBST(SYSTEM_SAXON)
5571 AC_SUBST(SAXON_JAR)
5573 if test -n "$NEED_SAXON"; then
5574     BUILD_TYPE="$BUILD_TYPE SAXON"
5577 # ===================================================================
5578 # Check whether to build stax
5579 # ===================================================================
5580 AC_MSG_CHECKING([whether building the stax is required])
5581 BUILD_STAX=NO
5582 if test -z "$SOLAR_JAVA"; then
5583     AC_MSG_RESULT([no (java disabled)])
5584 elif test "$SYSTEM_SAXON" = "YES"; then
5585     AC_MSG_RESULT([no (already provided by system saxon)])
5586 elif test -f "./stax/download/jsr173_1.0_api.jar"; then
5587     AC_MSG_RESULT([no (will use the prebuilt stax/download/jsr173_1.0_api.jar)])
5588 else
5589     BUILD_STAX=YES
5590     AC_MSG_RESULT([yes (no system saxon and no prebuilt copy)])
5592 AC_SUBST(BUILD_STAX)
5594 dnl ===================================================================
5595 dnl Check for system curl
5596 dnl ===================================================================
5597 AC_MSG_CHECKING([which libcurl to use])
5598 if test "$with_system_curl" = "yes"; then
5599     AC_MSG_RESULT([external])
5600     SYSTEM_CURL=YES
5602     curl_version=""
5603     if test "$cross_compiling" = "yes"; then
5604         dnl At least the OBS mingw32-libcurl-devel package
5605         dnl comes with a proper .pc file
5606         PKG_CHECK_MODULES(CURL, libcurl,, [:])
5607         if test -n "$CURL_PKG_ERRORS"; then
5608             AC_MSG_RESULT([no])
5609         else
5610             curl_version=`$PKG_CONFIG --modversion libcurl`
5611         fi
5612     fi
5613     if test -z "$curl_version"; then
5614         AC_PATH_PROG(CURLCONFIG, curl-config)
5615         if test -z "$CURLCONFIG"; then
5616             AC_MSG_ERROR([install the libcurl development package])
5617         fi
5618         CURL_LIBS=`$CURLCONFIG --libs`
5619         CURL_CFLAGS=`$CURLCONFIG --cflags`
5620         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
5621     fi
5623     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
5625     case $curl_version in
5626     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
5627     dnl so they need to be doubled to end up in the configure script
5628     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
5629         AC_MSG_RESULT([yes, you have $curl_version])
5630         ;;
5631     *)
5632         AC_MSG_ERROR([no, you have $curl_version])
5633         ;;
5634     esac
5636     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libintl-8.dll libidn-11.dll libnspr4.dll nssutil3.dll libplc4.dll libplds4.dll nss3.dll ssl3.dll libgpg-error-0.dll libgcrypt-11.dll libssh2-1.dll libcurl-4.dll"
5637 else
5638     AC_MSG_RESULT([internal])
5639     SYSTEM_CURL=NO
5640     BUILD_TYPE="$BUILD_TYPE CURL"
5642 AC_SUBST(SYSTEM_CURL)
5643 AC_SUBST(CURL_CFLAGS)
5644 AC_SUBST(CURL_LIBS)
5646 dnl ===================================================================
5647 dnl Check for system boost
5648 dnl ===================================================================
5649 AC_MSG_CHECKING([which boost to use])
5650 if test "$with_system_boost" = "yes"; then
5651     AC_MSG_RESULT([external])
5652     SYSTEM_BOOST=YES
5653     AC_LANG_PUSH([C++])
5654     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
5655        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
5656     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
5657        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
5658     AC_CHECK_HEADER(boost/function.hpp, [],
5659        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
5660     AC_CHECK_HEADER([boost/unordered_map.hpp], [HAVE_BOOST_UNORDERED_MAP=TRUE],
5661                    [AC_MSG_WARN([boost/unordered_map.hpp not found])], [])
5663     save_CXXFLAGS=$CXXFLAGS
5664     CXXFLAGS="$CXXFLAGS -fno-exceptions"
5665     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
5666     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
5667 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
5669     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
5670         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
5671     else
5672         AC_MSG_RESULT([yes])
5673     fi
5674     CXXFLAGS=$save_CXXFLAGS
5675     AC_LANG_POP([C++])
5676 else
5677     AC_MSG_RESULT([internal])
5678     BUILD_TYPE="$BUILD_TYPE BOOST"
5679     SYSTEM_BOOST=NO
5680     HAVE_BOOST_UNORDERED_MAP=TRUE
5682 AC_SUBST([HAVE_BOOST_UNORDERED_MAP])
5683 AC_SUBST(SYSTEM_BOOST)
5685 dnl ===================================================================
5686 dnl Check for system mdds
5687 dnl ===================================================================
5688 AC_MSG_CHECKING([which mdds to use])
5689 if test "$with_system_mdds" = "yes"; then
5690     AC_MSG_RESULT([external])
5691     SYSTEM_MDDS=YES
5693     dnl ===================================================================
5694     dnl Determine which hash container mdds shall use
5695     dnl ===================================================================
5696     AC_MSG_CHECKING([which hash container mdds shall use])
5697     if test "x$HAVE_CXX0X" = "xTRUE"; then
5698         MDDS_CPPFLAGS="-std=c++0x"
5699         AC_MSG_RESULT([std::unordered_map])
5700     else
5701         MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5702         AC_MSG_RESULT([boost::unordered_map])
5703     fi
5705     AC_LANG_PUSH([C++])
5706     save_CPPFLAGS="$CPPFLAGS"
5707     CPPFLAGS="$CPPFLAGS $MDDS_CPPFLAGS"
5708     AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
5709         [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
5710     AC_CHECK_HEADER(mdds/mixed_type_matrix.hpp, [],
5711         [AC_MSG_ERROR(mdds/mixed_type_matrix.hpp not found. install mdds >= 0.4.0)], [])
5712     CPPFLAGS="$save_CPPFLAGS"
5713     save_CXXFLAGS="$CXXFLAGS"
5714     CXXFLAGS="$CXXFLAGS $MDDS_CPPFLAGS"
5715     AC_MSG_CHECKING([for correct signature of ::mdds::flat_segment_tree])
5716     AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <mdds/flat_segment_tree.hpp>
5718     int main(int argc, char **argv) {
5719         ::mdds::flat_segment_tree<long, short> db(0, 100, 0);
5720         short val;
5721         if (!db.search(5, val).second)
5722             return 1;
5723         return 0;
5724     }
5725 ]])],[ac_cv_cxx_mdds_flat_segment_tree_correct=yes],[ac_cv_cxx_mdds_flat_segment_tree_correct=no],[])
5727     if test "$ac_cv_cxx_mdds_flat_segment_tree_correct" = "yes"; then
5728         AC_MSG_RESULT([yes])
5729     else
5730         AC_MSG_ERROR([no, install mdds >= 0.5.0])
5731     fi
5732     CXXFLAGS=$save_CXXFLAGS
5733     AC_LANG_POP([C++])
5734 else
5735     AC_MSG_RESULT([internal])
5736     BUILD_TYPE="$BUILD_TYPE MDDS"
5737     SYSTEM_MDDS=NO
5739     dnl ===================================================================
5740     dnl Determine which hash container mdds shall use
5741     dnl ===================================================================
5742     AC_MSG_CHECKING([which hash container mdds shall use])
5743     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5744     AC_MSG_RESULT([boost::unordered_map])
5746 AC_SUBST(SYSTEM_MDDS)
5747 AC_SUBST([MDDS_CPPFLAGS])
5749 dnl ===================================================================
5750 dnl Check for system vigra
5751 dnl ===================================================================
5752 AC_MSG_CHECKING([which vigra to use])
5753 if test "$with_system_vigra" = "yes"; then
5754     AC_MSG_RESULT([external])
5755     SYSTEM_VIGRA=YES
5756     AC_LANG_PUSH([C++])
5757     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
5758        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
5759     AC_LANG_POP([C++])
5760 else
5761     AC_MSG_RESULT([internal])
5762     BUILD_TYPE="$BUILD_TYPE VIGRA"
5763     SYSTEM_VIGRA=NO
5765 AC_SUBST(SYSTEM_VIGRA)
5767 dnl ===================================================================
5768 dnl Check for system odbc
5769 dnl ===================================================================
5770 AC_MSG_CHECKING([which odbc headers to use])
5771 if test "$with_system_odbc" = "yes"; then
5772     AC_MSG_RESULT([external])
5773     SYSTEM_ODBC_HEADERS=YES
5775     AC_CHECK_HEADER(sqlext.h, [],
5776       [AC_MSG_ERROR(odbc not found. install odbc)], [])
5777 else
5778     AC_MSG_RESULT([internal])
5779     SYSTEM_ODBC_HEADERS=NO
5780     BUILD_TYPE="$BUILD_TYPE UNIXODBC"
5782 AC_SUBST(SYSTEM_ODBC_HEADERS)
5784 AC_MSG_CHECKING([whether to enable build of Mozilla])
5785 if test "$enable_mozilla" = "no"; then
5786     AC_MSG_RESULT([no])
5787     WITH_MOZILLA=NO
5788 else
5789     AC_MSG_RESULT([yes])
5790     WITH_MOZILLA=YES
5792 AC_SUBST(WITH_MOZILLA)
5794 AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
5795 if test "$enable_mozilla" = "no"; then
5796     AC_MSG_RESULT([no])
5797 elif test "$with_system_mozilla" = "yes"; then
5798     AC_MSG_RESULT([no, not possible with system-mozilla])
5799 else
5800     AC_MSG_RESULT([yes])
5803 AC_MSG_CHECKING([whether to build XML Security support])
5804 if test "$enable_xmlsec" = "no"; then
5805     AC_MSG_RESULT([no])
5806     ENABLE_XMLSEC=
5807 else
5808     ENABLE_XMLSEC="YES"
5809     BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
5810     AC_MSG_RESULT([yes])
5812 AC_SUBST(ENABLE_XMLSEC)
5814 AC_MSG_CHECKING([whether to build LDAP configuration backend])
5815 if test "$enable_ldap" != "no"; then
5816     WITH_OPENLDAP=NO
5817     WITH_LDAP=NO
5818     if test "$with_openldap" = "yes"; then
5819         WITH_LDAP=YES
5820         AC_MSG_RESULT([OpenLDAP])
5821         WITH_OPENLDAP=YES
5822         AC_CHECK_HEADERS(ldap.h, [],
5823             [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
5824         AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
5825             [AC_MSG_ERROR(openldap lib not found or functional)], [])
5826         AC_CHECK_LIB(ldap, ldap_set_option, [],
5827             [AC_MSG_ERROR(openldap lib not found or functional)], [])
5828     elif test "$enable_mozilla" != "no"; then
5829         AC_MSG_RESULT([Mozilla])
5830         WITH_LDAP=YES
5831         WITH_OPENLDAP=NO
5832     else
5833         AC_MSG_RESULT([no. Either Mozilla or OpenLDAP required])
5834     fi
5835 else
5836     AC_MSG_RESULT([no])
5837     WITH_LDAP=NO
5839 AC_SUBST(WITH_LDAP)
5840 AC_SUBST(WITH_OPENLDAP)
5842 dnl ===================================================================
5843 dnl Check for system mozilla
5844 dnl ===================================================================
5845 AC_MSG_CHECKING([which Mozilla to use])
5846 if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
5847     AC_MSG_RESULT([external])
5848     SYSTEM_MOZILLA=YES
5849     AC_MSG_CHECKING([which Mozilla flavour to use])
5850     if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
5851         MOZ_FLAVOUR=libxul
5852     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
5853         MOZ_FLAVOUR=xulrunner
5854     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
5855         MOZ_FLAVOUR=seamonkey
5856     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "iceape"; then
5857         MOZ_FLAVOUR=iceape
5858     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
5859         MOZ_FLAVOUR=firefox
5860     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
5861         MOZ_FLAVOUR=mozilla
5862     else
5863         MOZ_FLAVOUR=libxul
5864     fi
5865     tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
5866     AC_MSG_RESULT($tmp)
5868     if test "$MOZ_FLAVOUR" != "libxul"; then
5869         PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
5870         MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
5871         MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
5872     fi
5874     if test -z "$HASXPCOM"; then
5875         PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
5876         MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
5877         MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
5878         if ! test -e "$MOZ_LIB/libxul.so"; then
5879             MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
5880             if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
5881                 MOZ_LIB="$MOZ_LIB/sdk/lib"
5882             fi
5883         fi
5884     fi
5886     MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
5887     if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
5888         AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
5889         if test -d "$MOZ_INC/ldap"; then
5890             AC_MSG_RESULT([yes])
5891             MOZ_LDAP_CFLAGS="-I$MOZ_INC"
5892         else
5893             AC_MSG_ERROR([no.
5894 Could not find LDAP header include files in $MOZ_INC/ldap.
5895 Please recompile $tmp with --enable-ldap or use --with-openldap.])
5896         fi
5897     fi
5899     #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
5900     #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
5901     if test "$MOZ_FLAVOUR" = "libxul"; then
5902         MOZ_FLAVOUR="mozilla"
5903     fi
5905 elif test "$enable_mozilla" = "no"; then
5906     AC_MSG_RESULT([none])
5907     WITH_MOZILLA=NO
5908 else
5909     AC_MSG_RESULT([internal])
5910     SYSTEM_MOZILLA=NO
5911     BUILD_TYPE="$BUILD_TYPE MOZ"
5912 if test -z "$with_mozilla_version"; then
5913     MOZILLA_VERSION=
5914 else
5915     AC_MSG_CHECKING([which Mozilla version to build])
5916     MOZILLA_VERSION=$with_mozilla_version
5917     enable_build_mozilla=1
5918     AC_MSG_RESULT([$MOZILLA_VERSION])
5921 AC_SUBST(MOZILLA_VERSION)
5923 AC_MSG_CHECKING([for toolkit Mozilla should use])
5924 if test -z "$with_mozilla_toolkit"; then
5925     if test "$_os" != "WINNT" ; then
5926         if test "$_os" = "Darwin" ; then
5927             MOZILLA_TOOLKIT=mac
5928             AC_MSG_RESULT([mac])
5929         else
5930             MOZILLA_TOOLKIT=gtk2
5931             AC_MSG_RESULT([gtk2])
5932         fi
5933     fi
5934 else
5935     MOZILLA_TOOLKIT=$with_mozilla_toolkit
5936     enable_build_mozilla=1
5937     AC_MSG_RESULT([$MOZILLA_TOOLKIT])
5940 AC_SUBST(MOZILLA_TOOLKIT)
5942 # default to enabling build mozilla
5943 if test "$enable_build_mozilla" != "no"; then
5944     enable_build_mozilla=yes
5945 else
5946     enable_build_mozilla=
5949 AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
5950 if test -n "$enable_build_mozilla"; then
5951     BUILD_MOZAB="TRUE"
5952     AC_MSG_RESULT([yes])
5953 else
5954     BUILD_MOZAB=""
5955     AC_MSG_RESULT([no])
5958 if test "$BUILD_MOZAB" = "TRUE"; then
5959     if test "$_os" = "WINNT"; then
5960         if test "$WITH_MINGW" != "yes"; then
5961             # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
5962             if test "$MSVSVER" != "2005"; then
5963                 AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio 2005 only.])
5964             fi
5965         else
5966             AC_MSG_WARN([Building SeaMonkey with MinGW is not tested, and likely to break.])
5967             echo "Building SeaMonkey with MinGW is not tested, and likely to break." >> warn
5968         fi
5969     fi
5971     if test -z "$MOZILLA_VERSION"; then
5972         MOZILLA_VERSION=1.1.14
5973     fi
5974     MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
5975     MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst.in`
5976     AC_MSG_CHECKING([for Mozilla sources])
5977     if test -z "$MOZILLA_FETCH_FILE"; then
5978         AC_MSG_RESULT([not found])
5979         HAVE_MOZILLA_TARBALL=n
5980     else
5981         AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
5982         if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
5983             if test -z "$DO_FETCH"; then
5984                 AC_MSG_RESULT([will be fetched])
5985                 HAVE_MOZILLA_TARBALL=y
5986             else
5987                 AC_MSG_RESULT([not found])
5988                 HAVE_MOZILLA_TARBALL=n
5989             fi
5990         else
5991             AC_MSG_RESULT([found])
5992             HAVE_MOZILLA_TARBALL=y
5993         fi
5994     fi
5995     if test "$HAVE_MOZILLA_TARBALL" != "y"; then
5996         AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
5997 Use "./download" to download.])
5998     fi
5999     if test "$_os" = "WINNT"; then
6000         AC_MSG_CHECKING([for moztools binaries])
6001         if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
6002             AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
6003 (from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
6004         else
6005             AC_MSG_RESULT([ok])
6006         fi
6007     elif test "$_os" = "Darwin"; then
6008         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
6009         if test -z "$MOZIDL"; then
6010             AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build Mozilla with Mac toolkit.])
6011         fi
6012     else
6013         # Generic Unix/Linux section
6014         if test "$MOZILLA_TOOLKIT" = "gtk2"; then
6015             PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
6016             if test -z "$MOZGTK"; then
6017                 AC_MSG_ERROR([GTK2 is needed to build Mozilla.])
6018             fi
6019             PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
6020             if test -z "$MOZIDL"; then
6021                 AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build Mozilla.])
6022             fi
6023         else
6024             PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
6025             if test -z "$MOZGTK"; then
6026                 AC_MSG_ERROR([GTK+ 1.2 is needed when not using GTK2 to build Mozilla.])
6027             fi
6028             PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
6029             if test -z "$MOZIDL"; then
6030                 AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build Mozilla.])
6031             fi
6032         fi
6033     fi
6036 AC_SUBST(BUILD_MOZAB)
6039 AC_SUBST(MOZILLABUILD)
6040 AC_SUBST(SYSTEM_MOZILLA)
6041 AC_SUBST(MOZ_FLAVOUR)
6042 AC_SUBST(MOZ_INC)
6043 AC_SUBST(MOZ_LIB)
6044 AC_SUBST(MOZ_LIB_XPCOM)
6045 AC_SUBST(MOZ_LDAP_CFLAGS)
6047 dnl ===================================================================
6048 dnl Check for system NSS only with xmlsec or mozilla build enabled
6049 dnl ===================================================================
6050 if test "x$enable_xmlsec" != "xno" -o "x$enable_mozilla" != "xno"; then
6051 AC_MSG_CHECKING([which NSS to use])
6052 if test "$with_system_nss" = "yes"; then
6053     AC_MSG_RESULT([external])
6054     SYSTEM_NSS="YES"
6055     PKG_CHECK_MODULES(NSS, nss >= 3.9.3 nspr >= 4.8)
6056 else
6057     SYSTEM_NSS="NO"
6058     BUILD_TYPE="$BUILD_TYPE NSS"
6059     AC_MSG_RESULT([internal])
6060     if test "$build_os" = "cygwin"; then
6061         AC_MSG_CHECKING([for Mozilla build tooling. Required for nss and/or mozilla])
6062         if test -z "$MOZILLABUILD" ; then
6063             AC_MSG_ERROR([Mozilla build tooling not found.
6064 Use the --with-mozilla-build option after installing the tools obtained
6065 from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
6066         else
6067             if test \( "$WITH_MINGW" = "yes" \) ; then
6068                 if test ! -d "$MOZILLABUILD" ; then
6069                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
6070                 else
6071                     AC_MSG_RESULT([ok])
6072                 fi
6073             else
6074                 if test ! -d "$MOZILLABUILD/moztools" \
6075                         -o ! -d "$MOZILLABUILD/msys" ; then
6076                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
6077                 else
6078                     AC_MSG_RESULT([ok])
6079                 fi
6080             fi
6081         fi
6082     fi
6083 fi # system nss
6084 fi # enable xmlsec || enable mozilla
6085 AC_SUBST(SYSTEM_NSS)
6086 AC_SUBST(NSS_CFLAGS)
6087 AC_SUBST(NSS_LIBS)
6089 dnl ===================================================================
6090 dnl Check for system mozilla headers
6091 dnl ===================================================================
6092 AC_MSG_CHECKING([which mozilla headers to use])
6093 if test "$with_system_mozilla_headers" = "yes"; then
6094     AC_MSG_RESULT([external])
6095     SYSTEM_MOZILLA_HEADERS=YES
6096     # First try npapi-sdk:
6097     PKG_CHECK_MODULES(MOZILLA_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
6098     # Then go with libxul:
6099     if test "x$LOCATED" != "xyes"; then
6100         PKG_CHECK_MODULES(MOZILLA_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
6101     fi
6102     # if still not found bail out
6103     if test "x$LOCATED" != "xyes"; then
6104         AC_MSG_ERROR([npapi.h header file not found])
6105     fi
6106 else
6107     AC_MSG_RESULT([internal])
6108     SYSTEM_MOZILLA_HEADERS=NO
6110 AC_SUBST(MOZILLA_HEADERS_CFLAGS)
6111 AC_SUBST(SYSTEM_MOZILLA_HEADERS)
6113 dnl ===================================================================
6114 dnl Check for system sane
6115 dnl ===================================================================
6116 AC_MSG_CHECKING([which sane header to use])
6117 if test "$with_system_sane" = "yes"; then
6118     AC_MSG_RESULT([external])
6119     SYSTEM_SANE_HEADER=YES
6120     AC_CHECK_HEADER(sane/sane.h, [],
6121       [AC_MSG_ERROR(sane not found. install sane)], [])
6122 else
6123     AC_MSG_RESULT([internal])
6124     SYSTEM_SANE_HEADER=NO
6125     BUILD_TYPE="$BUILD_TYPE SANE"
6127 AC_SUBST(SYSTEM_SANE_HEADER)
6129 dnl ===================================================================
6130 dnl Check for system icu
6131 dnl ===================================================================
6132 SYSTEM_GENBRK=
6133 SYSTEM_GENCCODE=
6134 SYSTEM_GENCMN=
6135 ICU_MAJOR=
6136 ICU_MINOR=
6137 ICU_MICRO=
6138 ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
6139 AC_MSG_CHECKING([which icu to use])
6140 if test "$with_system_icu" = "yes"; then
6141     AC_MSG_RESULT([external])
6142     SYSTEM_ICU=YES
6143     AC_LANG_PUSH([C++])
6144     AC_MSG_CHECKING([for unicode/rbbi.h])
6145     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
6146     AC_LANG_POP([C++])
6148     ICUPATH="$PATH"
6149     if test "$WITH_MINGW" = "yes" ; then
6150         ICUPATH="/usr/i686-w64-mingw32/sys-root/mingw/bin:$ICUPATH"
6151     fi
6152     AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
6154     AC_MSG_CHECKING([ICU version])
6155     ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
6156     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
6157     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
6158     ICU_MICRO=`echo $ICU_VERSION | cut -d"." -f3`
6160     if test "$ICU_MAJOR" -ge "4"; then
6161         AC_MSG_RESULT([OK, $ICU_VERSION])
6162     else
6163         AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
6164     fi
6166     if test "$cross_compiling" != "yes"; then
6167         # using the system icu tools can lead to version confusion, use the
6168         # ones from the build environment when cross-compiling
6169         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
6170         if test -z "$SYSTEM_GENBRK"; then
6171             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
6172         fi
6173         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6174         if test -z "$SYSTEM_GENCCODE"; then
6175             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
6176         fi
6177         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6178         if test -z "$SYSTEM_GENCMN"; then
6179             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
6180         fi
6181         if test "$ICU_MAJOR" -ge "5" -o "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4"; then
6182             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6183         fi
6184     fi
6186     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS icui18n$ICU_MAJOR$ICU_MINOR.dll icuuc$ICU_MAJOR$ICU_MINOR.dll icudata$ICU_MAJOR$ICU_MINOR.dll"
6187 else
6188     AC_MSG_RESULT([internal])
6189     SYSTEM_ICU="NO"
6190     ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6191     BUILD_TYPE="$BUILD_TYPE ICU"
6193 AC_SUBST(SYSTEM_ICU)
6194 AC_SUBST(SYSTEM_GENBRK)
6195 AC_SUBST(SYSTEM_GENCCODE)
6196 AC_SUBST(SYSTEM_GENCMN)
6197 AC_SUBST(ICU_MAJOR)
6198 AC_SUBST(ICU_MINOR)
6199 AC_SUBST(ICU_MICRO)
6200 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
6202 dnl ===================================================================
6203 dnl Graphite
6204 dnl ===================================================================
6206 AC_MSG_CHECKING([whether to enable graphite support])
6207 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
6208     AC_MSG_RESULT([yes])
6209     ENABLE_GRAPHITE="TRUE"
6210     AC_MSG_CHECKING([which graphite to use])
6211     if test "$with_system_graphite" = "yes"; then
6212         AC_MSG_RESULT([external])
6213         SYSTEM_GRAPHITE=YES
6214         PKG_CHECK_MODULES( GRAPHITE, graphite2 >= 0.9.3 )
6215         MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libgraphite2.dll"
6216     else
6217         AC_MSG_RESULT([internal])
6218         SYSTEM_GRAPHITE=NO
6219         BUILD_TYPE="$BUILD_TYPE GRAPHITE"
6220     fi
6221 else
6222     AC_MSG_RESULT([no])
6224 AC_SUBST(ENABLE_GRAPHITE)
6225 AC_SUBST(SYSTEM_GRAPHITE)
6226 AC_SUBST(GRAPHITE_LIBS)
6227 AC_SUBST(GRAPHITE_CFLAGS)
6229 dnl ===================================================================
6230 dnl SampleICC
6231 dnl ===================================================================
6232 AC_MSG_CHECKING([whether to use system SampleICC])
6233 if test "$with_system_sampleicc" = "yes"; then
6234     AC_MSG_RESULT([yes])
6235     SYSTEM_SAMPLEICC=YES
6236     PKG_CHECK_MODULES(SAMPLEICC, sampleicc)
6237 else
6238     AC_MSG_RESULT([no])
6239     SYSTEM_SAMPLEICC=NO
6241 AC_SUBST(SYSTEM_SAMPLEICC)
6242 AC_SUBST(SAMPLEICC_LIBS)
6243 AC_SUBST(SAMPLEICC_CFLAGS)
6245 dnl ===================================================================
6246 dnl Checks for libraries.
6247 dnl ===================================================================
6248 dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
6249 dnl See if we have the AppKit framework for building with Quartz graphics.
6251 if test  "$_os" = "Darwin"; then
6252     if test "x$with_x" = "xyes"; then
6253         AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
6254     else
6255         AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
6256         if test -d "/System/Library/Frameworks/AppKit.framework/"; then
6257             AC_MSG_RESULT([yes])
6258             x_includes="no_x_includes"
6259             x_libraries="no_x_libraries"
6260             dnl disable some things used on other Unix versions but not on the aqua build
6261             enable_gtk=no
6262         else
6263             AC_MSG_ERROR([No AppKit.framewrok found])
6264         fi
6265     fi
6268 if test $_os = iOS -o $_os = Android; then
6269     enable_gtk=no
6272 dnl ===================================================================
6273 dnl Check for nsplugin
6274 dnl ===================================================================
6275 AC_MSG_CHECKING([wether to build nsplugin extension])
6276 ENABLE_NSPLUGIN=NO
6277 if test "$enable_nsplugin" != "no"; then
6278     if test "$enable_gtk" != "no"; then
6279         AC_MSG_RESULT([yes])
6280         ENABLE_NSPLUGIN=YES
6281     else
6282         AC_MSG_RESULT([no, disabled gtk2])
6283     fi
6284 else
6285     AC_MSG_RESULT([no])
6287 AC_SUBST(ENABLE_NSPLUGIN)
6289 dnl ***************************************
6290 dnl testing for X libraries and includes...
6291 dnl ***************************************
6292 if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
6293     dnl Mac OS X using Aqua graphics. Don't check for X11.
6294     :
6295 elif test "$_os" != "WINNT" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6296     AC_PATH_X
6297     AC_PATH_XTRA
6298     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
6300     if test "x$x_includes" = "x"; then
6301         x_includes="default_x_includes"
6302     fi
6303     if test "x$x_libraries" = "x"; then
6304         x_libraries="default_x_libraries"
6305     fi
6306     dnl The variables $x_libraries and $x_includes are set.
6307     if test -z "$x_libraries"; then
6308         AC_MSG_ERROR([No X libraries found]) # Exit
6309     fi
6310     if test -z "$x_includes"; then
6311         AC_MSG_ERROR([No X includes found]) # Exit
6312     fi
6313     CFLAGS="$CFLAGS $X_CFLAGS"
6314     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
6315     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
6316     dnl Check if the XauDisposeAuth symbol is provided by libXau.
6317     AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
6318 else
6319     x_includes="no_x_includes"
6320     x_libraries="no_x_libraries"
6322 if test -z "$x_includes"; then
6323     x_includes="no_x_includes"
6325 if test -z "$x_libraries"; then
6326     x_libraries="no_x_libraries"
6328 if test "$x_includes" = "default_x_includes"; then
6329     XINC="/usr/include"
6330 else
6331     XINC="$x_includes"
6333 AC_SUBST(XINC)
6334 if test "$x_libraries" = "default_x_libraries"; then
6335     XLIB=`$PKG_CONFIG --variable=libdir x11`
6336     if test "x$XLIB" = x; then
6337         XLIB="/usr/lib"
6338     fi
6339 else
6340     XLIB="$x_libraries"
6342 AC_SUBST(XLIB)
6343 AC_SUBST(XAU_LIBS)
6345 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6346     dnl ===================================================================
6347     dnl Check for Composite.h for Mozilla plugin
6348     dnl ===================================================================
6349     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
6350      [#include <X11/Intrinsic.h>])
6353 AC_MSG_CHECKING([whether to use internal X11 extensions headers])
6354 if test "$with_system_xextensions_headers" != "no"; then
6355     AC_MSG_RESULT([no])
6356 else
6357     AC_MSG_RESULT([yes])
6358     BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
6361 dnl ===================================================================
6362 dnl Check for system Xrender
6363 dnl ===================================================================
6364 AC_MSG_CHECKING([whether to use Xrender])
6365 if test "$test_xrender" = "yes"; then
6366     AC_MSG_RESULT([yes])
6367     AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
6368       [AC_MSG_ERROR(libXrender not found or functional)], [])
6369     AC_MSG_CHECKING([which Xrender headers to use])
6370     if test "$with_system_xextensions_headers" != "no"; then
6371         AC_MSG_RESULT([external])
6372         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
6373           [AC_MSG_ERROR(Xrender not found. install X)], [])
6374     else
6375         AC_MSG_RESULT([internal])
6376     fi
6379 dnl ===================================================================
6380 dnl Check for XRandr
6381 dnl ===================================================================
6382 AC_MSG_CHECKING([whether to enable RandR support])
6383 if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
6384     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
6385         XRANDR_DLOPEN="TRUE"
6386         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
6387     else
6388         AC_MSG_RESULT([yes])
6389         XRANDR_DLOPEN="FALSE"
6390         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
6391         if test "$ENABLE_RANDR" != "TRUE"; then
6392             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
6393                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
6394             XRANDR_CFLAGS=" "
6395             AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
6396               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
6397             XRANDR_LIBS="-lXrandr "
6398             ENABLE_RANDR="TRUE"
6399         fi
6400     fi
6401 else
6402     ENABLE_RANDR=""
6403     AC_MSG_RESULT([no])
6405 AC_SUBST(XRANDR_DLOPEN)
6406 AC_SUBST(XRANDR_CFLAGS)
6407 AC_SUBST(XRANDR_LIBS)
6408 AC_SUBST(ENABLE_RANDR)
6410 dnl ===================================================================
6411 dnl Check for building neon
6412 dnl ===================================================================
6413 AC_MSG_CHECKING([whether to use neon])
6414 if test "$enable_neon" = "no"; then
6415     AC_MSG_RESULT([no])
6416     DISABLE_NEON=TRUE
6417     AC_SUBST(DISABLE_NEON)
6418 else
6419     AC_MSG_RESULT([yes])
6420 dnl ===================================================================
6421 dnl Check for system neon
6422 dnl ===================================================================
6423 AC_MSG_CHECKING([which neon to use])
6424 if test "$with_system_neon" = "yes"; then
6425     AC_MSG_RESULT([external])
6426     PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
6427     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
6428     NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
6429     SYSTEM_NEON=YES
6430     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libtasn1-3.dll libgnutls-26.dll libneon-27.dll"
6431 else
6432     AC_MSG_RESULT([internal])
6433     SYSTEM_NEON=NO
6434     NEON_LIBS=-lneon
6435     NEON_CFLAGS=
6436     BUILD_TYPE="$BUILD_TYPE NEON"
6438 AC_SUBST(SYSTEM_NEON)
6439 AC_SUBST(NEON_VERSION)
6440 AC_SUBST(NEON_LIBS)
6441 AC_SUBST(NEON_CFLAGS)
6444 dnl ===================================================================
6445 dnl Check for system openssl
6446 dnl ===================================================================
6447 if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6448         "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
6449     with_system_openssl=yes
6451 AC_MSG_CHECKING([which libssl to use])
6452 if test "$with_system_openssl" = "yes"; then
6453     AC_MSG_RESULT([external])
6454     # Mac OS builds should get out without extra stuff is the Mac porters'
6455     # wish. And pkg-config is although Xcode ships a .pc for openssl
6456     if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6457             "$_os" = "DragonFly"; then
6458         OPENSSL_CFLAGS=
6459         OPENSSL_LIBS="-lssl -lcrypto"
6460     else
6461         PKG_CHECK_MODULES( OPENSSL, openssl )
6462     fi
6463     SYSTEM_OPENSSL=YES
6464     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libssl-8.dll libcrypto-8.dll"
6465 else
6466     AC_MSG_RESULT([internal])
6467     SYSTEM_OPENSSL=NO
6468     BUILD_TYPE="$BUILD_TYPE OPENSSL"
6470 AC_SUBST(SYSTEM_OPENSSL)
6471 AC_SUBST(OPENSSL_CFLAGS)
6472 AC_SUBST(OPENSSL_LIBS)
6474 dnl ===================================================================
6475 dnl Check for system redland
6476 dnl ===================================================================
6477 AC_MSG_CHECKING([which redland library to use])
6478 if test "$with_system_redland" = "yes"; then
6479     AC_MSG_RESULT([external])
6480     SYSTEM_REDLAND=YES
6481     dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
6482     PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
6483     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libraptor-1.dll librasqal-2.dll libsqlite3-0.dll librdf-0.dll"
6484 else
6485     AC_MSG_RESULT([internal])
6486     BUILD_TYPE="$BUILD_TYPE REDLAND"
6487     SYSTEM_REDLAND=NO
6489 AC_SUBST(SYSTEM_REDLAND)
6490 AC_SUBST(REDLAND_CFLAGS)
6491 AC_SUBST(REDLAND_LIBS)
6493 dnl ===================================================================
6494 dnl Check for system hunspell
6495 dnl ===================================================================
6496 AC_MSG_CHECKING([which libhunspell to use])
6497 if test "$with_system_hunspell" = "yes"; then
6498     AC_MSG_RESULT([external])
6499     SYSTEM_HUNSPELL=YES
6500     AC_LANG_PUSH([C++])
6501     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
6502     if test "$HUNSPELL_PC" != "TRUE"; then
6503         AC_CHECK_HEADER(hunspell.hxx, [],
6504             [
6505             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
6506             [AC_MSG_ERROR(hunspell headers not found.)], [])
6507             ], [])
6508         AC_CHECK_LIB(hunspell, main, [],
6509            [ AC_MSG_ERROR(hunspell library not found.) ], [])
6510         HUNSPELL_LIBS=-lhunspell
6511     fi
6512     AC_LANG_POP([C++])
6513     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhunspell-1.3-0.dll"
6514 else
6515     AC_MSG_RESULT([internal])
6516     SYSTEM_HUNSPELL=NO
6517     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
6519 AC_SUBST(SYSTEM_HUNSPELL)
6520 AC_SUBST(HUNSPELL_CFLAGS)
6521 AC_SUBST(HUNSPELL_LIBS)
6523 dnl ===================================================================
6524 dnl Checking for altlinuxhyph
6525 dnl ===================================================================
6526 AC_MSG_CHECKING([which altlinuxhyph to use])
6527 if test "$with_system_altlinuxhyph" = "yes"; then
6528     AC_MSG_RESULT([external])
6529     SYSTEM_HYPH=YES
6530     AC_CHECK_HEADER(hyphen.h, [],
6531        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
6532     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
6533        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
6534        [#include <hyphen.h>])
6535     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
6536         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6537     if test -z "$HYPHEN_LIB"; then
6538         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
6539            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6540     fi
6541     if test -z "$HYPHEN_LIB"; then
6542         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
6543            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6544     fi
6545     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhyphen-0.dll"
6546 else
6547     AC_MSG_RESULT([internal])
6548     SYSTEM_HYPH=NO
6549     BUILD_TYPE="$BUILD_TYPE HYPHEN"
6551 AC_SUBST(SYSTEM_HYPH)
6552 AC_SUBST(HYPHEN_LIB)
6554 dnl ===================================================================
6555 dnl Checking for mythes
6556 dnl ===================================================================
6557 AC_MSG_CHECKING([which mythes to use])
6558 if test "$with_system_mythes" = "yes"; then
6559     AC_MSG_RESULT([external])
6560     SYSTEM_MYTHES=YES
6561     AC_LANG_PUSH([C++])
6562     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
6563     if test "$MYTHES_PKGCONFIG" = "no"; then
6564         AC_CHECK_HEADER(mythes.hxx, [],
6565             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
6566         AC_CHECK_LIB(mythes-1.2, main, [],
6567             [ MYTHES_FOUND=no], [])
6568     if test "$MYTHES_FOUND" = "no"; then
6569         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
6570                 [ MYTHES_FOUND=no], [])
6571     fi
6572     if test "$MYTHES_FOUND" = "no"; then
6573         AC_MSG_ERROR([mythes library not found!.])
6574     fi
6575     fi
6576     AC_LANG_POP([C++])
6577     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libmythes-1.2-0.dll"
6578 else
6579     AC_MSG_RESULT([internal])
6580     SYSTEM_MYTHES=NO
6581     BUILD_TYPE="$BUILD_TYPE MYTHES"
6583 AC_SUBST(SYSTEM_MYTHES)
6584 AC_SUBST(MYTHES_CFLAGS)
6585 AC_SUBST(MYTHES_LIBS)
6587 dnl ===================================================================
6588 dnl Checking for lpsolve
6589 dnl ===================================================================
6590 AC_MSG_CHECKING([which lpsolve to use])
6591 if test "$with_system_lpsolve" = "yes"; then
6592     AC_MSG_RESULT([external])
6593     SYSTEM_LPSOLVE=YES
6594     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
6595        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
6596     # some systems need this. Like Ubuntu....
6597     AC_CHECK_LIB(m, floor)
6598     AC_CHECK_LIB(dl, dlopen)
6599     AC_CHECK_LIB(lpsolve55, make_lp, ,
6600         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
6601     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS lpsolve55.dll"
6602 else
6603     AC_MSG_RESULT([internal])
6604     SYSTEM_LPSOLVE=NO
6605     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
6607 AC_SUBST(SYSTEM_LPSOLVE)
6609 dnl ===================================================================
6610 dnl Checking for libexttextcat
6611 dnl ===================================================================
6612 AC_MSG_CHECKING([which libexttextcat to use])
6613 if test "$with_system_libexttextcat" = "yes"; then
6614     AC_MSG_RESULT([external])
6615     SYSTEM_LIBEXTTEXTCAT=YES
6616     PKG_CHECK_MODULES([LIBEXTTEXTCAT], [libexttextcat >= 3.1.1])
6617     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
6618 else
6619     AC_MSG_RESULT([internal])
6620     SYSTEM_LIBEXTTEXTCAT=NO
6621     BUILD_TYPE="$BUILD_TYPE LIBEXTTEXTCAT"
6623 AC_SUBST(SYSTEM_LIBEXTTEXTCAT)
6624 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
6625 AC_SUBST(LIBEXTTEXTCAT_CFLAGS)
6626 AC_SUBST(LIBEXTTEXTCAT_LIBS)
6628 dnl ***************************************
6629 dnl testing libc version for Linux...
6630 dnl ***************************************
6631 if test "$_os" = "Linux"; then
6632     AC_MSG_CHECKING([whether libc is >= 2.1.1])
6633     exec 6>/dev/null # no output
6634     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
6635     exec 6>&1 # output on again
6636     if test "$HAVE_LIBC"; then
6637         AC_MSG_RESULT([yes])
6638     else
6639         AC_MSG_ERROR([no, upgrade libc])
6640     fi
6643 if test "$_os" != "WINNT"; then
6644     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
6645     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
6646     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
6647         SYSTEM_LIBC=YES
6648     fi
6649 else
6650     HAVE_GETOPT=NO
6651     HAVE_READDIR_R=NO
6652     SYSTEM_LIBC=YES
6654 AC_SUBST(HAVE_GETOPT)
6655 AC_SUBST(HAVE_READDIR_R)
6656 AC_SUBST(SYSTEM_LIBC)
6658 dnl =========================================
6659 dnl Check for the Windows  SDK.
6660 dnl =========================================
6661 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
6662 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
6663 if test "$_os" = "WINNT"; then
6664     AC_MSG_CHECKING([for Windows SDK])
6665     if test "$build_os" = "cygwin"; then
6666         if test -z "$with_windows_sdk_home"; then
6667             # This first line will detect a February 2003 Microsoft Platform SDK
6668             WINDOWS_SDK_HOME=`./oowintool --windows-sdk-home`
6669             # But there might be also an April 2005 PSDK, unfortunately MS changed
6670             # the registry entry. (we prefer the old version!?)
6671             if test -z "$WINDOWS_SDK_HOME"; then
6672                 WINDOWS_SDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
6673             fi
6674             # normalize if found
6675             if test -n "$WINDOWS_SDK_HOME"; then
6676                 WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6677                 WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6678             fi
6679         else
6680             WINDOWS_SDK_HOME=`cygpath -u "$with_windows_sdk_home"`
6681         fi
6682     fi
6683     if test -n "$WINDOWS_SDK_HOME"; then
6684         # Remove a possible trailing backslash
6685         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6686         # Problem with current PSDK (iz 49865)
6687         # (What "current" does that mean?)
6688         if test -f "$WINDOWS_SDK_HOME/Lib/libcp.lib"; then
6689             AC_MSG_ERROR([
6690 Some modules do not build correctly with MS Platform SDK - April 2005
6691 Edition if the library ($WINDOWS_SDK_HOME/Lib/libcp.lib) is found.
6692 Remove/rename/backup that file and restart configure. Details about this
6693 problem can be found in issue 49856.])
6694         fi
6696         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6697              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6698              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6699             HAVE_PSDK_H="yes"
6700         else
6701             HAVE_PSDK_H="no"
6702         fi
6703         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6704             HAVE_PSDK_LIB="yes"
6705         else
6706             HAVE_PSDK_LIB="no"
6707         fi
6709         if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
6710             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6711 the  Windows SDK are installed.])
6712         fi
6714         if test ! -x "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
6715              -o ! -x "$WINDOWS_SDK_HOME/bin/msidb.exe" \
6716              -o ! -x "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
6717              -o ! -x "$WINDOWS_SDK_HOME/bin/msitran.exe" ; then
6718             AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
6719         fi
6720     fi
6722     if test -z "$WINDOWS_SDK_HOME"; then
6723         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6724     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
6725         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
6726     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
6727         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
6728     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
6729         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
6730     else
6731         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6732     fi
6734 AC_SUBST(WINDOWS_SDK_HOME)
6736 dnl =========================================
6737 dnl Check for the Microsoft DirectX SDK.
6738 dnl =========================================
6739 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
6740     AC_MSG_CHECKING([for DirectX SDK])
6741     if test "$build_os" = "cygwin"; then
6742         if test -z "$with_directx_home"; then
6743             dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
6744             if test -n "$DXSDK_DIR"; then
6745                 DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
6746                 DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
6747             fi
6748             # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
6749             # the "DirectX SDK not found" error later
6750         else
6751             DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
6752         fi
6753         # Remove a possible trailing backslash
6754         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
6755     elif test -n "$with_directx_home"; then
6756         DIRECTXSDK_HOME="$with_directx_home"
6757     fi
6759     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
6760         HAVE_DIRECTXSDK_H="yes"
6761     else
6762         HAVE_DIRECTXSDK_H="no"
6763     fi
6765     # MS changed the location of the libraries with Dec 2004 DirectX SDK
6766     if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
6767         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
6768     else
6769         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
6770     fi
6772     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
6773         HAVE_DIRECTXSDK_LIB="yes"
6774     else
6775         HAVE_DIRECTXSDK_LIB="no"
6776     fi
6778     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
6779         AC_MSG_RESULT([found])
6780     else
6781         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6782     fi
6784 AC_SUBST(DIRECTXSDK_HOME)
6785 AC_SUBST(DIRECTXSDK_LIB)
6787 dnl ***************************************
6788 dnl Checking for bison and flex
6789 dnl ***************************************
6790 AC_PATH_PROG(BISON, bison)
6791 ANCIENT_BISON="NO"
6792 if test -z "$BISON"; then
6793     AC_MSG_ERROR([no bison found in \$PATH, install it])
6794 else
6795     AC_MSG_CHECKING([the bison version])
6796     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
6797     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
6798     # Accept newer than 1.875 or older(equal) than 1.75
6799     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
6800         if test "$_bison_version" = "1.875" ; then
6801             AC_MSG_WARN([suspect ($BISON $_bison_version)])
6802             echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
6803         else
6804             AC_MSG_RESULT([checked ($BISON $_bison_version)])
6805         fi
6806     else
6807         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
6808     fi
6809     if test "$_bison_longver" -lt 2000; then
6810         ANCIENT_BISON="YES"
6811     fi
6813 AC_SUBST(ANCIENT_BISON)
6815 AC_PATH_PROG(FLEX, flex)
6816 if test -z "$FLEX"; then
6817     AC_MSG_ERROR([no flex found in \$PATH, install it])
6819 dnl ***************************************
6820 dnl Checking for patch
6821 dnl ***************************************
6822 AC_PATH_PROG(PATCH, patch)
6823 if test -z "$PATCH"; then
6824     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
6827 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
6828 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
6829     if test -z "$with_gnu_patch"; then
6830         GNUPATCH=$PATCH
6831     else
6832         if test -x "$with_gnu_patch"; then
6833             GNUPATCH=$with_gnu_patch
6834         else
6835             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
6836         fi
6837     fi
6839     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
6840     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
6841         AC_MSG_RESULT([yes])
6842     else
6843         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
6844     fi
6847 dnl We also need to check for --with-gnu-cp
6849 if test -z "$with_gnu_cp"; then
6850     # check the place where the good stuff is hidden on Solaris...
6851     if test -x /usr/gnu/bin/cp; then
6852         GNUCP=/usr/gnu/bin/cp
6853     else
6854         AC_PATH_PROGS(GNUCP, gnucp cp)
6855     fi
6856     if test -z $GNUCP; then
6857         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
6858     fi
6859 else
6860     if test -x "$with_gnu_cp"; then
6861         GNUCP=$with_gnu_cp
6862     else
6863         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
6864     fi
6867 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
6868 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
6869     AC_MSG_RESULT([yes])
6870 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
6871     AC_MSG_RESULT([yes])
6872 else
6873     case "$build_os" in
6874     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
6875         GNUCP=''
6876         AC_MSG_RESULT([no gnucp found - using the system's cp command])
6877         ;;
6878     *)
6879         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
6880         ;;
6881     esac
6884 AC_SUBST(GNUPATCH)
6885 AC_SUBST(GNUCP)
6887 dnl ***************************************
6888 dnl testing assembler path
6889 dnl ***************************************
6890 ML_EXE=""
6891 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
6892     if test "$CL_X64" = ""; then
6893         assembler=ml.exe
6894         assembler_bin=bin
6895     else
6896         assembler=ml64.exe
6897         assembler_bin=bin/amd64
6898     fi
6899     if test -n "$with_asm_home"; then
6900         with_asm_home=`cygpath -u "$with_asm_home"`
6901     fi
6902     if test -x "$with_asm_home/$assembler"; then
6903         AC_MSG_CHECKING([$assembler assembler path])
6904         AC_MSG_RESULT([$with_asm_home/$assembler])
6905         ML_EXE="$with_asm_home/$assembler"
6906     else
6907         AC_PATH_PROG(ML_EXE, $assembler)
6908         if test -z "$ML_EXE"; then
6909             AC_MSG_CHECKING([$with_cl_home/$assembler_bin/$assembler])
6910             if test -x "$with_cl_home/$assembler_bin/$assembler"; then
6911                 with_asm_home=$with_cl_home/$assembler_bin
6912                 AC_MSG_RESULT([found])
6913                 ML_EXE="$with_cl_home/$assembler_bin/$assembler"
6914             else
6915                 AC_MSG_ERROR([Configure did not find $assembler assembler.])
6916             fi
6917         else
6918             with_asm_home="ASM_IN_PATH"
6919             ML_EXE="$assembler"
6920         fi
6921     fi
6922 else
6923     with_asm_home="NO_ASM_HOME"
6925 ASM_HOME="$with_asm_home"
6926 AC_SUBST(ASM_HOME)
6927 AC_SUBST(ML_EXE)
6929 dnl ===================================================================
6930 dnl We need zip and unzip
6931 dnl ===================================================================
6932 AC_PATH_PROG(ZIP, zip)
6933 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
6934 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
6935     AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
6938 AC_PATH_PROG(UNZIP, unzip)
6939 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
6941 dnl ===================================================================
6942 dnl Zip must be a specific type for different build types.
6943 dnl ===================================================================
6944 if test $build_os = cygwin; then
6945     if test -n "`$ZIP -h | grep -i WinNT`" ; then
6946         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
6947     fi
6950 dnl ===================================================================
6951 dnl Test which vclplugs have to be built.
6952 dnl ===================================================================
6953 R=""
6954 GTK3_CFLAGS=""
6955 GTK3_LIBS=""
6956 ENABLE_GTK3=""
6957 if test "x$enable_gtk3" = "xyes"; then
6958     if test "$with_system_cairo" != yes; then
6959         echo "System cairo required for gtk3 support, please use --with-system-cairo"
6960     fi
6961     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 gtk+-unix-print-3.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
6962     if test "x$ENABLE_GTK3" = "xTRUE"; then
6963         R="gtk3"
6964     else
6965         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
6966     fi
6968 AC_SUBST(GTK3_LIBS)
6969 AC_SUBST(GTK3_CFLAGS)
6970 AC_SUBST(ENABLE_GTK3)
6972 AC_MSG_CHECKING([which VCLplugs shall be built])
6973 ENABLE_GTK=""
6974 if test "x$enable_gtk" = "xyes"; then
6975     ENABLE_GTK="TRUE"
6976     R="gtk $R"
6978 AC_SUBST(ENABLE_GTK)
6980 ENABLE_KDE=""
6981 if test "x$enable_kde" = "xyes"; then
6982     ENABLE_KDE="TRUE"
6983     R="$R kde"
6985 AC_SUBST(ENABLE_KDE)
6987 ENABLE_KDE4=""
6988 if test "x$enable_kde4" = "xyes"; then
6989     ENABLE_KDE4="TRUE"
6990     R="$R kde4"
6992 AC_SUBST(ENABLE_KDE4)
6994 if test -z "$R"; then
6995     AC_MSG_RESULT([none])
6996 else
6997     AC_MSG_RESULT([$R])
7000 dnl ===================================================================
7001 dnl GCONF check
7002 dnl ===================================================================
7004 ENABLE_GCONF=""
7005 AC_MSG_CHECKING([whether to enable GConf support])
7006 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gconf" = "yes"; then
7007     ENABLE_GCONF="TRUE"
7008     AC_MSG_RESULT([yes])
7009     PKG_CHECK_MODULES( GCONF, gconf-2.0 ORBit-2.0 )
7010 else
7011     AC_MSG_RESULT([no])
7013 AC_SUBST(ENABLE_GCONF)
7015 dnl ===================================================================
7016 dnl Gnome VFS check
7017 dnl ===================================================================
7019 ENABLE_GNOMEVFS=""
7020 AC_MSG_CHECKING([whether to enable GNOME VFS support])
7021 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
7022     ENABLE_GNOMEVFS="TRUE"
7023     AC_MSG_RESULT([yes])
7024     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
7025 else
7026     AC_MSG_RESULT([no])
7028 AC_SUBST(ENABLE_GNOMEVFS)
7030 dnl ===================================================================
7031 dnl Check whether the gtk 2.0 libraries are available.
7032 dnl ===================================================================
7034 GTK_CFLAGS=""
7035 GTK_LIBS=""
7036 ENABLE_SYSTRAY_GTK=""
7037 ENABLE_DBUS=""
7038 DBUS_CFLAGS=""
7039 DBUS_LIBS=""
7040 if test  "$test_gtk" = "yes"; then
7042     if test "$ENABLE_GTK" = "TRUE" ; then
7043         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]))
7044         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]))
7045         BUILD_TYPE="$BUILD_TYPE GTK"
7047         if test "x$enable_systray" = "xyes"; then
7048             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
7049                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
7050                             [ ENABLE_SYSTRAY_GTK="" ])
7051         fi
7053         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
7054         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
7055                           [ENABLE_GTK_PRINT="TRUE"],
7056                           [ENABLE_GTK_PRINT=""])
7058         AC_MSG_CHECKING([whether to enable DBUS support])
7059         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
7060             ENABLE_DBUS="TRUE"
7061             AC_MSG_RESULT([yes])
7062             PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
7063         else
7064             AC_MSG_RESULT([no])
7065         fi
7067         AC_MSG_CHECKING([whether to enable GIO support])
7068         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
7069             if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
7070                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
7071             fi
7072             ENABLE_GIO="TRUE"
7073             AC_MSG_RESULT([yes])
7074             PKG_CHECK_MODULES( GIO, gio-2.0 )
7075         else
7076             AC_MSG_RESULT([no])
7077         fi
7078     fi
7080 AC_SUBST(ENABLE_GIO)
7081 AC_SUBST(ENABLE_DBUS)
7082 AC_SUBST(ENABLE_SYSTRAY_GTK)
7083 AC_SUBST(GTK_CFLAGS)
7084 AC_SUBST(GTK_LIBS)
7085 AC_SUBST(GTHREAD_CFLAGS)
7086 AC_SUBST(GTHREAD_LIBS)
7087 AC_SUBST(DBUS_CFLAGS)
7088 AC_SUBST(DBUS_LIBS)
7089 AC_SUBST([ENABLE_GTK_PRINT])
7090 AC_SUBST([GTK_PRINT_CFLAGS])
7091 AC_SUBST([GTK_PRINT_LIBS])
7093 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
7094 AC_SUBST(LIBPNG_LIBS)
7095 AC_SUBST(LIBPNG_CFLAGS)
7097 AC_MSG_CHECKING([whether to enable libpng linking in quickstarter])
7098 if test "x$enable_unix_qstart_libpng" != "xno"; then
7099     AC_MSG_RESULT([yes])
7100 else
7101     AC_MSG_RESULT([no])
7102     ENABLE_QUICKSTART_LIBPNG=""
7104 AC_SUBST(ENABLE_QUICKSTART_LIBPNG)
7106 SPLIT_APP_MODULES=""
7107 if test "$enable_split_app_modules" = "yes"; then
7108     SPLIT_APP_MODULES="YES"
7110 AC_SUBST(SPLIT_APP_MODULES)
7112 SPLIT_OPT_FEATURES=""
7113 if test "$enable_split_opt_features" = "yes"; then
7114     SPLIT_OPT_FEATURES="YES"
7116 AC_SUBST(SPLIT_OPT_FEATURES)
7118 ENABLE_CAIRO_CANVAS="FALSE"
7119 if test "$enable_cairo_canvas" = "yes" ; then
7120    ENABLE_CAIRO_CANVAS="TRUE"
7122 AC_SUBST(ENABLE_CAIRO_CANVAS)
7124 dnl ===================================================================
7125 dnl Check whether the GStreamer libraries are available.
7126 dnl ===================================================================
7128 ENABLE_GSTREAMER=""
7130 if test  "$build_gstreamer" = "yes"; then
7132     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
7133     if test "x$enable_gstreamer" != "xno" ; then
7134         ENABLE_GSTREAMER="TRUE"
7135         AC_MSG_RESULT([yes])
7136         PKG_CHECK_MODULES( GSTREAMER, gstreamer-0.10 gstreamer-plugins-base-0.10 )
7137     else
7138         AC_MSG_RESULT([no])
7139     fi
7142 AC_SUBST(ENABLE_GSTREAMER)
7144 dnl ===================================================================
7145 dnl Check whether the OpenGL libraries are available
7146 dnl ===================================================================
7148 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
7149 ENABLE_OPENGL=
7151 if test "$_os" = "Darwin" ; then
7152     # We use frameworks on Mac OS X, no need for detail checks
7153     ENABLE_OPENGL=TRUE
7154     SYSTEM_MESA_HEADERS=YES
7155     AC_MSG_RESULT([yes])
7156 else
7157     if test "x$enable_opengl" != "xno" ; then
7158         if test "$_os" != "WINNT"; then
7159             save_LDFLAGS=$LDFLAGS
7160             LDFLAGS="$LDFLAGS -lm"
7161             AC_MSG_RESULT([yes])
7162             AC_CHECK_LIB(GL, main, [],
7163                       [AC_MSG_ERROR(libGL not installed or functional)], [])
7164             AC_CHECK_LIB(GLU, main, [],
7165                       [AC_MSG_ERROR(libGLU not installed or functional)], [])
7166             ENABLE_OPENGL=TRUE
7167             LDFLAGS=$save_LDFLAGS
7169             dnl ===================================================================
7170             dnl Check for system Mesa
7171             dnl ===================================================================
7172             AC_MSG_CHECKING([which Mesa headers to use])
7173             if test "$with_system_mesa_headers" = "yes"; then
7174                 AC_MSG_RESULT([external])
7175                 SYSTEM_MESA_HEADERS=YES
7176                 AC_LANG_PUSH(C)
7177                 AC_CHECK_HEADER(GL/glxext.h, [],
7178                    [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
7179                 AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
7180                 AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
7181                 AC_LANG_POP(C)
7182             else
7183                 AC_MSG_RESULT([internal])
7184                 SYSTEM_MESA_HEADERS=NO
7185                 BUILD_TYPE="$BUILD_TYPE MESA"
7186             fi
7187         else
7188             AC_MSG_RESULT([not on Windows])
7189         fi
7190     else
7191        AC_MSG_RESULT([no])
7192     fi
7195 AC_SUBST(SYSTEM_MESA_HEADERS)
7196 AC_SUBST(ENABLE_OPENGL)
7198 # presenter minimizer extension?
7199 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
7200 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
7201    AC_MSG_RESULT([yes])
7202    ENABLE_MINIMIZER=YES
7203 else
7204    AC_MSG_RESULT([no])
7205    ENABLE_MINIMIZER=NO
7206    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
7208 AC_SUBST(ENABLE_MINIMIZER)
7210 # presenter console extension?
7211 AC_MSG_CHECKING([whether to build the Presenter Console extension])
7212 if test "x$enable_ext_presenter_console" != "xno" -a "x$enable_extension_integration" != "xno"; then
7213    AC_MSG_RESULT([yes])
7214    ENABLE_PRESENTER_SCREEN=YES
7215 else
7216    AC_MSG_RESULT([no])
7217    ENABLE_PRESENTER_SCREEN=NO
7218    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PRESENTER_SCREEN"
7220 AC_SUBST(ENABLE_PRESENTER_SCREEN)
7222 # pdf import extension?
7223 AC_MSG_CHECKING([whether to build the PDF Import extension])
7224 if test "x$enable_ext_pdfimport" != "xno" -a "x$enable_extension_integration" != "xno"; then
7225   AC_MSG_RESULT([yes])
7226   ENABLE_PDFIMPORT=YES
7228   dnl ===================================================================
7229   dnl Check for system poppler
7230   dnl ===================================================================
7231   AC_MSG_CHECKING([which pdf backend to use])
7232   if test "$with_system_poppler" = "yes"; then
7233       AC_MSG_RESULT([external])
7234       SYSTEM_POPPLER=YES
7235       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
7236       AC_LANG_PUSH([C++])
7237       save_CXXFLAGS=$CXXFLAGS
7238       save_CPPFLAGS=$CPPFLAGS
7239       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
7240       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
7241       AC_CHECK_HEADER([cpp/poppler-version.h], [],
7242                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
7243       CXXFLAGS=$save_CXXFLAGS
7244       CPPFLAGS=$save_CPPFLAGS
7245       AC_LANG_POP([C++])
7246   else
7247       AC_MSG_RESULT([internal])
7248       SYSTEM_POPPLER=NO
7249       BUILD_TYPE="$BUILD_TYPE XPDF"
7250   fi
7251 else
7252   AC_MSG_RESULT([no])
7253   ENABLE_PDFIMPORT=NO
7254   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PDFIMPORT"
7256 AC_SUBST(ENABLE_PDFIMPORT)
7257 AC_SUBST(SYSTEM_POPPLER)
7258 AC_SUBST(POPPLER_CFLAGS)
7259 AC_SUBST(POPPLER_LIBS)
7262 if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
7263    AC_MSG_CHECKING([for sdext module])
7264    BUILD_TYPE="$BUILD_TYPE SDEXT"
7267 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
7268 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7269   AC_MSG_RESULT([yes])
7270   AC_MSG_CHECKING([for swext module])
7271   ENABLE_MEDIAWIKI=YES
7272   BUILD_TYPE="$BUILD_TYPE SWEXT"
7273   if test  "x$with_java" = "xno"; then
7274     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
7275   fi
7276 else
7277   AC_MSG_RESULT([no])
7278   ENABLE_MEDIAWIKI=NO
7279   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
7281 AC_SUBST(ENABLE_MEDIAWIKI)
7283 if test "$ENABLE_MEDIAWIKI" = "YES"; then
7284     AC_MSG_CHECKING([which Servlet API Jar to use])
7285     if test "$with_system_servlet_api" = "yes"; then
7286         AC_MSG_RESULT([external])
7287         SYSTEM_SERVLETAPI=YES
7288         if test -z "$SERVLETAPI_JAR"; then
7289             SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
7290         fi
7291         AC_CHECK_FILE($SERVLETAPI_JAR, [],
7292               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
7293     else
7294         AC_MSG_RESULT([internal])
7295         SYSTEM_SERVLETAPI=NO
7296         BUILD_TYPE="$BUILD_TYPE TOMCAT"
7297     fi
7299 AC_SUBST(SYSTEM_SERVLETAPI)
7300 AC_SUBST(SERVLETAPI_JAR)
7302 AC_MSG_CHECKING([whether to build the Report Builder extension])
7303 if test "$enable_ext_report_builder" != "no" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7304     AC_MSG_RESULT([yes])
7305     ENABLE_REPORTBUILDER=YES
7306     AC_MSG_CHECKING([for reportbuilder module])
7307     AC_MSG_CHECKING([which jfreereport libs to use])
7308     if test "$with_system_jfreereport" = "yes"; then
7309         SYSTEM_JFREEREPORT=YES
7310         AC_MSG_RESULT([external])
7311         if test -z $SAC_JAR; then
7312             SAC_JAR=/usr/share/java/sac.jar
7313         fi
7314         AC_CHECK_FILE($SAC_JAR, [],
7315              [AC_MSG_ERROR(sac.jar not found.)], [])
7317         if test -z $LIBXML_JAR; then
7318             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
7319                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
7320                 [
7321                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
7322                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
7323                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
7324                     )
7325                 ]
7326             )
7327         else
7328             AC_CHECK_FILE($LIBXML_JAR, [],
7329                  [AC_MSG_ERROR(libxml.jar not found.)], [])
7330         fi
7332         if test -z $FLUTE_JAR; then
7333             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
7334                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
7335                 [
7336                     AC_CHECK_FILE(/usr/share/java/flute.jar,
7337                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
7338                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
7339                     )
7340                 ]
7341             )
7342         else
7343             AC_CHECK_FILE($FLUTE_JAR, [],
7344                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
7345         fi
7347         if test -z $JFREEREPORT_JAR; then
7348             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
7349                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
7350                 [
7351                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
7352                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
7353                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
7354                     )
7355                 ]
7356             )
7357         else
7358             AC_CHECK_FILE($JFREEREPORT_JAR, [],
7359                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
7360         fi
7362         if test -z $LIBLAYOUT_JAR; then
7363             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
7364                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
7365                 [
7366                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
7367                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
7368                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
7369                     )
7370                 ]
7371             )
7372         else
7373             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
7374                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
7375         fi
7377         if test -z $LIBLOADER_JAR; then
7378             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
7379                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
7380                 [
7381                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
7382                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
7383                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
7384                     )
7385                 ]
7386             )
7387         else
7388             AC_CHECK_FILE($LIBLOADER_JAR, [],
7389                 [AC_MSG_ERROR(libloader.jar not found.)], [])
7390         fi
7392         if test -z $LIBFORMULA_JAR; then
7393             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
7394                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
7395                  [
7396                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
7397                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
7398                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
7399                      )
7400                  ]
7401             )
7402         else
7403             AC_CHECK_FILE($LIBFORMULA_JAR, [],
7404                 [AC_MSG_ERROR(libformula.jar not found.)], [])
7405         fi
7407         if test -z $LIBREPOSITORY_JAR; then
7408             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
7409                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
7410                 [
7411                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
7412                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
7413                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
7414                     )
7415                 ]
7416             )
7417         else
7418             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
7419                 [AC_MSG_ERROR(librepository.jar not found.)], [])
7420         fi
7422         if test -z $LIBFONTS_JAR; then
7423             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
7424                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
7425                 [
7426                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
7427                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
7428                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
7429                     )
7430                 ]
7431             )
7432         else
7433             AC_CHECK_FILE($LIBFONTS_JAR, [],
7434                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
7435         fi
7437         if test -z $LIBSERIALIZER_JAR; then
7438             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
7439                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
7440                 [
7441                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
7442                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
7443                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
7444                     )
7445                 ]
7446             )
7447         else
7448             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
7449                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
7450         fi
7453         if test -z $LIBBASE_JAR; then
7454             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
7455                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
7456                 [
7457                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
7458                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
7459                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
7460                     )
7461                 ]
7462             )
7463         else
7464             AC_CHECK_FILE($LIBBASE_JAR, [],
7465                 [AC_MSG_ERROR(libbase.jar not found.)], [])
7466         fi
7468     else
7469         AC_MSG_RESULT([internal])
7470         AC_MSG_CHECKING([for jfreereport module])
7471         SYSTEM_JFREEREPORT=NO
7472         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
7473     fi
7474     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
7475 else
7476     AC_MSG_RESULT([no])
7477     ENABLE_REPORTBUILDER=NO
7478     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_REPORTDESIGN"
7479     SYSTEM_JFREEREPORT=NO
7481 AC_SUBST(ENABLE_REPORTBUILDER)
7482 AC_SUBST(SYSTEM_JFREEREPORT)
7483 AC_SUBST(SAC_JAR)
7484 AC_SUBST(LIBXML_JAR)
7485 AC_SUBST(FLUTE_JAR)
7486 AC_SUBST(JFREEREPORT_JAR)
7487 AC_SUBST(LIBBASE_JAR)
7488 AC_SUBST(LIBLAYOUT_JAR)
7489 AC_SUBST(LIBLOADER_JAR)
7490 AC_SUBST(LIBFORMULA_JAR)
7491 AC_SUBST(LIBREPOSITORY_JAR)
7492 AC_SUBST(LIBFONTS_JAR)
7493 AC_SUBST(LIBSERIALIZER_JAR)
7495 # this has to be here because both the Wiki Publisher and the SRB use
7496 # commons-logging
7497 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7498     AC_MSG_CHECKING([which Apache commons-* libs to use])
7499     if test "$with_system_apache_commons" = "yes"; then
7500         SYSTEM_APACHE_COMMONS=YES
7501         AC_MSG_RESULT([external])
7502         if test "$ENABLE_MEDIAWIKI" = "YES"; then
7503             if test -z $COMMONS_CODEC_JAR; then
7504                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
7505                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
7506                     [
7507                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
7508                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
7509                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
7510                         )
7511                     ]
7512                 )
7513             else
7514                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
7515                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
7516             fi
7518             if test -z $COMMONS_LANG_JAR; then
7519                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
7520                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
7521                     [
7522                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
7523                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
7524                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
7525                             )
7526                     ]
7527                 )
7528             else
7529                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
7530                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
7531             fi
7533             if test -z $COMMONS_HTTPCLIENT_JAR; then
7534                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
7535                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
7536                     [
7537                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
7538                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
7539                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
7540                         )
7541                     ]
7542                 )
7543             else
7544                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
7545                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
7546             fi
7547         fi
7548         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7549             if test -z $COMMONS_LOGGING_JAR; then
7550                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
7551                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
7552                    [
7553                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
7554                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
7555                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
7556                         )
7557                     ]
7558                 )
7559             else
7560                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
7561                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
7562             fi
7563         fi
7564     else
7565         AC_MSG_RESULT([internal])
7566         SYSTEM_APACHE_COMMONS=NO
7567         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
7568     fi
7570 AC_SUBST(SYSTEM_APACHE_COMMONS)
7571 AC_SUBST(COMMONS_CODEC_JAR)
7572 AC_SUBST(COMMONS_LANG_JAR)
7573 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
7574 AC_SUBST(COMMONS_LOGGING_JAR)
7576 # scripting provider for BeanShell extension?
7577 AC_MSG_CHECKING([whether to build extension for support of scripts in BeanShell])
7578 if test "x$enable_ext_scripting_beanshell" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
7579    AC_MSG_RESULT([yes])
7580    ENABLE_SCRIPTING_BEANSHELL=YES
7581 else
7582    AC_MSG_RESULT([no])
7583    ENABLE_SCRIPTING_BEANSHELL=NO
7584    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_BEANSHELL"
7586 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
7588 # scripting provider for JavaScript extension?
7589 AC_MSG_CHECKING([whether to build extension for support of scripts in JavaScript])
7590 if test "x$enable_ext_scripting_javascript" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
7591    AC_MSG_RESULT([yes])
7592    ENABLE_SCRIPTING_JAVASCRIPT=YES
7593 else
7594    AC_MSG_RESULT([no])
7595    ENABLE_SCRIPTING_JAVASCRIPT=NO
7596    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_JAVASCRIPT"
7598 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
7600 dnl Scripting provider for Python extension?
7601 dnl We always provide this unless we have disabled Python completely
7602 if test $enable_python = no; then
7603     ENABLE_SCRIPTING_PYTHON=NO
7604 else
7605     ENABLE_SCRIPTING_PYTHON=YES
7607 AC_SUBST(ENABLE_SCRIPTING_PYTHON)
7609 supports_multilib=
7610 case "$host_cpu" in
7611 x86_64 | powerpc64 | s390x)
7612     if test "$SIZEOF_LONG" = "8"; then
7613         supports_multilib="yes"
7614     fi
7615     ;;
7617     ;;
7618 esac
7620 dnl ===================================================================
7621 dnl Check whether the Qt3 and KDE3 libraries are available.
7622 dnl ===================================================================
7624 KDE_CFLAGS=""
7625 KDE_LIBS=""
7626 if test "$_os" != "OpenBSD"; then
7627     MOC="moc"
7629 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
7630     dnl Search paths for Qt3 and KDE3
7631     if test -z "$supports_multilib" ; then
7632         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"
7633         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"
7634     else
7635         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"
7636         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"
7637     fi
7638     if test -n "$QTDIR" ; then
7639         qt_incdirs="$QTDIR/include $qt_incdirs"
7640         if test -z "$supports_multilib" ; then
7641             qt_libdirs="$QTDIR/lib $qt_libdirs"
7642         else
7643             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7644         fi
7645     fi
7646     if test -z "$supports_multilib" ; then
7647         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"
7648         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"
7649     else
7650         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"
7651         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"
7652     fi
7653     if test -n "$KDEDIR" ; then
7654         kde_incdirs="$KDEDIR/include $kde_incdirs"
7655         if test -z "$supports_multilib" ; then
7656             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7657         else
7658             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7659         fi
7660     fi
7662     dnl What to test
7663     qt_test_include="qstyle.h"
7664     kde_test_include="kapp.h"
7666     if test "$_os" != "OpenBSD"; then
7667         qt_test_library="libqt-mt.so"
7668         kde_test_library="libDCOP.so"
7669     else
7670         qt_test_library="libqt-mt.so*"
7671         kde_test_library="libDCOP.so*"
7672     fi
7674     dnl Check for Qt3 headers
7675     AC_MSG_CHECKING([for Qt3 headers])
7676     qt_incdir="no"
7677     for kde_check in $qt_incdirs ; do
7678         if test -r "$kde_check/$qt_test_include" ; then
7679             qt_incdir="$kde_check"
7680             break
7681         fi
7682     done
7683     AC_MSG_RESULT([$qt_incdir])
7684     if test "x$qt_incdir" = "xno" ; then
7685         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
7686 your Qt3 installation by exporting QTDIR before running "configure".])
7687     fi
7689     dnl Check for Qt3 libraries
7690     AC_MSG_CHECKING([for Qt3 libraries])
7691     qt_libdir="no"
7692     for qt_check in $qt_libdirs ; do
7693         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`" ; then
7694             qt_libdir="$qt_check"
7695             break
7696         fi
7697     done
7698     AC_MSG_RESULT([$qt_libdir])
7699     if test "x$qt_libdir" = "xno" ; then
7700         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
7701 your Qt3 installation by exporting QTDIR before running "configure".])
7702     fi
7704     dnl Check for Meta Object Compiler
7705     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
7706     if test "$MOC" = "no" ; then
7707         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
7708 the root of your Qt3 installation by exporting QTDIR before running "configure".])
7709     fi
7711     dnl Check for KDE3 headers
7712     AC_MSG_CHECKING([for KDE3 headers])
7713     kde_incdir="no"
7714     for kde_check in $kde_incdirs ; do
7715         if test -r "$kde_check/$kde_test_include" ; then
7716             kde_incdir="$kde_check"
7717             break
7718         fi
7719     done
7720     AC_MSG_RESULT([$kde_incdir])
7721     if test "x$kde_incdir" = "xno" ; then
7722         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
7723 your KDE3 installation by exporting KDEDIR before running "configure".])
7724     fi
7726     dnl Check for KDE3 libraries
7727     AC_MSG_CHECKING([for KDE3 libraries])
7728     kde_libdir="no"
7729     for kde_check in $kde_libdirs ; do
7730         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`" ; then
7731             kde_libdir="$kde_check"
7732             break
7733         fi
7734     done
7735     AC_MSG_RESULT([$kde_libdir])
7736     if test "x$kde_libdir" = "xno" ; then
7737         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
7738 your KDE3 installation by exporting KDEDIR before running "configure".])
7739     fi
7741     dnl Set the variables
7742     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7743     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
7745 AC_SUBST(KDE_CFLAGS)
7746 AC_SUBST(KDE_LIBS)
7747 AC_SUBST(MOC)
7749 dnl ===================================================================
7750 dnl KDE4 Integration
7751 dnl ===================================================================
7753 KDE4_CFLAGS=""
7754 KDE4_LIBS=""
7755 MOC4="moc"
7756 KDE_GLIB_CFLAGS=""
7757 KDE_GLIB_LIBS=""
7758 KDE_HAVE_GLIB=""
7759 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
7760     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
7761     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
7763     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
7764     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
7766     if test -n "$supports_multilib" ; then
7767         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
7768         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
7769     fi
7771     if test -n "$QTDIR" ; then
7772         qt_incdirs="$QTDIR/include $qt_incdirs"
7773         if test -z "$supports_multilib" ; then
7774             qt_libdirs="$QTDIR/lib $qt_libdirs"
7775         else
7776             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7777         fi
7778     fi
7779     if test -n "$QT4DIR" ; then
7780         qt_incdirs="$QT4DIR/include $qt_incdirs"
7781         if test -z "$supports_multilib" ; then
7782             qt_libdirs="$QT4DIR/lib $qt_libdirs"
7783         else
7784             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
7785         fi
7786     fi
7788     if test -n "$KDEDIR" ; then
7789         kde_incdirs="$KDEDIR/include $kde_incdirs"
7790         if test -z "$supports_multilib" ; then
7791             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7792         else
7793             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7794         fi
7795     fi
7796     if test -n "$KDE4DIR" ; then
7797         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
7798         if test -z "$supports_multilib" ; then
7799             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
7800         else
7801             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
7802         fi
7803     fi
7805     qt_test_include="Qt/qobject.h"
7806     qt_test_library="libQtCore.so"
7807     kde_test_include="kwindowsystem.h"
7808     kde_test_library="libsolid.so"
7810     AC_MSG_CHECKING([for Qt4 headers])
7811     qt_header_dir="no"
7812     for inc_dir in $qt_incdirs ; do
7813         if test -r "$inc_dir/$qt_test_include" ; then
7814             qt_header_dir="$inc_dir"
7815             break
7816         fi
7817     done
7819     AC_MSG_RESULT([$qt_header_dir])
7820     if test "x$qt_header_dir" = "xno" ; then
7821         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7822     fi
7824     AC_MSG_CHECKING([for Qt4 libraries])
7825     qt_lib_dir="no"
7826     for lib_dir in $qt_libdirs ; do
7827         if test -r "$lib_dir/$qt_test_library" ; then
7828             qt_lib_dir="$lib_dir"
7829             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
7830             break
7831         fi
7832     done
7834     AC_MSG_RESULT([$qt_lib_dir])
7836     if test "x$qt_lib_dir" = "xno" ; then
7837         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7838     fi
7840     dnl Check for Meta Object Compiler
7842     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7843     MOC4="$MOCQT4"
7844     if test "$MOC4" = "no" ; then
7845         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7846         if test "$MOC4" = "no" ; then
7847             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
7848 the root of your Qt installation by exporting QT4DIR before running "configure".])
7849         fi
7850     fi
7852     dnl Check for KDE4 headers
7853     AC_MSG_CHECKING([for KDE4 headers])
7854     kde_incdir="no"
7855     for kde_check in $kde_incdirs ; do
7856         if test -r "$kde_check/$kde_test_include" ; then
7857             kde_incdir="$kde_check"
7858             break
7859         fi
7860     done
7861     AC_MSG_RESULT([$kde_incdir])
7862     if test "x$kde_incdir" = "xno" ; then
7863         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7864     fi
7866     dnl Check for KDE4 libraries
7867     AC_MSG_CHECKING([for KDE4 libraries])
7868     kde_libdir="no"
7869     for kde_check in $kde_libdirs ; do
7870         if test -r "$kde_check/$kde_test_library" ; then
7871             kde_libdir="$kde_check"
7872             break
7873         fi
7874     done
7876     AC_MSG_RESULT([$kde_libdir])
7877     if test "x$kde_libdir" = "xno" ; then
7878         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7879     fi
7881     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7882     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
7884     AC_LANG_PUSH([C++])
7885     save_CXXFLAGS=$CXXFLAGS
7886     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
7887     AC_MSG_CHECKING([whether KDE is >= 4.2])
7888        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7889 #include <kdeversion.h>
7891 int main(int argc, char **argv) {
7892        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
7893        else return 1;
7895        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
7896     CXXFLAGS=$save_CXXFLAGS
7897     AC_LANG_POP([C++])
7899    # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled
7900     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
7901         [KDE_HAVE_GLIB=1],
7902         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
7904 AC_SUBST(KDE4_CFLAGS)
7905 AC_SUBST(KDE4_LIBS)
7906 AC_SUBST(MOC4)
7907 AC_SUBST(KDE_GLIB_CFLAGS)
7908 AC_SUBST(KDE_GLIB_LIBS)
7909 AC_SUBST(KDE_HAVE_GLIB)
7911 dnl ===================================================================
7912 dnl Test for the enabling the lockdown pieces
7913 dnl ===================================================================
7914 AC_MSG_CHECKING([whether to enable the lockdown pieces])
7915 ENABLE_LOCKDOWN=""
7916 if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
7917     ENABLE_LOCKDOWN=YES
7918     AC_MSG_RESULT([yes])
7919 else
7920     AC_MSG_RESULT([no])
7922 AC_SUBST(ENABLE_LOCKDOWN)
7924 dnl ===================================================================
7925 dnl Test whether to include Evolution 2 support
7926 dnl ===================================================================
7927 AC_MSG_CHECKING([whether to enable evolution 2 support])
7928 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
7929     AC_MSG_RESULT([yes])
7930     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
7931     ENABLE_EVOAB2="TRUE"
7932 else
7933     ENABLE_EVOAB2=""
7934     AC_MSG_RESULT([no])
7936 AC_SUBST(ENABLE_EVOAB2)
7937 AC_SUBST(GOBJECT_CFLAGS)
7938 AC_SUBST(GOBJECT_LIBS)
7940 dnl ===================================================================
7941 dnl Test whether to include KDE AB support
7942 dnl ===================================================================
7943 AC_MSG_CHECKING([whether to enable KDE address book support])
7944 if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
7945     AC_MSG_RESULT([yes])
7946     AC_LANG_PUSH([C++])
7947     save_CXXFLAGS=$CXXFLAGS
7948     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
7949     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
7950        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7951 #include <kdeversion.h>
7953 int main(int argc, char **argv) {
7954        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
7955        else return 1;
7957        ]])],[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])],[])
7958     CXXFLAGS=$save_CXXFLAGS
7959     AC_LANG_POP([C++])
7960     ENABLE_KAB=TRUE
7961 else
7962     AC_MSG_RESULT([no])
7963     ENABLE_KAB=
7965 AC_SUBST(ENABLE_KAB)
7967 dnl ===================================================================
7968 dnl Test whether to include MathMLDTD
7969 dnl ===================================================================
7970 AC_MSG_CHECKING([whether to include MathMLDTD])
7971 if test -n "$enable_mathmldtd"; then
7972     if test "$enable_mathmldtd" = "no"; then
7973         AC_MSG_RESULT([no])
7974         SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7975     else
7976         AC_MSG_RESULT([yes])
7977         BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7978     fi
7979 else
7980     AC_MSG_RESULT([no])
7981     SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7984 dnl ===================================================================
7985 dnl Test which themes to include
7986 dnl ===================================================================
7987 AC_MSG_CHECKING([which themes to include])
7988 # if none given, use all available themes
7989 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
7990     with_theme="default crystal hicontrast oxygen tango"
7993 WITH_THEMES=""
7994 for theme in $with_theme; do
7995     case $theme in
7996         default|crystal|hicontrast|oxygen|tango|human) : ;;
7997         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
7998     esac
7999     WITH_THEMES="$WITH_THEMES $theme"
8000     SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
8001 done
8002 AC_MSG_RESULT([$WITH_THEMES])
8003 AC_SUBST([WITH_THEMES])
8005 dnl ===================================================================
8006 dnl Test whether to integrate helppacks into the product's installer
8007 dnl ===================================================================
8008 AC_MSG_CHECKING([for helppack integration])
8009 if test "z$with_helppack_integration" = "zno" ; then
8010     WITH_HELPPACK_INTEGRATION=NO
8011     AC_MSG_RESULT([no integration])
8012 else
8013     WITH_HELPPACK_INTEGRATION=YES
8014     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
8015     AC_MSG_RESULT([integration])
8017 AC_SUBST(WITH_HELPPACK_INTEGRATION)
8019 ###############################################################################
8020 # Extensions checking
8021 ###############################################################################
8022 dnl ===================================================================
8023 dnl Test whether to integrate extensions into the product's installer
8024 dnl ===================================================================
8025 AC_MSG_CHECKING([for extensions integration])
8026 if test "x$enable_extension_integration" != "xno"; then
8027     WITH_EXTENSION_INTEGRATION=YES
8028     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
8029     AC_MSG_RESULT([yes, use integration])
8030 else
8031     WITH_EXTENSION_INTEGRATION=NO
8032     AC_MSG_RESULT([no, do not integrate])
8034 AC_SUBST(WITH_EXTENSION_INTEGRATION)
8036 dnl ===================================================================
8037 dnl Test whether to include Watch Window extension
8038 dnl ===================================================================
8039 AC_MSG_CHECKING([for Watch Window extension integration])
8040 WATCH_WINDOW_EXTENSION_PACK=
8041 if test "x$enable_ext_watch_window" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8042     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_WATCH_WINDOW"
8043     WATCH_WINDOW_EXTENSION_PACK="23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt"
8044     AC_MSG_RESULT([yes])
8045 else
8046     AC_MSG_RESULT([no])
8048 AC_SUBST(WATCH_WINDOW_EXTENSION_PACK)
8050 dnl ===================================================================
8051 dnl Test whether to include SmART Gallery (Diagram) extension
8052 dnl ===================================================================
8053 AC_MSG_CHECKING([for SmART Gallery (Diagram) extension integration])
8054 DIAGRAM_EXTENSION_PACK=
8055 if test "x$enable_ext_diagram" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8056     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_DIAGRAM"
8057     DIAGRAM_EXTENSION_PACK="8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt"
8058     AC_MSG_RESULT([yes])
8059 else
8060     AC_MSG_RESULT([no])
8062 AC_SUBST(DIAGRAM_EXTENSION_PACK)
8064 dnl ===================================================================
8065 dnl Test whether to include Validator extension
8066 dnl ===================================================================
8067 AC_MSG_CHECKING([for Validator extension integration])
8068 VALIDATOR_EXTENSION_PACK=
8069 if test "x$enable_ext_validator" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8070     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_VALIDATOR"
8071     VALIDATOR_EXTENSION_PACK="bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt"
8072     AC_MSG_RESULT([yes])
8073 else
8074     AC_MSG_RESULT([no])
8076 AC_SUBST(VALIDATOR_EXTENSION_PACK)
8078 dnl ===================================================================
8079 dnl Test whether to include Barcode extension
8080 dnl ===================================================================
8081 AC_MSG_CHECKING([for Barcode extension integration])
8082 BARCODE_EXTENSION_PACK=
8083 if test "x$enable_ext_barcode" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8084     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_BARCODE"
8085     BARCODE_EXTENSION_PACK="7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt"
8086     AC_MSG_RESULT([yes])
8087 else
8088     AC_MSG_RESULT([no])
8090 AC_SUBST([BARCODE_EXTENSION_PACK])
8092 dnl ===================================================================
8093 dnl Test whether to include ConvertTextToNumber extension
8094 dnl ===================================================================
8095 AC_MSG_CHECKING([for ConvertTextToNumber extension integration])
8096 CT2N_EXTENSION_PACK=
8097 if test "x$enable_ext_ct2n" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8098     BUILD_TYPE="$BUILD_TYPE CT2N"
8099     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_CT2N"
8100     CT2N_EXTENSION_PACK="451ccf439a36a568653b024534669971-ConvertTextToNumber_1.3.2.oxt"
8101     AC_MSG_RESULT([yes])
8102 else
8103     AC_MSG_RESULT([no])
8105 AC_SUBST(CT2N_EXTENSION_PACK)
8107 dnl ===================================================================
8108 dnl Test whether to include Numbertext extension
8109 dnl ===================================================================
8110 AC_MSG_CHECKING([for Numbertext extension integration])
8111 NUMBERTEXT_EXTENSION_PACK=
8112 if test "x$enable_ext_numbertext" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8113     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NUMBERTEXT"
8114     NUMBERTEXT_EXTENSION_PACK="b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt"
8115     AC_MSG_RESULT([yes])
8116 else
8117     AC_MSG_RESULT([no])
8119 AC_SUBST(NUMBERTEXT_EXTENSION_PACK)
8121 dnl ===================================================================
8122 dnl Test whether to include Hungarian Cross-reference Toolbar extension
8123 dnl ===================================================================
8124 AC_MSG_CHECKING([for Hungarian Cross-reference Toolbar extension integration])
8125 HUNART_EXTENSION_PACK=
8126 if test "x$enable_ext_hunart" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8127     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_HUNART"
8128     HUNART_EXTENSION_PACK="b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt"
8129     AC_MSG_RESULT([yes])
8130 else
8131     AC_MSG_RESULT([no])
8133 AC_SUBST(HUNART_EXTENSION_PACK)
8135 dnl ===================================================================
8136 dnl Test whether to include Typography Toolbar extension
8137 dnl ===================================================================
8138 AC_MSG_CHECKING([for Typography Toolbar extension integration])
8139 TYPO_EXTENSION_PACK=
8140 if test "x$enable_ext_typo" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8141     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_TYPO"
8142     TYPO_EXTENSION_PACK="9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt"
8143     AC_MSG_RESULT([yes])
8144 else
8145     AC_MSG_RESULT([no])
8147 AC_SUBST(TYPO_EXTENSION_PACK)
8149 dnl ===================================================================
8150 dnl Test whether to include Google Docs extension
8151 dnl ===================================================================
8152 AC_MSG_CHECKING([for Google Docs extension integration])
8153 GOOGLE_DOCS_EXTENSION_PACK=
8154 if test "x$enable_ext_google_docs" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8155     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_GOOGLE_DOCS"
8156     GOOGLE_DOCS_EXTENSION_PACK="cea0f63d5985ba4fcbd882031df44346-gdocs_3.0.0_modified.oxt"
8157     AC_MSG_RESULT([yes])
8158 else
8159     AC_MSG_RESULT([no])
8161 AC_SUBST(GOOGLE_DOCS_EXTENSION_PACK)
8163 dnl ===================================================================
8164 dnl Test whether to include NLPSolver extension
8165 dnl ===================================================================
8166 AC_MSG_CHECKING([for NLPSolver extension integration])
8167 if test "x$enable_ext_nlpsolver" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
8168     BUILD_TYPE="$BUILD_TYPE NLPSOLVER"
8169     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NLPSOLVER"
8170     AC_MSG_RESULT([yes])
8171 else
8172     AC_MSG_RESULT([no])
8175 dnl ===================================================================
8176 dnl Test whether to include LanguageTool extension
8177 dnl ===================================================================
8178 AC_MSG_CHECKING([for LanguageTool extension integration])
8179 if test "x$enable_ext_languagetool" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8180     BUILD_TYPE="$BUILD_TYPE LANGUAGETOOL"
8181     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LANGUAGETOOL"
8182     AC_MSG_RESULT([yes])
8183 else
8184     AC_MSG_RESULT([no])
8187 dnl ===================================================================
8188 dnl Test whether to include oooblogger extension
8189 dnl ===================================================================
8190 AC_MSG_CHECKING([for oooblogger extension integration])
8191 OOOBLOGGER_EXTENSION_PACK=
8192 if test "x$enable_ext_oooblogger" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8193     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_OOOBLOGGER"
8194     OOOBLOGGER_EXTENSION_PACK="b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt"
8195     AC_MSG_RESULT([yes])
8196 else
8197     AC_MSG_RESULT([no])
8199 AC_SUBST(OOOBLOGGER_EXTENSION_PACK)
8200 ###############################################################################
8202 dnl ===================================================================
8203 dnl Test whether to include Sun Professional Template Pack
8204 dnl ===================================================================
8205 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
8206 if test "z$with_sun_templates" = "z" -o "z$with_sun_templates" = "zno" ; then
8207     SUNTEMPLATES_LANG=""
8208     AC_MSG_RESULT([no integration])
8209 else
8210     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
8211     sun_supported_langs="en-US de it fr es hu"
8212     if test "z$with_sun_templates" = "zyes" ; then
8213         wanted_sun_templates="$sun_supported_langs"
8214     else
8215         # check whether the langs are supported by Sun
8216         wanted_sun_templates=
8217         for lang in $with_sun_templates ; do
8218             if test -n "`echo $sun_supported_langs | grep "$lang"`" ; then
8219                 wanted_sun_templates="$wanted_sun_templates $lang"
8220             fi
8221         done
8222     fi
8223     SUNTEMPLATES_LANG=
8224     SUNTEMPLATES_DE_PACK=
8225     SUNTEMPLATES_EN_US_PACK=
8226     SUNTEMPLATES_ES_PACK=
8227     SUNTEMPLATES_FR_PACK=
8228     SUNTEMPLATES_HU_PACK=
8229     SUNTEMPLATES_IT_PACK=
8230     # check whether the langs are requested at all
8231     for lang in $wanted_sun_templates ; do
8232     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`" ; then
8233         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
8234         case $lang in
8235         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
8236         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
8237         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
8238         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
8239         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
8240         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
8241         esac
8242     fi
8243     done
8244     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
8246 AC_SUBST(SUNTEMPLATES_LANG)
8247 AC_SUBST(SUNTEMPLATES_DE_PACK)
8248 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
8249 AC_SUBST(SUNTEMPLATES_ES_PACK)
8250 AC_SUBST(SUNTEMPLATES_FR_PACK)
8251 AC_SUBST(SUNTEMPLATES_HU_PACK)
8252 AC_SUBST(SUNTEMPLATES_IT_PACK)
8254 dnl ===================================================================
8255 dnl Test whether to include fonts
8256 dnl ===================================================================
8257 AC_MSG_CHECKING([whether to include third-party fonts])
8258 if test "$with_fonts" != "no" ; then
8259     AC_MSG_RESULT([yes])
8260     WITH_FONTS=YES
8261     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
8262 else
8263     AC_MSG_RESULT([no])
8264     WITH_FONTS=NO
8265     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
8267 AC_SUBST(WITH_FONTS)
8269 AC_MSG_CHECKING([whether to include Agfa Monotype fonts])
8270 if test "$with_agfa_monotype_fonts" = "yes" ; then
8271     AC_MSG_RESULT([yes])
8272     WITH_AGFA_MONOTYPE_FONTS=YES
8273     SCPDEFS="$SCPDEFS -DWITH_AGFA_MONOTYPE_FONTS"
8274     BUILD_TYPE="$BUILD_TYPE AGFA_MONOTYPE_FONTS"
8275 else
8276     AC_MSG_RESULT([no])
8277     WITH_AGFA_MONOTYPE_FONTS=NO
8279 AC_SUBST(WITH_AGFA_MONOTYPE_FONTS)
8281 dnl ===================================================================
8282 dnl Test whether to include ppds
8283 dnl ===================================================================
8284 AC_MSG_CHECKING([whether to include PPDs])
8285 if test "$with_ppds" != "no"; then
8286     AC_MSG_RESULT([yes])
8287 else
8288     AC_MSG_RESULT([no])
8289     WITHOUT_PPDS=YES
8290     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
8292 AC_SUBST(WITHOUT_PPDS)
8294 dnl ===================================================================
8295 dnl Test whether to include afms
8296 dnl ===================================================================
8297 AC_MSG_CHECKING([whether to include AFMs])
8298 if test "$with_afms" != "no"; then
8299     AC_MSG_RESULT([yes])
8300     BUILD_TYPE="$BUILD_TYPE AFMS"
8301 else
8302     AC_MSG_RESULT([no])
8303     WITHOUT_AFMS=YES
8304     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
8306 AC_SUBST(WITHOUT_AFMS)
8308 dnl ===================================================================
8309 dnl Test whether to include extra galleries
8310 dnl ===================================================================
8311 AC_MSG_CHECKING([whether to include extra galleries])
8312 if test "z$enable_extra_gallery" = "z" -o "z$enable_extra_gallery" = "zno" ; then
8313     AC_MSG_RESULT([no])
8314     WITH_EXTRA_GALLERY=NO
8315     OOOP_GALLERY_PACK=""
8316 else
8317     AC_MSG_RESULT([yes])
8318     WITH_EXTRA_GALLERY=YES
8319     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
8320     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
8321     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
8323 AC_SUBST(WITH_EXTRA_GALLERY)
8324 AC_SUBST(OOOP_GALLERY_PACK)
8326 dnl ===================================================================
8327 dnl Test whether to include extra templates
8328 dnl ===================================================================
8329 AC_MSG_CHECKING([whether to include extra templates])
8330 if test "z$enable_extra_template" = "z" -o "z$enable_extra_template" = "zno" ; then
8331     AC_MSG_RESULT([no])
8332     WITH_EXTRA_TEMPLATE=NO
8333     OOOP_TEMPLATES_PACK=""
8334 else
8335     AC_MSG_RESULT([yes])
8336     WITH_EXTRA_TEMPLATE=YES
8337     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
8338     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
8339     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
8341 AC_SUBST(WITH_EXTRA_TEMPLATE)
8342 AC_SUBST(OOOP_TEMPLATES_PACK)
8344 dnl ===================================================================
8345 dnl Test whether to include extra samples
8346 dnl ===================================================================
8347 AC_MSG_CHECKING([whether to include extra samples])
8348 if test "z$enable_extra_sample" = "z" -o "z$enable_extra_sample" = "zno" ; then
8349     AC_MSG_RESULT([no])
8350     WITH_EXTRA_SAMPLE=NO
8351     OOOP_SAMPLES_PACK=""
8352 else
8353     AC_MSG_RESULT([yes])
8354     WITH_EXTRA_SAMPLE=YES
8355     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
8356     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
8357     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
8359 AC_SUBST(WITH_EXTRA_SAMPLE)
8360 AC_SUBST(OOOP_SAMPLES_PACK)
8362 dnl ===================================================================
8363 dnl Test whether to include extra fonts
8364 dnl ===================================================================
8365 AC_MSG_CHECKING([whether to include extra fonts])
8366 if test "z$enable_extra_font" = "z" -o "z$enable_extra_font" = "zno" ; then
8367     AC_MSG_RESULT([no])
8368     WITH_EXTRA_FONT=NO
8369     OOOP_FONTS_PACK=""
8370 else
8371     AC_MSG_RESULT([yes])
8372     WITH_EXTRA_FONT=YES
8373     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
8374     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
8375     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
8377 AC_SUBST(WITH_EXTRA_FONT)
8378 AC_SUBST(OOOP_FONTS_PACK)
8380 dnl ===================================================================
8381 dnl Test whether to download OxygenOffice branding and set custom settings
8382 dnl ===================================================================
8383 AC_MSG_CHECKING([whether to download OxygenOffice branding and set custom settings])
8384 if test "z$enable_oxygenoffice" = "z" -o "z$enable_oxygenoffice" = "zno" ; then
8385     AC_MSG_RESULT([no])
8386     ENABLE_OXYGENOFFICE=NO
8387 else
8388     AC_MSG_RESULT([yes])
8389     ENABLE_OXYGENOFFICE=YES
8390     OXYGENOFFICE_PACK="18bf204479ff641d99a88cd71f6f25f7-oxygenoffice-001.zip"
8391     BUILD_TYPE="$BUILD_TYPE OXYGENOFFICE"
8393 AC_SUBST(ENABLE_OXYGENOFFICE)
8394 AC_SUBST(OXYGENOFFICE_PACK)
8396 dnl ===================================================================
8397 dnl Test whether to build global menu support
8398 dnl ===================================================================
8399 AC_MSG_CHECKING([whether to build global menu support])
8400 if test "z$enable_lomenubar" = "z" -o "z$enable_lomenubar" = "zno" ; then
8401     AC_MSG_RESULT([no])
8402     ENABLE_LOMENUBAR="FALSE"
8403 else
8404     AC_MSG_RESULT([yes])
8405     PKG_CHECK_MODULES(DBUSMENUGTK, dbusmenu-gtk-0.4,, AC_MSG_ERROR([requirements to build lo-menubar not met. Use --disable-lomenubar or install the missing packages]))
8406     ENABLE_LOMENUBAR="TRUE"
8408 AC_SUBST(ENABLE_LOMENUBAR)
8410 dnl ===================================================================
8411 dnl Test whether to enable online update service
8412 dnl ===================================================================
8413 AC_MSG_CHECKING([whether to enable online update])
8414 ENABLE_ONLINE_UPDATE=
8415 if test "z$enable_online_update" = "z" ; then
8416     if test "$_os" = "WINNT" -o "$_os" = "Darwin" ; then
8417         AC_MSG_RESULT([yes])
8418         ENABLE_ONLINE_UPDATE="TRUE"
8419     else
8420         AC_MSG_RESULT([no])
8421     fi
8422 else
8423     if test "z$enable_online_update" = "zyes" ; then
8424         AC_MSG_RESULT([yes])
8425         ENABLE_ONLINE_UPDATE="TRUE"
8426     else
8427         AC_MSG_RESULT([no])
8428     fi
8430 AC_SUBST(ENABLE_ONLINE_UPDATE)
8432 dnl ===================================================================
8433 dnl Test whether build target is Release Build
8434 dnl ===================================================================
8435 AC_MSG_CHECKING([whether build target is Release Build])
8436 if test "z$enable_release_build" = "z" -o "z$enable_release_build" = "zno" ; then
8437     AC_MSG_RESULT([no])
8438     ENABLE_RELEASE_BUILD="FALSE"
8439 else
8440     AC_MSG_RESULT([yes])
8441     ENABLE_RELEASE_BUILD="TRUE"
8443 AC_SUBST(ENABLE_RELEASE_BUILD)
8445 dnl ===================================================================
8446 dnl Test whether to create MSI with LIMITUI=1 (silent install)
8447 dnl ===================================================================
8448 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
8449 if test "z$enable_silent_msi" = "z" -o "z$enable_silent_msi" = "zno" ; then
8450     AC_MSG_RESULT([no])
8451     ENABLE_SILENT_MSI="FALSE"
8452 else
8453     AC_MSG_RESULT([yes])
8454     ENABLE_SILENT_MSI="TRUE"
8455     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
8457 AC_SUBST(ENABLE_SILENT_MSI)
8459 dnl ===================================================================
8460 dnl Test whether to enable ActiveX embedding
8461 dnl ===================================================================
8462 if test "$_os" = "WINNT"; then
8463     AC_MSG_CHECKING([whether to enable ActiveX embedding of LibreOffice components])
8464     if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
8465         ENABLE_ACTIVEX_COMPONENT="TRUE"
8466         AC_MSG_RESULT([yes])
8467         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
8468     else
8469         ENABLE_ACTIVEX_COMPONENT=""
8470         AC_MSG_RESULT([no])
8471     fi
8472     AC_SUBST(ENABLE_ACTIVEX_COMPONENT)
8473     AC_SUBST(SCPDEFS)
8476 AC_MSG_CHECKING([whether and how to use Xinerama])
8477 if test "$_os" = "Darwin"; then
8478     USE_XINERAMA=YES
8479     XINERAMA_LINK=dynamic
8480     AC_MSG_RESULT([yes])
8481 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
8482     if test "$x_libraries" = "default_x_libraries"; then
8483         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
8484         if test "x$XINERAMALIB" = x; then
8485            XINERAMALIB="/usr/lib"
8486         fi
8487     else
8488         XINERAMALIB="$x_libraries"
8489     fi
8490     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
8491         # we have both versions, let the user decide but use the dynamic one
8492         # per default
8493         USE_XINERAMA=YES
8494         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
8495             XINERAMA_LINK=dynamic
8496         else
8497             XINERAMA_LINK=static
8498         fi
8499     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
8500         # we have only the dynamic version
8501         USE_XINERAMA=YES
8502         XINERAMA_LINK=dynamic
8503     elif test -e "$XINERAMALIB/libXinerama.a"; then
8504         # static version
8505         if echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
8506             USE_XINERAMA=YES
8507             XINERAMA_LINK=static
8508         else
8509             USE_XINERAMA=NO
8510             XINERAMA_LINK=none
8511         fi
8512     else
8513         # no Xinerama
8514         USE_XINERAMA=NO
8515         XINERAMA_LINK=none
8516     fi
8517     if test "$USE_XINERAMA" = "YES"; then
8518         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
8519         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
8520             [AC_MSG_ERROR(Xinerama header not found.)], [])
8521         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
8522         if test "x$XEXTLIB" = x; then
8523            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
8524         fi
8525         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
8526         if test "$_os" = "FreeBSD"; then
8527             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
8528         fi
8529         if test "$_os" = "Linux"; then
8530             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
8531         fi
8532         AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
8533             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
8534     else
8535         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
8536     fi
8537 else
8538     USE_XINERAMA=NO
8539     XINERAMA_LINK=none
8540     AC_MSG_RESULT([no])
8542 AC_SUBST(USE_XINERAMA)
8543 AC_SUBST(XINERAMA_LINK)
8545 dnl ===================================================================
8546 dnl Checks for librsvg
8547 dnl ===================================================================
8549 dnl ENABLE_LIBRSVG is set to "" (for NO), SYSTEM or INTERNAL. The
8550 dnl SYSTEM_LIBRSVG, SYSTEM_GDKPIXBUF etc are redundant.
8552 ENABLE_LIBRSVG=""
8553 LIBRSVG_CFLAGS=""
8554 LIBRSVG_LIBS=""
8556 AC_MSG_CHECKING([what librsvg to use])
8558 case "$enable_librsvg" in
8559 no|disable)
8560     AC_MSG_RESULT([none])
8561     enable_librsvg=no
8562     ;;
8564 ""|yes|auto)
8565     if test $build_os = cygwin -o \
8566            $_os = Darwin; then
8567         dnl When building on/for these OSes always use the internal one,
8568         dnl if at all. Add more OSes above as needed.
8569         AC_MSG_RESULT([internal])
8570         enable_librsvg=internal
8571     elif test  $_os = iOS -o $_os = Android; then
8572         AC_MSG_RESULT([none])
8573         enable_librsvg=no
8574     else
8575         if test "$with_system_libs" = yes; then
8576             AC_MSG_RESULT([system])
8577             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8578             enable_librsvg=system
8579         elif test "$with_system_libs" = no; then
8580             AC_MSG_RESULT([internal])
8581             enable_librsvg=internal
8582         else
8583             AC_MSG_RESULT([checking further])
8584             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14,, [:])
8585             if test -z "$LIBRSVG_PKG_ERRORS"; then
8586                 enable_librsvg=system
8587             else
8588                 enable_librsvg=internal
8589             fi
8590         fi
8591     fi
8592     ;;
8594 internal)
8595     AC_MSG_RESULT([internal])
8596     ;;
8598 system)
8599     if test $_os = WINNT -a "$WITH_MINGW" != yes; then
8600         AC_MSG_ERROR([Must use internal librsvg when building with MSVC])
8601     fi
8602     AC_MSG_RESULT([system])
8603     PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8604     ;;
8607     AC_MSG_ERROR([Incorrect --enable-librsvg option])
8608     ;;
8609 esac
8611 dnl By now enable_librsvg should be "system", "internal" or "no"
8612 case $enable_librsvg in
8613 system)
8614     ENABLE_LIBRSVG=SYSTEM
8615     SYSTEM_LIBRSVG=YES
8616     ;;
8618 internal)
8619     ENABLE_LIBRSVG=INTERNAL
8620     SYSTEM_LIBRSVG=NO
8621     BUILD_TYPE="$BUILD_TYPE LIBRSVG"
8622     ;;
8625     ENABLE_LIBRSVG=NO
8626     SYSTEM_LIBRSVG=NO
8627     ;;
8630     AC_MSG_ERROR([Internal configure script error, invalid enable_librsvg value "$enable_librsvg"])
8631     ;;
8632 esac
8634 AC_SUBST(ENABLE_LIBRSVG)
8635 AC_SUBST(LIBRSVG_CFLAGS)
8636 AC_SUBST(LIBRSVG_LIBS)
8637 AC_SUBST(SYSTEM_LIBRSVG)
8639 dnl ===================================================================
8640 dnl Test whether to build cairo or rely on the system version
8641 dnl ===================================================================
8644 SYSTEM_CAIRO=""
8646 AC_MSG_CHECKING([whether to use the system cairo])
8648 if test "$with_system_cairo" = "yes"; then
8649     SYSTEM_CAIRO=YES
8650     AC_MSG_RESULT([yes])
8652     PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
8654     if test "$test_xrender" = "yes"; then
8655         if test "$with_system_xextensions_headers" != "no"; then
8656             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
8657             AC_LANG_PUSH([C])
8658             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
8659 #ifdef PictStandardA8
8660 #else
8661       return fail;
8662 #endif
8663 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
8665             AC_LANG_POP([C])
8666         fi
8667     fi
8668     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libfontconfig-1.dll libfreetype-6.dll libpixman-1-0.dll libpng15-15.dll libcairo-2.dll"
8669 else
8670     AC_MSG_RESULT([no])
8672     if test $_os = Android; then
8673         dnl For Android cairo isn't
8674         dnl buildable yet.
8675         :
8676     elif test $_os = WINNT; then
8677         dnl We only need cairo for Windows if we
8678         dnl build librsvg or directx disabled
8679         if test "$ENABLE_LIBRSVG" != NO -o -z "$ENABLE_DIRECTX"; then
8680             BUILD_TYPE="$BUILD_TYPE CAIRO"
8681         fi
8682     else
8683         BUILD_TYPE="$BUILD_TYPE CAIRO"
8684     fi
8687 AC_SUBST(SYSTEM_CAIRO)
8688 AC_SUBST(CAIRO_CFLAGS)
8689 AC_SUBST(CAIRO_LIBS)
8692 dnl ===================================================================
8693 dnl Test whether to build gdk-pixbuf or rely on the system version
8694 dnl ===================================================================
8696 AC_MSG_CHECKING([whether to use the system gdk-pixbuf])
8698 dnl As long as the only thing we need gdk-pixbuf for is below
8699 dnl librsvg, use the same --enable-librsvg (possibly implied
8700 dnl by --with-system-libs) to override this.
8702 if test "$SYSTEM_LIBRSVG" = YES; then
8703     SYSTEM_GDKPIXBUF=YES
8704     AC_MSG_RESULT([yes])
8705 else
8706     case "$_os" in
8707     WINNT|Darwin|iOS|Android)
8708         SYSTEM_GDKPIXBUF=NO
8709         AC_MSG_RESULT([no])
8710         ;;
8711     *)
8712         SYSTEM_GDKPIXBUF=YES
8713         AC_MSG_RESULT([yes])
8714         ;;
8715     esac
8717 AC_SUBST(SYSTEM_GDKPIXBUF)
8719 dnl ===================================================================
8720 dnl Test whether to build GLib or rely on the system version
8721 dnl ===================================================================
8723 AC_MSG_CHECKING([whether to use the system GLib])
8725 dnl As long as the only thing we need GLib for is below
8726 dnl librsvg, use the same --enable-librsvg (possibly implied
8727 dnl by --with-system-libs) to override this.
8729 if test "$SYSTEM_LIBRSVG" = YES; then
8730     SYSTEM_GLIB=YES
8731     AC_MSG_RESULT([yes])
8732 else
8733     case "$_os" in
8734     WINNT|Darwin|iOS|Android)
8735         SYSTEM_GLIB=NO
8736         AC_MSG_RESULT([no])
8737         ;;
8738     *)
8739         SYSTEM_GLIB=YES
8740         AC_MSG_RESULT([yes])
8741         ;;
8742     esac
8744 AC_SUBST(SYSTEM_GLIB)
8746 dnl ===================================================================
8747 dnl Test whether to build gettext runtime (libintl) or rely on the
8748 dnl system version
8749 dnl ===================================================================
8751 AC_MSG_CHECKING([whether to use the system gettext runtime])
8753 if test "$with_system_gettext" = yes; then
8754     SYSTEM_GETTEXT=YES
8755     AC_MSG_RESULT([yes])
8756 else
8757     case "$_os" in
8758     WINNT|Darwin|iOS|Android)
8759         SYSTEM_GETTEXT=NO
8760         AC_MSG_RESULT([no])
8761         ;;
8762     *)
8763         SYSTEM_GETTEXT=YES
8764         AC_MSG_RESULT([yes])
8765         ;;
8766     esac
8768 AC_SUBST(SYSTEM_GETTEXT)
8770 dnl ===================================================================
8771 dnl Test whether to build libcroco or rely on the system version
8772 dnl ===================================================================
8774 AC_MSG_CHECKING([whether to use the system libcroco])
8776 dnl As long as the only thing we need libcroco for is below
8777 dnl librsvg, use the same --enable-librsvg (possibly implied
8778 dnl by --with-system-libs) to override this.
8780 if test "$SYSTEM_LIBRSVG" = YES; then
8781     SYSTEM_LIBCROCO=YES
8782     AC_MSG_RESULT([yes])
8783 else
8784     case "$_os" in
8785     WINNT|Darwin|iOS|Android)
8786         SYSTEM_LIBCROCO=NO
8787         AC_MSG_RESULT([no])
8788         ;;
8789     *)
8790         SYSTEM_LIBCROCO=YES
8791         AC_MSG_RESULT([yes])
8792         ;;
8793     esac
8795 AC_SUBST(SYSTEM_LIBCROCO)
8797 dnl ===================================================================
8798 dnl Test whether to build Pango or rely on the system version
8799 dnl ===================================================================
8801 AC_MSG_CHECKING([whether to use the system pango])
8803 dnl As long as the only thing we need Pango for is below
8804 dnl librsvg, use the same --enable-librsvg (possibly implied
8805 dnl by --with-system-libs) to override this.
8807 if test "$SYSTEM_LIBRSVG" = YES; then
8808     SYSTEM_PANGO=YES
8809     AC_MSG_RESULT([yes])
8810 else
8811     case "$_os" in
8812     WINNT|Darwin|iOS|Android)
8813         SYSTEM_PANGO=NO
8814         AC_MSG_RESULT([no])
8815         ;;
8816     *)
8817         SYSTEM_PANGO=YES
8818         AC_MSG_RESULT([yes])
8819         ;;
8820     esac
8822 AC_SUBST(SYSTEM_PANGO)
8824 dnl ===================================================================
8825 dnl Test whether to build libgsf or rely on the system version
8826 dnl ===================================================================
8828 AC_MSG_CHECKING([whether to use the system libgsf])
8830 dnl As long as the only thing we need libgsf for is below librsvg (is
8831 dnl it?), use the same --enable-librsvg (possibly implied by
8832 dnl --with-system-libs) to override this.
8834 if test "$SYSTEM_LIBRSVG" = YES; then
8835     SYSTEM_LIBGSF=YES
8836     AC_MSG_RESULT([yes])
8837 else
8838     case "$_os" in
8839     WINNT|Darwin|iOS|Android)
8840         SYSTEM_LIBGSF=NO
8841         AC_MSG_RESULT([no])
8842         ;;
8843     *)
8844         SYSTEM_LIBGSF=YES
8845         AC_MSG_RESULT([yes])
8846         ;;
8847     esac
8849 AC_SUBST(SYSTEM_LIBGSF)
8851 dnl ===================================================================
8852 dnl Test whether to build libpng or rely on the system version
8853 dnl ===================================================================
8855 AC_MSG_CHECKING([whether to use the system libpng])
8857 dnl How should and does this interact with the checks for libpng
8858 dnl related to use of libpng in the quickstarter above? This needs to
8859 dnl be unified.
8861 if test "$with_system_libpng" = yes; then
8862     SYSTEM_LIBPNG=YES
8863     AC_MSG_RESULT([yes])
8864 else
8865     case "$_os" in
8866     WINNT|Darwin|iOS|Android)
8867         SYSTEM_LIBPNG=NO
8868         AC_MSG_RESULT([no])
8869         ;;
8870     *)
8871         SYSTEM_LIBPNG=YES
8872         AC_MSG_RESULT([no])
8873         ;;
8874     esac
8876 AC_SUBST(SYSTEM_LIBPNG)
8878 dnl ===================================================================
8879 dnl Test whether to build libjpeg or rely on the system version
8880 dnl ===================================================================
8881 dnl FIXME: this is currently because we have jpeg-6b for our filters
8882 dnl        and jpeg-8 as dependency for librsvg
8883 dnl        this should be unified into using only one version for both
8885 AC_MSG_CHECKING([whether to use the system libjpeg])
8887 if test "$SYSTEM_JPEG" == "YES"; then
8888     SYSTEM_LIBJPEG=YES
8889     AC_MSG_RESULT([yes])
8890 else
8891     case "$_os" in
8892     WINNT|Darwin|iOS|Android)
8893         SYSTEM_LIBJPEG=NO
8894         AC_MSG_RESULT([no])
8895         ;;
8896     *)
8897         SYSTEM_LIBJPEG=YES
8898         AC_MSG_RESULT([yes])
8899         ;;
8900     esac
8902 AC_SUBST(SYSTEM_LIBJPEG)
8904 dnl ===================================================================
8905 dnl Check for runtime JVM search path
8906 dnl ===================================================================
8907 if test "$SOLAR_JAVA" != ""; then
8908     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
8909     if test -n "$with_jvm_path" && test "$with_jvm_path" != "no"; then
8910         AC_MSG_RESULT([yes])
8911         if ! test -d "$with_jvm_path"; then
8912             AC_MSG_ERROR(["$with_jvm_path" not a directory])
8913         fi
8914         if ! test -d "$with_jvm_path"jvm; then
8915             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
8916         fi
8917         JVM_ONE_PATH_CHECK="$with_jvm_path"
8918         AC_SUBST(JVM_ONE_PATH_CHECK)
8919     else
8920         AC_MSG_RESULT([no])
8921     fi
8924 dnl ===================================================================
8925 dnl Test for the presence of Ant and that it works
8926 dnl ===================================================================
8928 if test "$SOLAR_JAVA" != ""; then
8929     ANT_HOME=; export ANT_HOME
8930     WITH_ANT_HOME=; export WITH_ANT_HOME
8931     if test -z "$with_ant_home"; then
8932         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
8933     else
8934         if test "$_os" = "WINNT"; then
8935             with_ant_home=`cygpath -u "$with_ant_home"`
8936         fi
8937         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
8938         WITH_ANT_HOME=$with_ant_home
8939         ANT_HOME=$with_ant_home
8940     fi
8942     if test -z "$ANT"; then
8943         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
8944     else
8945         # resolve relative or absolute symlink
8946         while test -h "$ANT"; do
8947             a_cwd=`pwd`
8948             a_basename=`basename "$ANT"`
8949             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
8950             cd "`dirname "$ANT"`"
8951             cd "`dirname "$a_script"`"
8952             ANT="`pwd`"/"`basename "$a_script"`"
8953             cd "$a_cwd"
8954         done
8956         AC_MSG_CHECKING([if $ANT works])
8957         cat > conftest.java << EOF
8958         public class conftest {
8959             int testmethod(int a, int b) {
8960                     return a + b;
8961             }
8962         }
8965         cat > conftest.xml << EOF
8966         <project name="conftest" default="conftest">
8967         <target name="conftest">
8968             <javac srcdir="." includes="conftest.java">
8969             </javac>
8970         </target>
8971         </project>
8974         oldJAVA_HOME=$JAVA_HOME
8975         if test "$JAVACISGCJ" = "yes"; then
8976             JAVA_HOME=; export JAVA_HOME
8977             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
8978         else
8979             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
8980         fi
8981         AC_TRY_EVAL(ant_cmd)
8982         if test $? = 0 && test -f ./conftest.class ; then
8983             AC_MSG_RESULT([Ant works])
8984             if test -z "$WITH_ANT_HOME"; then
8985                 ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
8986                 if test -z "$ANT_HOME"; then
8987                     ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
8988                 fi
8989             else
8990                 ANT_HOME="$WITH_ANT_HOME"
8991             fi
8992         else
8993             echo "configure: Ant test failed" >&5
8994             cat conftest.java >&5
8995             cat conftest.xml >&5
8996             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
8997             ANT_HOME=""
8998             echo "Ant does not work - Some Java projects will not build!" >>warn
8999         fi
9000         JAVA_HOME=$oldJAVA_HOME
9001         rm -f conftest* core core.* *.core
9002     fi
9003     if test -z "$ANT_HOME"; then
9004         ANT_HOME="NO_ANT_HOME"
9005     fi
9006     AC_SUBST(ANT_HOME)
9008     dnl Checking for ant.jar
9009     if test "$ANT_HOME" != "NO_ANT_HOME"; then
9010         AC_MSG_CHECKING([Ant lib directory])
9011         if test -f $ANT_HOME/lib/ant.jar; then
9012             ANT_LIB="$ANT_HOME/lib"
9013         else
9014             if test -f $ANT_HOME/ant.jar; then
9015                 ANT_LIB="$ANT_HOME"
9016             else
9017                 if test -f /usr/share/java/ant.jar; then
9018                     ANT_LIB=/usr/share/java
9019                 else
9020                     if test -f /usr/share/ant-core/lib/ant.jar; then
9021                         ANT_LIB=/usr/share/ant-core/lib
9022                     else
9023                         if test -f $ANT_HOME/lib/ant/ant.jar; then
9024                             ANT_LIB="$ANT_HOME/lib/ant"
9025                         else
9026                             if test -f /usr/share/lib/ant/ant.jar; then
9027                                 ANT_LIB=/usr/share/lib/ant
9028                             else
9029                                 AC_MSG_ERROR([Ant libraries not found!])
9030                             fi
9031                         fi
9032                     fi
9033                 fi
9034             fi
9035         fi
9036         AC_MSG_RESULT([Ant lib directory found.])
9037     fi
9038     AC_SUBST(ANT_LIB)
9040     ant_minver=1.6.0
9041     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
9043     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
9044     ant_version=`$ANT -version | $AWK '{ print $4; }'`
9045     ant_version_major=`echo $ant_version | cut -d. -f1`
9046     ant_version_minor=`echo $ant_version | cut -d. -f2`
9047     echo "configure: ant_version $ant_version " >&5
9048     echo "configure: ant_version_major $ant_version_major " >&5
9049     echo "configure: ant_version_minor $ant_version_minor " >&5
9050     if test "$ant_version_major" -ge "2"; then
9051         AC_MSG_RESULT([yes, $ant_version])
9052     elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
9053         AC_MSG_RESULT([yes, $ant_version])
9054     else
9055         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
9056     fi
9058     if test "$ENABLE_MEDIAWIKI" = "YES"; then
9059         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
9060         rm -rf confdir
9061         mkdir confdir
9062         cat > conftest.java << EOF
9063             public class conftest {
9064                 int testmethod(int a, int b) {
9065                     return a + b;
9066                 }
9067             }
9070         cat > conftest.xml << EOF
9071             <project name="conftest" default="conftest">
9072             <target name="conftest" depends="copytest">
9073                 <javac srcdir="." includes="conftest.java">
9074                 </javac>
9075             </target>
9076             <target name="copytest">
9077                  <copy todir="confdir">
9078                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
9079                  <filterset/>
9080                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
9081                  </copy>
9082             </target>
9083             </project>
9086         if test "$JAVACISGCJ" = "yes"; then
9087             JAVA_HOME=; export JAVA_HOME
9088             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
9089         else
9090             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
9091         fi
9092         AC_TRY_EVAL(ant_cmd)
9093         if test $? = 0 && test -f ./conftest.class ; then
9094             AC_MSG_RESULT([yes])
9095             rm -rf confdir
9096         else
9097             echo "configure: Ant test failed" >&5
9098             cat conftest.java >&5
9099             cat conftest.xml >&5
9100             rm -rf confdir
9101             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
9102         fi
9103     fi
9104     rm -f conftest* core core.* *.core
9107 OOO_JUNIT_JAR=
9108 if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
9109     AC_MSG_CHECKING([for JUnit 4])
9110     if test "$with_junit" = "yes"; then
9111         if test -e /usr/share/java/junit4.jar; then
9112             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
9113         else
9114            if test -e /usr/share/lib/java/junit.jar; then
9115               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
9116            else
9117               OOO_JUNIT_JAR=/usr/share/java/junit.jar
9118            fi
9119         fi
9120     else
9121         OOO_JUNIT_JAR=$with_junit
9122     fi
9123     if test "$_os" = "WINNT"; then
9124         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
9125     fi
9126     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
9127         grep org/junit/Before.class > /dev/null 2>&5
9128     if test $? -eq 0; then
9129         # check if either class-path entry is available for hamcrest or
9130         # it's bundled
9131         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |grep -q hamcrest || \
9132             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |grep -q 'Class-Path: hamcrest'; then
9133             AC_MSG_RESULT([$OOO_JUNIT_JAR])
9134         else
9135             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
9136 provide a full junit jar or use --without-junit])
9137         fi
9138     else
9139         AC_MSG_RESULT([no])
9140         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
9141 location (/usr/share/java), specify its pathname via
9142 --with-junit=..., or disable it via --without-junit])
9143     fi
9144     if test $OOO_JUNIT_JAR != ""; then
9145         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
9146     fi
9148 AC_SUBST(OOO_JUNIT_JAR)
9150 dnl ===================================================================
9151 dnl Product version
9152 dnl ===================================================================
9153 AC_MSG_CHECKING([for product version])
9154 PRODUCTVERSION=AC_PACKAGE_VERSION
9155 AC_MSG_RESULT([$PRODUCTVERSION])
9156 AC_SUBST(PRODUCTVERSION)
9158 dnl ===================================================================
9159 dnl Dealing with l10n options
9160 dnl ===================================================================
9161 AC_MSG_CHECKING([which languages to be built])
9162 # get list of all languages
9163 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
9164 # the sed command does the following:
9165 #   + if a line ends with a backslash, append the next line to it
9166 #   + adds " on the beginning of the value (after =)
9167 #   + adds " at the end of the value
9168 #   + removes en-US; we want to put it on the beginning
9169 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
9170 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' solenv/inc/langlist.mk)]
9171 ALL_LANGS="en-US $completelangiso"
9172 # check the configured localizations
9173 WITH_LANG="$with_lang"
9174 if test -z "$WITH_LANG"; then
9175     AC_MSG_RESULT([en-US])
9176 else
9177     AC_MSG_RESULT([$WITH_LANG])
9178     GIT_REPO_NAMES="$GIT_REPO_NAMES translations"
9180 # check that the list is valid
9181 for lang in $WITH_LANG ; do
9182     test "$lang" = "ALL" && continue;
9183     # need to check for the exact string, so add space before and after the list of all languages
9184     for vl in $ALL_LANGS ; do
9185         if test "$vl" = "$lang" ; then
9186            break;
9187         fi
9188     done
9189     if test "$vl" != "$lang" ; then
9190         AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
9191     fi
9192 done
9193 # list with substituted ALL
9194 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
9195 # this variable is used only by bin/distro-install-* helper scripts
9196 # they need a real list of languages
9197 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
9198 AC_SUBST(ALL_LANGS)
9199 AC_SUBST(WITH_LANG)
9200 AC_SUBST(WITH_LANG_LIST)
9201 AC_SUBST(GIT_REPO_NAMES)
9203 dnl git-new-workdir
9204 dnl ===================================================================
9205 if test -n "${GIT_LINK_SRC}"; then
9206     for repo in ${GIT_REPO_NAMES}; do
9207         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
9208             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
9209         fi
9210     done
9212 AC_SUBST(GIT_LINK_SRC)
9214 AC_MSG_CHECKING([for custom 'intro' progress bar color])
9215 PROGRESSBARCOLOR=
9216 if test -z "$with_intro_progressbar_color" ; then
9217    PROGRESSBARCOLOR="126,170,23"
9218    AC_MSG_RESULT([none])
9219 else
9220    PROGRESSBARCOLOR="$with_intro_progressbar_color"
9221    AC_MSG_RESULT([$PROGRESSBARCOLOR])
9223 AC_SUBST(PROGRESSBARCOLOR)
9225 AC_MSG_CHECKING([for custom 'intro' progress bar size])
9226 PROGRESSSIZE=
9227 if test -z "$with_intro_progressbar_size" ; then
9228    PROGRESSSIZE="319,10"
9229    AC_MSG_RESULT([none])
9230 else
9231    PROGRESSSIZE="$with_intro_progressbar_size"
9232    AC_MSG_RESULT([$PROGRESSSIZE])
9234 AC_SUBST(PROGRESSSIZE)
9236 AC_MSG_CHECKING([for custom 'intro' progress bar position])
9237 PROGRESSPOSITION=
9238 if test -z "$with_intro_progressbar_position" ; then
9239    PROGRESSPOSITION="164,225"
9240    AC_MSG_RESULT([none])
9241 else
9242    PROGRESSPOSITION="$with_intro_progressbar_position"
9243    AC_MSG_RESULT([$PROGRESSPOSITION])
9245 AC_SUBST(PROGRESSPOSITION)
9247 AC_MSG_CHECKING([for custom 'intro' progress bar frame color])
9248 PROGRESSFRAMECOLOR=
9249 if test -z "$with_intro_progressbar_frame_color" ; then
9250    PROGRESSFRAMECOLOR="207,208,211"
9251    AC_MSG_RESULT([none])
9252 else
9253    PROGRESSFRAMECOLOR="$with_intro_progressbar_frame_color"
9254    AC_MSG_RESULT([$PROGRESSFRAMECOLOR])
9256 AC_SUBST(PROGRESSFRAMECOLOR)
9258 AC_MSG_CHECKING([for alternative branding images directory])
9259 INTRO_BITMAP=
9260 ABOUT_BITMAP=
9261 STARTCENTER_LEFT_BITMAP=
9262 STARTCENTER_RIGHT_BITMAP=
9263 STARTCENTER_RTL_LEFT_BITMAP=
9264 STARTCENTER_RTL_RIGHT_BITMAP=
9265 STARTCENTER_SPACE_BITMAP=
9266 if test -z "$with_branding" -o "$with_branding" = "no" ; then
9267     AC_MSG_RESULT([none])
9268 else
9269     INTRO_BITMAP="$with_branding/intro.png"
9270     ABOUT_BITMAP="$with_branding/about.png"
9271     STARTCENTER_LEFT_BITMAP="$with_branding/backing_left.png"
9272     STARTCENTER_RIGHT_BITMAP="$with_branding/backing_right.png"
9273     STARTCENTER_RTL_LEFT_BITMAP="$with_branding/backing_rtl_left.png"
9274     STARTCENTER_RTL_RIGHT_BITMAP="$with_branding/backing_rtl_right.png"
9275     STARTCENTER_SPACE_BITMAP="$with_branding/backing_space.png"
9276     for i in $INTRO_BITMAP \
9277              $ABOUT_BITMAP \
9278              $STARTCENTER_LEFT_BITMAP \
9279              $STARTCENTER_RIGHT_BITMAP \
9280              $STARTCENTER_RTL_LEFT_BITMAP \
9281              $STARTCENTER_RTL_RIGHT_BITMAP \
9282              $STARTCENTER_SPACE_BITMAP; do
9283         if test ! -f $i; then
9284             AC_MSG_WARN([Required file $i does not exist!])
9285         fi
9286     done
9287     AC_MSG_RESULT([$with_branding])
9290 AC_MSG_CHECKING([for yet another 'intro' bitmap])
9291 if test -z "$with_intro_bitmap" -o "$with_intro_bitmap" = "no" ; then
9292     if test "$with_intro_bitmap" = "no" ; then
9293         INTRO_BITMAP=
9294     fi
9295     AC_MSG_RESULT([none])
9296 else
9297     case "$with_intro_bitmap" in
9298     *.png) INTRO_BITMAP="$with_intro_bitmap" ;;
9299     *)     AC_MSG_WARN([Intro bitmap should be a .png file!]) ;;
9300     esac
9301     AC_MSG_RESULT([$INTRO_BITMAP])
9303 AC_SUBST(INTRO_BITMAP)
9305 AC_MSG_CHECKING([for yet another 'about' bitmap])
9306 if test -z "$with_about_bitmap" -o "$with_about_bitmap" = "no" ; then
9307     if test "$with_about_bitmap" = "no" ; then
9308         ABOUT_BITMAP=
9309     fi
9310     AC_MSG_RESULT([none])
9311 else
9312    case "$with_about_bitmap" in
9313    *.png) ABOUT_BITMAP="$with_about_bitmap" ;;
9314    *)     AC_MSG_WARN([About bitmap should be a .png file!]) ;;
9315    esac
9316    AC_MSG_RESULT([$ABOUT_BITMAP])
9318 AC_SUBST(ABOUT_BITMAP)
9320 AC_MSG_CHECKING([for yet another 'start center left' bitmap])
9321 if test -z "$with_startcenter_left_bitmap" -o "$with_startcenter_left_bitmap" = "no" ; then
9322    if test "$with_startcenter_left_bitmap" = "no" ; then
9323       STARTCENTER_LEFT_BITMAP=
9324    fi
9325    AC_MSG_RESULT([none])
9326 else
9327    case "$with_startcenter_left_bitmap" in
9328       *.png) STARTCENTER_LEFT_BITMAP="$with_startcenter_left_bitmap" ;;
9329       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9330    esac
9331    AC_MSG_RESULT([$STARTCENTER_LEFT_BITMAP])
9333 AC_SUBST(STARTCENTER_LEFT_BITMAP)
9335 AC_MSG_CHECKING([for yet another 'start center right' bitmap])
9336 if test -z "$with_startcenter_right_bitmap" -o "$with_startcenter_right_bitmap" = "no" ; then
9337    if test "$with_startcenter_right_bitmap" = "no" ; then
9338       STARTCENTER_RIGHT_BITMAP=
9339    fi
9340    AC_MSG_RESULT([none])
9341 else
9342    case "$with_startcenter_right_bitmap" in
9343       *.png) STARTCENTER_RIGHT_BITMAP="$with_startcenter_right_bitmap" ;;
9344       *)     AC_MSG_WARN([Startcenter right bitmap should be a .png file!]) ;;
9345    esac
9346    AC_MSG_RESULT([$STARTCENTER_RIGHT_BITMAP])
9348 AC_SUBST(STARTCENTER_RIGHT_BITMAP)
9350 AC_MSG_CHECKING([for yet another 'start center rtl left' bitmap])
9351 if test -z "$with_startcenter_rtl_left_bitmap" -o "$with_startcenter_rtl_left_bitmap" = "no" ; then
9352    if test "$with_startcenter_rtl_left_bitmap" = "no" ; then
9353       STARTCENTER_RTL_LEFT_BITMAP=
9354    fi
9355    AC_MSG_RESULT([none])
9356 else
9357    case "$with_startcenter_rtl_left_bitmap" in
9358       *.png) STARTCENTER_RTL_LEFT_BITMAP="$with_startcenter_rtl_left_bitmap" ;;
9359       *)     AC_MSG_WARN([Startcenter rtl left bitmap should be a .png file!]) ;;
9360    esac
9361    AC_MSG_RESULT([$STARTCENTER_RTL_LEFT_BITMAP])
9363 AC_SUBST(STARTCENTER_RTL_LEFT_BITMAP)
9365 AC_MSG_CHECKING([for yet another 'start center rtl right' bitmap])
9366 if test -z "$with_startcenter_rtl_right_bitmap" -o "$with_startcenter_rtl_right_bitmap" = "no" ; then
9367    if test "$with_startcenter_rtl_right_bitmap" = "no" ; then
9368       STARTCENTER_RTL_RIGHT_BITMAP=
9369    fi
9370    AC_MSG_RESULT([none])
9371 else
9372    case "$with_startcenter_rtl_right_bitmap" in
9373       *.png) STARTCENTER_RTL_RIGHT_BITMAP="$with_startcenter_rtl_right_bitmap" ;;
9374       *)     AC_MSG_WARN([Startcenter rtl right bitmap should be a .png file!]) ;;
9375    esac
9376    AC_MSG_RESULT([$STARTCENTER_RTL_RIGHT_BITMAP])
9378 AC_SUBST(STARTCENTER_RTL_RIGHT_BITMAP)
9380 AC_MSG_CHECKING([for yet another 'start center space' bitmap])
9381 if test -z "$with_startcenter_space_bitmap" -o "$with_startcenter_space_bitmap" = "no" ; then
9382    if test "$with_startcenter_space_bitmap" = "no" ; then
9383       STARTCENTER_SPACE_BITMAP=
9384    fi
9385    AC_MSG_RESULT([none])
9386 else
9387    case "$with_startcenter_space_bitmap" in
9388       *.png) STARTCENTER_SPACE_BITMAP="$with_startcenter_space_bitmap" ;;
9389       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9390    esac
9391    AC_MSG_RESULT([$STARTCENTER_SPACE_BITMAP])
9393 AC_SUBST(STARTCENTER_SPACE_BITMAP)
9395 OOO_VENDOR=
9396 AC_MSG_CHECKING([for vendor])
9397 if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
9398     AC_MSG_RESULT([not set])
9399 else
9400     OOO_VENDOR="$with_vendor"
9401     AC_MSG_RESULT([$OOO_VENDOR])
9403 AC_SUBST(OOO_VENDOR)
9405 UNIXWRAPPERNAME=
9406 AC_MSG_CHECKING([for UNIX wrapper name])
9407 if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
9408     AC_MSG_RESULT([not set])
9409 else
9410     UNIXWRAPPERNAME="$with_unix_wrapper"
9411     AC_MSG_RESULT([$UNIXWRAPPERNAME])
9413 AC_SUBST(UNIXWRAPPERNAME)
9415 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
9416 if test "$with_compat_oowrappers" = "yes" ; then
9417     WITH_COMPAT_OOWRAPPERS=YES
9418     AC_MSG_RESULT(yes)
9419 else
9420     WITH_COMPAT_OOWRAPPERS=
9421     AC_MSG_RESULT(no)
9423 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
9425 AC_MSG_CHECKING([for product name])
9426 PRODUCTNAME=AC_PACKAGE_NAME
9427 AC_MSG_RESULT([$PRODUCTNAME])
9428 AC_SUBST(PRODUCTNAME)
9430 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
9431 AC_MSG_CHECKING([for install dirname])
9432 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes" ; then
9433    INSTALLDIRNAME="$with_install_dirname"
9435 AC_MSG_RESULT([$INSTALLDIRNAME])
9436 AC_SUBST(INSTALLDIRNAME)
9438 AC_MSG_CHECKING([for prefix])
9439 test "x$prefix" = xNONE && prefix=$ac_default_prefix
9440 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
9441 PREFIXDIR="$prefix"
9442 AC_MSG_RESULT([$PREFIXDIR])
9443 AC_SUBST(PREFIXDIR)
9445 AC_MSG_CHECKING([for libdir])
9446 LIBDIR=[$(eval echo $(eval echo $libdir))]
9447 AC_MSG_RESULT([$LIBDIR])
9448 AC_SUBST(LIBDIR)
9450 AC_MSG_CHECKING([for data dir])
9451 DATADIR=[$(eval echo $(eval echo $datadir))]
9452 AC_MSG_RESULT([$DATADIR])
9453 AC_SUBST(DATADIR)
9455 AC_MSG_CHECKING([for man dir])
9456 MANDIR=[$(eval echo $(eval echo $mandir))]
9457 AC_MSG_RESULT([$MANDIR])
9458 AC_SUBST(MANDIR)
9460 AC_MSG_CHECKING([for doc dir])
9461 DOCDIR=[$(eval echo $(eval echo $docdir))]
9462 AC_MSG_RESULT([$DOCDIR])
9463 AC_SUBST(DOCDIR)
9465 AC_MSG_CHECKING([for install dir])
9466 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
9467 AC_MSG_RESULT([$INSTALLDIR])
9468 AC_SUBST(INSTALLDIR)
9470 AC_MSG_CHECKING([whether to statically link to Gtk])
9471 if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
9472     ENABLE_STATIC_GTK="TRUE"
9473     AC_MSG_RESULT([yes])
9474 else
9475     ENABLE_STATIC_GTK="FALSE"
9476     AC_MSG_RESULT([no])
9478 AC_SUBST(ENABLE_STATIC_GTK)
9480 # ===================================================================
9481 # De- or increase default verbosity of build process
9482 # ===================================================================
9483 AC_MSG_CHECKING([build verbosity])
9484 if test -n "$enable_verbose"; then
9485     if test "$enable_verbose" = "yes"; then
9486         VERBOSE="TRUE"
9487         AC_MSG_RESULT([high])
9488     fi
9489     if test "$enable_verbose" = "no"; then
9490         VERBOSE="FALSE"
9491         AC_MSG_RESULT([low])
9492     fi
9493 else
9494     AC_MSG_RESULT([not set])
9496 AC_SUBST(VERBOSE)
9498 dnl ===================================================================
9499 dnl Use zenity during build
9500 dnl ===================================================================
9501 AC_MSG_CHECKING([whether to use zenity during build])
9502 if test "$enable_zenity" = "yes"; then
9503     AC_MSG_RESULT([yes])
9504     AC_PATH_PROGS( ZNTY, zenity )
9505     if test -z "$ZNTY"; then
9506         ENABLE_ZENITY=FALSE
9507     else
9508         ENABLE_ZENITY=TRUE
9509     fi
9510 else
9511     ENABLE_ZENITY=FALSE
9512     AC_MSG_RESULT([no])
9514 AC_SUBST(ENABLE_ZENITY)
9517 dnl ===================================================================
9518 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
9519 dnl --enable-dependency-tracking configure option
9520 dnl ===================================================================
9521 AC_MSG_CHECKING([whether to enable dependency tracking])
9522 if test "$enable_dependency_tracking" = "no"; then
9523     nodep=TRUE
9524     AC_MSG_RESULT([no])
9525 else
9526     AC_MSG_RESULT([yes])
9528 AC_SUBST(nodep)
9530 dnl ===================================================================
9531 dnl Number of CPUs to use during the build
9532 dnl ===================================================================
9533 AC_MSG_CHECKING([for number of processors to use])
9534 if test -n "$with_num_cpus"; then
9535     BUILD_NCPUS=$with_num_cpus
9536 else
9537     case `uname -s` in
9539     Darwin|FreeBSD|NetBSD|OpenBSD)
9540         BUILD_NCPUS=`sysctl -n hw.ncpu`
9541         ;;
9543     Linux)
9544         BUILD_NCPUS=`getconf _NPROCESSORS_ONLN`
9545         ;;
9546     # what else than above does profit here *and* has /proc?
9547     *)
9548         BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
9549         ;;
9550     esac
9552     # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
9553     # unexpected format, 'wc -l' will have returned 0.
9554     if test "$BUILD_NCPUS" -eq 0; then
9555         BUILD_NCPUS=1
9556     fi
9558 AC_MSG_RESULT([$BUILD_NCPUS])
9559 AC_SUBST(BUILD_NCPUS)
9561 # ===================================================================
9562 # Creating bigger shared library to link against
9563 # ===================================================================
9564 AC_MSG_CHECKING([whether to create a big library for better performance])
9565 MERGELIBS=
9566 if test "$enable_mergelibs" = "yes"; then
9567     MERGELIBS="TRUE"
9568     AC_MSG_RESULT([yes])
9569 else
9570     AC_MSG_RESULT([no])
9572 AC_SUBST(MERGELIBS)
9574 dnl ===================================================================
9575 dnl Number of parallel jobs to be executed by dmake
9576 dnl ===================================================================
9577 AC_MSG_CHECKING([for maximum of jobs per processor])
9578 BUILD_MAX_JOBS="1"
9579 if test "z$with_max_jobs" != "z"; then
9580     BUILD_MAX_JOBS="$with_max_jobs"
9581 else
9582     if test "$enable_icecream" = "yes" ; then
9583         BUILD_MAX_JOBS="10"
9584     fi
9586 AC_MSG_RESULT([$BUILD_MAX_JOBS])
9587 AC_SUBST(BUILD_MAX_JOBS)
9589 # =====================================================================
9590 # determine the parallelism for gnu make
9591 # =====================================================================
9592 AC_MSG_CHECKING([for maximum parallelism for gmake])
9593 if test $BUILD_MAX_JOBS -gt $BUILD_NCPUS ; then
9594     GMAKE_PARALLELISM="$BUILD_MAX_JOBS"
9595 else
9596     GMAKE_PARALLELISM="$BUILD_NCPUS"
9598 GMAKE_MODULE_PARALLELISM="$BUILD_MAX_JOBS"
9599 if test "$no_parallelism_make" = "YES" ; then
9600     if test -z "$with_num_cpus"; then
9601         GMAKE_PARALLELISM="1";
9602         if test $GMAKE_MODULE_PARALLELISM -gt 1 ; then
9603             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
9604             if test -z "$with_num_cpus"; then
9605                 echo "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this." >> warn
9606             fi
9607             GMAKE_MODULE_PARALLELISM="1"
9608         fi
9609     else
9610         GMAKE_PARALLELISM="$BUILD_NCPUS";
9611         echo "make 3.81 is prone to crashes with parallelism > 1. Since --with-num-cpus was explicitly given, it is honored, but do not complain when make segfault on you." >> warn
9612     fi
9615 # GMAKE_PARALLELISM is used in tail_build
9616 # GMAKE_MODULE_PARALLELISM is used when building individual gbuildified module
9617 AC_MSG_RESULT([per module:$GMAKE_MODULE_PARALLELISM, for tail_build:$GMAKE_PARALLELISM])
9618 AC_SUBST(GMAKE_PARALLELISM)
9619 AC_SUBST(GMAKE_MODULE_PARALLELISM)
9621 dnl ===================================================================
9622 dnl Setting up the environment.
9623 dnl ===================================================================
9624 echo "setting up the build environment variables..."
9626 if test -z "$COMPATH"; then
9627     AC_MSG_ERROR([No compiler found.])
9629 AC_SUBST(COMPATH)
9631 AC_MSG_CHECKING([solver path])
9632 if test -z "$with_local_solver"; then
9633     LOCAL_SOLVER="DEFAULT"
9634     AC_MSG_RESULT([default])
9635 else
9636     LOCAL_SOLVER=$with_local_solver
9637     AC_MSG_RESULT([$with_local_solver])
9639 AC_SUBST(LOCAL_SOLVER)
9641 AC_SUBST(BUILD_TYPE)
9643 if test "$WITH_MINGW" != "yes" ; then
9644     MINGW_EXTERNAL_DLLS=
9645 else
9646     mingw_dlldir=`$CC -print-sysroot`/mingw/bin
9647     for DLL in $MINGW_EXTERNAL_DLLS ; do
9648         AC_MSG_CHECKING([for $DLL])
9649         if ! test -f "$mingw_dlldir/$DLL" ; then
9650             AC_MSG_ERROR([Could not find $DLL, install the appropriate mingw32-<package>, not only mingw32-<package>-devel.])
9651         fi
9652         AC_MSG_RESULT([$mingw_dlldir/$DLL])
9653     done
9655 AC_SUBST(MINGW_EXTERNAL_DLLS)
9657 # make sure config.guess is +x; we execute config.guess, so it has to be so;
9658 chmod +x ./config.guess
9660 dnl Setting up the post_download check script
9661 dnl Using autoconf here, so that the migration from the previous state
9662 dnl (checks for the additional Windows downloads were directly in
9663 dnl configure.in) is as easy as possible
9664 echo "setting up the post_download check script"
9665 autoconf post_download.in > post_download
9666 chmod +x post_download
9668 # Generate a configuration timestamp we can use for deps
9669 if test -f set_soenv; then
9670     mv -f set_soenv set_soenv.last
9671 else
9672     echo > set_soenv.last
9675 AC_CONFIG_FILES([ooo.lst set_soenv bin/repo-list desktop/scripts/soffice.sh build_env])
9676 AC_OUTPUT
9678 # make sure this is executable
9679 chmod +x desktop/scripts/soffice.sh
9681 # touch the config timestamp file set_soenv.stamp
9682 if test ! -f set_soenv.stamp; then
9683     echo > set_soenv.stamp
9684 elif diff set_soenv set_soenv.last >/dev/null 2>&1; then
9685     echo "Configuration unchanged - avoiding scp2 stamp update"
9686 else
9687     echo > set_soenv.stamp
9690 dnl Run the set_soenv script to setup the Env.Host.sh script that sets
9691 dnl environment variables for the build.
9692 chmod +x set_soenv
9694 ./set_soenv
9696 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: