s/OpenOffice.org/LibreOffice/ fdo#43120
[LibreOffice.git] / configure.in
blobeebcc78f2230bf2fb0e9a4d0ea454798efd14b59
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
163     ;;
165 darwin*) # Mac OS X or iOS
166     test_gtk=yes
167     test_randr=no
168     test_xrender=no
169     test_freetype=no
170     test_fontconfig=no
171     if test "$host_cpu" = "arm"; then
172         _os=iOS
173         test_gtk=no
174         test_cups=no
175     else
176         _os=Darwin
177     fi
178     enable_systray=no
181 freebsd*)
182     test_gtk=yes
183     build_gstreamer=yes
184     test_kde=yes
185     test_kde4=yes
186     test_freetype=yes
187     AC_MSG_CHECKING([the FreeBSD operating system release])
188     if test -n "$with_os_version"; then
189         OSVERSION="$with_os_version"
190     else
191         OSVERSION=`/sbin/sysctl -n kern.osreldate`
192     fi
193     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
194     AC_MSG_CHECKING([which thread library to use])
195     if test "$OSVERSION" -lt "500016"; then
196         PTHREAD_CFLAGS="-D_THREAD_SAFE"
197         PTHREAD_LIBS="-pthread"
198     elif test "$OSVERSION" -lt "502102"; then
199         PTHREAD_CFLAGS="-D_THREAD_SAFE"
200         PTHREAD_LIBS="-lc_r"
201     else
202         PTHREAD_CFLAGS=""
203         PTHREAD_LIBS="-pthread"
204     fi
205     AC_MSG_RESULT([$PTHREAD_LIBS])
206     _os=FreeBSD
207     ;;
209 *netbsd*)
210     test_gtk=yes
211     build_gstreamer=yes
212     test_kde=no
213     test_kde4=yes
214     test_freetype=yes
215     PTHREAD_LIBS="-pthread -lpthread"
216     _os=NetBSD
217     ;;
219 aix*)
220     test_randr=no
221     test_freetype=yes
222     PTHREAD_LIBS=-pthread
223     _os=AIX
224     ;;
226 openbsd*)
227     test_gtk=yes
228     test_kde=yes
229     test_freetype=yes
230     PTHREAD_CFLAGS="-D_THREAD_SAFE"
231     PTHREAD_LIBS="-pthread"
232     _os=OpenBSD
233     ;;
235 dragonfly*)
236     test_gtk=yes
237     build_gstreamer=yes
238     test_kde=yes
239     test_kde4=yes
240     test_freetype=yes
241     PTHREAD_LIBS="-pthread"
242     _os=DragonFly
243     ;;
245 linux-androideabi*)
246     build_gstreamer=no
247     test_cups=no
248     test_fontconfig=no
249     test_freetype=no
250     test_gtk=no
251     test_kde=no
252     test_kde4=no
253     test_randr=no
254     test_xrender=no
255     test_unix_quickstarter=no
256     _os=Android
258     # Make sure env vars pointing to where to find the cross-build
259     # toolchain are set. There aren't really any sensible
260     # guesstimates.
261     for var in CC CXX AR NM OBJDUMP RANLIB STRIP; do
262         if test -z `eval echo '$'$var`; then
263             AC_MSG_ERROR([You need to set the $var environment variable in a cross-compilation for Android. See README.cross for an example.])
264         fi
265     done
266     ;;
269     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
270     ;;
271 esac
273 if test "$_os" = "AIX"; then
274     AC_PATH_PROG(GAWK, gawk)
275     if test -z "$GAWK"; then
276         AC_MSG_ERROR([gawk not found in \$PATH])
277     fi
280 AC_SUBST(WITH_MINGW)
281 AC_SUBST(OSVERSION)
282 AC_SUBST(PTHREAD_CFLAGS)
283 AC_SUBST(PTHREAD_LIBS)
286 ###############################################################################
287 # Extensions switches --enable/--disable
288 ###############################################################################
289 # By default these should be enabled unless having extra dependencies.
290 # If there is extra dependency over configure options then the enable should
291 # be automagic based on wether the requiring feature is enabled or not.
292 # All this options change anything only with --enable-extension-integration.
293 AC_ARG_ENABLE(extension-integration,
294     AS_HELP_STRING([--disable-extension-integration],
295         [Disable integration of the builded extensions to the installer of the
296          product. Use this switch to disable the integration.])
299 AC_ARG_ENABLE(ext-barcode,
300     AS_HELP_STRING([--enable-ext-barcode],
301         [Enable the Barcode extension.])
304 AC_ARG_ENABLE(ext-diagram,
305     AS_HELP_STRING([--enable-ext-diagram],
306         [Enable the SmART Gallery (Diagram) extension.])
309 AC_ARG_ENABLE(ext-google-docs,
310     AS_HELP_STRING([--enable-ext-google-docs],
311         [Enable the Google Documents extension.])
314 AC_ARG_ENABLE(ext-hunart,
315     AS_HELP_STRING([--enable-ext-hunart],
316         [Enable the Hungarian Cross-reference Toolbar extension.])
319 AC_ARG_ENABLE(ext-languagetool,
320     AS_HELP_STRING([--enable-ext-languagetool],
321         [Enable the LanguageTool extension.])
324 AC_ARG_ENABLE(ext-lightproof,
325     AS_HELP_STRING([--enable-ext-lightproof],
326         [Enable the Lightproof extension. The enable switch can contain only
327          the desired languages: --enable-lightproof="en hu ru"]),
328     [enable_ext_lightproof="$enableval"],
329     [enable_ext_lightproof=no]
332 AC_ARG_ENABLE(ext-mysql-connector,
333     AS_HELP_STRING([--enable-ext-mysql-connector],
334         [Enable the build of the MySQL Connector extension.])
337 AC_ARG_ENABLE(ext-nlpsolver,
338     AS_HELP_STRING([--enable-ext-nlpsolver],
339         [Enable the NLPSolver extension.])
342 AC_ARG_ENABLE(ext-ct2n,
343     AS_HELP_STRING([--enable-ext-ct2n],
344         [Enable the ConvertTextToNumber extension.])
347 AC_ARG_ENABLE(ext-numbertext,
348     AS_HELP_STRING([--enable-ext-numbertext],
349         [Enable the Numbertext extension.])
352 AC_ARG_ENABLE(ext-oooblogger,
353     AS_HELP_STRING([--enable-ext-oooblogger],
354         [Enable the OOo Blogger extension.])
357 AC_ARG_ENABLE(ext-pdfimport,
358     AS_HELP_STRING([--disable-ext-pdfimport],
359         [Disable the PDF Import extension.])
362 AC_ARG_ENABLE(ext-postgresql-sdbc,
363     AS_HELP_STRING([--enable-ext-postgresql-sdbc],
364         [Enable the build of the PostgreSQL-SDBC extension.])
367 AC_ARG_ENABLE(ext-presenter-console,
368     AS_HELP_STRING([--disable-ext-presenter-console],
369         [Disable the Presenter Console extension.])
372 AC_ARG_ENABLE(ext-presenter-minimizer,
373     AS_HELP_STRING([--disable-ext-presenter-minimizer],
374         [Disable the Presentation Minimizer extension.])
377 AC_ARG_ENABLE(ext-report-builder,
378     AS_HELP_STRING([--disable-ext-report-builder],
379         [Disable the Report Builder extension.])
382 AC_ARG_ENABLE(ext-scripting-beanshell,
383     AS_HELP_STRING([--enable-ext-scripting-beanshell],
384         [Enable support for scripts in BeanShell.])
387 AC_ARG_ENABLE(ext-scripting-javascript,
388     AS_HELP_STRING([--enable-ext-scripting-javascript],
389         [Enable support for scripts in JavaScript.])
392 AC_ARG_ENABLE(ext-typo,
393     AS_HELP_STRING([--enable-ext-typo],
394         [Enable the Typography Toolbar extension.])
397 AC_ARG_ENABLE(ext-validator,
398     AS_HELP_STRING([--enable-ext-validator],
399         [Enable the Validator extension.])
402 AC_ARG_ENABLE(ext-watch-window,
403     AS_HELP_STRING([--enable-ext-watch-window],
404         [Enable the Watch Window extension to Calc.])
407 AC_ARG_ENABLE(ext-wiki-publisher,
408     AS_HELP_STRING([--enable-ext-wiki-publisher],
409         [Enable the Wiki Publisher extension.])
411 ###############################################################################
413 dnl ---------- *** ----------
415 AC_ARG_ENABLE(mergelibs,
416     AS_HELP_STRING([--enable-mergelibs],
417         [Enables linking of big merged library used for better performance.])
420 AC_ARG_ENABLE(graphite,
421     AS_HELP_STRING([--enable-graphite],
422         [Enables the compilation of Graphite smart font rendering.])
425 AC_ARG_ENABLE(ldap,
426     AS_HELP_STRING([--disable-ldap],
427         [Disables the use of LDAP backend via Netscape/Mozilla or OpenLDAP LDAP SDK])
430 AC_ARG_ENABLE(fetch-external,
431     AS_HELP_STRING([--disable-fetch-external],
432         [Disables fetching external tarballs from web sources.])
435 AC_ARG_ENABLE(lockdown,
436     AS_HELP_STRING([--disable-lockdown],
437         [Disables the gconf integration work in LibreOffice.]),
440 AC_ARG_ENABLE(vba,
441     AS_HELP_STRING([--disable-vba],
442         [Disables the vba compatibility feature.])
445 AC_ARG_ENABLE(pch,
446     AS_HELP_STRING([--enable-pch],
447         [EXPERIMENTAL: Enables precompiled header support for C++.])
450 AC_ARG_ENABLE(mozilla,
451     AS_HELP_STRING([--disable-mozilla],
452         [LibreOffice usually includes a strangely hacked up Mozilla binary for your
453          platform, to build without this version, use this option.])
456 AC_ARG_ENABLE(epm,
457     AS_HELP_STRING([--enable-epm],
458         [LibreOffice includes self-packaging code, that requires epm, however epm is
459          useless for large scale package building.])
462 AC_ARG_ENABLE(activex_component,
463     AS_HELP_STRING([--disable-activex-component],
464         [Remove support for ActiveX embedding of LibreOffice.])
467 AC_ARG_ENABLE(odk,
468     AS_HELP_STRING([--disable-odk],
469         [LibreOffice includes an ODK, office development kit which some packagers may
470          wish to build without.])
473 AC_ARG_ENABLE(mathmldtd,
474     AS_HELP_STRING([--disable-mathmldtd],
475         [Disable mathmldtd (useful for distributions that want to avoid
476          packaging it).])
479 AC_ARG_ENABLE(evolution2,
480     AS_HELP_STRING([--enable-evolution2],
481         [Allows the built-in evolution 2 addressbook connectivity build to be
482          enabled.])
485 AC_ARG_ENABLE(directx,
486     AS_HELP_STRING([--disable-directx],
487         [Remove DirectX implementation for the new XCanvas interface.
488          The DirectX support requires more stuff installed on Windows to
489          compile. (DirectX SDK, GDI+ libs)])
492 AC_ARG_ENABLE(activex,
493     AS_HELP_STRING([--disable-activex],
494         [Disable the use of ActiveX for a Windows build.
495         This switch is mandatory when using VC++ 2008 Express.])
498 AC_ARG_ENABLE(atl,
499     AS_HELP_STRING([--disable-atl],
500         [Disable the use of ATL for a Windows build.])
501     [
502                           This switch is mandatory when using VC++ 2008 Express.
503     ],
506 AC_ARG_ENABLE(symbols,
507     AS_HELP_STRING([--enable-symbols],
508         [Include debugging symbols in output. WARNING - a complete build needs
509          8 Gb of space and takes much longer (enables -g compiler flag).])
510     [
511                           Enabling symbols disables the stripping of the solver
512                           (--disable-strip-solver).
513     ],
516 AC_ARG_ENABLE(strip-solver,
517     AS_HELP_STRING([--disable-strip-solver],
518         [Disable the stripping of the solver. By default the solver is stripped
519          unless a build with debugging symbols (--enable-symbols) is requested.])
520     [
521                           This switch allows to override this setting.
522     ],
525 AC_ARG_ENABLE(werror,
526     AS_HELP_STRING([--enable-werror],
527         [Turn warnings to errors. (Has no effect in modules where the treating
528          of warnings as errors is disabled explicitly.)]),
531 AC_ARG_ENABLE(debug,
532     AS_HELP_STRING([--enable-debug],
533         [Include debugging symbols from --enable-symbols plus extra debugging
534          code. Extra large build! (enables -g compiler flag and dmake debug=true)
535          If you need even more verbose output, build a module with
536          "build -- debug=true dbglevel=2".]))
538 AC_ARG_ENABLE(dbgutil,
539     AS_HELP_STRING([--enable-dbgutil],
540         [Include additional debugging utilities, such as assertions, object
541          counting, etc. Larger build. Independent from --enable-debug]))
543 AC_ARG_ENABLE(linkoo,
544     AS_HELP_STRING([--disable-linkoo],
545         [Disable linkoo for the smoketest installation.]))
547 AC_ARG_ENABLE(lto,
548     AS_HELP_STRING([--enable-lto],
549         [Enable link-time optimization. Suitable for product builds.
550          Building takes longer but libraries are optimized for speed.
551          (possible only with gcc-4.5 or later,
552           better to use gcc-4.6 and 'gold' as linker)]))
554 AC_ARG_ENABLE(crashdump,
555     AS_HELP_STRING([--enable-crashdump],
556         [Enable the crashdump feature.]))
558 AC_ARG_ENABLE(python,
559     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
560         [Enables or disables Python support at run-time and build-time.
561          Also specifies what Python to use. 'auto' is the
562          default. Note that Python can be disabled with
563          --disable-python or --enable-python=no only if no
564          translations are required.]))
566 AC_ARG_ENABLE(gtk,
567     AS_HELP_STRING([--disable-gtk],
568         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
569 ,enable_gtk=yes)
571 AC_ARG_ENABLE(gtk3,
572     AS_HELP_STRING([--disable-gtk3],
573         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
574 ,enable_gtk3=no)
576 AC_ARG_ENABLE(systray,
577     AS_HELP_STRING([--disable-systray],
578         [Determines whether to build the systray quickstarter.]),
579 ,enable_systray=yes)
581 AC_ARG_ENABLE(split-app-modules,
582     AS_HELP_STRING([--enable-split-app-modules],
583         [Split file lists for app modules, e.g. base, calc.
584          Has effect only with make distro-pack-install]),
587 AC_ARG_ENABLE(split-opt-features,
588     AS_HELP_STRING([--enable-split-opt-features],
589         [Split file lists for some optional features, .e.g. pyuno, testtool.
590          Has effect only with make distro-pack-install]),
593 AC_ARG_ENABLE(cairo-canvas,
594 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
595                           platforms where Cairo is available.
596 ],,enable_cairo_canvas=yes)
598 AC_ARG_ENABLE(librsvg,
599     AS_HELP_STRING([--enable-librsvg=<no/auto/system/internal>],
600         [Enables or disables use of librsvg to render SVG at run-time.
601          Also specificed what librsvg to use. 'auto' is the default.]))
603 AC_ARG_ENABLE(opengl,
604     AS_HELP_STRING([--disable-opengl],
605         [Determines whether to build the OpenGL 3D slide transitions component.]),
606 ,enable_opengl=yes)
608 AC_ARG_ENABLE(dbus,
609     AS_HELP_STRING([--enable-dbus],
610         [Determines whether to enable presentation mode screensaver control
611          under GNOME via DBUS.]),
612 ,enable_dbus=no)
614 AC_ARG_ENABLE(gconf,
615     AS_HELP_STRING([--disable-gconf],
616         [Determines whether to use the GConf support.]),
617 ,enable_gconf=yes)
619 AC_ARG_ENABLE(gnome-vfs,
620     AS_HELP_STRING([--disable-gnome-vfs],
621         [Determines whether to use the Gnome Virtual Filing System on platforms
622          where that VFS is available.]),
623 ,enable_gnome_vfs=yes)
625 AC_ARG_ENABLE(gio,
626     AS_HELP_STRING([--enable-gio],
627         [Determines whether to use the GIO support.]),
628 ,enable_gio=no)
630 AC_ARG_ENABLE(static-gtk,
631     AS_HELP_STRING([--enable-static-gtk],
632         [Modules that are linked against GTK+ libraries use the static libraries
633          instead of the dynamic ones. (Enables -Bstatic linker flag for GTK+ libraries.)]),
636 AC_ARG_ENABLE(build-mozilla,
637     AS_HELP_STRING([--disable-build-mozilla],
638         [Use this option if you do not want to build the Mozilla components from
639          the Mozilla source code but take precompiled zips.]),
642 AC_ARG_ENABLE(xmlsec,
643     AS_HELP_STRING([--disable-xmlsec],
644         [Whether to enable XMLsec for open document signing.]),
647 AC_ARG_ENABLE(kde,
648     AS_HELP_STRING([--enable-kde],
649         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
650          KDE3 are available.]),
653 AC_ARG_ENABLE(kdeab,
654     AS_HELP_STRING([--disable-kdeab],
655         [Disable the KDE3 address book support.]),
657     if test "$enable_kde" = "yes"; then
658         enable_kdeab=yes;
659     fi
662 AC_ARG_ENABLE(kde4,
663     AS_HELP_STRING([--enable-kde4],
664         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
665          KDE4 are available. May be used with --enable-kde if you want to support
666          both KDE3 and KDE4.]),
669 AC_ARG_ENABLE(unix-qstart-libpng,
670     AS_HELP_STRING([--disable-unix-qstart-libpng],
671         [On UNIX systems, we have a faster splash app, that can use libpng to
672          render its splash, if we can safely link to the system libpng then
673          enabling this is a good idea (ie. for Linux Distro packaging).]),
674 ,enable_unix_libpng=yes)
676 AC_ARG_ENABLE(binfilter,
677     AS_HELP_STRING([--enable-binfilter],
678         [Enable legacy binary file formats filters build.]),
679 ,enable_binfilter=no
682 AC_ARG_ENABLE(ugly,
683     AS_HELP_STRING([--enable-ugly],
684         [Enables ugly pieces of functionality.]),
685 ,enable_ugly=no
688 AC_ARG_ENABLE(rpath,
689     AS_HELP_STRING([--disable-rpath],
690         [Disable the use of relative paths in shared libraries.]),
693 AC_ARG_ENABLE(randr,
694     AS_HELP_STRING([--disable-randr],
695         [Disable RandR support in the vcl project.]),
696 ,enable_randr=yes)
698 AC_ARG_ENABLE(randr-link,
699     AS_HELP_STRING([--disable-randr-link],
700         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
701 ,enable_randr_link=yes)
703 AC_ARG_ENABLE(gstreamer,
704     AS_HELP_STRING([--disable-gstreamer],
705         [Disable building the gstreamer avmedia backend.]),
706 ,enable_gstreamer=yes)
708 AC_ARG_ENABLE(neon,
709     AS_HELP_STRING([--disable-neon],
710         [Disable neon and the compilation of webdav binding.]),
713 AC_ARG_ENABLE(build-unowinreg,
714     AS_HELP_STRING([--enable-build-unowinreg],
715         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
716          compiler is needed on Linux.])
717     [
718                           Usage:     --enable-build-unowinreg
719     ],
722 AC_ARG_ENABLE(verbose,
723     AS_HELP_STRING([--enable-verbose],
724         [Increase build verbosity.])[
725   --disable-verbose       Decrease build verbosity.],
728 AC_ARG_ENABLE(dependency-tracking,
729     AS_HELP_STRING([--enable-dependency-tracking],
730         [Do not reject slow dependency extractors.])[
731   --disable-dependency-tracking
732                           Disables generation of dependency information.
733                           Speed up one-time builds.],
736 AC_ARG_ENABLE(icecream,
737     AS_HELP_STRING([--enable-icecream],
738         [Use the 'icecream' distributed compiling tool to speedup the compilation.
739          It defaults to /opt/icecream for the location of the icecream gcc/g++
740          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
743 AC_ARG_ENABLE(zenity,
744     AS_HELP_STRING([--disable-zenity],
745         [Do not display a build icon in the notification area (on unix) during build.]),
746 ,enable_zenity=yes)
748 AC_ARG_ENABLE(nsplugin,
749     AS_HELP_STRING([--disable-nsplugin],
750         [Do not build nsplugin extension for browser embedding.])
753 AC_ARG_ENABLE(ccache,
754     AS_HELP_STRING([--disable-ccache],
755         [Do not try to use ccache automatically.
756          By default, we will try to detect if ccache is available; in that case if
757          CC/CXX are not yet set, and --enable-icecream is not given, we
758          attempt to use ccache. --disable-ccache disables ccache completely.
762 AC_ARG_ENABLE(cl-x64,
763     AS_HELP_STRING([--enable-cl-x64],
764         [Build a 64-bit LibreOffice using the Microsoft C/C++ x64 compiler.]),
767 AC_ARG_ENABLE(extra-gallery,
768     AS_HELP_STRING([--enable-extra-gallery],
769         [Add extra gallery content.]),
772 AC_ARG_ENABLE(extra-template,
773     AS_HELP_STRING([--enable-extra-template],
774         [Add extra template content.]),
777 AC_ARG_ENABLE(extra-sample,
778     AS_HELP_STRING([--enable-extra-sample],
779         [Add extra sample content.]),
782 AC_ARG_ENABLE(extra-font,
783     AS_HELP_STRING([--enable-extra-font],
784         [Add extra font content.]),
787 AC_ARG_ENABLE(lomenubar,
788     AS_HELP_STRING([--enable-lomenubar],
789         [Enable global menu support.]),
792 AC_ARG_ENABLE(online-update,
793     AS_HELP_STRING([--enable-online-update],
794         [Enable the online update service that will check for new versions of
795          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
798 AC_ARG_ENABLE(release-build,
799     AS_HELP_STRING([--enable-release-build],
800         [Enable release build.
801          See http://wiki.documentfoundation.org/DevBuild]),
804 AC_ARG_ENABLE(silent-msi,
805     AS_HELP_STRING([--enable-silent-msi],
806         [Enable MSI with LIMITUI=1 (silent install).]),
809 dnl ===================================================================
810 dnl Optional Packages (--with/without-)
811 dnl ===================================================================
812 AC_ARG_WITH(gnu-patch,
813     AS_HELP_STRING([--with-gnu-patch],
814         [Specify location of GNU patch on Solaris or FreeBSD.]),
817 AC_ARG_WITH(gnu-cp,
818     AS_HELP_STRING([--with-gnu-cp],
819         [Specify location of GNU cp on Solaris or FreeBSD.]),
822 AC_ARG_WITH(external-tar,
823     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
824         [Specify path to tarfiles manually.]),
825     TARFILE_LOCATION=$withval ,
828 AC_ARG_WITH(linked-git,
829     AS_HELP_STRING([--with-linked-git=<OTHER_CLONE_DIR>],
830         [Specify another checkout's clonedir to re-use. This makes use of
831                  git-new-workdir, and saves a lot of diskspace when having multiple
832                  trees side-by-side.]),
833     GIT_LINK_SRC=$withval ,
836 AC_ARG_WITH(openldap,
837     AS_HELP_STRING([--with-openldap],
838         [Enables the use of the OpenLDAP LDAP SDK instead of the Netscape/Mozilla one.]),
841 AC_ARG_WITH(vba-package-format,
842     AS_HELP_STRING([--with-vba-package-format],
843         [Specify package format for vba compatibility api. Specifying  "builtin"
844          means the api component and associated type library are  part of the
845          installation set. Specifying "extn" creates an uno extension that is
846          part of the installation set (located in the program directory) that
847          MUST be optionly registered using either the unopkg executeable or the
848          extension manager gui.])
849     [
850                           Note: "builtin" is the default, "extn" can cause
851                           problems.
853                           Usage:     --with-vba-package-format="builtin" or
854                                      --with-vba-package-format="extn"
855     ],
858 AC_ARG_WITH(theme,
859     AS_HELP_STRING([--with-theme="theme1 theme2..."],
860         [Choose which themes to include. By default those themes with an '*' are included.
861          Possible choices: *default, *crystal, *hicontrast, *oxygen, *tango, classic, industrial.]),
864 AC_ARG_WITH(helppack-integration,
866   --without-helppack-integration      It will not integrate the helppacks to the installer
867                           of the product.
868                           Please use this switch to use the online help or separate help packages.],
871 AC_ARG_WITH(fonts,
872     AS_HELP_STRING([--without-fonts],
873         [LibreOffice includes some third-party fonts to provide a reliable basis for
874          help content, templates, samples, etc. When these fonts are already
875          known to be available on the system then you should use this option.]),
878 AC_ARG_WITH(ppds,
879     AS_HELP_STRING([--without-ppds],
880         [Removes Postscript Printer definition files from LibreOffice
881          installation set, for people building for specific distributions where
882          PPDs are known to be already available (every recent distro with CUPS backend).]),
885 AC_ARG_WITH(afms,
886     AS_HELP_STRING([--without-afms],
887         [Removes bitmap font files from LibreOffice installation set, for people
888          building for specific distributions where AFM files or TrueType Fonts
889          are known to be available.]),
892 AC_ARG_WITH(agfa-monotype-fonts,
893      AS_HELP_STRING([--with-agfa-monotype-fonts],
894           [This switch should only be enabled for those who have the right
895            to use or distribute the proprietary Agfa Monotype
896            fonts.])
899 AC_ARG_WITH(epm,
900     AS_HELP_STRING([--with-epm],
901         [Decides which epm to use. Default is to use the one from the system if
902          one is built. When either this is not there or you say =internal epm
903          will be built.]),
906 AC_ARG_WITH(package-format,
907     AS_HELP_STRING([--with-package-format],
908         [Specify package format(s) for LibreOffice installsets. Default is the
909          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
910          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
911           installed, msi. Example: --with-package-format="deb dmg"]),
914 AC_ARG_WITH(system-libs,
915     AS_HELP_STRING([--with-system-libs],
916         [Use libraries already on system -- enables all --with-system-* flags except
917          mozilla.]),
920 AC_ARG_WITH(system-headers,
921     AS_HELP_STRING([--with-system-headers],
922         [Use headers already on system -- enables all --with-system-* flags for
923          external packages whose headers are the only entities used i.e.
924          boost/vigra/odbc/sane-header(s).]),
927 AC_ARG_WITH(system-jars,
928     AS_HELP_STRING([--without-system-jars],
929         [When building with --with-system-libs, also the needed jars are expected
930          on the system. Use this to disable that (except for the db case where
931          --with-system-db *has to* imply using the db.jar from there, too).]),
934 AC_ARG_WITH(system-stdlibs,
935     AS_HELP_STRING([--with-system-stdlibs],
936         [Use libstdc++/libgcc_s already on system.]),,
937     [with_system_stdlibs="$with_system_libs"])
939 AC_ARG_WITH(system-cairo,
940     AS_HELP_STRING([--with-system-cairo],
941         [Use Cairo libraries already on system.]),,
942     [with_system_cairo="$with_system_libs"])
944 AC_ARG_WITH(system-graphite,
945     AS_HELP_STRING([--with-system-graphite],
946         [Use graphite library already installed on system.]),,
947     [with_system_graphite="$with_system_libs"])
949 AC_ARG_WITH(system-nss,
950     AS_HELP_STRING([--with-system-nss],
951         [Use NSS/nspr libraries already on system.]),,
952     [with_system_nss="$with_system_libs"])
954 AC_ARG_WITH(mozilla-version,
955     AS_HELP_STRING([--with-mozilla-version],
956         [Choose which version of Mozilla to use while building Mozilla.
957          (default=1.7.5) Note that not all versions are supported.]),
960 AC_ARG_WITH(mozilla-toolkit,
961     AS_HELP_STRING([--with-mozilla-toolkit],
962         [Choose which GUI toolkit to use while building Mozilla components. (default=gtk2)]),
965 AC_ARG_WITH(myspell-dicts,
966     AS_HELP_STRING([--without-myspell-dicts],
967         [Removes myspell dictionaries from LibreOffice installation set, for
968          people building for specific distributions where the myspell dictionaries
969          are installed from other sources.]),
972 AC_ARG_WITH(system-dicts,
973     AS_HELP_STRING([--with-system-dicts],
974         [Use dictionaries from system paths- Specify them via
975          --with-{dict,hyph,thes}-path=/path if you want to override the default ones.]),
978 AC_ARG_WITH(external-dict-dir,
979     AS_HELP_STRING([--with-external-dict-dir],
980         [Specify external dictionary dir.]),
983 AC_ARG_WITH(external-hyph-dir,
984     AS_HELP_STRING([--with-external-hyph-dir],
985         [Specify external hyphenation pattern dir.]),
988 AC_ARG_WITH(external-thes-dir,
989     AS_HELP_STRING([--with-external-thes-dir],
990         [Specify external thesaurus dir.]),
993 AC_ARG_WITH(system-zlib,
994     AS_HELP_STRING([--with-system-zlib],
995         [Use zlib already on system.]),,
996  [if test "$_os" != "WINNT"; then
997     with_system_zlib=yes
998   else
999     with_system_zlib="$with_system_libs"
1000   fi])
1002 AC_ARG_WITH(system-openssl,
1003     AS_HELP_STRING([--with-system-openssl],
1004         [Use OpenSSL already on system.]),,
1005     [with_system_openssl="$with_system_libs"])
1007 AC_ARG_WITH(system-jpeg,
1008     AS_HELP_STRING([--with-system-jpeg],
1009         [Use jpeg already on system.]),,
1010  [if test "$_os" = "Linux"; then
1011     with_system_jpeg=yes
1012   else
1013     with_system_jpeg="$with_system_libs"
1014   fi])
1016 AC_ARG_WITH(system-expat,
1017     AS_HELP_STRING([--with-system-expat],
1018         [Use expat already on system.]),,
1019     [with_system_expat="$with_system_libs"])
1021 AC_ARG_WITH(system-libcmis,
1022     AS_HELP_STRING([--with-system-libcmis],
1023         [Use libcmis already on system.]),,
1024     [with_system_libcmis="$with_system_libs"])
1026 AC_ARG_WITH(system-libvisio,
1027     AS_HELP_STRING([--with-system-libvisio],
1028         [Use libvisio already on system.]),,
1029     [with_system_libvisio="$with_system_libs"])
1031 AC_ARG_WITH(system-libwpd,
1032     AS_HELP_STRING([--with-system-libwpd],
1033         [Use libwpd already on system.]),,
1034     [with_system_libwpd="$with_system_libs"])
1036 AC_ARG_WITH(system-libwps,
1037     AS_HELP_STRING([--with-system-libwps],
1038         [Use libwps already on system.]),,
1039     [with_system_libwps="$with_system_libs"])
1041 AC_ARG_WITH(system-libwpg,
1042     AS_HELP_STRING([--with-system-libwpg],
1043         [Use libwpg already on system.]),,
1044     [with_system_libwpg="$with_system_libs"])
1046 AC_ARG_WITH(system-libxml,
1047     AS_HELP_STRING([--with-system-libxml],
1048         [Use libxml/libxslt already on system.]),,
1049  [if test "$_os" = "Darwin"; then
1050     with_system_libxml=yes
1051   else
1052     with_system_libxml="$with_system_libs"
1053   fi])
1055 AC_ARG_WITH(system-icu,
1056     AS_HELP_STRING([--with-system-icu],
1057         [Use icu already on system.]),,
1058     [with_system_icu="$with_system_libs"])
1060 AC_ARG_WITH(system-poppler,
1061     AS_HELP_STRING([--with-system-poppler],
1062         [Use system poppler. (only needed for pdfimport extension)]),,
1063     [with_system_poppler="$with_system_libs"])
1065 AC_ARG_WITH(system-db,
1066     AS_HELP_STRING([--with-system-db],
1067         [Use Berkeley db already on system.]),,
1068     [with_system_db="$with_system_libs"])
1070 AC_ARG_WITH(system-lucene,
1071     AS_HELP_STRING([--with-system-lucene],
1072         [Use Lucene already on system.]),,
1073     [with_system_lucene="$with_system_jars"])
1075 AC_ARG_WITH(system-apache-commons,
1076     AS_HELP_STRING([--with-system-apache-commons],
1077         [Use Apache commons libraries already on system.]),,
1078     [with_system_apache_commons="$with_system_jars"])
1080 AC_ARG_WITH(lucene-core-jar,
1081     AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
1082         [Specify path to jarfile manually.]),
1083     LUCENE_CORE_JAR=$withval)
1085 AC_ARG_WITH(lucene-analyzers-jar,
1086     AS_HELP_STRING([--with-lucene-analyzers-jar=JARFILE],
1087         [Specify path to jarfile manually.]),
1088     LUCENE_ANALYZERS_JAR=$withval ,)
1090 AC_ARG_WITH(system-mysql,
1091     AS_HELP_STRING([--with-system-mysql],
1092         [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice
1093          extension. If the the mysql_config executable is not in PATH, use MYSQLCONFIG to
1094          point to it.]),,
1095     [with_system_mysql="$with_system_libs"])
1097 AC_ARG_WITH(libmysql-path,
1098     AS_HELP_STRING([--with-libmysql-path],
1099         [Use Connector/C (libmysql) installation for building the MySQL
1100          Connector/LibreOffice extension.])
1101     [
1102                           Usage:     --with-libmysql-path=<absolute path to
1103                                                   your Connector/C installation>
1104     ],
1107 AC_ARG_WITH(system-mysql-cppconn,
1108     AS_HELP_STRING([--with-system-mysql-cppconn],
1109         [Use MySQL C++ Connector libraries already on system.]),,
1110     [with_system_mysql_cppconn="$with_system_libs"])
1112 AC_ARG_WITH(system-postgresql,
1113     AS_HELP_STRING([--with-system-postgresql],
1114         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1115          extension. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1116     [with_system_postgresql="$with_system_libs"])
1118 AC_ARG_WITH(libpq-path,
1119     AS_HELP_STRING([--with-libpq-path],
1120         [Use this PostgreSQL C interface (libpq) installation for building
1121          the PostgreSQL-SDBC extension.])
1122     [
1123                           Usage:     --with-libpq-path=<absolute path to
1124                                                   your libq installation>
1125     ],
1128 AC_ARG_WITH(system-hsqldb,
1129     AS_HELP_STRING([--with-system-hsqldb],
1130         [Use hsqldb already on system.]),,
1131     [with_system_hsqldb="$with_system_jars"])
1133 AC_ARG_WITH(hsqldb-jar,
1134     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1135         [Specify path to jarfile manually.]),
1136     HSQLDB_JAR=$withval)
1138 AC_ARG_WITH(system-beanshell,
1139     AS_HELP_STRING([--with-system-beanshell],
1140         [Use beanshell already on system.]),,
1141     [with_system_beanshell="$with_system_jars"])
1143 AC_ARG_WITH(beanshell-jar,
1144     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1145         [Specify path to jarfile manually.]),
1146     BSH_JAR=$withval)
1148 AC_ARG_WITH(commons-codec-jar,
1149     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1150         [Specify path to jarfile manually.]),
1151     COMMONS_CODEC_JAR=$withval)
1153 AC_ARG_WITH(commons-lang-jar,
1154     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1155         [Specify path to jarfile manually.]),
1156     COMMONS_LANG_JAR=$withval)
1158 AC_ARG_WITH(commons-httpclient-jar,
1159     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1160         [Specify path to jarfile manually.]),
1161     COMMONS_HTTPCLIENT_JAR=$withval)
1163 AC_ARG_WITH(commons-logging-jar,
1164     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1165         [Specify path to jarfile manually.]),
1166     COMMONS_LOGGING_JAR=$withval)
1168 AC_ARG_WITH(system-servlet-api,
1169     AS_HELP_STRING([--with-system-servlet-api],
1170         [Use servlet-api already on system.]),,
1171     [with_system_servlet_api="$with_system_jars"])
1173 AC_ARG_WITH(servlet-api-jar,
1174     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1175         [Specify path to jarfile manually.]),
1176     SERVLETAPI_JAR=$withval)
1178 AC_ARG_WITH(system-jfreereport,
1179     AS_HELP_STRING([--with-system-jfreereport],
1180         [Use JFreeReport already on system.]),,
1181     [with_system_jfreereport="$with_system_jars"])
1183 AC_ARG_WITH(sac-jar,
1184     AS_HELP_STRING([--with-sac-jar=JARFILE],
1185         [Specify path to jarfile manually.]),
1186     SAC_JAR=$withval)
1188 AC_ARG_WITH(libxml-jar,
1189     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1190         [Specify path to jarfile manually.]),
1191     LIBXML_JAR=$withval)
1193 AC_ARG_WITH(flute-jar,
1194     AS_HELP_STRING([--with-flute-jar=JARFILE],
1195         [Specify path to jarfile manually.]),
1196     FLUTE_JAR=$withval)
1198 AC_ARG_WITH(jfreereport-jar,
1199     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1200         [Specify path to jarfile manually.]),
1201     JFREEREPORT_JAR=$withval)
1203 AC_ARG_WITH(liblayout-jar,
1204     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1205         [Specify path to jarfile manually.]),
1206     LIBLAYOUT_JAR=$withval)
1208 AC_ARG_WITH(libloader-jar,
1209     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1210         [Specify path to jarfile manually.]),
1211     LIBLOADER_JAR=$withval)
1213 AC_ARG_WITH(libloader-jar,
1214     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1215         [Specify path to jarfile manually.]),
1216     LIBLOADER_JAR=$withval)
1218 AC_ARG_WITH(libformula-jar,
1219     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1220         [Specify path to jarfile manually.]),
1221     LIBFORMULA_JAR=$withval)
1223 AC_ARG_WITH(librepository-jar,
1224     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1225         [Specify path to jarfile manually.]),
1226     LIBREPOSITORY_JAR=$withval)
1228 AC_ARG_WITH(libfonts-jar,
1229     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1230         [Specify path to jarfile manually.]),
1231     LIBFONTS_JAR=$withval)
1233 AC_ARG_WITH(libserializer-jar,
1234     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1235         [Specify path to jarfile manually.]),
1236     LIBSERIALIZER_JAR=$withval)
1238 AC_ARG_WITH(libbase-jar,
1239     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1240         [Specify path to jarfile manually.]),
1241     LIBBASE_JAR=$withval)
1243 AC_ARG_WITH(system-saxon,
1244     AS_HELP_STRING([--with-system-saxon],
1245         [Use saxon already on system.]),,
1246     [with_system_saxon="$with_system_jars"])
1248 AC_ARG_WITH(saxon-jar,
1249     AS_HELP_STRING([--with-saxon-jar=JARFILE],
1250         [Specify path to jarfile manually.]),
1251     SAXON_JAR=$withval)
1253 AC_ARG_WITH(system-odbc,
1254     AS_HELP_STRING([--with-system-odbc],
1255         [Use the odbc headers already on system.]),,
1256     [with_system_odbc="$with_system_headers"])
1258 AC_ARG_WITH(system-sane,
1259     AS_HELP_STRING([--with-system-sane],
1260         [Use sane.h already on system.]),,
1261     [with_system_sane="$with_system_headers"])
1263 AC_ARG_WITH(system-xextensions-headers,
1264     AS_HELP_STRING([--with-system-xextensions-headers],
1265         [To build without system X11 extensions headers, use
1266          --without-system-xextensions-headers. This is possibly
1267          useful on legacy unix systems which ship with the libs
1268          but without the headers.]))
1270 AC_ARG_WITH(system-mesa-headers,
1271     AS_HELP_STRING([--with-system-mesa-headers],
1272         [Use Mesa headers already on system.]),,
1273     [with_system_mesa_headers="$with_system_headers"])
1275 AC_ARG_WITH(system-curl,
1276     AS_HELP_STRING([--with-system-curl],
1277         [Use curl already on system.]),,
1278  [if test "$_os" = "Darwin"; then
1279     with_system_curl=yes
1280   else
1281     with_system_curl="$with_system_libs"
1282   fi])
1284 AC_ARG_WITH(system-boost,
1285     AS_HELP_STRING([--with-system-boost],
1286         [Use boost already on system.]),,
1287     [with_system_boost="$with_system_headers"])
1289 AC_ARG_WITH(system-mdds,
1290     AS_HELP_STRING([--with-system-mdds],
1291         [Use mdds already on system.]),,
1292     [with_system_mdds="$with_system_headers"])
1294 AC_ARG_WITH(system-vigra,
1295     AS_HELP_STRING([--with-system-vigra],
1296         [Use vigra already on system.]),,
1297     [with_system_vigra="$with_system_headers"])
1299 AC_ARG_WITH(system-neon,
1300     AS_HELP_STRING([--with-system-neon],
1301         [Use neon already on system.]),,
1302     [with_system_neon="$with_system_libs"])
1304 AC_ARG_WITH(system-hunspell,
1305     AS_HELP_STRING([--with-system-hunspell],
1306         [Use libhunspell already on system.]),,
1307     [with_system_hunspell="$with_system_libs"])
1309 AC_ARG_WITH(system-mythes,
1310     AS_HELP_STRING([--with-system-mythes],
1311         [Use mythes already on system.]),,
1312     [with_system_mythes="$with_system_libs"])
1314 AC_ARG_WITH(system-altlinuxhyph,
1315     AS_HELP_STRING([--with-system-altlinuxhyph],
1316         [Use ALTLinuxhyph already on system.]),,
1317     [with_system_altlinuxhyph="$with_system_libs"])
1319 AC_ARG_WITH(system-lpsolve,
1320     AS_HELP_STRING([--with-system-lpsolve],
1321         [Use lpsolve already on system.]),,
1322     [with_system_lpsolve="$with_system_libs"])
1324 AC_ARG_WITH(system-libexttextcat,
1325     AS_HELP_STRING([--with-system-libexttextcat],
1326         [Use libexttextcat already on system.]),,
1327     [with_system_libexttextcat="$with_system_libs"])
1329 AC_ARG_WITH(system-cppunit,
1330     AS_HELP_STRING([--with-system-cppunit],
1331         [Use cppunit already on system.]),,
1332     [with_system_cppunit="$with_system_libs"])
1334 AC_ARG_WITH(system-redland,
1335     AS_HELP_STRING([--with-system-redland],
1336         [Use redland library already on system.]),,
1337     [with_system_redland="$with_system_libs"])
1339 AC_ARG_WITH(system-mozilla,
1340     AS_HELP_STRING([--with-system-mozilla],
1341         [Use Mozilla already on system. Note that some components cannot be built
1342          against a contemporary Mozilla. The flavour used can be specified by
1343          --with-system-mozilla=<flavour>. Supported are: libxul (default),
1344          xulrunner, firefox, seamonkey, mozilla.]),
1345     WITH_SYSTEM_MOZILLA=$withval ,
1346 WITH_SYSTEM_MOZILLA=no)
1348 AC_ARG_WITH(system-mozilla-headers,
1349     AS_HELP_STRING([--with-system-mozilla-headers],
1350         [Use mozilla headers provided by system instead of bundled ones. Used in
1351          nsplugin]),,
1352     [with_system_mozilla_headers="$with_system_headers"]
1355 AC_ARG_WITH(system-gettext,
1356     AS_HELP_STRING([--with-system-gettext],
1357         [Use gettext runtime library already on system.]),,
1358     [with_system_gettext="$with_system_libs"])
1360 AC_ARG_WITH(system-libpng,
1361     AS_HELP_STRING([--with-system-libpng],
1362         [Use libpng already on system.]),,
1363     [with_system_libpng="$with_system_libs"])
1365 AC_ARG_WITH(linker-hash-style,
1366     AS_HELP_STRING([--with-linker-hash-style],
1367         [Use linker with --hash-style=<style> when linking shared objects.
1368          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1369          if supported on the build system, and "sysv" otherwise.]))
1371 AC_ARG_WITH(stlport,
1372     AS_HELP_STRING([--with-stlport],
1373         [Build the STLPort library for compatibility with old extensions for
1374          architectures where STLPort used to be used.]),
1375     with_stlport=$withval ,
1376 with_stlport=auto)
1378 AC_ARG_WITH(jdk-home,
1379     AS_HELP_STRING([--with-jdk-home],
1380         [If you have installed JDK 1.3 or later on your system please supply the
1381          path here. Note that this is not the location of the java command but the
1382          location of the entire distribution.])
1383     [
1384                           Usage:     --with-jdk-home=<absolute path to JDK home>
1385     ],
1388 AC_ARG_WITH(gxx_include_path,
1389     AS_HELP_STRING([--with-gxx-include-path],
1390         [If you want to override the autodetected g++ include path.])
1391     [
1392                           Usage:     --with-gxx-include-path=<absolute path to
1393                                                                 g++ include dir>
1394     ],
1397 AC_ARG_WITH(help,
1398     AS_HELP_STRING([--with-help],
1399         [Enable the build of help.
1401          To build without help, use --without-help.]))
1403 AC_ARG_WITH(java,
1404     AS_HELP_STRING([--with-java],
1405         [Specify the name of the Java interpreter command. Typically "java"
1406          which is the default.
1408          To build without support for Java components, applets, accessibility
1409          or the XML filters written in Java, use --without-java or --with-java=no.])
1410     [
1411                           Usage:     --with-java==<java command>
1412                                      --without-java
1413     ],
1414     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1415     [ with_java=java ]
1418 AC_ARG_WITH(java_target_version,
1419     AS_HELP_STRING([--with-java-target-version],
1420         [Generate class files that will work on JVMs with the specified version.
1421          For example, use --with-java-target-version=1.4 to make sure that the
1422          application will work with JVM 1.4 even when compiled with JDK 1.5.])
1423     [
1424                           This option is ignored when you compile with gcj/gij.
1426                           Usage:     --with-java-target-version=<jvm version>
1427     ],
1430 AC_ARG_WITH(jvm-path,
1431     AS_HELP_STRING([--with-jvm-path],
1432         [Use a specific JVM search path at runtime.])
1433     [
1434                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1436                           e. g.: --with-jvm-path=/usr/lib/
1437                                  to find JRE/JDK in /usr/lib/jvm/
1438     ],
1441 AC_ARG_WITH(ant-home,
1442     AS_HELP_STRING([--with-ant-home],
1443         [If you have installed Jakarta Ant on your system, please supply the path here.
1444          Note that this is not the location of the Ant binary but the location
1445          of the entire distribution.])
1446     [
1447                           Usage:     --with-ant-home=<absolute path to Ant home>
1448     ],
1451 AC_ARG_WITH(junit,
1452     AS_HELP_STRING([--with-junit],
1453         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1454          --without-junit disables those tests. Not relevant in the --without-java case.])
1455     [
1456                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1457     ],
1458 ,with_junit=yes)
1460 AC_ARG_WITH(perl-home,
1461     AS_HELP_STRING([--with-perl-home],
1462         [If you have installed Perl 5 Distribution, on your system, please
1463          supply the path here. Note that this is not the location of the Perl
1464          binary but the location of the entire distribution.])
1465     [
1466                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1467     ],
1470 AC_ARG_WITH(cl-home,
1471     AS_HELP_STRING([--with-cl-home],
1472         [For Windows NT users, please supply the path for the Microsoft C/C++
1473          compiler. Note that this is not the location of the compiler binary but
1474          the location of the entire distribution.])
1475     [
1476                           Usage:     --with-cl-home=<absolute path to Microsoft
1477                                                             C/C++ compiler home>
1478     ],
1481 AC_ARG_WITH(mspdb-path,
1482     AS_HELP_STRING([--with-mspdb-path],
1483         [For Microsoft C/C++ compiler users, please supply the path pointing to
1484          the mspdb80.dll (if using Visual Studio 2008) or mspdb100.dll (if using
1485          Visual Studio 2010).])
1486     [
1487                           Usage:     --with-mspdb-path=<path to
1488                                                        mspdb80.dll/mspdb100.dll>
1489     ],
1492 AC_ARG_WITH(midl-path,
1493     AS_HELP_STRING([--with-midl-path],
1494         [For Microsoft compiler users, please supply the path pointing to the midl.exe.])
1495     [
1496                           Usage:     --with-midl-path=<abs. path to midl.exe>
1497     ],
1500 AC_ARG_WITH(csc-path,
1501     AS_HELP_STRING([--with-csc-path],
1502         [For Windows builds, please supply the path pointing to the csc.exe.
1503          Usually found automatically when building on Windows.])
1504     [
1505                           Usage:     --with-csc-path=<abs. path to csc.exe>
1506     ],
1509 AC_ARG_WITH(nsis-path,
1510     AS_HELP_STRING([--with-nsis-path],
1511         [For Windows builds, please supply the directory where makensis
1512          is located. If makensis is found in PATH or this option is
1513          properly supplied a self-contained executable installer for
1514          LibreOffice will be created.])
1515     [
1516                           Usage:     --with-nsis-path=<path to directory containing makensis>
1517     ],
1520 AC_ARG_WITH(dotnet-framework-home,
1521     AS_HELP_STRING([--with-dotnet-framework-home],
1522         [For Microsoft compiler users, please supply the path pointing to
1523          lib/mscoree.lib, usually something like:
1524          "/cygdrive/c/Program Files/Windows SDKs/Windows/v7.0"])
1525     [
1526                           Note that in most cases it will be automatically
1527                           found, though.
1529                           Usage:     --with-dotnet-framework-home=<absolute path to .NET
1530                                                           Framework>
1531     ],
1534 AC_ARG_WITH(windows-sdk-home,
1535     AS_HELP_STRING([--with-windows-sdk-home],
1536         [For Windows builds, please supply the path to the Windows SDK.
1537          Usually found automatically when building on Windows.])
1538     [
1539                           Usage:     --with-windows-sdk-home=<absolute path to Windows SDK>
1540     ],
1543 AC_ARG_WITH(directx-home,
1544     AS_HELP_STRING([--with-directx-home],
1545         [For Windows users, please supply the path to the Microsoft DirectX SDK.])
1546     [
1547                           Usage:     --with-directx-home=<absolute path to
1548                                                           Microsoft DirectX SDK>
1549     ],
1552 AC_ARG_WITH(mozilla-build,
1553     AS_HELP_STRING([--with-mozilla-build],
1554         [For Windows users, please supply the path to the Mozilla build tools.])
1555     [
1556                           Usage:     --with-mozilla-build=<absolute path to
1557                                                           Mozilla build tools>
1559                           At the moment of this writing, an installer for the
1560                           mozilla build tools can be obtained from http://ftp.
1561                           mozilla.org/pub/mozilla.org/mozilla/libraries/win32.
1562     ],
1563     MOZILLABUILD=$withval ,
1566 AC_ARG_WITH(local-solver,
1567     AS_HELP_STRING([--with-local-solver],
1568         [If you have solver in a location other than ./solver, please supply the path here.])
1569     [
1570                           Usage:     --with-local-solver=<abs. path to solver>
1571     ],
1574 AC_ARG_WITH(lang,
1575     AS_HELP_STRING([--with-lang],
1576         [Use this option to build LibreOffice with additional language support.
1577          English (US) is always included by default.
1578          Separate multiple languages with space.
1579          For all languages, use --with-lang=ALL.])
1580     [
1581                           Usage:     --with-lang="es sw tu cs sk"
1582     ],
1585 dnl ===================================================================
1586 dnl Branding
1587 dnl ===================================================================
1589 AC_ARG_WITH(intro-bitmap,
1590 [  --with-intro-bitmap    Prefer the specified intro bitmap over the
1591                           the default one.
1593                           Usage:     --with-intro-bitmap=/path/my_ooo_intro.png
1594 ],,)
1596 AC_ARG_WITH(intro-progressbar-color,
1597 [  --with-intro-progressbar-color    Set color of progress bar on intro screen.
1598                                      Comma separated RGB values in decimal format.
1600                           Usage: --with-intro-progressbar-color=126,170,23
1601 ],,)
1603 AC_ARG_WITH(intro-progressbar-size,
1604 [  --with-intro-progressbar-size     Set size of progress bar on intro screen.
1605                                      Comma separated values in decimal format.
1607                           Usage: --with-intro-progressbar-size=319,10
1608 ],,)
1610 AC_ARG_WITH(intro-progressbar-position,
1611 [  --with-intro-progressbar-position Set position of progress bar on intro screen.
1612                                      Comma separated values in decimal format.
1614                           Usage: --with-intro-progressbar-position=164,225
1615 ],,)
1617 AC_ARG_WITH(intro-progressbar-frame-color,
1618 [  --with-intro-progressbar-frame-color    Set color of progress bar frame on intro screen.
1619                                            Comma separated RGB values in decimal format.
1621                           Usage: --with-intro-progressbar-frame-color=207,208,211
1622 ],,)
1624 AC_ARG_WITH(about-bitmap,
1625 [  --with-about-bitmap    Similarly to --with-intro-bitmap, this allows
1626                           specification of bitmap for the About box.
1628                           Usage:     --with-about-bitmap=/path/my_ooo_about.png
1629 ],,)
1631 AC_ARG_WITH(startcenter-left-bitmap,
1632 [  --with-startcenter-left-bitmap    Similarly to --with-intro-bitmap, this allows
1633                                      specification of bitmap for the Start center.
1635                           Usage: --with-startcenter-left-bitmap=/path/my_backing_left.png
1636 ],,)
1638 AC_ARG_WITH(startcenter-right-bitmap,
1639 [  --with-startcenter-right-bitmap    Similarly to --with-intro-bitmap, this allows
1640                                       specification of bitmap for the Start center.
1642                           Usage: --with-startcenter-right-bitmap=/path/my_backing_right.png
1643 ],,)
1645 AC_ARG_WITH(startcenter-rtl-left-bitmap,
1646 [  --with-startcenter-rtl-left-bitmap    Similarly to --with-intro-bitmap, this allows
1647                                          specification of bitmap for the Start center.
1649                           Usage: --with-startcenter-rtl-left-bitmap=/path/my_backing_rtl_left.png
1650 ],,)
1652 AC_ARG_WITH(startcenter-rtl-right-bitmap,
1653 [  --with-startcenter-rtl-right-bitmap    Similarly to --with-intro-bitmap, this allows
1654                                           specification of bitmap for the Start center.
1656                           Usage: --with-startcenter-rtl-right-bitmap=/path/my_backing_rtl_right.png
1657 ],,)
1659 AC_ARG_WITH(startcenter-space-bitmap,
1660 [  --with-startcenter-space-bitmap    Similarly to --with-intro-bitmap, this allows
1661                                       specification of bitmap for the Start center.
1663                           Usage: --with-startcenter-space-bitmap=/path/my_backing_space.png
1664 ],,)
1666 AC_ARG_WITH(vendor,
1667     AS_HELP_STRING([--with-vendor],
1668         [Set vendor of the build.])
1669     [
1670                           Usage:     --with-vendor="John the Builder"
1671     ],
1674 AC_ARG_WITH(unix-wrapper,
1675     AS_HELP_STRING([--with-unix-wrapper],
1676         [Redefines the name of the UNIX wrapper that will be used in the desktop
1677          files and in the desktop-integration RPMs.])
1678     [
1679                           Usage:     --with-unix-wrapper=ooffice
1680     ],
1683 AC_ARG_WITH(compat-oowrappers,
1684     AS_HELP_STRING([--with-compat-oowrappers],
1685         [Install oo* wrappers in parallel with
1686          lo* ones to keep backward compatibility.
1687          Has effect only with make distro-pack-install]),
1690 AC_ARG_WITH(asm-home,
1691     AS_HELP_STRING([--with-asm-home],
1692         [For Windows, please supply the path for the ml.exe or ml64.exe assembler.])
1693     [
1694                           Usage:     --with-asm-home=<path to assembler directory>
1695     ],
1698 AC_ARG_WITH(os-version,
1699     AS_HELP_STRING([--with-os-version],
1700         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1701     [
1702                           Usage:     --with-os-version=<OSVERSION>
1703     ],
1706 AC_ARG_WITH(mingw-cross-compiler,
1707     AS_HELP_STRING([--with-mingw-cross-compiler],
1708         [Specify the MinGW cross-compiler to use.])
1709     [
1710                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1712                           When building on the ODK on Unix and building unowinreg.dll,
1713                           specify the MinGW C++ cross-compiler.
1714     ],
1717 AC_ARG_WITH(build-version,
1718     AS_HELP_STRING([--with-build-version],
1719         [Allows the builder to add a custom version tag that will appear in the
1720          Help/About box for QA purposes.])
1721     [
1722                           Usage:     --with-build-version="Built by Jim"
1723     ],
1724     with_build_version=$withval ,
1727 AC_ARG_WITH(alloc,
1728     AS_HELP_STRING([--with-alloc],
1729         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1730          Note that on FreeBSD/NetBSD system==jemalloc]),
1733 AC_ARG_WITH(sun-templates,
1734     AS_HELP_STRING([--with-sun-templates],
1735         [Integrate Sun template packages.]),
1738 AC_ARG_WITH(num-cpus,
1739     AS_HELP_STRING([--with-num-cpus],
1740         [Number of build processes/cpus to use (number of projects that will build at the same time).
1741          Multi-process/multi-cpu builds can save a lot of time on multi-cpu machines.
1742          Defaults to the number of CPUs on the machine.]),
1745 AC_ARG_WITH(max-jobs,
1746     AS_HELP_STRING([--with-max-jobs],
1747         [Maximum number of jobs that will be issued at the same time per dmake or gbuild subproject.
1748          The real number of the jobs is affected by the --with-num-cpus too, it can get up to CPUS*max_jobs.
1749          Defaults to 1, unless you configure --enable-icecream - then to 10.]),
1752 dnl ===================================================================
1753 dnl MacOSX build and runtime environment options
1754 dnl ===================================================================
1756 AC_ARG_WITH(macosx-sdk,
1757     AS_HELP_STRING([--with-macosx-sdk],
1758         [Use a specific SDK for building.])
1759     [
1760                           Usage:     --with-macosx-sdk=<version>
1762                           e. g.: --with-macosx-sdk=10.4
1764                           there are 3 options to controle the MacOSX build:
1765                           --with-macosx-sdk (refered as 'sdl' below)
1766                           --with-macosx-version-min-required (refered as 'min' below)
1767                           --with-macosx-version-max-allowed (refered as 'max' below)
1769                           the connection between these value and the default they take is as follow:
1770                           ( ? means not specified on the command line, constraint: x <= y <= z)
1772                           ==========================================
1773                            command line      || config result
1774                           ==========================================
1775                           min  | max  | sdk  || min  | max  | sdk  |
1776                           ?    | ?    | ?    || 10.4 | 10.4 | 10.4 |
1777                           ?    | ?    | 10.x || 10.4 | 10.4 | 10.x |
1778                           ?    | 10.x | ?    || 10.4 | 10.x | 10.x |
1779                           ?    | 10.x | 10.y || 10.4 | 10.x | 10.y |
1780                           10.x | ?    | ?    || 10.x | 10.x | 10.x |
1781                           10.x | ?    | 10.y || 10.x | 10.x | 10.y |
1782                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1783                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1786                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1787                           for a detailled technical explanation of these variables
1789                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1791     ],
1794 AC_ARG_WITH(macosx-version-min-required,
1795     AS_HELP_STRING([--with-macosx-version-min-required],
1796         [set the minimum OS version needed to run the built LibreOffice])
1797     [
1798                           Usage:     --with-macosx-version-min-required=<version>
1800                           e. g.: --with-macos-version-min-required=10.4
1801                           see --with-macosx-sdk for more info
1802     ],
1805 AC_ARG_WITH(macosx-version-max-allowed,
1806     AS_HELP_STRING([--with-macosx-version-max-allowed],
1807         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1808     [
1809                           Usage:     --with-macosx-version-max-allowed=<version>
1811                           e. g.: --with-macos-version-max-allowed=10.6
1812                           see --with-macosx-sdk for more info
1813     ],
1817 dnl ===================================================================
1818 dnl check for required programs (grep, awk, sed, bash)
1819 dnl ===================================================================
1820 AC_PROG_EGREP
1821 AC_PROG_AWK
1822 AC_PATH_PROG( AWK, $AWK)
1823 if test -z "$AWK"; then
1824     AC_MSG_ERROR([install awk to run this script])
1827 AC_PATH_PROG(BASH, bash)
1828 if test -z "$BASH"; then
1829     AC_MSG_ERROR([bash not found in \$PATH])
1831 AC_SUBST(BASH)
1833 AC_MSG_CHECKING([for GNU or BSD tar])
1834 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
1835     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
1836     if test $? -eq 0;  then
1837         GNUTAR=$a
1838         break
1839     fi
1840 done
1841 AC_MSG_RESULT($GNUTAR)
1842 if test -z "$GNUTAR"; then
1843     AC_MSG_ERROR([not found. install GNU or BSD tar.])
1845 AC_SUBST(GNUTAR)
1847 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
1848 dnl desktop OSes from "mobile" ones.
1850 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
1851 dnl In other words, that when building for an OS that is not a
1852 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
1854 dnl Note the direction of the implication; there is no assumption that
1855 dnl cross-compiling would imply a non-desktop OS.
1857 if test $_os != iOS -a $_os != Android; then
1858     BUILD_TYPE="$BUILD_TYPE DESKTOP"
1861 dnl ===================================================================
1862 dnl Extra check for Windows. Cygwin builds need gcc to build dmake
1863 dnl although MSVC is used to build other build-time tools and 
1864 dnl LibreOffice itself.
1865 dnl ===================================================================
1866 if test "$build_os" = "cygwin" ; then
1867     AC_MSG_CHECKING([for Cygwin gcc/g++])
1868     if which gcc > /dev/null && which g++ > /dev/null ; then
1869         AC_MSG_RESULT([found])
1870     else
1871         AC_MSG_ERROR([Cygwin gcc and g++ are needed, please install them.])
1872     fi
1877 dnl ===================================================================
1878 dnl  Checks if ccache is available
1879 dnl ===================================================================
1880 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \) ; then
1881     if test -z "$CC" ; then
1882         if test -z "$CXX" ; then
1883             AC_PATH_PROG([CCACHE],[ccache],[not found])
1884             if test "$CCACHE" = "not found" ; then
1885                 CCACHE=""
1886             else
1887                 CCACHE="ccache"
1888                 # need to check for ccache version: otherwise prevents
1889                 # caching of the results (like "-x objective-c++" for Mac)
1890                 if test $_os = Darwin -o $_os = iOS; then
1891                     # check ccache version
1892                     AC_MSG_CHECKING([whether version of ccache is suitable])
1893                     CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
1894                     CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1895                     if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
1896                         AC_MSG_RESULT([yes])
1897                     else
1898                         AC_MSG_RESULT([no])
1899                         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. ccache will not be used.])
1900                         CCACHE=""
1901                     fi
1902                 fi
1903             fi
1904         else
1905             AC_MSG_NOTICE([Automatic ccache detection ingored: CXX is pre-defined])
1906             CCACHE=""
1907         fi
1908     else
1909         AC_MSG_NOTICE([Automatic ccache detection ingored: CC is pre-defined])
1910         CCACHE=""
1911     fi
1912 else
1913     CCACHE=""
1916 if test "$CCACHE" != "" ; then
1917     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
1918     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
1919     if test "$ccache_size" = "" ; then
1920         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
1921         if test "$ccache_size" = "" ; then
1922             ccache_size=0
1923         fi
1924         # we could not determine the size or it was less than 1GB -> disable auto-ccache
1925         if test $ccache_size -lt 1024 ; then
1926             CCACHE=""
1927             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
1928             echo "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled" >> warn
1929         else
1930             # warn that ccache may be too small for debug build
1931             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1932             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1933         fi
1934     else
1935         if test $ccache_size -lt 5  ; then
1936             #warn that ccache may be too small for debug build
1937             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1938             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1939         fi
1940     fi
1943 dnl ===================================================================
1944 dnl  Checks for C compiler,
1945 dnl  The check for the C++ compiler is later on.
1946 dnl ===================================================================
1947 GCC_HOME_SET="true"
1948 AC_MSG_CHECKING([gcc home])
1949 if test -z "$with_gcc_home"; then
1950     if test "$enable_icecream" = "yes" ; then
1951         GCC_HOME="/opt/icecream"
1952     else
1953         GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1954         GCC_HOME_SET="false"
1955     fi
1956 else
1957     GCC_HOME="$with_gcc_home"
1959 AC_MSG_RESULT($GCC_HOME)
1960 AC_SUBST(GCC_HOME)
1962 if test "$GCC_HOME_SET" = "true" ; then
1963     if test -z "$CC"; then
1964         CC="$GCC_HOME/bin/gcc"
1965     fi
1966     if test -z "$CXX"; then
1967         CXX="$GCC_HOME/bin/g++"
1968     fi
1971 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1972 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
1973     AC_PROG_CC
1976 COMPATH=`dirname "$CC"`
1977 if test "$COMPATH" = "." ; then
1978     AC_PATH_PROGS(COMPATH, $CC)
1979     dnl double square bracket to get single because of M4 quote...
1980     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1982 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1987 dnl ===================================================================
1988 dnl  Test MacOSX sdk and version requirement
1989 dnl ===================================================================
1990 if test "$_os" = "Darwin" ; then
1992     if test "$with_macosx_version_min_required" = "" ; then
1993         with_macosx_version_min_required="10.4"
1994     fi
1996     if test "$with_macosx_version_max_allowed" = "" ; then
1997         with_macosx_version_max_allowed="$with_macosx_version_min_required"
1998     fi
2000     if test "$with_macosx_sdk" = "" ; then
2001         with_macosx_sdk="$with_macosx_version_max_allowed"
2002     fi
2004     case "$with_macosx_sdk" in
2006     10.4)
2007         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.4u.sdk"
2008         if test ! -d "$MACOSX_SDK_PATH"; then
2009           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.4u.sdk"
2010         fi
2011         macosx_sdk_value="1040"
2012         ;;
2013     10.5)
2014         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"
2015         if test ! -d "$MACOSX_SDK_PATH"; then
2016           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.5.sdk"
2017         fi
2018         macosx_sdk_value="1050"
2019         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
2020         echo "Building with a SDK > 10.4 is experimental" >> warn
2021         ;;
2022     10.6)
2023         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk"
2024         macosx_sdk_value="1060"
2025         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
2026         echo "Building with a SDK > 10.4 is experimental" >> warn
2027         ;;
2028     10.7)
2029         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.7.sdk"
2030         macosx_sdk_value="1070"
2031         AC_MSG_WARN([Building with SDK 10.7 is known to fail in vcl])
2032         echo "Building with SDK 10.7 is known to fail in vcl" >> warn
2033         ;;
2034     *)
2035         AC_MSG_ERROR([$with_macosx_sdk is not a supported SDK value, supported value are 10.4, 10.5, 10.6 and 10.7])
2036         ;;
2037     esac
2038     AC_MSG_CHECKING([the presence of the SDK $with_macosx_sdk])
2039     if test -d "$MACOSX_SDK_PATH" ; then
2040         AC_MSG_RESULT([$MACOSX_SDK_PATH ok])
2041     else
2042         AC_MSG_ERROR([$MACOSX_SDK_PATH not found])
2043     fi
2044     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2046     case "$with_macosx_version_min_required" in
2048     10.4)
2049         MAC_OS_X_VERSION_MIN_REQUIRED="1040"
2050         ;;
2051     10.5)
2052         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2053         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2054         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2055         if test -z "$save_CC" ; then
2056             CC="gcc-4.2 -m32"
2057             CXX="g++-4.2 -m32"
2058         fi
2059         ;;
2060     10.6)
2061         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2062         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2063         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2064         if test -z "$save_CC" ; then
2065             CC="gcc-4.2 -m32"
2066             CXX="g++-4.2 -m32"
2067         fi
2068         ;;
2069     10.7)
2070         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2071         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2072         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2073         if test -z "$save_CC" ; then
2074             CC="gcc-4.2 -m32"
2075             CXX="g++-4.2 -m32"
2076         fi
2077         ;;
2078     *)
2079         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])
2080         ;;
2081     esac
2083     case "$with_macosx_version_max_allowed" in
2085     10.4)
2086         MAC_OS_X_VERSION_MAX_ALLOWED="1040"
2087         ;;
2088     10.5)
2089         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2090         ;;
2091     10.6)
2092         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2093         ;;
2094     10.7)
2095         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2096         ;;
2097     *)
2098         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])
2099         ;;
2100     esac
2102     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2103     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED ; then
2104         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2105     else
2106         AC_MSG_RESULT([ok])
2107     fi
2109     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent macos-with-sdk])
2110     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $macosx_sdk_value ; then
2111         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2112     else
2113         AC_MSG_RESULT([ok])
2114     fi
2115     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2116     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2118 AC_SUBST(MACOSX_SDK_PATH)
2119 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2120 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2121 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2123 dnl ===================================================================
2124 dnl  Test the gcc version,  3 is OK
2125 dnl ===================================================================
2126 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) -a "$GCC" = "yes"; then
2127     AC_MSG_CHECKING([the GNU C compiler version])
2128     _gcc_version=`$CC -dumpversion`
2129     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2130     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2132     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$GCCVER" -ge "040100" ; then
2133         if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
2134             export CC="$GCC_HOME/bin/gcc-4.0"
2135             #  export CC to have it available in set_soenv -> config.guess
2136             GCCVER2=`$CC -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2137             if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
2138                 GCCVER=$GCCVER2
2139             fi
2140         fi
2141         if test "$GCCVER" -ge "040100" ; then
2142             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])
2143         else
2144             AC_MSG_RESULT([implicitly using CC=$CC])
2145         fi
2146     else
2147         AC_MSG_RESULT([checked (gcc $_gcc_version)])
2148     fi
2153 # prefix C with ccache if needed
2155 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" ; then
2156     if test "$CCACHE" != "" ; then
2157         AC_MSG_CHECKING([whether $CC is already ccached])
2160         AC_LANG_PUSH([C])
2161         save_CFLAGS=$CFLAGS
2162         CFLAGS="$CFLAGS --ccache-skip -O2"
2163         dnl an empty program will do, we're checking the compiler flags
2164         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2165                           [use_ccache=yes], [use_ccache=no])
2166         if test $use_ccache = yes ; then
2167             AC_MSG_RESULT([yes])
2168         else
2169             CC="$CCACHE $CC"
2170             AC_MSG_RESULT([no])
2171         fi
2172         CFLAGS=$save_CFLAGS
2173         AC_LANG_POP([C])
2174     fi
2178 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2179 if test "$GCC" = "yes"; then
2180     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2181     bsymbolic_functions_ldflags_save=$LDFLAGS
2182     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2183     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2184 #include <stdio.h>
2185         ],[
2186 printf ("hello world\n");
2187         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2188     if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
2189         AC_MSG_RESULT( found )
2190     else
2191         AC_MSG_RESULT( not found )
2192     fi
2193     LDFLAGS=$bsymbolic_functions_ldflags_save
2195 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2197 dnl ===================================================================
2198 dnl Set up a different compiler to produce tools to run on the build
2199 dnl machine when doing cross-compilation
2200 dnl ===================================================================
2202 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
2203 if test "$cross_compiling" = "yes"; then
2204     AC_MSG_CHECKING([for BUILD platform configuration])
2205     echo
2206     rm -rf CONF-FOR-BUILD Env.Build.sh
2207     mkdir CONF-FOR-BUILD
2208     tar cf - \
2209         Makefile.in \
2210         bin/repo-list.in \
2211         build_env.in \
2212         config.guess \
2213         configure \
2214         ooo.lst.in \
2215         oowintool \
2216         post_download.in \
2217         set_soenv.in \
2218         solenv/inc/langlist.mk \
2219         solenv/inc/postset.mk \
2220         desktop/scripts/soffice.sh.in \
2221     | (cd CONF-FOR-BUILD && tar xf -)
2222     (
2223     unset COM GUI GUIBASE OS CPU CPUNAME
2224     unset CC CXX SYSBASE CFLAGS
2225     unset PYTHON_CFLAGS PYTHON_LIBS
2226     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
2227     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
2228     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
2229     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
2230     cd CONF-FOR-BUILD
2231     sub_conf_opts=""
2232     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
2233     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
2234     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
2235     ./configure \
2236         --disable-mozilla \
2237         --disable-build-mozilla \
2238         --disable-zenity \
2239         --with-num-cpus="$with_num_cpus" \
2240         --with-max-jobs="$with_max_jobs" \
2241         $sub_conf_opts \
2242         2>&1 | sed -e 's/^/    /'
2243     test -f ./Env.Host.sh 2>/dev/null || exit
2244     cp Env.Host.sh ../Env.Build.sh
2245     . ./Env.Host.sh
2246     for V in COM GUI GUIBASE OS CPU CPUNAME CC CXX GXX_INCLUDE_PATH MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
2247              SYSTEM_LIBXSLT; do
2248         VV='$'$V
2249         VV=`eval "echo $VV"`
2250         if test -n "$VV"; then
2251             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
2252             echo "$line" >>build-config
2253         fi
2254     done
2256     for V in OUTDIR PATH SOLARINC SOLARLIB WORKDIR; do
2257         VV='$'$V
2258         VV=`eval "echo $VV"`
2259         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
2260         if test -n "$VV"; then
2261             line="${V}_FOR_BUILD='$VV'"
2262             echo "$line" >>build-config
2263         fi
2264     done
2265     )
2266     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
2267     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])
2268     perl -pi -e 's,/CONF-FOR-BUILD,,g' Env.Build.sh
2269     eval `cat CONF-FOR-BUILD/build-config`
2270     AC_MSG_RESULT([checking for BUILD platform configuration... done])
2271     rm -rf CONF-FOR-BUILD
2272 else
2273     CC_FOR_BUILD="$CC"
2274     CXX_FOR_BUILD="$CXX"
2276 AC_SUBST(COM_FOR_BUILD)
2277 AC_SUBST(GUI_FOR_BUILD)
2278 AC_SUBST(GUIBASE_FOR_BUILD)
2279 AC_SUBST(OS_FOR_BUILD)
2280 AC_SUBST(CPU_FOR_BUILD)
2281 AC_SUBST(CPUNAME_FOR_BUILD)
2282 AC_SUBST(CC_FOR_BUILD)
2283 AC_SUBST(CXX_FOR_BUILD)
2284 AC_SUBST(GXX_INCLUDE_PATH_FOR_BUILD)
2285 AC_SUBST(INPATH_FOR_BUILD)
2286 AC_SUBST(OUTPATH_FOR_BUILD)
2287 AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD)
2288 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
2290 AC_SUBST(OUTDIR_FOR_BUILD)
2291 AC_SUBST(PATH_FOR_BUILD)
2292 AC_SUBST(SOLARINC_FOR_BUILD)
2293 AC_SUBST(SOLARLIB_FOR_BUILD)
2294 AC_SUBST(WORKDIR_FOR_BUILD)
2296 UPD="`echo AC_PACKAGE_VERSION | sed "s/\.//"`0"
2297 SOURCEVERSION="OOO$UPD"
2298 AC_SUBST(UPD)
2299 AC_SUBST(SOURCEVERSION)
2301 dnl ===================================================================
2302 dnl Set the ENABLE_CRASHDUMP variable.
2303 dnl ===================================================================
2304 AC_MSG_CHECKING([whether to enable crashdump feature])
2305 if test "$enable_crashdump" = "yes"; then
2306     ENABLE_CRASHDUMP="TRUE"
2307     BUILD_TYPE="$BUILD_TYPE CRASHREP"
2308     AC_MSG_RESULT([yes])
2309 else
2310     ENABLE_CRASHDUMP=""
2311     AC_MSG_RESULT([no])
2313 AC_SUBST(ENABLE_CRASHDUMP)
2316 dnl ===================================================================
2317 dnl Windows specific tests and stuff
2318 dnl ===================================================================
2319 if test "$_os" = "WINNT"; then
2321     dnl Include twain scanners
2322     BUILD_TYPE="$BUILD_TYPE TWAIN"
2324     dnl Set the CL_X64 variable if we are building a 64-bit LibreOffice.
2325     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2326     if test "z$enable_cl_x64" = "z" -o "$enable_cl_x64" = "no"; then
2327         CL_X64=""
2328         AC_MSG_RESULT([no])
2329     else
2330         CL_X64="TRUE"
2331         AC_MSG_RESULT([yes])
2332     fi
2333     AC_SUBST(CL_X64)
2335     AC_MSG_CHECKING([whether to use DirectX])
2336     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2337         ENABLE_DIRECTX="TRUE"
2338         AC_MSG_RESULT([yes])
2339     else
2340         ENABLE_DIRECTX=""
2341         AC_MSG_RESULT([no])
2342     fi
2343     AC_SUBST(ENABLE_DIRECTX)
2345     AC_MSG_CHECKING([whether to use ActiveX])
2346     if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
2347         DISABLE_ACTIVEX=""
2348         AC_MSG_RESULT([yes])
2349     else
2350         DISABLE_ACTIVEX="TRUE"
2351         AC_MSG_RESULT([no])
2352     fi
2353     AC_SUBST(DISABLE_ACTIVEX)
2355     AC_MSG_CHECKING([whether to use ATL])
2356     if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE"; then
2357         DISABLE_ATL=""
2358         AC_MSG_RESULT([yes])
2359     elif test "$enable_atl" = ""; then
2360         if test "$WITH_MINGW" = "yes"; then
2361             DISABLE_ATL="TRUE"
2362             AC_MSG_RESULT([no])
2363         else
2364             DISABLE_ATL=""
2365             AC_MSG_RESULT([yes])
2366         fi
2367     else
2368         DISABLE_ATL="TRUE"
2369         AC_MSG_RESULT([no])
2370     fi
2371     AC_SUBST(DISABLE_ATL)
2374 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
2375 dnl ===================================================================
2376 AC_MSG_CHECKING([whether to turn warnings to errors])
2377 if test -n "$enable_werror" && test "$enable_werror" != "no"; then
2378     ENABLE_WERROR="TRUE"
2379     AC_MSG_RESULT([yes])
2380 else
2381     ENABLE_WERROR="FALSE"
2382     AC_MSG_RESULT([no])
2384 AC_SUBST(ENABLE_WERROR)
2386 dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
2387 dnl ===================================================================
2388 AC_MSG_CHECKING([whether to do a debug build])
2389 if test -n "$enable_debug" && test "$enable_debug" != "no"; then
2390     ENABLE_DEBUG="TRUE"
2391     enable_symbols="yes"
2392     AC_MSG_RESULT([yes])
2393 else
2394     ENABLE_DEBUG="FALSE"
2395     AC_MSG_RESULT([no])
2397 AC_SUBST(ENABLE_DEBUG)
2399 dnl Set the ENABLE_DBGUTIL variable
2400 dnl ===================================================================
2401 AC_MSG_CHECKING([whether to build with additional debug utilities])
2402 if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2403     PROEXT=""
2404     PRODUCT=""
2406     # Compiling with MSVC using --enable-dbgutil (i.e. using the
2407     # debugging runtime, and defining _DEBUG when compiling) just
2408     # causes too many compilation errors. After having spent some
2409     # months slowly fixing them one by one, having reached sw, I give
2410     # up. Feel free to try again.
2411     if test "$_os" = WINNT -a "$WITH_MINGW" != yes; then
2412         AC_MSG_ERROR([Sorry, --enable-dbgutil won't work with MSVC])
2413     fi
2415     AC_MSG_RESULT([yes])
2416     # cppunit and graphite expose STL in public headers
2417     if test "$with_system_cppunit" = "yes"; then
2418         AC_MSG_ERROR([--with-system-cppunit conflicts with DBG_UTIL build])
2419     else
2420         with_system_cppunit=no
2421     fi
2422     if test "$with_system_graphite" = "yes"; then
2423         AC_MSG_ERROR([--with-system-graphite conflicts with DBG_UTIL build])
2424     else
2425         with_system_graphite=no
2426     fi
2427     if test "$with_system_mysql_cppconn" = "yes"; then
2428         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with DBG_UTIL build])
2429     else
2430         with_system_mysql_cppconn=no
2431     fi
2432     if test $_os = WINNT -a \
2433             \( "$enable_mozilla" != no -o \
2434                "$enable_build_mozilla" != no \); then
2435         # We can't build against the Mozilla stuff if using _DEBUG, will get linking errors
2436         # See connectivity/drivers/mozab
2437         AC_MSG_WARN([Also disabling Mozilla stuff then])
2438         enable_mozilla=no
2439         enable_build_mozilla=no
2440     fi
2441 else
2442     PRODUCT="full"
2443     PROEXT=".pro"
2444     AC_MSG_RESULT([no, full product build])
2446 AC_SUBST(PRODUCT)
2447 AC_SUBST(PROEXT)
2449 dnl Determine whether to use linkoo for the smoketest installation
2450 dnl ===================================================================
2451 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
2452 if test "$enable_linkoo" = "no"; then
2453     DISABLE_LINKOO="TRUE"
2454     AC_MSG_RESULT([no])
2455 else
2456     DISABLE_LINKOO=
2457     AC_MSG_RESULT([yes])
2459 AC_SUBST(DISABLE_LINKOO)
2461 # Set the ENABLE_LTO variable
2462 # ===================================================================
2463 AC_MSG_CHECKING([whether to use link-time optimization])
2464 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2465     ENABLE_LTO="TRUE"
2466     AC_MSG_RESULT([yes])
2467 else
2468     ENABLE_LTO=""
2469     AC_MSG_RESULT([no])
2471 AC_SUBST(ENABLE_LTO)
2473 dnl whether to include symbols into final build.
2474 dnl ===================================================================
2475 AC_MSG_CHECKING([whether to include symbols])
2476 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
2477     ENABLE_SYMBOLS="TRUE"
2478     AC_MSG_RESULT([yes])
2479 else
2480     ENABLE_SYMBOLS=
2481     AC_MSG_RESULT([no])
2483 AC_SUBST(ENABLE_SYMBOLS)
2485 dnl Determine if the solver is to be stripped or not.
2486 dnl ===================================================================
2487 AC_MSG_CHECKING([whether to strip the solver or not.])
2488 if test "z$enable_strip_solver" = "zno"; then
2489     DISABLE_STRIP="TRUE"
2490     AC_MSG_RESULT([no])
2491 else
2492     if test -n "$ENABLE_SYMBOLS"; then
2493         DISABLE_STRIP="TRUE"
2494         AC_MSG_RESULT([no])
2495     else
2496         DISABLE_STRIP=
2497         AC_MSG_RESULT([yes])
2498     fi
2500 AC_SUBST(DISABLE_STRIP)
2502 dnl check for cups support
2503 dnl ===================================================================
2504 if test "$test_cups" = "yes"; then
2505     AC_MSG_CHECKING([whether cups support is present])
2506     AC_CHECK_LIB(cups, cupsPrintFiles)
2507     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
2508     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
2509         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
2510     fi
2514 # check for fontconfig support
2515 AC_MSG_CHECKING([whether we need fontconfig])
2516 if test "z$test_fontconfig" = "zyes"; then
2517     ENABLE_FONTCONFIG="TRUE"
2518     AC_MSG_RESULT([yes])
2519     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
2520 else
2521     ENABLE_FONTCONFIG=""
2522     AC_MSG_RESULT([no])
2524 AC_SUBST(ENABLE_FONTCONFIG)
2525 AC_SUBST(FONTCONFIG_CFLAGS)
2526 AC_SUBST(FONTCONFIG_LIBS)
2528 dnl whether to find & fetch external tarballs?
2529 dnl ===================================================================
2530 if test -z "$TARFILE_LOCATION"; then
2531     TARFILE_LOCATION="DEFAULT"
2533 AC_SUBST(TARFILE_LOCATION)
2535 if test "z$enable_fetch_external" != "zno" ; then
2536     DO_FETCH_TARBALLS="YES"
2538 AC_SUBST(DO_FETCH_TARBALLS)
2541 dnl Disable legacy binary file formats filters
2542 dnl ===================================================================
2543 AC_MSG_CHECKING([whether to enable filters for legacy binary file formats (StarOffice 5.2)])
2544 if test "$enable_binfilter" = "no"; then
2545     WITH_BINFILTER="NO"
2546     AC_MSG_RESULT([no])
2547 else
2548     WITH_BINFILTER="YES"
2549     BUILD_TYPE="$BUILD_TYPE BINFILTER"
2550     GIT_REPO_NAMES="$GIT_REPO_NAMES binfilter"
2551     AC_MSG_RESULT([yes])
2553 AC_SUBST(WITH_BINFILTER)
2555 AC_MSG_CHECKING([whether to build help])
2556 if test "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
2557     AC_MSG_RESULT([yes])
2558     BUILD_TYPE="$BUILD_TYPE HELP"
2559     SCPDEFS="$SCPDEFS -DWITH_HELP"
2560     GIT_REPO_NAMES="$GIT_REPO_NAMES help"
2561 else
2562     AC_MSG_RESULT([no])
2565 dnl Enable ugly pieces of code we're better off without
2566 dnl ===================================================================
2567 if test "$enable_ugly" = "yes"; then
2568     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2569     SCPDEFS="$SCPDEFS -DWITH_UGLY"
2570     ENABLE_UGLY=YES
2571 else
2572     ENABLE_UGLY=NO
2574 AC_SUBST(ENABLE_UGLY)
2576 dnl ===================================================================
2577 dnl Disable rpath in shared libraries?
2578 dnl ===================================================================
2579 AC_MSG_CHECKING([whether to use RPATH in shared libraries])
2580 if test "$enable_rpath" = "no"; then
2581     ENABLE_RPATH="no"
2582 else
2583     ENABLE_RPATH="yes"
2585 AC_MSG_RESULT([$ENABLE_RPATH])
2586 AC_SUBST(ENABLE_RPATH)
2588 dnl Test whether to include MySpell dictionaries
2589 dnl ===================================================================
2590 AC_MSG_CHECKING([whether to include MySpell dictionaries])
2591 if test -z "$with_myspell_dicts" || test "$with_myspell_dicts" = "yes"; then
2592     AC_MSG_RESULT([yes])
2593     WITH_MYSPELL_DICTS=YES
2594     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2595     GIT_REPO_NAMES="$GIT_REPO_NAMES dictionaries"
2596 else
2597     AC_MSG_RESULT([no])
2598     WITH_MYSPELL_DICTS=NO
2600 AC_SUBST(WITH_MYSPELL_DICTS)
2602 AC_MSG_CHECKING([whether to use dicts from external paths])
2603 if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
2604     AC_MSG_RESULT([yes])
2605     SYSTEM_DICTS=YES
2606     AC_MSG_CHECKING([for spelling dictionary directory])
2607     if test -n "$with_external_dict_dir"; then
2608         DICT_SYSTEM_DIR=file://$with_external_dict_dir
2609     else
2610         DICT_SYSTEM_DIR=file:///usr/share/hunspell
2611     fi
2612     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
2613     AC_MSG_CHECKING([for hyphenation patterns directory])
2614     if test -n "$with_external_hyph_dir"; then
2615         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
2616     else
2617         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
2618     fi
2619     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
2620     AC_MSG_CHECKING([for thesaurus directory])
2621     if test -n "$with_external_thes_dir"; then
2622         THES_SYSTEM_DIR=file://$with_external_thes_dir
2623     else
2624         THES_SYSTEM_DIR=file:///usr/share/mythes
2625     fi
2626     AC_MSG_RESULT([$THES_SYSTEM_DIR])
2627 else
2628     AC_MSG_RESULT([no])
2629     SYSTEM_DICTS=NO
2631 AC_SUBST(SYSTEM_DICTS)
2632 AC_SUBST(DICT_SYSTEM_DIR)
2633 AC_SUBST(HYPH_SYSTEM_DIR)
2634 AC_SUBST(THES_SYSTEM_DIR)
2636 dnl ===================================================================
2637 dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
2638 dnl ===================================================================
2639 AC_MSG_CHECKING([whether to enable pch feature])
2640 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
2641     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2642         ENABLE_PCH="TRUE"
2643         AC_MSG_RESULT([yes])
2644 dnl There is no PCH support in GCC versions prior to this
2645     elif test "$GCC" = "yes"; then
2646         ENABLE_PCH="TRUE"
2647         AC_MSG_RESULT([yes])
2648     else
2649         ENABLE_PCH=""
2650         AC_MSG_WARN([Precompiled header not yet supported for your platform/compiler])
2651     fi
2652 else
2653     ENABLE_PCH=""
2654     AC_MSG_RESULT([no])
2656 AC_SUBST(ENABLE_PCH)
2658 dnl ===================================================================
2659 dnl Search all the common names for GNU make
2660 dnl ===================================================================
2661 AC_MSG_CHECKING([for GNU make])
2663 # try to use our own make if it is available and GNUMAKE was not already defined
2664 if test -z "$GNUMAKE"; then
2665     if test -x "/opt/lo/bin/make"; then
2666         GNUMAKE="/opt/lo/bin/make"
2667     fi
2670 for a in "$MAKE" $GNUMAKE make gmake gnumake; do
2671     $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
2672     if test $? -eq 0;  then
2673         GNUMAKE=$a
2674         break
2675     fi
2676 done
2677 AC_MSG_RESULT($GNUMAKE)
2678 if test -z "$GNUMAKE"; then
2679     AC_MSG_ERROR([not found. install GNU make.])
2682 AC_MSG_CHECKING([the GNU make version])
2683 _make_version=`$GNUMAKE --version | grep GNU | grep -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
2684 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2685 if test "$_make_longver" -ge "038200" ; then
2686     AC_MSG_RESULT([$GNUMAKE $_make_version])
2688 elif test "$_make_longver" -ge "038100" ; then
2689     AC_MSG_RESULT([$GNUMAKE $_make_version])
2690     AC_MSG_CHECKING([for GNU make bug 20033])
2691     TESTGMAKEBUG20033=`mktemp -d`
2692     cat > $TESTGMAKEBUG20033/Makefile << EOF
2693 A := \$(wildcard *.a)
2695 .PHONY: all
2696 all: \$(A:.a=.b)
2697         @echo survived bug20033. #dont kill these tabs, you will break the Makefile!!!!
2699 .PHONY: setup
2700 setup:
2701         @touch 1.a 2.a 3.a 4.a 5.a 6.a
2703 define d1
2704 @echo lala \$(1)
2705 @sleep 1
2706 endef
2708 define d2
2709 @echo tyty \$(1)
2710 @sleep 1
2711 endef
2713 %.b : %.a
2714         \$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | sha1sum))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
2715         \$(call d1,\$(CHECKSUM)),\
2716         \$(call d2,\$(CHECKSUM)))
2718     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
2719         no_parallelism_make="YES"
2720         AC_MSG_RESULT([yes, disable parallelism])
2721     else
2722         AC_MSG_RESULT([no, keep parallelism enabled])
2723     fi
2724     rm -rf $TESTGMAKEBUG20033
2725 else
2726     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
2728 AC_SUBST(GNUMAKE)
2730 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`;
2731 STALE_MAKE=
2732 make_warning=
2733 if test "z$_make_ver_check" = "z"; then
2734    STALE_MAKE=TRUE
2736 AC_SUBST(STALE_MAKE)
2738 dnl ===================================================================
2739 dnl  Test the Solaris compiler version
2740 dnl ===================================================================
2741 if test "$_os" = "SunOS"; then
2742     if test "$CC" = "cc"; then
2743         AC_PATH_PROGS(_cc, cc)
2744         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2745         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2746         dnl cc -V outputs to standard error!!!!
2747         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2748         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2749         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2750         if test "$_sunstudio_major" != "5"; then
2751             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2752         else
2753             _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" }'`
2754             if test "$_sunstudio_minor" = "false"; then
2755                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2756             else
2757                 dnl compiler will do
2758                 AC_MSG_RESULT([checked])
2759             fi
2760         fi
2761     fi
2764 HAVE_LD_HASH_STYLE=FALSE
2765 WITH_LINKER_HASH_STYLE=
2766 AC_MSG_CHECKING( for --hash-style gcc linker support )
2767 if test "$GCC" = "yes" ; then
2768     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes" ; then
2769         hash_styles="gnu sysv"
2770     elif test "$with_linker_hash_style" = "no" ; then
2771         hash_styles=
2772     else
2773         hash_styles="$with_linker_hash_style"
2774     fi
2776     for hash_style in $hash_styles ; do
2777         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
2778         hash_style_ldflags_save=$LDFLAGS
2779         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
2781         AC_LINK_IFELSE([AC_LANG_PROGRAM(
2782             [
2783 #include <stdio.h>
2784             ],[
2785 printf ("");
2786             ])],
2787             [ if ./conftest$EXEEXT; then
2788                   HAVE_LD_HASH_STYLE=TRUE
2789                   WITH_LINKER_HASH_STYLE=$hash_style
2790               fi],
2791             [HAVE_LD_HASH_STYLE=FALSE])
2792         LDFLAGS=$hash_style_ldflags_save
2793     done
2795     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
2796         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
2797     else
2798         AC_MSG_RESULT( no )
2799     fi
2800     LDFLAGS=$hash_style_ldflags_save
2801 else
2802     AC_MSG_RESULT( no )
2804 AC_SUBST(HAVE_LD_HASH_STYLE)
2805 AC_SUBST(WITH_LINKER_HASH_STYLE)
2807 dnl ===================================================================
2808 dnl Check whether there's a Perl version available.
2809 dnl ===================================================================
2810 if test -z "$with_perl_home"; then
2811     AC_PATH_PROG(PERL, perl)
2812 else
2813     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
2814     _perl_path="$with_perl_home/bin/perl"
2815     if test -x "$_perl_path"; then
2816         PERL=$_perl_path
2817     else
2818         AC_MSG_ERROR([$_perl_path not found])
2819     fi
2822 dnl ===================================================================
2823 dnl Testing for Perl version 5 or greater.
2824 dnl $] is the Perl version variable, it is returned as an integer
2825 dnl ===================================================================
2826 if test "$PERL"; then
2827     AC_MSG_CHECKING([the Perl version])
2828     ${PERL} -e "exit($]);"
2829     _perl_version=$?
2830     if test "$_perl_version" -lt 5; then
2831         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2832     fi
2833     AC_MSG_RESULT([checked (perl $_perl_version)])
2834 else
2835     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2837 AC_SUBST(PERL)
2839 dnl ===================================================================
2840 dnl Testing for required Perl modules
2841 dnl ===================================================================
2843 AC_MSG_CHECKING([for required Perl modules])
2844 if `$PERL -e 'use Archive::Zip; use Cwd;'`; then
2845     AC_MSG_RESULT([all modules found])
2846 else
2847     AC_MSG_ERROR([Failed to find some modules])
2850 dnl ===================================================================
2851 dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2852 dnl ===================================================================
2853 SHOWINCLUDES_PREFIX=
2854 if test "$_os" = "WINNT"; then
2855     if test "$WITH_MINGW" != "yes"; then
2856         AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
2857         if test -z "$with_cl_home"; then
2858             vctest=`./oowintool --msvc-productdir`;
2859             if test "$CL_X64" = ""; then
2860                 if test -x "$vctest/bin/cl.exe"; then
2861                     with_cl_home=$vctest;
2862                 fi
2863             else
2864                 if test -x "$vctest/bin/amd64/cl.exe"; then
2865                     with_cl_home=$vctest;
2866                 fi
2867             fi
2868         else
2869             with_cl_home=`cygpath -u "$with_cl_home"`
2870         fi
2871         with_cl_home=`cygpath -d "$with_cl_home"`
2872         with_cl_home=`cygpath -u "$with_cl_home"`
2873         AC_MSG_RESULT([$with_cl_home])
2875         dnl ===========================================================
2876         dnl  Check for mspdb80.dll/mspdb100.dll
2877         dnl ===========================================================
2878         dnl MSVS 2008/10 Compiler
2879         if test -n "$with_mspdb_path";then
2880             with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2881         fi
2882         if test -e "$with_mspdb_path/mspdb80.dll" -o -e "$with_mspdb_path/mspdb100.dll"; then
2883             MSPDB_PATH="$with_mspdb_path"
2884         fi
2885         dnl MSVS 2008 case
2886         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2887             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2888         fi
2889         dnl Windows SDK 6.0 case
2890         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2891             MSPDB_PATH="$with_cl_home/bin"
2892         fi
2893         dnl MSVS 2010 case
2894         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb100.dll"; then
2895             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2896         fi
2898         if test -z "$MSPDB_PATH";then
2899             dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2900             AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2901             AC_PATH_PROG(MSPDB_PATH, mspdb100.dll)
2902             MSPDB_PATH=`dirname "$MSPDB_PATH"`
2903         fi
2905         if test -z "$MSPDB_PATH"; then
2906             AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
2907         fi
2908         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2909         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2910         dnl The path needs to be added before cl is called
2911         PATH="$MSPDB_PATH:$PATH"
2913         AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2914         if test -z "$CC"; then
2915             if test "$CL_X64" = ""; then
2916                 if test -x "$with_cl_home/bin/cl.exe"; then
2917                     CC="$with_cl_home/bin/cl.exe"
2918                 fi
2919             else
2920                 if test -x "$with_cl_home/bin/amd64/cl.exe"; then
2921                     CC="$with_cl_home/bin/amd64/cl.exe"
2922                 fi
2923             fi
2924             if test -z "$CC"; then
2925                 AC_PATH_PROG(CC, cl.exe)
2926             fi
2927             # This gives us a posix path with 8.3 filename restrictions
2928             CC=`cygpath -d "$CC"`
2929             CC=`cygpath -u "$CC"`
2930         fi
2932         if test -n "$CC"; then
2933             # Remove /cl.exe from CC case insensitive
2934             AC_MSG_RESULT([found ($CC)])
2935             if test "$CL_X64" = ""; then
2936                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
2937             else
2938                 if test -n "$with_cl_home"; then
2939                     COMPATH=`echo $with_cl_home`
2940                 fi
2941             fi
2942             export INCLUDE=`cygpath -d "$COMPATH/Include"`
2943             dnl  Check which Microsoft C/C++ compiler is found
2944             AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2945             # The following finds Microsoft, matches nn.nn.nnnn then pulls numbers out.
2946             CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft/ && /..\\...\\...../ {
2947                             x = match( \\\$0, /..\\...\\...../ )
2948                             CCversion = substr( \\\$0, RSTART, RLENGTH)
2949                             tokencount = split (CCversion,vertoken,\".\")
2950                             for ( i = 1 ; i <= tokencount ; i++ ) {
2951                                 printf (\"%04d\",vertoken[[i]] )
2952                             }
2953                             }"`
2954             if test "$CCNUMVER" -ge "001600000000"; then
2955                 COMEX=13
2956                 MSVSVER=2010
2957             elif test "$CCNUMVER" -ge "001500000000"; then
2958                 COMEX=12
2959                 MSVSVER=2008
2960             else
2961                 AC_MSG_ERROR([Compiler too old. Use Microsoft Visual Studio 2008 or 2010.])
2962             fi
2963             AC_MSG_RESULT([found compiler version $CCNUMVER (MSVS $MSVSVER).])
2964         else
2965             AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
2966         fi
2968         dnl We need to guess the prefix of the -showIncludes output, it can be
2969         dnl localized
2970         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
2971         echo "#include <stdlib.h>" > conftest.c
2972         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
2973             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
2974         rm -f conftest.c conftest.obj
2975         if test -z "$SHOWINCLUDES_PREFIX" ; then
2976             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
2977         else
2978             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
2979         fi
2981         # Check for 64-bit (cross-)compiler to use to build the 64-bit
2982         # version of the Explorer extension (and maybe other small
2983         # bits, too) needed when installing a 32-bit LibreOffice on a
2984         # 64-bit OS. The 64-bit Explorer extension is a feature that
2985         # has been present since long in OOo. Don't confuse it with
2986         # building LibreOffice itself as 64-bit code, which is
2987         # unfished work and highly experimental.
2989         BUILD_X64=
2990         CC_X64_BINARY=
2991         LINK_X64_BINARY=
2992         LIBMGR_X64_BINARY=
2994         AC_MSG_CHECKING([for a x64 compiler and libraries for 64bit ActiveX component])
2995         if test "$CL_X64" = "" -a -f "$with_cl_home/atlmfc/lib/amd64/atls.lib"; then
2996             # Prefer native x64 compiler to cross-compiler, in case we are running
2997             # the build on a 64-bit OS.
2998             if "$with_cl_home/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2999                 BUILD_X64=TRUE
3000                 CC_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
3001                 CXX_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
3002                 LINK_X64_BINARY="$with_cl_home/bin/amd64/link.exe"
3003                 LIBMGR_X64_BINARY="$with_cl_home/bin/amd64/lib.exe"
3004             elif "$with_cl_home/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3005                 BUILD_X64=TRUE
3006                 CC_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
3007                 CXX_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
3008                 LINK_X64_BINARY="$with_cl_home/bin/x86_amd64/link.exe"
3009                 LIBMGR_X64_BINARY="$with_cl_home/bin/x86_amd64/lib.exe"
3010             fi
3011         fi
3012         if test "$BUILD_X64" = TRUE; then
3013             AC_MSG_RESULT([found])
3014         else
3015             AC_MSG_RESULT([not found])
3016             AC_MSG_WARN([Installation set will not contain the 64-bit Explorer extension])
3017         fi
3018         AC_SUBST(BUILD_X64)
3020         # These are passed to the environment through set_soenv.in as usual, and then
3021         # used in set_wntx64.mk
3022         AC_SUBST(CC_X64_BINARY)
3023         AC_SUBST(CXX_X64_BINARY)
3024         AC_SUBST(LINK_X64_BINARY)
3025         AC_SUBST(LIBMGR_X64_BINARY)
3027     else
3028         AC_MSG_CHECKING([the compiler is MinGW])
3029         MACHINE_PREFIX=`$CC -dumpmachine`
3030         if echo $MACHINE_PREFIX | grep -q mingw32; then
3031             AC_MSG_RESULT([yes])
3032         else
3033             AC_MSG_ERROR([Compiler is not MinGW.])
3034         fi
3035     fi
3037 AC_SUBST(COMEX)
3038 AC_SUBST(MSPDB_PATH)
3039 AC_SUBST(SHOWINCLUDES_PREFIX)
3041 dnl ===================================================================
3042 dnl Check for pkg-config
3043 dnl ===================================================================
3044 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3045     PKG_PROG_PKG_CONFIG
3048 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3050     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
3051     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
3052     # explicitly. Or put /path/to/compiler in PATH yourself.
3054     AC_CHECK_TOOL(AR,ar)
3055     AC_CHECK_TOOL(NM,nm)
3056     AC_CHECK_TOOL(OBJDUMP,objdump)
3057     AC_CHECK_TOOL(RANLIB,ranlib)
3058     AC_CHECK_TOOL(STRIP,strip)
3059     if test "$_os" = "WINNT"; then
3060         AC_CHECK_TOOL(DLLTOOL,dlltool)
3061         AC_CHECK_TOOL(WINDRES,windres)
3062     fi
3064 AC_SUBST(AR)
3065 AC_SUBST(DLLTOOL)
3066 AC_SUBST(NM)
3067 AC_SUBST(OBJDUMP)
3068 AC_SUBST(PKG_CONFIG)
3069 AC_SUBST(RANLIB)
3070 AC_SUBST(STRIP)
3071 AC_SUBST(WINDRES)
3073 dnl ===================================================================
3074 dnl pkg-config checks on Mac OS X
3075 dnl ===================================================================
3077 if test $_os = Darwin; then
3078     AC_MSG_CHECKING([for bogus pkg-config])
3079     if test -n "$PKG_CONFIG"; then
3080         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | grep -q Mono.framework; then
3081             AC_MSG_RESULT([yes, from Mono])
3082         else
3083             AC_MSG_RESULT([yes, from unknown origin])
3084         fi
3085         AC_MSG_WARN([This might have unexpected consequences, please consider hiding $PKG_CONFIG])
3086         echo "Having a $PKG_CONFIG might have unexpected consequences, please consider hiding it" >>warn
3087     else
3088         AC_MSG_RESULT([no])
3089     fi
3092 dnl ===================================================================
3093 dnl  .NET needs special treatment
3094 dnl (does the above comment really mean .NET, or is it misusing
3095 dnl that to mean Visual Studio .NET 2003 ? And does this also
3096 dnl in fact apply equally to what we actually support, i.e.
3097 dnl Visual Studio 2008 and 2010?)
3098 dnl ===================================================================
3099 if test "$build_os" = "cygwin"; then
3100     dnl Check midl.exe
3101     AC_PATH_PROG(MIDL_PATH, midl.exe)
3102     if test -n "$MIDL_PATH";then
3103         MIDL_PATH=`dirname "$MIDL_PATH"`
3104     fi
3105     if test -n "$with_midl_path";then
3106         with_midl_path=`cygpath -u "$with_midl_path"`
3107     fi
3108     if test -x "$with_midl_path/midl.exe"; then
3109         MIDL_PATH="$with_midl_path"
3110     fi
3111     if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
3112         MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
3113     fi
3114     if test -z "$MIDL_PATH" ; then
3115         vstest=`./oowintool --msvs-productdir`;
3116         if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
3117             MIDL_PATH="$vstest/Common7/Tools/Bin"
3118         fi
3119     fi
3120     if test -z "$MIDL_PATH" ; then
3121         winsdktest=`./oowintool --windows-sdk-home`
3122         if test -x "$winsdktest/Bin/midl.exe" ; then
3123             MIDL_PATH="$winsdktest/Bin"
3124         fi
3125     fi
3126     if test ! -x "$MIDL_PATH/midl.exe"; then
3127         AC_MSG_ERROR([midl.exe not found. Make sure it's in PATH or use --with-midl-path])
3128     fi
3129     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3130     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
3131     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
3133     dnl Check csc.exe
3134     AC_PATH_PROG(CSC_PATH, csc.exe)
3135     if test -n "$CSC_PATH";then
3136         CSC_PATH=`dirname "$CSC_PATH"`
3137     fi
3138     if test -n "$with_csc_path";then
3139         with_csc_path=`cygpath -u "$with_csc_path"`
3140     fi
3141     if test -x "$with_csc_path/csc.exe"; then
3142         CSC_PATH="$with_csc_path"
3143     else
3144        csctest=`./oowintool --csc-compilerdir`;
3145        if test -x "$csctest/csc.exe"; then
3146            CSC_PATH="$csctest"
3147        fi
3148     fi
3149     if test ! -x "$CSC_PATH/csc.exe"; then
3150         AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
3151     fi
3152     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3153     CSC_PATH=`cygpath -d "$CSC_PATH"`
3154     CSC_PATH=`cygpath -u "$CSC_PATH"`
3156     dnl Check mscoree.lib / .NET Framework dir
3157     AC_MSG_CHECKING(.NET Framework)
3158     if test -n "$with_dotnet_framework_home"; then
3159         with_dotnet_framework_home=`cygpath -u "$with_dotnet_framework_home"`
3160     fi
3161     if test -f "$with_dotnet_framework_home/lib/mscoree.lib"; then
3162         DOTNET_FRAMEWORK_HOME="$with_dotnet_framework_home"
3163     fi
3164     if test -z "$DOTNET_FRAMEWORK_HOME" ; then
3165         frametest=`./oowintool --dotnetsdk-dir`
3166         if test -f "$frametest/lib/mscoree.lib"; then
3167             DOTNET_FRAMEWORK_HOME="$frametest"
3168         else
3169             frametest=`./oowintool --windows-sdk-home`
3170             if test -f "$frametest/lib/mscoree.lib"; then
3171                 DOTNET_FRAMEWORK_HOME="$frametest"
3172             fi
3173         fi
3174     fi
3175     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
3176         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-dotnet-framework-home])
3177     fi
3178     AC_MSG_RESULT(found)
3179     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3180     DOTNET_FRAMEWORK_HOME=`cygpath -d "$DOTNET_FRAMEWORK_HOME"`
3181     DOTNET_FRAMEWORK_HOME=`cygpath -u "$DOTNET_FRAMEWORK_HOME"`
3182     AC_SUBST(MIDL_PATH)
3183     AC_SUBST(CSC_PATH)
3184     AC_SUBST(DOTNET_FRAMEWORK_HOME)
3187 dnl ===================================================================
3188 dnl Check if stdc headers are available excluding MSVC.
3189 dnl ===================================================================
3190 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3191     AC_HEADER_STDC
3194 dnl ===================================================================
3195 dnl Testing for C++ compiler and version...
3196 dnl ===================================================================
3198 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3199     AC_PROG_CXX
3200 else
3201     if test -n "$CC" -a -z "$CXX"; then
3202         CXX="$CC"
3203     fi
3206 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
3207 if test "$GXX" = "yes"; then
3208     AC_MSG_CHECKING([the GNU C++ compiler version])
3210     _gpp_version=`$CXX -dumpversion`
3211     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
3213     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$_gpp_majmin" -ge "401" ; then
3214         if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
3215             export CXX="$GCC_HOME/bin/g++-4.0"
3216             _gpp_majmin_2=`$CXX -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
3217             if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
3218                 _gpp_majmin=$_gpp_majmin_2
3219             fi
3220         fi
3221         if test "$_gpp_majmin" -ge "401" ; then
3222             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])
3223         else
3224             AC_MSG_RESULT([implicitly using CXX=$CXX])
3225         fi
3226     else
3227         AC_MSG_RESULT([checked (g++ $_gpp_version)])
3228     fi
3230     if test "$_gpp_majmin" = "304"; then
3231         AC_MSG_CHECKING([whether $CXX has the enum bug])
3232         AC_RUN_IFELSE([AC_LANG_SOURCE([[
3233             extern "C" void abort (void);
3234             extern "C" void exit (int status);
3236             enum E { E0, E1, E2, E3, E4, E5 };
3238             void test (enum E e)
3239             {
3240                 if (e == E2 || e == E3 || e == E1)
3241                     exit (1);
3242             }
3244             int main (void)
3245             {
3246                 test (E4);
3247                 test (E5);
3248                 test (E0);
3249                 return 0;
3250             }
3251             ]])],[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])],[])
3252     fi
3256 # prefx CXX with ccache if needed
3258 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3259     if test "$CCACHE" != "" ; then
3260         AC_MSG_CHECKING([whether $CXX is already ccached])
3261         AC_LANG_PUSH([C++])
3262         save_CXXFLAGS=$CXXFLAGS
3263         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
3264         dnl an empty program will do, we're checking the compiler flags
3265         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3266                           [use_ccache=yes], [use_ccache=no])
3267         if test $use_ccache = yes ; then
3268             AC_MSG_RESULT([yes])
3269         else
3270             CXX="$CCACHE $CXX"
3271             AC_MSG_RESULT([no])
3272         fi
3273         CXXFLAGS=$save_CXXFLAGS
3274         AC_LANG_POP([C++])
3275     fi
3278 dnl ===================================================================
3279 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
3280 dnl ===================================================================
3282 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3283     AC_PROG_CXXCPP
3285     dnl Check whether there's a C pre-processor.
3286     dnl ===================================================================
3287     dnl When using SunStudio compiler, there is a bug with the cc
3288     dnl preprocessor, so use CC preprocessor as the cc preprocessor
3289     dnl See Issuezilla #445.
3290     dnl ===================================================================
3291     if test "$_os" = "SunOS"; then
3292         CPP=$CXXCPP
3293     else
3294         AC_PROG_CPP
3295     fi
3299 dnl ===================================================================
3300 dnl Find integral type sizes and alignments
3301 dnl ===================================================================
3303 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3305     AC_CHECK_SIZEOF(long)
3306     AC_CHECK_SIZEOF(short)
3307     AC_CHECK_SIZEOF(int)
3308     AC_CHECK_SIZEOF(long long)
3309     AC_CHECK_SIZEOF(double)
3310     AC_CHECK_SIZEOF(void*)
3312     SIZEOF_SHORT=$ac_cv_sizeof_short
3313     SIZEOF_INT=$ac_cv_sizeof_int
3314     SIZEOF_LONG=$ac_cv_sizeof_long
3315     SIZEOF_LONGLONG=$ac_cv_sizeof_long_long
3316     SIZEOF_DOUBLE=$ac_cv_sizeof_double
3317     SIZEOF_POINTER=$ac_cv_sizeof_voidp
3319     dnl Allow build without AC_CHECK_ALIGNOF, grrr
3320     m4_pattern_allow([AC_CHECK_ALIGNOF])
3321     m4_ifdef([AC_CHECK_ALIGNOF],
3322       ,
3323       [
3324          dnl We know that the ALIGNOF_ variables are used only when cross-compiling
3325          dnl in sal/typesconfig/makefile.mk...
3326          if test "$cross_compiling" = "yes"; then
3327             AC_MSG_ERROR([When cross-compiling you must use a recent Autoconf with [AC_][CHECK_ALIGNOF]])
3328          fi
3329          m4_define([AC_CHECK_ALIGNOF],
3330             [
3331                AC_MSG_WARN([Cannot determine alignment of $1])
3332                AS_TR_SH([ac_cv_alignof_$3])=unknown
3333             ])
3334       ])
3336     AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
3337     AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
3338     AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
3339     AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
3341     ALIGNOF_SHORT=$ac_cv_alignof_short
3342     ALIGNOF_INT=$ac_cv_alignof_int
3343     ALIGNOF_LONG=$ac_cv_alignof_long
3344     ALIGNOF_DOUBLE=$ac_cv_alignof_double
3346     AC_C_BIGENDIAN
3347     WORDS_BIGENDIAN=$ac_cv_c_bigendian
3349     dnl Check for large file support
3350     AC_SYS_LARGEFILE
3351     if test -n "$ac_cv_sys_file_offset_bits"; then
3352         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
3353     fi
3354     if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
3355         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
3356     fi
3357 else
3358     # Hardcode for MSVC
3359     SIZEOF_SHORT=2
3360     SIZEOF_INT=4
3361     SIZEOF_LONG=4
3362     SIZEOF_LONGLONG=8
3363     if test "$CL_X64" = ""; then
3364         SIZEOF_POINTER=4
3365     else
3366         SIZEOF_POINTER=8
3367     fi
3368     ALIGNOF_SHORT=2
3369     ALIGNOF_INT=4
3370     ALIGNOF_LONG=4
3371     ALIGNOF_DOUBLE=8
3372     WORDS_BIGENDIAN=no
3373     LFS_CFLAGS=''
3375 AC_SUBST(WORDS_BIGENDIAN)
3376 AC_SUBST(LFS_CFLAGS)
3378 AC_SUBST(SIZEOF_SHORT)
3379 AC_SUBST(SIZEOF_INT)
3380 AC_SUBST(SIZEOF_LONG)
3381 AC_SUBST(SIZEOF_LONGLONG)
3382 AC_SUBST(SIZEOF_DOUBLE)
3383 AC_SUBST(SIZEOF_POINTER)
3384 AC_SUBST(ALIGNOF_SHORT)
3385 AC_SUBST(ALIGNOF_INT)
3386 AC_SUBST(ALIGNOF_LONG)
3387 AC_SUBST(ALIGNOF_DOUBLE)
3389 dnl ===================================================================
3390 dnl Check if valgrind.h is available
3391 dnl ===================================================================
3392 if test "$cross_compiling" != "yes" -a "$enable_dbgutil" != "no" -a \
3393         -z "$VALGRIND_CFLAGS"; then
3394     dnl Test $prefix (currently only testing for /usr and /usr/local)
3395     dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
3396     prev_cppflags=$CPPFLAGS
3397     CPPFLAGS="-I/usr/include/valgrind"
3398     AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
3399     if test -z "$VALGRIND_CFLAGS"; then
3400         CPPFLAGS="-I/usr/local/include/valgrind"
3401         AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
3402     fi
3403     if test -n "$VALGRIND_CFLAGS"; then
3404         CPPFLAGS=$VALGRIND_CFLAGS
3405         AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
3406     fi
3407     CPPFLAGS=$prev_cppflags
3409 AC_SUBST([VALGRIND_CFLAGS])
3411 dnl ===================================================================
3412 dnl Set the gcc/gxx include directories
3413 dnl ===================================================================
3414 # Removed the special FreeBSD treatment. The problem was that with_gxx_include_path
3415 # often contains an i386 which is expanded as a macro.
3416 if test "$GXX" = "yes"; then
3417     AC_MSG_CHECKING([for g++ include path])
3418     if test -z "$with_gxx_include_path"; then
3419         with_gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
3420         if test "$with_gxx_include_path" = "/usr/libexec/(null)/include"; then
3421             with_gxx_include_path="/usr/include"
3422         fi
3423         if echo $with_gxx_include_path | grep -q linux; then
3424             # workaround for Mandriva - issue 100049
3425             with_gxx_include_path=`cd $with_gxx_include_path && pwd`
3426         fi
3427     fi
3428     dnl This is the original code...
3429     dnl with_gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include
3430     if test -z "$with_gxx_include_path"; then
3431         with_gxx_include_path="NO_GXX_INCLUDE"
3432         AC_MSG_RESULT([none])
3433     else
3434         AC_MSG_RESULT([$with_gxx_include_path])
3435     fi
3436 else
3437     with_gxx_include_path="NO_GXX_INCLUDE"
3439 GXX_INCLUDE_PATH="$with_gxx_include_path"
3440 AC_SUBST(GXX_INCLUDE_PATH)
3442 dnl ===================================================================
3443 dnl Set the MinGW include directories
3444 dnl ===================================================================
3445 if test "$WITH_MINGW" = "yes"; then
3446     AC_MSG_CHECKING([for MinGW include path])
3447     cat >conftest.$ac_ext <<_ACEOF
3448 #include <stddef.h>
3449 #include <bits/c++config.h>
3450 _ACEOF
3451     _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`
3452     rm conftest.$ac_ext
3453     if test -z "$_mingw_lib_include_path"; then
3454         _mingw_lib_include_path="NO_LIB_INCLUDE"
3455         AC_MSG_RESULT([no MinGW include path])
3456     else
3457         AC_MSG_RESULT([$_mingw_lib_include_path])
3458     fi
3459     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
3460     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
3462     mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
3463     MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
3465     AC_LANG_PUSH([C++])
3467     AC_MSG_CHECKING([for dynamic libgcc])
3468     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3469 #include <iostream>
3470 using namespace std;
3471 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[   
3472             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
3473             if test -n "$MINGW_GCCDLL"; then
3474                 MINGW_SHARED_GCCLIB=YES
3475                 AC_MSG_RESULT([ $MINGW_GCCDLL])
3476             else
3477                 MINGW_SHARED_GCCLIB=NO
3478                 AC_MSG_RESULT([no])
3479             fi
3480        ],[ AC_MSG_RESULT([no])
3481        
3482     ])
3484     AC_MSG_CHECKING([for dynamic libstdc++])
3485     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3486 #include <iostream>
3487 using namespace std;
3488 ]], [[ cout << "Hello there." << endl; ]])],[   
3489             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
3490             if test -n "$MINGW_GXXDLL"; then
3491                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
3492                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
3493                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
3494                 MINGW_SHARED_GXXLIB=YES
3495                 AC_MSG_RESULT([$MINGW_GXXDLL])
3496             else
3497                 MINGW_SHARED_GXXLIB=NO
3498                 AC_MSG_RESULT([no])
3499             fi
3500        ],[ AC_MSG_RESULT([no])
3501        
3502     ])
3504     AC_LANG_POP([C++])
3506     AC_SUBST(MINGW_CLIB_DIR)
3507     AC_SUBST(MINGW_SHARED_GCCLIB)
3508     AC_SUBST(MINGW_SHARED_GXXLIB)
3509     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
3510     AC_SUBST(MINGW_GCCDLL)
3511     AC_SUBST(MINGW_GXXDLL)
3514 dnl ===================================================================
3515 dnl Extra checking for the SunOS compiler
3516 dnl ===================================================================
3517 if test "$_os" = "SunOS"; then
3518     dnl SunStudio C++ compiler packaged with SunStudio C compiler
3519     if test "$CC" = "cc"; then
3520     AC_MSG_CHECKING([SunStudio C++ Compiler])
3521         if test "$CXX" != "CC"; then
3522             AC_MSG_WARN([SunStudio C++ was not found])
3523             echo "SunStudio C++ was not found" >> warn
3524         else
3525             AC_MSG_RESULT([checked])
3526         fi
3527     fi
3530 dnl *************************************************************
3531 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
3532 dnl *************************************************************
3533 if test "$WITH_MINGW" = "yes"; then
3534     AC_MSG_CHECKING([exception type])
3535     AC_LANG_PUSH([C++])
3536     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
3538         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
3540         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
3541     ])
3542     AC_MSG_RESULT($exceptions_type)
3543     AC_LANG_POP([C++])
3546 EXCEPTIONS="$exceptions_type"
3547 AC_SUBST(EXCEPTIONS)
3549 dnl ===================================================================
3550 dnl Checks for what the default STL should be
3551 dnl ===================================================================
3552 AC_MSG_CHECKING([Whether building STLPort library makes sense])
3553 BUILD_STLPORT="no"
3554 if test "$_os" = "Linux"; then
3555     case "$host_cpu" in
3556     i?86)
3557         case "$host_os" in
3558         k*bsd*-gnu*)
3559             BUILD_STLPORT="no"
3560             ;;
3561         *)
3562             BUILD_STLPORT="yes"
3563             ;;
3564         esac
3565         ;;
3566     *)
3567         BUILD_STLPORT="no"
3568         ;;
3569     esac
3570 elif test "$_os" = "SunOS"; then
3571     BUILD_STLPORT="yes"
3572 elif test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
3573     BUILD_STLPORT="yes"
3574 elif test "$_os" = "FreeBSD"; then
3575     BUILD_STLPORT="yes"
3577 if test "$BUILD_STLPORT" = "yes" ; then
3578     AC_MSG_RESULT([yes])
3579 else
3580     AC_MSG_RESULT([no])
3583 AC_MSG_CHECKING([Whether STLPort library will be actually built])
3584 if test "$with_stlport" = "auto" -o "$BUILD_STLPORT" = "no"; then
3585     with_stlport=$BUILD_STLPORT
3587 if test "$with_stlport" = "yes" ; then
3588     AC_MSG_RESULT([yes])
3589     WITH_STLPORT=YES
3590     SCPDEFS="$SCPDEFS -DWITH_STLPORT"
3591     BUILD_TYPE="$BUILD_TYPE STLPORT"
3592 else
3593     WITH_STLPORT=NO
3594     AC_MSG_RESULT([no])
3597 AC_SUBST(WITH_STLPORT)
3599 dnl ===================================================================
3600 dnl thread-safe statics
3601 dnl ===================================================================
3602 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
3603 unset HAVE_THREADSAFE_STATICS
3604 if test "$GCC" = "yes"; then
3605     save_CXXFLAGS=$CXXFLAGS
3606     CXXFLAGS="$CXXFLAGS -fthreadsafe-statics"
3607     AC_LANG_PUSH([C++])
3608     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)],[HAVE_THREADSAFE_STATICS=TRUE],[])
3609     AC_LANG_POP([C++])
3610     CXXFLAGS=$save_CXXFLAGS
3611     if test "$HAVE_THREADSAFE_STATICS" = "TRUE"; then
3612         dnl Some C++ runtimes use a single lock for all static variables, which
3613         dnl can cause deadlock in multi-threaded applications.  This is not
3614         dnl easily tested here; for POSIX-based systems, if executing the
3615         dnl following C++ program does not terminate then the tool chain
3616         dnl apparently has this problem:
3617         dnl
3618         dnl   #include <pthread.h>
3619         dnl   int h() { return 0; }
3620         dnl   void * g(void * unused) {
3621         dnl     static int n = h();
3622         dnl     return &n;
3623         dnl   }
3624         dnl   int f() {
3625         dnl     pthread_t t;
3626         dnl     pthread_create(&t, 0, g, 0);
3627         dnl     pthread_join(t, 0);
3628         dnl     return 0;
3629         dnl   }
3630         dnl   int main() {
3631         dnl     static int n = f();
3632         dnl     return n;
3633         dnl   }
3634         dnl
3635         dnl Mac OS X up to at least 10.7.1 is known to have this problem:
3636         if test "$_os" = "Darwin"; then
3637             unset HAVE_THREADSAFE_STATICS
3638             AC_MSG_RESULT([broken (i.e., no)])
3639         else
3640             AC_MSG_RESULT([yes])
3641         fi
3642     else
3643         AC_MSG_RESULT([no])
3644     fi
3645 else
3646     AC_MSG_RESULT([unknown (assuming no)])
3648 AC_SUBST(HAVE_THREADSAFE_STATICS)
3650 dnl ===================================================================
3651 dnl visibility and c++0x features
3652 dnl ===================================================================
3653 if test "$GCC" = "yes"; then
3654     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
3655     save_CFLAGS=$CFLAGS
3656     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
3657     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
3658     CFLAGS=$save_CFLAGS
3659     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3660         AC_MSG_RESULT([yes])
3661     else
3662         AC_MSG_RESULT([no])
3663     fi
3665     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
3666     save_CFLAGS=$CFLAGS
3667     CFLAGS="$CFLAGS -Werror -Wno-long-double"
3668     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
3669     CFLAGS=$save_CFLAGS
3670     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
3671         AC_MSG_RESULT([yes])
3672     else
3673         AC_MSG_RESULT([no])
3674     fi
3676     AC_MSG_CHECKING([whether $CC supports -mno-avx])
3677     save_CFLAGS=$CFLAGS
3678     CFLAGS="$CFLAGS -Werror -mno-avx"
3679     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
3680     CFLAGS=$save_CFLAGS
3681     if test "$HAVE_GCC_AVX" = "TRUE"; then
3682         AC_MSG_RESULT([yes])
3683     else
3684         AC_MSG_RESULT([no])
3685     fi
3687     AC_MSG_CHECKING([whether $CC supports -std=c++0x without Language Defect 757])
3688     save_CXXFLAGS=$CXXFLAGS
3689     CXXFLAGS="$CXXFLAGS -std=c++0x"
3690     AC_LANG_PUSH([C++])
3692     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3693 #include <stddef.h>
3695 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
3697 namespace
3699         struct b
3700         {
3701                 int i;
3702                 int j;
3703         };
3705 ]], [[
3706 struct a
3708         int i;
3709         int j;
3711 a thinga[]={{0,0}, {1,1}};
3712 b thingb[]={{0,0}, {1,1}};
3713 size_t i = sizeof(sal_n_array_size(thinga));
3714 size_t j = sizeof(sal_n_array_size(thingb));
3715 return !(i != 0 && j != 0);
3716 ]])],[HAVE_CXX0X=TRUE],[])
3718     AC_LANG_POP([C++])
3719     CXXFLAGS=$save_CXXFLAGS
3720     if test "$HAVE_CXX0X" = "TRUE"; then
3721         AC_MSG_RESULT([yes])
3722     else
3723         AC_MSG_RESULT([no])
3724     fi
3727 AC_SUBST(HAVE_CXX0X)
3728 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
3729 AC_SUBST(HAVE_GCC_AVX)
3731 dnl ===================================================================
3732 dnl system stl sanity tests
3733 dnl ===================================================================
3734 HAVE_GCC_VISIBILITY_BROKEN=
3735 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) ; then
3737     AC_LANG_PUSH([C++])
3739     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3740         AC_MSG_CHECKING([if STL headers are visibility safe])
3741         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
3742         AC_MSG_RESULT([$stlvisok])
3743         if test "$stlvisok" = "no"; then
3744             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
3745             echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
3746             unset HAVE_GCC_VISIBILITY_FEATURE
3747         fi
3748     fi
3750     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3751         sharedlink_ldflags_save=$LDFLAGS
3752         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
3754         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
3755         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3756 #include <sstream>
3757 using namespace std;
3758             ]], [[
3759 istringstream strm( "test" ); return 0;
3760             ]])],[$EGREP -q  unresolvable conftest.err;
3761             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
3762         ])
3763         AC_MSG_RESULT([$gccvisok])
3764         if test "$gccvisok" = "no"; then
3765             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
3766             echo "Your gcc is not -fvisibility-inlines-hidden safe, disabling that." >> warn
3767             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
3768         fi
3770         LDFLAGS=$sharedlink_ldflags_save
3771     fi
3773     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3774         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
3775         cat >visibility.cxx <<_ACEOF
3776 #pragma GCC visibility push(hidden)
3777 struct __attribute__ ((visibility ("default"))) TestStruct {
3778   static void Init();
3780 __attribute__ ((visibility ("default"))) void TestFunc() {
3781   TestStruct::Init();
3783 _ACEOF
3784         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
3785             gccvisbroken=yes
3786         else
3787             case "$host_cpu" in
3788             i?86|x86_64)
3789                 if test "$_os" = "Darwin"; then
3790                     gccvisbroken=no
3791                 else
3792                     if $EGREP -q '@PLT' visibility.s; then
3793                         gccvisbroken=no
3794                     else
3795                         gccvisbroken=yes
3796                     fi
3797                 fi
3798                 ;;
3799             *)
3800                 gccvisbroken=no
3801                 ;;
3802             esac
3803         fi
3804         rm -f visibility.s visibility.cxx
3806         AC_MSG_RESULT([$gccvisbroken])
3807         if test "$gccvisbroken" = "yes"; then
3808             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
3809             echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
3810             unset HAVE_GCC_VISIBILITY_FEATURE
3811         fi
3812     fi
3814     AC_LANG_POP([C++])
3817 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3818 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
3820 dnl ===================================================================
3821 dnl allocator
3822 dnl ===================================================================
3823 AC_MSG_CHECKING([which memory allocator to use])
3824 if test "$with_alloc" = "system"; then
3825     AC_MSG_RESULT([system])
3826     ALLOC="SYS_ALLOC";
3827     AC_CHECK_FUNCS([malloc realloc calloc free])
3829 if test "$with_alloc" = "tcmalloc"; then
3830     AC_MSG_RESULT(tcmalloc)
3831     if ! echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3832         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3833     fi
3834     AC_CHECK_LIB(tcmalloc, malloc, [],
3835         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3836     ALLOC="TCMALLOC";
3838 if test "$with_alloc" = "jemalloc"; then
3839     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3840         AC_MSG_RESULT(jemalloc)
3841         save_CFLAGS=$CFLAGS
3842         CFLAGS="$CFLAGS -pthread"
3843         AC_CHECK_LIB(jemalloc, malloc, [],
3844             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3845         ALLOC="JEMALLOC";
3846         CFLAGS=$save_CFLAGS
3847     else
3848         AC_MSG_RESULT([system])
3849         ALLOC="SYS_ALLOC";
3850         AC_CHECK_FUNCS([malloc realloc calloc free])
3851     fi
3853 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3854     AC_MSG_RESULT([internal])
3856 AC_SUBST(ALLOC)
3858 dnl ===================================================================
3859 dnl Custom build version
3860 dnl ===================================================================
3862 AC_MSG_CHECKING([whether to add custom build version])
3863 if test "z$with_build_version" != "z"; then
3864     BUILD_VER_STRING=$with_build_version
3865     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3866 else
3867     BUILD_VER_STRING=
3868     AC_MSG_RESULT([no])
3870 AC_SUBST(BUILD_VER_STRING)
3872 dnl ===================================================================
3873 dnl Java support enable
3874 dnl ===================================================================
3875 AC_MSG_CHECKING([whether to build with Java support])
3876 if test "$with_java" != "no"; then
3877     AC_MSG_RESULT([yes])
3878     SOLAR_JAVA="TRUE"
3879 else
3880     AC_MSG_RESULT([no])
3881     SOLAR_JAVA=""
3884 AC_SUBST(SOLAR_JAVA)
3886 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
3887 dnl want there to be *run-time* (and build-time) support for Java extensions in the
3888 dnl built LibreOffice.
3889 dnl SOLAR_JAVA="BUILD" indicate build-time only support (no runtime support)
3890 dnl SOLAR_JAVA="" indicate no java support at all
3892 if test "$_os" = "Linux" && test "$host_cpu" = "powerpc"; then
3893     # IBMs JDK needs this...
3894     JITC_PROCESSOR_TYPE=6
3895     export JITC_PROCESSOR_TYPE
3897 AC_SUBST([JITC_PROCESSOR_TYPE])
3899 if test $_os = "WINNT"; then
3900     WITH_VC_REDIST="TRUE"
3902 AC_SUBST(WITH_VC_REDIST)
3904 dnl ===================================================================
3905 dnl Checks for Java
3906 dnl ===================================================================
3907 if test "$SOLAR_JAVA" != ""; then
3909     # Windows-specific tests
3910     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3911         if test "$CL_X64" != ""; then
3912             bitness="64-bit"
3913             otherbitness="32-bit"
3914         else
3915             bitness="32-bit"
3916             otherbitness="64-bit"
3917         fi
3919         if test -z "$with_jdk_home"; then
3921             # Unfortunately apparently no way to find, if needed, the 64-bit
3922             # JDK in the Registry from the 32-bit Perl oowintool
3924             _jdk_home=`./oowintool --jdk-home`
3925             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
3926                 with_jdk_home="$_jdk_home"
3927                 howfound="found by oowintool"
3928             else
3929                 AC_MSG_ERROR([No JDK found by oowintool, pass the --with-jdk-home option pointing to a $bitness JDK])
3930             fi
3931         else
3932             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
3933             howfound="you passed"
3934         fi
3935     fi
3937     JAVA_HOME=; export JAVA_HOME
3938     if test -z "$with_jdk_home"; then
3939         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
3940     else
3941         _java_path="$with_jdk_home/bin/$with_java"
3942         dnl Check if there is a Java interpreter at all.
3943         if test -x "$_java_path"; then
3944             JAVAINTERPRETER=$_java_path
3945         else
3946             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
3947         fi
3948     fi
3950     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3951         # Check that the JDK found is correct architecture
3952         # Why is this necessary, we don't link with any library from the JDK I think,
3954         shortjdkhome=`cygpath -d "$with_jdk_home"`
3955         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
3956             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
3957             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
3958         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
3959             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
3960             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
3961         fi
3963         if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
3964             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3965         fi
3966         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3967         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3968     elif test "$_os" = "Darwin"; then
3969         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
3970         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
3971         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
3972         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
3973         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
3974             AC_MSG_RESULT([yes])
3975             JAVAIFLAGS=-d32
3976         else
3977             AC_MSG_RESULT([no])
3978         fi
3979     fi
3982 dnl ===================================================================
3983 dnl Checks for JDK.
3984 dnl ===================================================================
3985 if test "$SOLAR_JAVA" != ""; then
3986     _gij_longver=0
3987     AC_MSG_CHECKING([the installed JDK])
3988     if test -n "$JAVAINTERPRETER"; then
3989         dnl java -version sends output to stderr!
3990         if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3991             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3992         elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
3993             JDK=gcj
3994             AC_MSG_RESULT([checked (gcj)])
3995             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
3996             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3998         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "BEA"` -gt 0; then
3999             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
4000         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "IBM"` -gt 0; then
4001             JDK=ibm
4003             dnl IBM JDK specific tests
4004             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
4005             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
4007             if test "$_jdk_ver" -lt 10500; then
4008                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
4009             fi
4011             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
4013             if test "$with_jdk_home" = ""; then
4014                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
4015 you must use the "--with-jdk-home" configure option explicitly])
4016             fi
4018            JAVA_HOME=$with_jdk_home
4020         else
4021             JDK=sun
4023             dnl Sun JDK specific tests
4024             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
4025             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
4027             if test "$_jdk_ver" -lt 10500; then
4028                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
4029             fi
4030             AC_MSG_RESULT([checked (JDK $_jdk)])
4031             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
4032             if test "$_os" = "WINNT"; then
4033                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
4034             fi
4035         fi
4036     else
4037         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
4038     fi
4039 else
4040     dnl Java disabled
4041     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
4044 _java_target_ver="1.5"
4045 dnl ===================================================================
4046 dnl Check for target Java bytecode version
4047 dnl ===================================================================
4048 if test "$SOLAR_JAVA" != ""; then
4049     AC_MSG_CHECKING([for target Java bytecode version])
4050     if test "$JDK" = "gcj" -o "$JDK" = "kaffe"; then
4051     AC_MSG_RESULT([default by $JDK])
4052     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
4053         AC_MSG_WARN([Value defined by --with-java-target-version is ignored!])
4054     fi
4055     else
4056     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
4057         _java_target_ver="$with_java_target_version"
4058         AC_MSG_RESULT([$_java_target_ver])
4059     elif test $_jdk_ver -gt 10000 ; then
4060         _java_target_ver=`echo "$_jdk_ver" | $AWK '{ maj=substr($0,1,1); min=substr($0,2,2); print int(maj)"."int(min) }'`
4061         AC_MSG_RESULT([$_java_target_ver])
4062     else
4063         AC_MSG_ERROR([Unable to guess Java bytecode version from Java version!])
4064     fi
4065     fi
4067     if ! test -z "$_java_target_ver" -o \
4068         "$_java_target_ver" = "1.1" -o \
4069             "$_java_target_ver" = "1.2" -o \
4070         "$_java_target_ver" = "1.3" -o \
4071         "$_java_target_ver" = "1.4" -o \
4072         "$_java_target_ver" = "1.5" -o \
4073         "$_java_target_ver" = "1.6" -o \
4074         "$_java_target_ver" = "5" ; then
4075         AC_MSG_ERROR([$_java_target_ver is not a supported Java bytecode version!])
4076     fi
4078     JAVA_SOURCE_VER="$_java_target_ver"
4079     JAVA_TARGET_VER="$_java_target_ver"
4082 dnl ===================================================================
4083 dnl Checks for javac
4084 dnl ===================================================================
4085 if test "$SOLAR_JAVA" != ""; then
4086     if test "$JDK" = "gcj"; then
4087         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
4088     else
4089         javacompiler="javac"
4090     fi
4091     if test -z "$with_jdk_home"; then
4092         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
4093     else
4094         _javac_path="$with_jdk_home/bin/$javacompiler"
4095         dnl Check if there is a Java compiler at all.
4096         if test -x "$_javac_path"; then
4097             JAVACOMPILER=$_javac_path
4098         fi
4099     fi
4100     if test -z "$JAVACOMPILER"; then
4101         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
4102     fi
4103     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4104         if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
4105             JAVACOMPILER="${JAVACOMPILER}.exe"
4106         fi
4107         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
4108         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
4109     fi
4111     if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
4112         AC_MSG_CHECKING([re-checking JDK])
4113         JDK=gcj
4114         AC_MSG_RESULT([checked (ecj)])
4115         #TODO: what's to do here? some switch to do 1.5 compiling?
4116         JAVAFLAGS="-source 1.5 -target 1.5"
4117         _gij_longver="40200"
4118     fi
4121 JAVACISGCJ=""
4122 dnl ===================================================================
4123 dnl Checks that javac is gcj
4124 dnl ===================================================================
4125 if test "$SOLAR_JAVA" != ""; then
4126     if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
4127         JAVACISGCJ="yes"
4128     fi
4130 AC_SUBST(JAVACISGCJ)
4132 JAVACISKAFFE=""
4133 dnl ===================================================================
4134 dnl Checks that javac is kaffe
4135 dnl ===================================================================
4136 if test "$SOLAR_JAVA" != ""; then
4137     if test `$JAVACOMPILER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
4138         JAVACISKAFFE="yes"
4139     fi
4141 AC_SUBST(JAVACISKAFFE)
4143 dnl ===================================================================
4144 dnl Checks for javadoc
4145 dnl ===================================================================
4146 if test "$SOLAR_JAVA" != ""; then
4147     if test -z "$with_jdk_home"; then
4148         AC_PATH_PROG(JAVADOC, javadoc)
4149     else
4150         _javadoc_path="$with_jdk_home/bin/javadoc"
4151         dnl Check if there is a javadoc at all.
4152         if test -x "$_javadoc_path"; then
4153             JAVADOC=$_javadoc_path
4154         else
4155             AC_PATH_PROG(JAVADOC, javadoc)
4156         fi
4157     fi
4158     if test -z "$JAVADOC"; then
4159         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
4160     fi
4161     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4162         if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
4163             JAVADOC="${JAVADOC}.exe"
4164         fi
4165         JAVADOC=`cygpath -d "$JAVADOC"`
4166         JAVADOC=`cygpath -u "$JAVADOC"`
4167     fi
4170 if test "$SOLAR_JAVA" != ""; then
4171     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
4172     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
4173         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
4174            # try to recover first by looking whether we have a alternatives
4175            # system as in Debian or newer SuSEs where following /usr/bin/javac
4176            # over /etc/alternatives/javac leads to the right bindir where we
4177            # just need to strip a bit away to get a valid JAVA_HOME
4178            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
4179         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
4180             # maybe only one level of symlink (e.g. on Mac)
4181             JAVA_HOME=$(readlink $JAVACOMPILER)
4182             if test "$(dirname $JAVA_HOME)" = "."; then
4183                 # we've got no path to trim back
4184                 JAVA_HOME=""
4185             fi
4186         else
4187             # else warn
4188             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
4189             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
4190             echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
4191             echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
4192         fi
4193         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
4194         if test "$JAVA_HOME" != "/usr"; then
4195             if test "$_os" = "Darwin"; then
4196                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
4197                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
4198                 dnl Tiger already returns a JDK path..
4199                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
4200             else
4201                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
4202             fi
4203         fi
4204     fi
4205     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
4207     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
4208     if test -z "$JAVA_HOME"; then
4209         if test "x$with_jdk_home" = "x"; then
4210             cat > findhome.java <<_ACEOF
4211 [import java.io.File;
4213 class findhome
4215     public static void main(String args[])
4216     {
4217         String jrelocation = System.getProperty("java.home");
4218         File jre = new File(jrelocation);
4219         System.out.println(jre.getParent());
4220     }
4222 _ACEOF
4223             AC_MSG_CHECKING([if javac works])
4224             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
4225             AC_TRY_EVAL(javac_cmd)
4226             if test $? = 0 && test -f ./findhome.class ; then
4227                 AC_MSG_RESULT([javac works])
4228             else
4229                 echo "configure: javac test failed" >&5
4230                 cat findhome.java >&5
4231                 AC_MSG_ERROR([javac does not work - java projects will not build!])
4232             fi
4233             AC_MSG_CHECKING([if gij knows its java.home])
4234             JAVA_HOME=`$JAVAINTERPRETER findhome`
4235             if test $? = 0 && test "$JAVA_HOME" != "" ; then
4236                 AC_MSG_RESULT([$JAVA_HOME])
4237             else
4238                 echo "configure: java test failed" >&5
4239                 cat findhome.java >&5
4240                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
4241             fi
4242             # clean-up after ourselves
4243             rm -f ./findhome.java ./findhome.class
4244         else
4245             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
4246         fi
4247     fi
4249     dnl second sanity check JAVA_HOME if possible
4250     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
4251         # now check if $JAVA_HOME is really valid
4252         if test "$_os" = "Darwin"; then
4253             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
4254                 JAVA_HOME_OK="NO"
4255             fi
4256         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
4257             JAVA_HOME_OK="NO"
4258         fi
4259         if test "$JAVA_HOME_OK" = "NO"; then
4260             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
4261             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
4262             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
4263             echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
4264             echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
4265             echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
4266         fi
4267     fi
4270 AWTLIB=
4272 if test "$SOLAR_JAVA" != ""; then
4273     AC_MSG_CHECKING([for jawt lib name])
4274     if test "$JDK" = "gcj"; then
4275         save_CFLAGS=$CFLAGS
4276         save_LDFLAGS=$LDFLAGS
4277         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4278         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
4279         exec 6>/dev/null # no output
4280         AC_CHECK_HEADER(jni.h, [],
4281                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
4282         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
4283         exec 6>&1 # output on again
4284         CFLAGS=$save_CFLAGS
4285         LDFLAGS=$save_LDFLAGS
4286     fi
4287     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
4288     # A workaround is to link also against libpmawt.so
4289     if test "$JDK" = "ibm" ; then
4290         save_CFLAGS=$CFLAGS
4291         save_LDFLAGS=$LDFLAGS
4292         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
4293         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4294         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
4295         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
4296         export LD_LIBRARY_PATH
4297         exec 6>/dev/null # no output
4298         AC_CHECK_HEADER(jni.h, [],
4299                     [AC_MSG_ERROR([jni.h could not be found.])], [])
4300         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
4301         if test -z "$AWTLIB"; then
4302             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
4303             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
4304         fi
4305         exec 6>&1 # output on again
4306         CFLAGS=$save_CFLAGS
4307         LDFLAGS=$save_LDFLAGS
4308         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
4309     fi
4310     if test -z "$AWTLIB"; then
4311         AWTLIB=-ljawt
4312     fi
4313     AC_MSG_RESULT([$AWTLIB])
4314     AC_SUBST(AWTLIB)
4317 AC_SUBST(JAVA_HOME)
4318 AC_SUBST(JDK)
4319 AC_SUBST(JAVAFLAGS)
4320 AC_SUBST(JAVA_SOURCE_VER)
4321 AC_SUBST(JAVA_TARGET_VER)
4322 AC_SUBST(JAVAINTERPRETER)
4323 AC_SUBST(JAVAIFLAGS)
4324 AC_SUBST(JAVACOMPILER)
4325 AC_SUBST(JAVADOC)
4327 dnl ===================================================================
4328 dnl Checks for specific files.
4329 dnl ===================================================================
4331 dnl ===================================================================
4332 dnl Checks for programs.
4333 dnl ===================================================================
4335 dnl ===================================================================
4336 dnl Check whether we already have dmake
4337 dnl ===================================================================
4338 AC_PATH_PROG(DMAKE, dmake, no)
4339 if test "$DMAKE" = "no"; then
4340     BUILD_DMAKE=YES
4341     echo "dmake will be built on ./bootstrap"
4342 else
4343     AC_MSG_CHECKING([whether the found dmake is the right dmake])
4344     # we need to find out whether that dmake we found is "our" dmake
4345     # or the dmake from Sun's SunStudio Compiler which is something
4346     # different
4347     # This test _should_ work because the one accepts -V (ours) and one
4348     # (the other) not...
4349     $DMAKE -V 2>/dev/null | grep 'dmake .* Version .*' >/dev/null
4350     if test $? -eq 0; then
4351         BUILD_DMAKE=NO
4352         AC_MSG_RESULT([yes])
4353         AC_MSG_CHECKING([the dmake version])
4354         DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
4355         if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
4356             AC_MSG_RESULT([OK, >= 4.11])
4357         elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
4358             test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
4359             AC_MSG_RESULT([OK, >= 4.11])
4360         else
4361             AC_MSG_RESULT([too old. >= 4.11 is needed])
4362             echo "A newer dmake will be built on ./bootstrap"
4363             BUILD_DMAKE=YES
4364         fi
4365     else
4366         AC_MSG_RESULT([no])
4367         echo "dmake will be built on ./bootstrap"
4368         BUILD_DMAKE=YES
4369     fi
4371 AC_SUBST(BUILD_DMAKE)
4373 AC_MSG_CHECKING([whether to enable EPM for packing])
4374 BUILD_EPM=NO
4375 if test "$enable_epm" = "yes"; then
4376     AC_MSG_RESULT([yes])
4377     dnl ===================================================================
4378     dnl Check for epm - not needed for Windows
4379     dnl ===================================================================
4380     if test "$_os" != "WINNT"; then
4381         if test -n "$with_epm"; then
4382             EPM=$with_epm
4383         else
4384             AC_PATH_PROG(EPM, epm, no)
4385         fi
4386         if test "$EPM" = "no" || test "$EPM" = "internal"; then
4387             echo "EPM will be built."
4388             BUILD_EPM=YES
4389             BUILD_TYPE="$BUILD_TYPE EPM"
4390         else
4391             # Gentoo has some epm which is something different...
4392             AC_MSG_CHECKING([whether the found epm is the right epm])
4393             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
4394                 AC_MSG_RESULT([yes])
4395             else
4396                 AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
4397             fi
4398             AC_MSG_CHECKING([epm version])
4399             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
4400             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
4401                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
4402                 AC_MSG_RESULT([OK, >= 3.7])
4403                 BUILD_EPM=NO
4404                 if test "$_os" = "Darwin"; then
4405                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
4406                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
4407                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4408                         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)])
4409                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4410                         AC_MSG_RESULT([$_pm, ok])
4411                     else # we never should get here, but go safe
4412                         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)])
4413                     fi
4414                 fi
4415             else
4416                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
4417                 echo "EPM will be built."
4418                 BUILD_EPM=YES
4419                 BUILD_TYPE="$BUILD_TYPE EPM"
4420             fi
4421         fi
4422     fi
4424     # test which package format to use
4425     AC_MSG_CHECKING([which package format to use])
4427     # defaults
4428     case "$_os" in
4429     Darwin)
4430         PKGFORMAT=dmg
4431         ;;
4432     SunOS)
4433         PKGFORMAT=pkg
4434         ;;
4435     Linux)
4436         # if building on Debian, default should be deb...
4437         if test -e /etc/debian_version; then
4438             PKGFORMAT=deb
4439         else
4440             PKGFORMAT=rpm
4441         fi
4442         ;;
4443     AIX)
4444         PKGFORMAT=rpm
4445         ;;
4446     OpenBSD|DragonFly)
4447         PKGFORMAT=portable
4448         ;;
4449     *BSD)
4450         PKGFORMAT=bsd
4451         ;;
4452     WINNT)
4453         PKGFORMAT=msi
4454         ;;
4455     # we never should get here since we check the arciecture/os at the beginning,
4456     # but go sure...
4457     *)
4458         AC_MSG_ERROR([unknown system])
4459     esac
4460     if test -n "$with_package_format"; then
4461         for i in $with_package_format; do
4462             case "$i" in
4463             aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4464                 ;;
4465             *)
4466                 AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4467 aix - AIX software distribution
4468 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4469 deb - Debian software distribution
4470 inst or tardist - IRIX software distribution
4471 osx - MacOS X software distribution
4472 pkg - Solaris software distribution
4473 rpm - RedHat software distribution
4474 setld - Tru64 (setld) software distribution
4475 native - "Native" software distribution for the platform
4476 portable - Portable software distribution
4477 LibreOffice additionally supports:
4478 archive - .tar.gz or .zip
4479 dmg - Mac OS X .dmg
4480 installed - installation tree
4481 msi - Windows .msi
4482             ])
4483                 ;;
4484             esac
4485         done
4486         PKGFORMAT="$with_package_format"
4487     fi
4488     AC_MSG_RESULT([$PKGFORMAT])
4489     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
4490         AC_MSG_CHECKING([for rpm])
4491         for a in "$RPM" rpmbuild rpm; do
4492             $a --usage >/dev/null 2> /dev/null
4493             if test $? -eq 0; then
4494                 RPM=$a
4495                 break
4496             else
4497                 $a --version >/dev/null 2> /dev/null
4498                 if test $? -eq 0; then
4499                     RPM=$a
4500                     break
4501                 fi
4502             fi
4503         done
4504         if test -z "$RPM" ; then
4505             AC_MSG_ERROR([not found])
4506         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
4507             RPM_PATH=`which $RPM`
4508             AC_MSG_RESULT([$RPM_PATH])
4509         else
4510             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
4511         fi
4512     fi
4513     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
4514         AC_PATH_PROG(DPKG, dpkg, no)
4515         if test "$DPKG" = "no"; then
4516             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
4517         fi
4518     fi
4519     if echo "PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
4520         if test "$_os" = "Darwin"; then
4521             AC_MSG_CHECKING([for PackageMaker availability])
4522             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
4523                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
4524             else
4525                 AC_MSG_RESULT([ok])
4526             fi
4527         else
4528             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
4529         fi
4530     fi
4531     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
4532        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4533         if test "$EPM" != "no" && test "$EPM" != "internal"; then
4534             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
4535                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
4536                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
4537                     AC_MSG_RESULT([yes])
4538                 else
4539                     AC_MSG_RESULT([no])
4540                     if echo "$PKGFORMAT" | grep -q rpm; then
4541                         _pt="rpm"
4542                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
4543                         echo "the rpms will need to be installed with --nodeps" >> warn
4544                     else
4545                         _pt="pkg"
4546                     fi
4547                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
4548                     echo "the ${_pt}s will not be relocateable" >> warn
4549                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
4550                                  relocation will work, you need to patch your epm with the
4551                                  patch in epm/epm-3.7.patch or build with
4552                                  --with-epm=internal which will build a suitable epm])
4553                 fi
4554             fi
4555         fi
4556     fi
4557     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4558         AC_PATH_PROG(PKGMK, pkgmk, no)
4559         if test "$PKGMK" = "no"; then
4560             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
4561         fi
4562     fi
4563     AC_SUBST(RPM)
4564     AC_SUBST(DPKG)
4565     AC_SUBST(PKGMK)
4566 else
4567     AC_MSG_RESULT([no])
4568     EPM=NO
4569     PKGFORMAT=native
4571 AC_SUBST(EPM)
4572 AC_SUBST(BUILD_EPM)
4573 AC_SUBST(PKGFORMAT)
4575 dnl ===================================================================
4576 dnl Check for gperf
4577 dnl ===================================================================
4578 AC_PATH_PROG(GPERF, gperf)
4579 if test -z "$GPERF"; then
4580     AC_MSG_ERROR([gperf not found but needed. Install it.])
4582 AC_MSG_CHECKING([gperf version])
4583 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
4584     AC_MSG_RESULT([OK])
4585 else
4586     AC_MSG_ERROR([too old, you need at least 3.0.0])
4588 AC_SUBST(GPERF)
4590 dnl ===================================================================
4591 dnl Check for building ODK
4592 dnl ===================================================================
4593 AC_MSG_CHECKING([whether to build the ODK])
4594 if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
4595     AC_MSG_RESULT([yes])
4597     if test "$with_java" != "no"; then
4598         AC_MSG_CHECKING([whether to build unowinreg.dll])
4599         if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
4600             # build on Win by default
4601             enable_build_unowinreg=yes
4602         fi
4603         if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
4604             AC_MSG_RESULT([no])
4605             BUILD_UNOWINREG=NO
4606         else
4607             AC_MSG_RESULT([yes])
4608             BUILD_UNOWINREG=YES
4609         fi
4610         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
4611             if test -z "$with_mingw_cross_compiler"; then
4612                 dnl Guess...
4613                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
4614             elif test -x "$with_mingw_cross_compiler"; then
4615                  MINGWCXX="$with_mingw_cross_compiler"
4616             else
4617                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
4618             fi
4620             if test "$MINGWCXX" = "false"; then
4621                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
4622             fi
4624             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
4625             if test -x "$mingwstrip_test"; then
4626                 MINGWSTRIP="$mingwstrip_test"
4627             else
4628                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
4629             fi
4631             if test "$MINGWSTRIP" = "false"; then
4632                 AC_MSG_ERROR(MinGW32 binutils not found.)
4633             fi
4634         fi
4635     fi
4636     BUILD_TYPE="$BUILD_TYPE ODK"
4637 else
4638     AC_MSG_RESULT([no])
4639     BUILD_UNOWINREG=NO
4641 AC_SUBST(BUILD_UNOWINREG)
4642 AC_SUBST(MINGWCXX)
4643 AC_SUBST(MINGWSTRIP)
4645 dnl ===================================================================
4646 dnl Check for system stdlibs
4647 dnl ===================================================================
4648 AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
4649 if test "$with_system_stdlibs" = "yes"; then
4650     AC_MSG_RESULT([no])
4651     SYSTEM_STDLIBS=YES
4652 else
4653     AC_MSG_RESULT([yes])
4654     SYSTEM_STDLIBS=NO
4656 AC_SUBST(SYSTEM_STDLIBS)
4658 dnl ===================================================================
4659 dnl Check for system zlib
4660 dnl ===================================================================
4661 AC_MSG_CHECKING([which zlib to use])
4662 if test "$with_system_zlib" = "yes"; then
4663     AC_MSG_RESULT([external])
4664     SYSTEM_ZLIB=YES
4665     AC_CHECK_HEADER(zlib.h, [],
4666         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
4667     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
4668         [AC_MSG_ERROR(zlib not found or functional)], [])
4669 else
4670     AC_MSG_RESULT([internal])
4671     SYSTEM_ZLIB=NO
4672     BUILD_TYPE="$BUILD_TYPE ZLIB"
4674 AC_SUBST(SYSTEM_ZLIB)
4676 dnl ===================================================================
4677 dnl Check for system jpeg
4678 dnl ===================================================================
4679 AC_MSG_CHECKING([which jpeg to use])
4680 if test "$with_system_jpeg" = "yes"; then
4681     AC_MSG_RESULT([external])
4682     SYSTEM_JPEG=YES
4683     AC_CHECK_HEADER(jpeglib.h, [],
4684         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
4685     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
4686     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
4687 else
4688     AC_MSG_RESULT([internal])
4689     SYSTEM_JPEG=NO
4690     BUILD_TYPE="$BUILD_TYPE JPEG"
4692 AC_SUBST(SYSTEM_JPEG)
4694 dnl ===================================================================
4695 dnl Check for system expat
4696 dnl ===================================================================
4697 AC_MSG_CHECKING([which expat to use])
4698 if test "$with_system_expat" = "yes"; then
4699     AC_MSG_RESULT([external])
4700     SYSTEM_EXPAT=YES
4701     AC_CHECK_HEADER(expat.h, [],
4702         [AC_MSG_ERROR(expat.h not found. install expat)], [])
4703     AC_CHECK_LIB(expat, XML_ParserCreate, [],
4704     [AC_MSG_RESULT(expat library not found or functional.)], [])
4705     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libexpat-1.dll"
4706 else
4707     AC_MSG_RESULT([internal])
4708     SYSTEM_EXPAT=NO
4709     BUILD_TYPE="$BUILD_TYPE EXPAT"
4711 AC_SUBST(SYSTEM_EXPAT)
4713 dnl ===================================================================
4714 dnl Check for system libvisio
4715 dnl ===================================================================
4716 AC_MSG_CHECKING([which libvisio to use])
4717 if test "$with_system_libvisio" = "yes"; then
4718     AC_MSG_RESULT([external])
4719     SYSTEM_LIBVISIO=YES
4720     PKG_CHECK_MODULES( VISIO, libvisio-0.0 )
4721 else
4722     AC_MSG_RESULT([internal])
4723     SYSTEM_LIBVISIO=NO
4724     BUILD_TYPE="$BUILD_TYPE LIBVISIO"
4726 AC_SUBST(SYSTEM_LIBVISIO)
4727 AC_SUBST(VISIO_CFLAGS)
4728 AC_SUBST(VISIO_LIBS)
4730 dnl ===================================================================
4731 dnl Check for system libcmis
4732 dnl ===================================================================
4733 AC_MSG_CHECKING([which libcmis to use])
4734 if test "$with_system_libcmis" = "yes"; then
4735     AC_MSG_RESULT([external])
4736     SYSTEM_LIBCMIS=YES
4737     PKG_CHECK_MODULES( LIBCMIS, libcmis-0.2 )
4738 else
4739     AC_MSG_RESULT([internal])
4740     SYSTEM_LIBCMIS=NO
4741     BUILD_TYPE="$BUILD_TYPE LIBCMIS"
4743 AC_SUBST(SYSTEM_LIBCMIS)
4744 AC_SUBST(LIBCMIS_CFLAGS)
4745 AC_SUBST(LIBCMIS_LIBS)
4748 dnl ===================================================================
4749 dnl Check for system libwpd
4750 dnl ===================================================================
4751 AC_MSG_CHECKING([which libwpd to use])
4752 if test "$with_system_libwpd" = "yes"; then
4753     AC_MSG_RESULT([external])
4754     SYSTEM_LIBWPD=YES
4755     PKG_CHECK_MODULES( WPD, libwpd-0.9 libwpd-stream-0.9 )
4756 else
4757     AC_MSG_RESULT([internal])
4758     SYSTEM_LIBWPD=NO
4759     BUILD_TYPE="$BUILD_TYPE LIBWPD"
4761 AC_SUBST(SYSTEM_LIBWPD)
4762 AC_SUBST(WPD_CFLAGS)
4763 AC_SUBST(WPD_LIBS)
4765 dnl ===================================================================
4766 dnl Check for system cppunit
4767 dnl ===================================================================
4768 AC_MSG_CHECKING([which cppunit to use])
4769 if test "$with_system_cppunit" = "yes"; then
4770     AC_MSG_RESULT([external])
4771     SYSTEM_CPPUNIT=YES
4772     # might work for earlier, too but go sure:
4773     PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
4774 else
4775     AC_MSG_RESULT([internal])
4776     SYSTEM_CPPUNIT=NO
4777     BUILD_TYPE="$BUILD_TYPE CPPUNIT"
4779 AC_SUBST(SYSTEM_CPPUNIT)
4780 AC_SUBST(CPPUNIT_CFLAGS)
4781 AC_SUBST(CPPUNIT_LIBS)
4783 dnl ===================================================================
4784 dnl Check whether freetype is available
4785 dnl ===================================================================
4786 if test  "$test_freetype" = "yes"; then
4787     AC_MSG_CHECKING([whether freetype is available])
4788     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
4790 AC_SUBST(FREETYPE_CFLAGS)
4791 AC_SUBST(FREETYPE_LIBS)
4793 dnl ===================================================================
4794 dnl Check for system libwps
4795 dnl ===================================================================
4796 AC_MSG_CHECKING([which libwps to use])
4797 if test "$with_system_libwps" = "yes"; then
4798     AC_MSG_RESULT([external])
4799     SYSTEM_LIBWPS=YES
4800     PKG_CHECK_MODULES( WPS, libwps-0.2 )
4801 else
4802     AC_MSG_RESULT([internal])
4803     SYSTEM_LIBWPS=NO
4804     BUILD_TYPE="$BUILD_TYPE LIBWPS"
4806 AC_SUBST(SYSTEM_LIBWPS)
4807 AC_SUBST(WPS_CFLAGS)
4808 AC_SUBST(WPS_LIBS)
4810 dnl ===================================================================
4811 dnl Check for system libwpg
4812 dnl ===================================================================
4813 AC_MSG_CHECKING([which libwpg to use])
4814 if test "$with_system_libwpg" = "yes"; then
4815     AC_MSG_RESULT([external])
4816     SYSTEM_LIBWPG=YES
4817     PKG_CHECK_MODULES( WPG, libwpg-0.2 )
4818 else
4819     AC_MSG_RESULT([internal])
4820     SYSTEM_LIBWPG=NO
4821     BUILD_TYPE="$BUILD_TYPE LIBWPG"
4823 AC_SUBST(SYSTEM_LIBWPG)
4824 AC_SUBST(WPG_CFLAGS)
4825 AC_SUBST(WPG_LIBS)
4827 dnl ===================================================================
4828 dnl Check whether freetype2 supports emboldening
4829 dnl ===================================================================
4830 if test  "$test_freetype" = "yes"; then
4831     save_CPPFLAGS="$CPPFLAGS"
4832     save_LDFLAGS="$LDFLAGS"
4833     save_LIBS="$LIBS"
4834     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
4835     LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
4836     AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
4837                  [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4838     LDFLAGS="$save_LDFLAGS"
4839     CPPFLAGS="$save_CPPFLAGS"
4840     LIBS="$save_LIBS"
4842 AC_SUBST(USE_FT_EMBOLDEN)
4844 # ===================================================================
4845 # Check for system libxslt
4846 # to prevent incompatibilities between internal libxml2 and external libxslt,
4847 # or vice versa, use with_system_libxml here
4848 # ===================================================================
4849 AC_MSG_CHECKING([which libxslt to use])
4850 if test "$with_system_libxml" = "yes"; then
4851     AC_MSG_RESULT([external])
4852     SYSTEM_LIBXSLT=YES
4853     if test "$_os" = "Darwin"; then
4854         dnl make sure to use SDK path
4855         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4856         dnl omit -L/usr/lib
4857         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
4858     else
4859         PKG_CHECK_MODULES(LIBXSLT, libxslt)
4860     fi
4862     dnl Check for xsltproc
4863     AC_PATH_PROG(XSLTPROC, xsltproc, no)
4864     if test "$XSLTPROC" = "no"; then
4865         AC_MSG_ERROR([xsltproc is required])
4866     fi
4868     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libxslt-1.dll"
4869 else
4870     AC_MSG_RESULT([internal])
4871     SYSTEM_LIBXSLT=NO
4872     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4874     if test "$cross_compiling" = "yes"; then
4875         AC_PATH_PROG(XSLTPROC, xsltproc, no)
4876         if test "$XSLTPROC" = "no"; then
4877             AC_MSG_ERROR([xsltproc is required])
4878         fi
4879     fi
4881 AC_SUBST(SYSTEM_LIBXSLT)
4882 AC_SUBST(LIBXSLT_CFLAGS)
4883 AC_SUBST(LIBXSLT_LIBS)
4884 AC_SUBST(XSLTPROC)
4886 # ===================================================================
4887 # Check for system libxml
4888 # ===================================================================
4889 AC_MSG_CHECKING([which libxml to use])
4890 if test "$with_system_libxml" = "yes"; then
4891     AC_MSG_RESULT([external])
4892     SYSTEM_LIBXML=YES
4893     if test "$_os" = "Darwin"; then
4894         dnl make sure to use SDK path
4895         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4896         dnl omit -L/usr/lib
4897         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
4898     elif test $_os = iOS; then
4899         dnl make sure to use SDK path
4900         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
4901         LIBXML_CFLAGS="-I$usr/include/libxml2"
4902         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
4903     else
4904         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4905     fi
4906     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS zlib1.dll libxml2-2.dll"
4907 else
4908     AC_MSG_RESULT([internal])
4909     SYSTEM_LIBXML=NO
4910     BUILD_TYPE="$BUILD_TYPE LIBXML2"
4912 AC_SUBST(SYSTEM_LIBXML)
4913 AC_SUBST(LIBXML_CFLAGS)
4914 AC_SUBST(LIBXML_LIBS)
4916 dnl ===================================================================
4917 dnl Checks for Python
4918 dnl ===================================================================
4920 AC_MSG_CHECKING([which Python to use])
4922 case "$enable_python" in
4923 no|disable)
4924     enable_python=no
4925     AC_MSG_RESULT([none])
4926     DISABLE_PYTHON=TRUE
4927     ;;
4928 ""|yes|auto)
4929     if test $build_os = cygwin; then
4930         dnl When building on Windows we don't attempt to use any installed
4931         dnl "system"  Python.
4932         dnl
4933         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
4934         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
4935         dnl MinGW cross-compilation setups.)
4936         AC_MSG_RESULT([internal])
4937         enable_python=internal
4938     elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4939         AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4940         enable_python=internal
4941     else
4942         AC_MSG_RESULT([checking below])
4943         enable_python=auto
4944     fi
4945     ;;
4946 internal)
4947     AC_MSG_RESULT([internal])
4948     ;;
4949 system)
4950     if test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4951         AC_MSG_ERROR([Cannot use "system" Python, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4952     fi
4953     AC_MSG_RESULT([system])
4954     ;;
4956     AC_MSG_ERROR([Incorrect --enable-python option])
4957     ;;
4958 esac
4960 AC_SUBST(DISABLE_PYTHON)
4962 if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then
4963     AC_MSG_ERROR([Must use internal Python when building with MSVC])
4966 if test $enable_python != no; then
4967     BUILD_TYPE="$BUILD_TYPE PYUNO"
4970 if test "$cross_compiling" = yes; then
4971     if test $enable_python = auto; then
4972         enable_python=system
4973     fi
4974 else
4975     if test $enable_python = system; then
4976         # This causes an error if no python command is found
4977         # Note that this takes the system python called just "python",
4978         # which isn't actually what we want on MacOSX when building
4979         # against the 10.6 SDK. But that shouldn't matter, we
4980         # select the correct python command manually below anyway.
4981         AM_PATH_PYTHON([2.6])
4982     elif test $enable_python = auto; then
4983         dnl This allows lack of system Python
4984         AM_PATH_PYTHON([2.6],, [:])
4986         if test "$PYTHON" = :; then
4987             enable_python=internal
4988         else
4989             enable_python=system
4990         fi
4991     fi
4994 if test $enable_python = system; then
4995     if test $_os = Darwin; then
4996         # We already have logic above to make sure the system Python
4997         # is used only when building against SDK 10.6 or newer.
4999         # Make sure we use the 2.6 Python when building against the
5000         # 10.6 SDK.
5001         case $with_macosx_sdk in
5002         10.6)
5003             python_version=2.6;;
5004         10.7)
5005             python_version=2.7;;
5006         *)
5007             # ???
5008             python_version=2.7;;
5009         esac
5010         PYTHON=python$python_version
5012         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
5013         PYTHON_LIBS="-framework Python"
5014     fi
5015     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
5016         # Fallback: Accept these in the environment, or as set above
5017         # for MacOSX.
5018         :
5019     elif test "$cross_compiling" != yes; then
5020         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
5021         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
5022         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
5023         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
5024         if $PKG_CONFIG --exists python-$python_version; then
5025             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
5026             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version`"
5027         else
5028             PYTHON_CFLAGS="-I$python_include"
5029             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
5030         fi
5031     elif test "$cross_compiling" = yes; then
5032         dnl How to find out the cross-compilation Python installation path?
5033         dnl Let's hardocode what we know for different distributions for now...
5035         for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw ; do
5036             for python_version in 2.6 ; do
5037                 if test -f ${python_sysroot}/include/python${python_version}/Python.h; then
5038                     PYTHON_CFLAGS="-I ${python_sysroot}/include/python$python_version"
5039                     PYTHON_LIBS="-L ${python_sysroot}lib -lpython$python_version $python_libs"
5040                     break
5041                 fi
5042             done
5043             test -n "$PYTHON_CFLAGS" && break
5044         done
5045     fi
5048 dnl By now enable_python should be "system", "internal" or "no"
5049 case $enable_python in
5050 system)
5051     SYSTEM_PYTHON=YES
5053     dnl Check if the headers really work
5054     save_CPPFLAGS="$CPPFLAGS"
5055     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
5056     AC_CHECK_HEADER(Python.h, [],
5057        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
5058        [])
5059     CPPFLAGS="$save_CPPFLAGS"
5061     dnl FIXME Check if the Python library can be linked with, too?
5062     ;;
5064 internal)
5065     SYSTEM_PYTHON=NO
5066     BUILD_TYPE="$BUILD_TYPE PYTHON"
5067     # Embedded Python dies without Home set
5068     if test "z$HOME" = "z"; then
5069         export HOME="";
5070     fi
5071     # bz2 tarball and bzip2 is not standard
5072     if test -z "$BZIP2"; then
5073         AC_PATH_PROG( BZIP2, bzip2)
5074         if test -z "$BZIP2"; then
5075             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
5076         fi
5077     fi
5078     ;;
5080     SYSTEM_PYTHON=NO
5081     ;;
5083     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
5084     ;;
5085 esac
5087 AC_SUBST(SYSTEM_PYTHON)
5088 AC_SUBST(PYTHON_CFLAGS)
5089 AC_SUBST(PYTHON_LIBS)
5091 dnl ===================================================================
5092 dnl Check for system Berkeley db
5093 dnl ===================================================================
5094 AC_MSG_CHECKING([which db to use])
5095 if test "$with_system_db" = "yes"; then
5096     SYSTEM_DB=YES
5097     AC_MSG_RESULT([external])
5099     db_header=
5100     for dbver in 5.1 5.0 5 4.8 4.7 4; do
5101         for dash in - ''; do
5102             AC_CHECK_HEADER([db$dash$dbver/db.h],
5103                 [ db_header="db$dash$dbver/db.h"; break 2 ])
5104         done
5105     done
5107     if test -z "$db_header"; then
5108         AC_CHECK_HEADER([db/db.h], [db_header='db/db.h'; dbver=''])
5109     fi
5111     if test -z "$db_header"; then
5112        AC_CHECK_HEADER(db.h, [ db_header='db.h'; dbver='' ])
5113     fi
5115     if test -z "$db_header"; then
5116         AC_MSG_ERROR([db.h not found. Use the correct -I flag, or install the Berkeley db development package.])
5117     fi
5119     AC_MSG_CHECKING([whether db is at least 4.1])
5120     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])])
5122     SYSTEM_DB_CFLAGS="-DSYSTEM_DB_HEADER='<$db_header>'"
5124     DB_LIB=
5125     dnl At least on OpenBSD dbver is not appended to the library
5126     if test "$_os" = "OpenBSD"; then
5127         dbver=''
5128     fi
5129     for dash in - ''; do
5130         AC_CHECK_LIB(db$dash$dbver, dbopen,
5131             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5132         AC_CHECK_LIB(db$dash$dbver, __db185_open,
5133             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5134     done
5136     if test -z "$DB_LIB" ; then
5137         AC_MSG_ERROR([db library not found. Use the correct -L flag,
5138 or install the Berkeley db development package.])
5139     fi
5141     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
5142     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libdb-4.8.dll"
5143 else
5144     AC_MSG_RESULT([internal])
5145     SYSTEM_DB=NO
5146     BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
5148 AC_SUBST(SYSTEM_DB)
5149 AC_SUBST(SYSTEM_DB_CFLAGS)
5150 AC_SUBST(DB_LIB)
5151 AC_SUBST(DB_CPPLIB)
5153 dnl ===================================================================
5154 dnl Check for system lucene
5155 dnl ===================================================================
5156 if test "$with_java" != "no"; then
5157 AC_MSG_CHECKING([which lucene to use])
5158 if test "$with_system_lucene" = "yes"; then
5159     AC_MSG_RESULT([external])
5160     SYSTEM_LUCENE=YES
5161     if test -z $LUCENE_CORE_JAR; then
5162          AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
5163             [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
5164             [
5165               AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
5166                 [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
5167                 [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
5168                    [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
5169                    [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
5170                   )
5171                 ]
5172               )
5173             ]
5174          )
5175     else
5176         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5177                [AC_MSG_ERROR(lucene-core.jar not found.)], [])
5178     fi
5180     if test -z $LUCENE_ANALYZERS_JAR; then
5181         AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
5182             [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
5183             [
5184               AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
5185                 [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
5186                 [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
5187               )
5188             ]
5189         )
5190     else
5191         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5192                [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
5193     fi
5194     AC_MSG_CHECKING([whether lucene is version 2.x])
5195     export LUCENE_CORE_JAR
5196     if $PERL -e 'use Archive::Zip;
5197             my $file = "$ENV{'LUCENE_CORE_JAR'}";
5198             my $zip = Archive::Zip->new( $file );
5199             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5200             if ( $mf =~ m/Specification-Version: 2.*/ ) {
5201                 exit 0;
5202             } else {
5203                 exit 1;
5204             }'; then
5205         AC_MSG_RESULT([yes])
5206     else
5207         AC_MSG_ERROR([no, you need lucene 2])
5208     fi
5210 else
5211     AC_MSG_RESULT([internal])
5212     SYSTEM_LUCENE=NO
5213     BUILD_TYPE="$BUILD_TYPE LUCENE"
5216 AC_SUBST(SYSTEM_LUCENE)
5217 AC_SUBST(LUCENE_CORE_JAR)
5218 AC_SUBST(LUCENE_ANALYZERS_JAR)
5220 AC_MSG_CHECKING([whether to build the MySQL Connector extension])
5221 if test "x$enable_ext_mysql_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
5222     AC_MSG_RESULT([yes])
5223     ENABLE_MYSQLC=YES
5224     BUILD_TYPE="$BUILD_TYPE MYSQLC"
5225 else
5226     AC_MSG_RESULT([no])
5227     ENABLE_MYSQLC=NO
5229 AC_SUBST(ENABLE_MYSQLC)
5231 if test "$ENABLE_MYSQLC" = "YES"; then
5233     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MYSQLC"
5235     dnl ===================================================================
5236     dnl Check for system MySQL
5237     dnl ===================================================================
5238     AC_MSG_CHECKING([for MySQL prerequisites])
5239     if test "$with_system_mysql" = "yes"; then
5240         AC_MSG_RESULT([external MySQL])
5241         SYSTEM_MYSQL=YES
5242         AC_PATH_PROG( MYSQLCONFIG, mysql_config)
5243         AC_MSG_CHECKING([MySQL version])
5244         MYSQL_VERSION=`$MYSQLCONFIG --version`
5245         MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
5246         if test "$MYSQL_MAJOR" -ge "5"; then
5247             AC_MSG_RESULT([OK])
5248         else
5249             AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
5250         fi
5251         AC_MSG_CHECKING([for MySQL Client library])
5252         MYSQL_INC=`$MYSQLCONFIG --include`
5253         MYSQL_LIB=`$MYSQLCONFIG --libs`
5254         MYSQL_DEFINES=`$MYSQLCONFIG --cflags | $SED -e s,$MYSQL_INC,,`
5255         AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
5256     else
5257         SYSTEM_MYSQL=NO
5258         if test -n "$with_libmysql_path"; then
5259             AC_MSG_RESULT([external Connector/C (libmysql)])
5260             LIBMYSQL=libmysql.so
5261             if test "$_os" = "Darwin"; then
5262                 LIBMYSQL=libmysql.dylib
5263             elif test "$_os" = "WINNT"; then
5264                 LIBMYSQL=libmysql.dll
5265             fi
5266             AC_MSG_CHECKING([for $LIBMYSQL])
5267             if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
5268                 AC_MSG_RESULT([found.])
5269                 LIBMYSQL_PATH=$with_libmysql_path
5270             else
5271                 AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
5272             fi
5273         else
5274             AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
5275         fi
5276     fi
5277     AC_SUBST(SYSTEM_MYSQL)
5278     AC_SUBST(MYSQL_INC)
5279     AC_SUBST(MYSQL_LIB)
5280     AC_SUBST(MYSQL_DEFINES)
5281     AC_SUBST(LIBMYSQL_PATH)
5283     AC_LANG_PUSH([C++])
5284     dnl ===================================================================
5285     dnl Check for system MySQL C++ Connector
5286     dnl ===================================================================
5287     # FIXME!
5288     # who thought this too-generic cppconn dir was a good idea?
5289     AC_MSG_CHECKING([MySQL Connector/C++])
5290     if test "$with_system_mysql_cppconn" = "yes"; then
5291         AC_MSG_RESULT([external])
5292         SYSTEM_MYSQL_CPPCONN=YES
5293         AC_LANG_PUSH([C++])
5294         AC_CHECK_HEADER(mysql_driver.h, [],
5295                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
5296         AC_CHECK_LIB(mysqlcppconn, main, [],
5297                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
5298         AC_MSG_CHECKING([version])
5299         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5300 #include <mysql_driver.h>
5302 int main(int argc, char **argv) {
5303     sql::Driver *driver;
5304     driver = get_driver_instance();
5305     if (driver->getMajorVersion() > 1 || \
5306        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
5307        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
5308         return 0;
5309       else
5310         return 1;
5312       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
5314         AC_LANG_POP([C++])
5316     else
5317         AC_MSG_RESULT([internal])
5318         AC_MSG_CHECKING([for mysqlcppconn module])
5319         if test -d mysqlcppconn; then
5320             AC_MSG_RESULT([OK])
5321         else
5322             AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
5323         fi
5324         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
5325         SYSTEM_MYSQL_CPPCONN=NO
5326     fi
5327     AC_LANG_POP([C++])
5328     AC_SUBST(SYSTEM_MYSQL_CPPCONN)
5331 dnl ===================================================================
5332 dnl Check for system hsqldb
5333 dnl ===================================================================
5334 if test "$with_java" != "no"; then
5335 AC_MSG_CHECKING([which hsqldb to use])
5336 if test "$with_system_hsqldb" = "yes"; then
5337     AC_MSG_RESULT([external])
5338     SYSTEM_HSQLDB=YES
5339     if test -z $HSQLDB_JAR; then
5340         HSQLDB_JAR=/usr/share/java/hsqldb.jar
5341     fi
5342     AC_CHECK_FILE($HSQLDB_JAR, [],
5343                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
5344     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
5345     export HSQLDB_JAR
5346     if $PERL -e 'use Archive::Zip;
5347             my $file = "$ENV{'HSQLDB_JAR'}";
5348             my $zip = Archive::Zip->new( $file );
5349             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5350             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
5351                push @l, split(/\n/, $mf);
5352                foreach my $line (@l) {
5353                   if ($line =~ m/Specification-Version:/) {
5354                       ($t, $version) = split (/:/,$line);
5355                       $version =~ s/^\s//;
5356                       ($a, $b, $c, $d) = split (/\./,$version);
5357                       if ($c == "0" && $d > "8")  {
5358                           exit 0;
5359                       } else {
5360                           exit 1;
5361                       }
5362                   }
5363                }
5364             } else {
5365                 exit 1;
5366             }'; then
5367         AC_MSG_RESULT([yes])
5368     else
5369         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
5370     fi
5371 else
5372     AC_MSG_RESULT([internal])
5373     SYSTEM_HSQLDB=NO
5374     BUILD_TYPE="$BUILD_TYPE HSQLDB"
5376 AC_SUBST(SYSTEM_HSQLDB)
5377 AC_SUBST(HSQLDB_JAR)
5380 dnl ===================================================================
5381 dnl Check for PostgreSQL stuff
5382 dnl ===================================================================
5384 if test "x$enable_ext_postgresql_sdbc" = "xyes"; then
5385     AC_MSG_CHECKING([for PostgreSQL prerequisites])
5386     if test "$with_system_postgresql" = "yes"; then
5387         AC_MSG_RESULT([external PostgreSQL])
5388         SYSTEM_POSTGRESQL=YES
5389         AC_PATH_PROG(PGCONFIG, pg_config)
5390         if test -z "$PGCONFIG"; then
5391            AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
5392         fi
5393         POSTGRESQL_INC=-I$(pg_config --includedir)
5394         POSTGRESQL_LIB="-L$(pg_config --libdir) -lpq"
5395     else
5396         SYSTEM_POSTGRESQL=NO
5397         if test -n "$with_libpq_path"; then
5398             AC_MSG_RESULT([external libpq])
5399             POSTGRESQL_LIB="-L${with_libpq_path}/lib/ -lpq"
5400             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
5401         else
5402             AC_MSG_ERROR([not given. Please specify either --with-system-postgresql or --with-libpq-path])
5403         fi
5404     fi
5405     AC_MSG_CHECKING([for PostgreSQL C interface])
5406     save_CFLAGS=$CFLAGS
5407     save_CPPFLAGS=$CPPFLAGS
5408     save_LIBS=$LIBS
5409     CPPFLAGS="${POSTGRESQL_INC}"
5410     LIBS="${POSTGRESQL_LIB}"
5411     AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
5412     AC_CHECK_LIB(pq, PQconnectdbParams, [],
5413         [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
5414     CFLAGS=$save_CFLAGS
5415     CPPFLAGS=$save_CPPFLAGS
5416     LIBS=$save_LIBS
5417     BUILD_POSTGRESQL_SDBC=YES
5419 AC_SUBST(BUILD_POSTGRESQL_SDBC)
5420 AC_SUBST(SYSTEM_POSTGRESQL)
5421 AC_SUBST(POSTGRESQL_INC)
5422 AC_SUBST(POSTGRESQL_LIB)
5424 dnl ===================================================================
5425 dnl Check for system beanshell
5426 dnl ===================================================================
5427 if test "$with_java" != "no"; then
5428 AC_MSG_CHECKING([which beanshell to use])
5429 if test "$with_system_beanshell" = "yes"; then
5430     AC_MSG_RESULT([external])
5431     SYSTEM_BSH=YES
5432     if test -z $BSH_JAR; then
5433         BSH_JAR=/usr/share/java/bsh.jar
5434     fi
5435     AC_CHECK_FILE($BSH_JAR, [],
5436                [AC_MSG_ERROR(bsh.jar not found.)], [])
5437 else
5438     AC_MSG_RESULT([internal])
5439     SYSTEM_BSH=NO
5440     BUILD_TYPE="$BUILD_TYPE BSH"
5443 AC_SUBST(SYSTEM_BSH)
5444 AC_SUBST(BSH_JAR)
5447 dnl ===================================================================
5448 dnl Check for system saxon
5449 dnl ===================================================================
5450 if test "$with_java" != "no"; then
5451 AC_MSG_CHECKING([which saxon to use])
5452 if test "$with_system_saxon" = "yes"; then
5453     AC_MSG_RESULT([external])
5454     SYSTEM_SAXON=YES
5455     if test -z $SAXON_JAR; then
5456         AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5457             [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5458             [
5459               AC_CHECK_FILE(/usr/share/java/saxon.jar,
5460                 [ SAXON_JAR=/usr/share/java/saxon.jar ],
5461                 [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5462                     [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5463                     [ AC_MSG_ERROR(saxon.jar replacement not found)]
5464                   )
5465                 ]
5466               )
5467             ]
5468           )
5469     else
5470         AC_CHECK_FILE($SAXON_JAR, [],
5471                [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
5472     fi
5473     if test -n "$SERIALIZER_JAR"; then
5474         AC_CHECK_FILE($SERIALIZER_JAR, [],
5475                [AC_MSG_ERROR(serializer.jar not found.)], [])
5476         AC_SUBST(SERIALIZER_JAR)
5477     fi
5479     dnl Saxon comes in two practically available versions, the out-of-date saxonb which
5480     dnl supports the Java extensions that LibreOffice uses, and the up-to-date saxon he
5481     dnl "home edition" version, which is crippled to not support those Java extensions.
5482     dnl And as an aside the he one also needs to be tweaked to include
5483     dnl a META-INF/services to broadcast that it supports the jaxp transform factory
5485     AC_MSG_CHECKING([if saxon works])
5486     cat > saxontest.java <<_ACEOF
5487 [import javax.xml.transform.TransformerFactory;
5488 import javax.xml.transform.Transformer;
5489 import javax.xml.transform.stream.StreamSource;
5490 import java.io.*;
5492 import net.sf.saxon.FeatureKeys;
5494 class saxontest {
5495     public static void main(String[] args) {
5496       System.setProperty("javax.xml.transform.TransformerFactory",
5497         "net.sf.saxon.TransformerFactoryImpl");
5498       try {
5499         TransformerFactory tfactory = TransformerFactory.newInstance();
5500     // some external saxons (Debian, Ubuntu, ...) have this disabled
5501     // per default
5502     tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
5503         System.out.println("TransformerFactory is" +
5504           tfactory.getClass().getName());
5505         Transformer transformer = tfactory.newTransformer(
5506           new StreamSource(new File(args[0])));
5507       } catch(Exception e){
5508         e.printStackTrace(System.err);
5509         System.exit(-1);
5510       }
5511       System.exit(0);
5512     }
5515 _ACEOF
5517     cat > saxontest.xsl<<_ACEOF
5518 [<?xml version="1.0" encoding="UTF-8"?>
5519 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5520  <xsl:template match="/">
5521   <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
5522  </xsl:template>
5523 </xsl:stylesheet>
5525 _ACEOF
5527     javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
5528     AC_TRY_EVAL(javac_cmd)
5529     if test $? = 0 && test -f ./saxontest.class ; then
5530         java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
5531         AC_TRY_EVAL(java_cmd)
5532         if test $? = 0; then
5533             AC_MSG_RESULT([yes])
5534         else
5535             cat saxontest.java >&5
5536             AC_MSG_RESULT([no])
5537             AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
5538         fi
5539     else
5540         AC_MSG_RESULT([no])
5541         cat saxontest.java >&5
5542         AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
5543     fi
5544 else
5545     AC_MSG_RESULT([internal])
5546     SYSTEM_SAXON=NO
5547     NEED_SAXON=TRUE
5550 AC_SUBST(SYSTEM_SAXON)
5551 AC_SUBST(SAXON_JAR)
5553 if test -n "$NEED_SAXON"; then
5554     BUILD_TYPE="$BUILD_TYPE SAXON"
5557 # ===================================================================
5558 # Check whether to build stax
5559 # ===================================================================
5560 AC_MSG_CHECKING([whether building the stax is required])
5561 BUILD_STAX=NO
5562 if test -z "$SOLAR_JAVA"; then
5563     AC_MSG_RESULT([no (java disabled)])
5564 elif test "$SYSTEM_SAXON" = "YES"; then
5565     AC_MSG_RESULT([no (already provided by system saxon)])
5566 elif test -f "./stax/download/jsr173_1.0_api.jar"; then
5567     AC_MSG_RESULT([no (will use the prebuilt stax/download/jsr173_1.0_api.jar)])
5568 else
5569     BUILD_STAX=YES
5570     AC_MSG_RESULT([yes (no system saxon and no prebuilt copy)])
5572 AC_SUBST(BUILD_STAX)
5574 dnl ===================================================================
5575 dnl Check for system curl
5576 dnl ===================================================================
5577 AC_MSG_CHECKING([which libcurl to use])
5578 if test "$with_system_curl" = "yes"; then
5579     AC_MSG_RESULT([external])
5580     SYSTEM_CURL=YES
5582     curl_version=""
5583     if test "$cross_compiling" = "yes"; then
5584         dnl At least the OBS mingw32-libcurl-devel package
5585         dnl comes with a proper .pc file
5586         PKG_CHECK_MODULES(CURL, libcurl,, [:])
5587         if test -n "$CURL_PKG_ERRORS"; then
5588             AC_MSG_RESULT([no])
5589         else
5590             curl_version=`$PKG_CONFIG --modversion libcurl`
5591         fi
5592     fi
5593     if test -z "$curl_version"; then
5594         AC_PATH_PROG(CURLCONFIG, curl-config)
5595         if test -z "$CURLCONFIG"; then
5596             AC_MSG_ERROR([install the libcurl development package])
5597         fi
5598         CURL_LIBS=`$CURLCONFIG --libs`
5599         CURL_CFLAGS=`$CURLCONFIG --cflags`
5600         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
5601     fi
5603     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
5605     case $curl_version in
5606     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
5607     dnl so they need to be doubled to end up in the configure script
5608     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
5609         AC_MSG_RESULT([yes, you have $curl_version])
5610         ;;
5611     *)
5612         AC_MSG_ERROR([no, you have $curl_version])
5613         ;;
5614     esac
5616     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"
5617 else
5618     AC_MSG_RESULT([internal])
5619     SYSTEM_CURL=NO
5620     BUILD_TYPE="$BUILD_TYPE CURL"
5622 AC_SUBST(SYSTEM_CURL)
5623 AC_SUBST(CURL_CFLAGS)
5624 AC_SUBST(CURL_LIBS)
5626 dnl ===================================================================
5627 dnl Check for system boost
5628 dnl ===================================================================
5629 AC_MSG_CHECKING([which boost to use])
5630 if test "$with_system_boost" = "yes"; then
5631     AC_MSG_RESULT([external])
5632     SYSTEM_BOOST=YES
5633     AC_LANG_PUSH([C++])
5634     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
5635        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
5636     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
5637        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
5638     AC_CHECK_HEADER(boost/function.hpp, [],
5639        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
5640     AC_CHECK_HEADER([boost/unordered_map.hpp], [HAVE_BOOST_UNORDERED_MAP=TRUE],
5641                    [AC_MSG_WARN([boost/unordered_map.hpp not found])], [])
5643     save_CXXFLAGS=$CXXFLAGS
5644     CXXFLAGS="$CXXFLAGS -fno-exceptions"
5645     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
5646     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
5647 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
5649     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
5650         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
5651     else
5652         AC_MSG_RESULT([yes])
5653     fi
5654     CXXFLAGS=$save_CXXFLAGS
5655     AC_LANG_POP([C++])
5656 else
5657     AC_MSG_RESULT([internal])
5658     BUILD_TYPE="$BUILD_TYPE BOOST"
5659     SYSTEM_BOOST=NO
5660     HAVE_BOOST_UNORDERED_MAP=TRUE
5662 AC_SUBST([HAVE_BOOST_UNORDERED_MAP])
5663 AC_SUBST(SYSTEM_BOOST)
5665 dnl ===================================================================
5666 dnl Check for system mdds
5667 dnl ===================================================================
5668 AC_MSG_CHECKING([which mdds to use])
5669 if test "$with_system_mdds" = "yes"; then
5670     AC_MSG_RESULT([external])
5671     SYSTEM_MDDS=YES
5673     dnl ===================================================================
5674     dnl Determine which hash container mdds shall use
5675     dnl ===================================================================
5676     AC_MSG_CHECKING([which hash container mdds shall use])
5677     if test "x$HAVE_CXX0X" = "xTRUE"; then
5678         MDDS_CPPFLAGS="-std=c++0x"
5679         AC_MSG_RESULT([std::unordered_map])
5680     else
5681         MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5682         AC_MSG_RESULT([boost::unordered_map])
5683     fi
5685     AC_LANG_PUSH([C++])
5686     save_CPPFLAGS="$CPPFLAGS"
5687     CPPFLAGS="$CPPFLAGS $MDDS_CPPFLAGS"
5688     AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
5689         [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
5690     AC_CHECK_HEADER(mdds/mixed_type_matrix.hpp, [],
5691         [AC_MSG_ERROR(mdds/mixed_type_matrix.hpp not found. install mdds >= 0.4.0)], [])
5692     CPPFLAGS="$save_CPPFLAGS"
5693     save_CXXFLAGS="$CXXFLAGS"
5694     CXXFLAGS="$CXXFLAGS $MDDS_CPPFLAGS"
5695     AC_MSG_CHECKING([for correct signature of ::mdds::flat_segment_tree])
5696     AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <mdds/flat_segment_tree.hpp>
5698     int main(int argc, char **argv) {
5699         ::mdds::flat_segment_tree<long, short> db(0, 100, 0);
5700         short val;
5701         if (!db.search(5, val).second)
5702             return 1;
5703         return 0;
5704     }
5705 ]])],[ac_cv_cxx_mdds_flat_segment_tree_correct=yes],[ac_cv_cxx_mdds_flat_segment_tree_correct=no],[])
5707     if test "$ac_cv_cxx_mdds_flat_segment_tree_correct" = "yes"; then
5708         AC_MSG_RESULT([yes])
5709     else
5710         AC_MSG_ERROR([no, install mdds >= 0.5.0])
5711     fi
5712     CXXFLAGS=$save_CXXFLAGS
5713     AC_LANG_POP([C++])
5714 else
5715     AC_MSG_RESULT([internal])
5716     BUILD_TYPE="$BUILD_TYPE MDDS"
5717     SYSTEM_MDDS=NO
5719     dnl ===================================================================
5720     dnl Determine which hash container mdds shall use
5721     dnl ===================================================================
5722     AC_MSG_CHECKING([which hash container mdds shall use])
5723     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5724     AC_MSG_RESULT([boost::unordered_map])
5726 AC_SUBST(SYSTEM_MDDS)
5727 AC_SUBST([MDDS_CPPFLAGS])
5729 dnl ===================================================================
5730 dnl Check for system vigra
5731 dnl ===================================================================
5732 AC_MSG_CHECKING([which vigra to use])
5733 if test "$with_system_vigra" = "yes"; then
5734     AC_MSG_RESULT([external])
5735     SYSTEM_VIGRA=YES
5736     AC_LANG_PUSH([C++])
5737     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
5738        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
5739     AC_LANG_POP([C++])
5740 else
5741     AC_MSG_RESULT([internal])
5742     BUILD_TYPE="$BUILD_TYPE VIGRA"
5743     SYSTEM_VIGRA=NO
5745 AC_SUBST(SYSTEM_VIGRA)
5747 dnl ===================================================================
5748 dnl Check for system odbc
5749 dnl ===================================================================
5750 AC_MSG_CHECKING([which odbc headers to use])
5751 if test "$with_system_odbc" = "yes"; then
5752     AC_MSG_RESULT([external])
5753     SYSTEM_ODBC_HEADERS=YES
5755     AC_CHECK_HEADER(sqlext.h, [],
5756       [AC_MSG_ERROR(odbc not found. install odbc)], [])
5757 else
5758     AC_MSG_RESULT([internal])
5759     SYSTEM_ODBC_HEADERS=NO
5760     BUILD_TYPE="$BUILD_TYPE UNIXODBC"
5762 AC_SUBST(SYSTEM_ODBC_HEADERS)
5764 AC_MSG_CHECKING([whether to enable build of Mozilla])
5765 if test "$enable_mozilla" = "no"; then
5766     AC_MSG_RESULT([no])
5767     WITH_MOZILLA=NO
5768 else
5769     AC_MSG_RESULT([yes])
5770     WITH_MOZILLA=YES
5772 AC_SUBST(WITH_MOZILLA)
5774 AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
5775 if test "$enable_mozilla" = "no"; then
5776     AC_MSG_RESULT([no])
5777 elif test "$with_system_mozilla" = "yes"; then
5778     AC_MSG_RESULT([no, not possible with system-mozilla])
5779 else
5780     AC_MSG_RESULT([yes])
5783 AC_MSG_CHECKING([whether to build XML Security support])
5784 if test "$enable_xmlsec" = "no"; then
5785     AC_MSG_RESULT([no])
5786     ENABLE_XMLSEC=
5787 else
5788     ENABLE_XMLSEC="YES"
5789     BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
5790     AC_MSG_RESULT([yes])
5792 AC_SUBST(ENABLE_XMLSEC)
5794 AC_MSG_CHECKING([whether to build LDAP configuration backend])
5795 if test "$enable_ldap" != "no"; then
5796     WITH_OPENLDAP=NO
5797     WITH_LDAP=NO
5798     if test "$with_openldap" = "yes"; then
5799         WITH_LDAP=YES
5800         AC_MSG_RESULT([OpenLDAP])
5801         WITH_OPENLDAP=YES
5802         AC_CHECK_HEADERS(ldap.h, [],
5803             [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
5804         AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
5805             [AC_MSG_ERROR(openldap lib not found or functional)], [])
5806         AC_CHECK_LIB(ldap, ldap_set_option, [],
5807             [AC_MSG_ERROR(openldap lib not found or functional)], [])
5808     elif test "$enable_mozilla" != "no"; then
5809         AC_MSG_RESULT([Mozilla])
5810         WITH_LDAP=YES
5811         WITH_OPENLDAP=NO
5812     else
5813         AC_MSG_RESULT([no. Either Mozilla or OpenLDAP required])
5814     fi
5815 else
5816     AC_MSG_RESULT([no])
5817     WITH_LDAP=NO
5819 AC_SUBST(WITH_LDAP)
5820 AC_SUBST(WITH_OPENLDAP)
5822 dnl ===================================================================
5823 dnl Check for system mozilla
5824 dnl ===================================================================
5825 AC_MSG_CHECKING([which Mozilla to use])
5826 if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
5827     AC_MSG_RESULT([external])
5828     SYSTEM_MOZILLA=YES
5829     AC_MSG_CHECKING([which Mozilla flavour to use])
5830     if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
5831         MOZ_FLAVOUR=libxul
5832     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
5833         MOZ_FLAVOUR=xulrunner
5834     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
5835         MOZ_FLAVOUR=seamonkey
5836     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
5837         MOZ_FLAVOUR=firefox
5838     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
5839         MOZ_FLAVOUR=mozilla
5840     else
5841         MOZ_FLAVOUR=libxul
5842     fi
5843     tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
5844     AC_MSG_RESULT($tmp)
5846     if test "$MOZ_FLAVOUR" != "libxul"; then
5847         PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
5848         MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
5849         MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
5850     fi
5852     if test -z "$HASXPCOM"; then
5853         PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
5854         MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
5855         MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
5856         if ! test -e "$MOZ_LIB/libxul.so"; then
5857             MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
5858             if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
5859                 MOZ_LIB="$MOZ_LIB/sdk/lib"
5860             fi
5861         fi
5862     fi
5864     MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
5865     if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
5866         AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
5867         if test -d "$MOZ_INC/ldap"; then
5868             AC_MSG_RESULT([yes])
5869             MOZ_LDAP_CFLAGS="-I$MOZ_INC"
5870         else
5871             AC_MSG_ERROR([no.
5872 Could not find LDAP header include files in $MOZ_INC/ldap.
5873 Please recompile $tmp with --enable-ldap or use --with-openldap.])
5874         fi
5875     fi
5877     #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
5878     #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
5879     if test "$MOZ_FLAVOUR" = "libxul"; then
5880         MOZ_FLAVOUR="mozilla"
5881     fi
5883 elif test "$enable_mozilla" = "no"; then
5884     AC_MSG_RESULT([none])
5885     WITH_MOZILLA=NO
5886 else
5887     AC_MSG_RESULT([internal])
5888     SYSTEM_MOZILLA=NO
5889     BUILD_TYPE="$BUILD_TYPE MOZ"
5890 if test -z "$with_mozilla_version"; then
5891     MOZILLA_VERSION=
5892 else
5893     AC_MSG_CHECKING([which Mozilla version to build])
5894     MOZILLA_VERSION=$with_mozilla_version
5895     enable_build_mozilla=1
5896     AC_MSG_RESULT([$MOZILLA_VERSION])
5899 AC_SUBST(MOZILLA_VERSION)
5901 AC_MSG_CHECKING([for toolkit Mozilla should use])
5902 if test -z "$with_mozilla_toolkit"; then
5903     if test "$_os" != "WINNT" ; then
5904         if test "$_os" = "Darwin" ; then
5905             MOZILLA_TOOLKIT=mac
5906             AC_MSG_RESULT([mac])
5907         else
5908             MOZILLA_TOOLKIT=gtk2
5909             AC_MSG_RESULT([gtk2])
5910         fi
5911     fi
5912 else
5913     MOZILLA_TOOLKIT=$with_mozilla_toolkit
5914     enable_build_mozilla=1
5915     AC_MSG_RESULT([$MOZILLA_TOOLKIT])
5918 AC_SUBST(MOZILLA_TOOLKIT)
5920 # default to enabling build mozilla
5921 if test "$enable_build_mozilla" != "no"; then
5922     enable_build_mozilla=yes
5923 else
5924     enable_build_mozilla=
5927 AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
5928 if test -n "$enable_build_mozilla"; then
5929     BUILD_MOZAB="TRUE"
5930     AC_MSG_RESULT([yes])
5931 else
5932     BUILD_MOZAB=""
5933     AC_MSG_RESULT([no])
5936 if test "$BUILD_MOZAB" = "TRUE"; then
5937     if test "$_os" = "WINNT"; then
5938         if test "$WITH_MINGW" != "yes"; then
5939             # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
5940             if test "$MSVSVER" != "2005"; then
5941                 AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio 2005 only.])
5942             fi
5943         else
5944             AC_MSG_WARN([Building SeaMonkey with MinGW is not tested, and likely to break.])
5945             echo "Building SeaMonkey with MinGW is not tested, and likely to break." >> warn
5946         fi
5947     fi
5949     if test -z "$MOZILLA_VERSION"; then
5950         MOZILLA_VERSION=1.1.14
5951     fi
5952     MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
5953     MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst.in`
5954     AC_MSG_CHECKING([for Mozilla sources])
5955     if test -z "$MOZILLA_FETCH_FILE"; then
5956         AC_MSG_RESULT([not found])
5957         HAVE_MOZILLA_TARBALL=n
5958     else
5959         AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
5960         if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
5961             if test -z "$DO_FETCH"; then
5962                 AC_MSG_RESULT([will be fetched])
5963                 HAVE_MOZILLA_TARBALL=y
5964             else
5965                 AC_MSG_RESULT([not found])
5966                 HAVE_MOZILLA_TARBALL=n
5967             fi
5968         else
5969             AC_MSG_RESULT([found])
5970             HAVE_MOZILLA_TARBALL=y
5971         fi
5972     fi
5973     if test "$HAVE_MOZILLA_TARBALL" != "y"; then
5974         AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
5975 Use "./download" to download.])
5976     fi
5977     if test "$_os" = "WINNT"; then
5978         AC_MSG_CHECKING([for moztools binaries])
5979         if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
5980             AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
5981 (from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
5982         else
5983             AC_MSG_RESULT([ok])
5984         fi
5985     elif test "$_os" = "Darwin"; then
5986         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
5987         if test -z "$MOZIDL"; then
5988             AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build Mozilla with Mac toolkit.])
5989         fi
5990     else
5991         # Generic Unix/Linux section
5992         if test "$MOZILLA_TOOLKIT" = "gtk2"; then
5993             PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
5994             if test -z "$MOZGTK"; then
5995                 AC_MSG_ERROR([GTK2 is needed to build Mozilla.])
5996             fi
5997             PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
5998             if test -z "$MOZIDL"; then
5999                 AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build Mozilla.])
6000             fi
6001         else
6002             PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
6003             if test -z "$MOZGTK"; then
6004                 AC_MSG_ERROR([GTK+ 1.2 is needed when not using GTK2 to build Mozilla.])
6005             fi
6006             PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
6007             if test -z "$MOZIDL"; then
6008                 AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build Mozilla.])
6009             fi
6010         fi
6011     fi
6014 AC_SUBST(BUILD_MOZAB)
6017 AC_SUBST(MOZILLABUILD)
6018 AC_SUBST(SYSTEM_MOZILLA)
6019 AC_SUBST(MOZ_FLAVOUR)
6020 AC_SUBST(MOZ_INC)
6021 AC_SUBST(MOZ_LIB)
6022 AC_SUBST(MOZ_LIB_XPCOM)
6023 AC_SUBST(MOZ_LDAP_CFLAGS)
6025 dnl ===================================================================
6026 dnl Check for system NSS only with xmlsec or mozilla build enabled
6027 dnl ===================================================================
6028 if test "x$enable_xmlsec" != "xno" -o "x$enable_mozilla" != "xno"; then
6029 AC_MSG_CHECKING([which NSS to use])
6030 if test "$with_system_nss" = "yes"; then
6031     AC_MSG_RESULT([external])
6032     SYSTEM_NSS="YES"
6033     PKG_CHECK_MODULES(NSS, nss >= 3.9.3 nspr >= 4.8)
6034 else
6035     SYSTEM_NSS="NO"
6036     BUILD_TYPE="$BUILD_TYPE NSS"
6037     AC_MSG_RESULT([internal])
6038     if test "$build_os" = "cygwin"; then
6039         AC_MSG_CHECKING([for Mozilla build tooling])
6040         if test -z "$MOZILLABUILD" ; then
6041             AC_MSG_ERROR([Mozilla build tooling not found.
6042 Use the --with-mozilla-build option after installing the tools obtained
6043 from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
6044         else
6045             if test \( "$WITH_MINGW" = "yes" \) ; then
6046                 if test ! -d "$MOZILLABUILD" ; then
6047                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
6048                 else
6049                     AC_MSG_RESULT([ok])
6050                 fi
6051             else
6052                 if test ! -d "$MOZILLABUILD/moztools" \
6053                         -o ! -d "$MOZILLABUILD/msys" ; then
6054                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
6055                 else
6056                     AC_MSG_RESULT([ok])
6057                 fi
6058             fi
6059         fi
6060     fi
6061 fi # system nss
6062 fi # enable xmlsec || enable mozilla
6063 AC_SUBST(SYSTEM_NSS)
6064 AC_SUBST(NSS_CFLAGS)
6065 AC_SUBST(NSS_LIBS)
6067 dnl ===================================================================
6068 dnl Check for system mozilla headers
6069 dnl ===================================================================
6070 AC_MSG_CHECKING([which mozilla headers to use])
6071 if test "$with_system_mozilla_headers" = "yes"; then
6072     AC_MSG_RESULT([external])
6073     SYSTEM_MOZILLA_HEADERS=YES
6074     # First try npapi-sdk:
6075     PKG_CHECK_MODULES(MOZILLA_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
6076     # Then go with libxul:
6077     if test "x$LOCATED" != "xyes"; then
6078         PKG_CHECK_MODULES(MOZILLA_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
6079     fi
6080     # if still not found bail out
6081     if test "x$LOCATED" != "xyes"; then
6082         AC_MSG_ERROR([npapi.h header file not found])
6083     fi
6084 else
6085     AC_MSG_RESULT([internal])
6086     SYSTEM_MOZILLA_HEADERS=NO
6088 AC_SUBST(MOZILLA_HEADERS_CFLAGS)
6089 AC_SUBST(SYSTEM_MOZILLA_HEADERS)
6091 dnl ===================================================================
6092 dnl Check for system sane
6093 dnl ===================================================================
6094 AC_MSG_CHECKING([which sane header to use])
6095 if test "$with_system_sane" = "yes"; then
6096     AC_MSG_RESULT([external])
6097     SYSTEM_SANE_HEADER=YES
6098     AC_CHECK_HEADER(sane/sane.h, [],
6099       [AC_MSG_ERROR(sane not found. install sane)], [])
6100 else
6101     AC_MSG_RESULT([internal])
6102     SYSTEM_SANE_HEADER=NO
6103     BUILD_TYPE="$BUILD_TYPE SANE"
6105 AC_SUBST(SYSTEM_SANE_HEADER)
6107 dnl ===================================================================
6108 dnl Check for system icu
6109 dnl ===================================================================
6110 SYSTEM_GENBRK=
6111 SYSTEM_GENCCODE=
6112 SYSTEM_GENCMN=
6113 ICU_MAJOR=
6114 ICU_MINOR=
6115 ICU_MICRO=
6116 ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
6117 AC_MSG_CHECKING([which icu to use])
6118 if test "$with_system_icu" = "yes"; then
6119     AC_MSG_RESULT([external])
6120     SYSTEM_ICU=YES
6121     AC_LANG_PUSH([C++])
6122     AC_MSG_CHECKING([for unicode/rbbi.h])
6123     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
6124     AC_LANG_POP([C++])
6126     ICUPATH="$PATH"
6127     if test "$WITH_MINGW" = "yes" ; then
6128         ICUPATH="/usr/i686-w64-mingw32/sys-root/mingw/bin:$ICUPATH"
6129     fi
6130     AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
6132     AC_MSG_CHECKING([ICU version])
6133     ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
6134     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
6135     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
6136     ICU_MICRO=`echo $ICU_VERSION | cut -d"." -f3`
6138     if test "$ICU_MAJOR" -ge "4"; then
6139         AC_MSG_RESULT([OK, $ICU_VERSION])
6140     else
6141         AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
6142     fi
6144     if test "$cross_compiling" != "yes"; then
6145         # using the system icu tools can lead to version confusion, use the
6146         # ones from the build environment when cross-compiling
6147         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
6148         if test -z "$SYSTEM_GENBRK"; then
6149             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
6150         fi
6151         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6152         if test -z "$SYSTEM_GENCCODE"; then
6153             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
6154         fi
6155         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6156         if test -z "$SYSTEM_GENCMN"; then
6157             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
6158         fi
6159         if test "$ICU_MAJOR" -ge "5" -o "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4"; then
6160             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6161         fi
6162     fi
6164     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS icui18n$ICU_MAJOR$ICU_MINOR.dll icuuc$ICU_MAJOR$ICU_MINOR.dll icudata$ICU_MAJOR$ICU_MINOR.dll"
6165 else
6166     AC_MSG_RESULT([internal])
6167     SYSTEM_ICU="NO"
6168     ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6169     BUILD_TYPE="$BUILD_TYPE ICU"
6171 AC_SUBST(SYSTEM_ICU)
6172 AC_SUBST(SYSTEM_GENBRK)
6173 AC_SUBST(SYSTEM_GENCCODE)
6174 AC_SUBST(SYSTEM_GENCMN)
6175 AC_SUBST(ICU_MAJOR)
6176 AC_SUBST(ICU_MINOR)
6177 AC_SUBST(ICU_MICRO)
6178 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
6180 dnl ===================================================================
6181 dnl Graphite
6182 dnl ===================================================================
6184 AC_MSG_CHECKING([whether to enable graphite support])
6185 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
6186     AC_MSG_RESULT([yes])
6187     ENABLE_GRAPHITE="TRUE"
6188     AC_MSG_CHECKING([which graphite to use])
6189     if test "$with_system_graphite" = "yes"; then
6190         AC_MSG_RESULT([external])
6191         SYSTEM_GRAPHITE=YES
6192         PKG_CHECK_MODULES( GRAPHITE, graphite2 >= 0.9.3 )
6193         MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libgraphite2.dll"
6194     else
6195         AC_MSG_RESULT([internal])
6196         SYSTEM_GRAPHITE=NO
6197         BUILD_TYPE="$BUILD_TYPE GRAPHITE"
6198     fi
6199 else
6200     AC_MSG_RESULT([no])
6202 AC_SUBST(ENABLE_GRAPHITE)
6203 AC_SUBST(SYSTEM_GRAPHITE)
6204 AC_SUBST(GRAPHITE_LIBS)
6205 AC_SUBST(GRAPHITE_CFLAGS)
6207 dnl ===================================================================
6208 dnl Checks for libraries.
6209 dnl ===================================================================
6210 dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
6211 dnl See if we have the AppKit framework for building with Quartz graphics.
6213 if test  "$_os" = "Darwin"; then
6214     if test "x$with_x" = "xyes"; then
6215         AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
6216     else
6217         AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
6218         if test -d "/System/Library/Frameworks/AppKit.framework/"; then
6219             AC_MSG_RESULT([yes])
6220             x_includes="no_x_includes"
6221             x_libraries="no_x_libraries"
6222             dnl disable some things used on other Unix versions but not on the aqua build
6223             enable_gtk=no
6224         else
6225             AC_MSG_ERROR([No AppKit.framewrok found])
6226         fi
6227     fi
6230 if test $_os = iOS -o $_os = Android; then
6231     enable_gtk=no
6234 dnl ===================================================================
6235 dnl Check for nsplugin
6236 dnl ===================================================================
6237 AC_MSG_CHECKING([wether to build nsplugin extension])
6238 ENABLE_NSPLUGIN=NO
6239 if test "$enable_nsplugin" != "no"; then
6240     if test "$enable_gtk" != "no"; then
6241         AC_MSG_RESULT([yes])
6242         ENABLE_NSPLUGIN=YES
6243     else
6244         AC_MSG_RESULT([no, disabled gtk2])
6245     fi
6246 else
6247     AC_MSG_RESULT([no])
6249 AC_SUBST(ENABLE_NSPLUGIN)
6251 dnl ***************************************
6252 dnl testing for X libraries and includes...
6253 dnl ***************************************
6254 if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
6255     dnl Mac OS X using Aqua graphics. Don't check for X11.
6256     :
6257 elif test "$_os" != "WINNT" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6258     AC_PATH_X
6259     AC_PATH_XTRA
6260     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
6262     if test "x$x_includes" = "x"; then
6263         x_includes="default_x_includes"
6264     fi
6265     if test "x$x_libraries" = "x"; then
6266         x_libraries="default_x_libraries"
6267     fi
6268     dnl The variables $x_libraries and $x_includes are set.
6269     if test -z "$x_libraries"; then
6270         AC_MSG_ERROR([No X libraries found]) # Exit
6271     fi
6272     if test -z "$x_includes"; then
6273         AC_MSG_ERROR([No X includes found]) # Exit
6274     fi
6275     CFLAGS="$CFLAGS $X_CFLAGS"
6276     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
6277     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
6278     dnl Check if the XauDisposeAuth symbol is provided by libXau.
6279     AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
6280 else
6281     x_includes="no_x_includes"
6282     x_libraries="no_x_libraries"
6284 if test -z "$x_includes"; then
6285     x_includes="no_x_includes"
6287 if test -z "$x_libraries"; then
6288     x_libraries="no_x_libraries"
6290 if test "$x_includes" = "default_x_includes"; then
6291     XINC="/usr/include"
6292 else
6293     XINC="$x_includes"
6295 AC_SUBST(XINC)
6296 if test "$x_libraries" = "default_x_libraries"; then
6297     XLIB=`$PKG_CONFIG --variable=libdir x11`
6298     if test "x$XLIB" = x; then
6299         XLIB="/usr/lib"
6300     fi
6301 else
6302     XLIB="$x_libraries"
6304 AC_SUBST(XLIB)
6305 AC_SUBST(XAU_LIBS)
6307 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6308     dnl ===================================================================
6309     dnl Check for Composite.h for Mozilla plugin
6310     dnl ===================================================================
6311     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
6312      [#include <X11/Intrinsic.h>])
6315 AC_MSG_CHECKING([whether to use internal X11 extensions headers])
6316 if test "$with_system_xextensions_headers" != "no"; then
6317     AC_MSG_RESULT([no])
6318 else
6319     AC_MSG_RESULT([yes])
6320     BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
6323 dnl ===================================================================
6324 dnl Check for system Xrender
6325 dnl ===================================================================
6326 AC_MSG_CHECKING([whether to use Xrender])
6327 if test "$test_xrender" = "yes"; then
6328     AC_MSG_RESULT([yes])
6329     AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
6330       [AC_MSG_ERROR(libXrender not found or functional)], [])
6331     AC_MSG_CHECKING([which Xrender headers to use])
6332     if test "$with_system_xextensions_headers" != "no"; then
6333         AC_MSG_RESULT([external])
6334         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
6335           [AC_MSG_ERROR(Xrender not found. install X)], [])
6336     else
6337         AC_MSG_RESULT([internal])
6338     fi
6341 dnl ===================================================================
6342 dnl Check for XRandr
6343 dnl ===================================================================
6344 AC_MSG_CHECKING([whether to enable RandR support])
6345 if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
6346     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
6347         XRANDR_DLOPEN="TRUE"
6348         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
6349     else
6350         AC_MSG_RESULT([yes])
6351         XRANDR_DLOPEN="FALSE"
6352         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
6353         if test "$ENABLE_RANDR" != "TRUE"; then
6354             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
6355                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
6356             XRANDR_CFLAGS=" "
6357             AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
6358               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
6359             XRANDR_LIBS="-lXrandr "
6360             ENABLE_RANDR="TRUE"
6361         fi
6362     fi
6363 else
6364     ENABLE_RANDR=""
6365     AC_MSG_RESULT([no])
6367 AC_SUBST(XRANDR_DLOPEN)
6368 AC_SUBST(XRANDR_CFLAGS)
6369 AC_SUBST(XRANDR_LIBS)
6370 AC_SUBST(ENABLE_RANDR)
6372 dnl ===================================================================
6373 dnl Check for building neon
6374 dnl ===================================================================
6375 AC_MSG_CHECKING([whether to use neon])
6376 if test "$enable_neon" = "no"; then
6377     AC_MSG_RESULT([no])
6378     DISABLE_NEON=TRUE
6379     AC_SUBST(DISABLE_NEON)
6380 else
6381     AC_MSG_RESULT([yes])
6382 dnl ===================================================================
6383 dnl Check for system neon
6384 dnl ===================================================================
6385 AC_MSG_CHECKING([which neon to use])
6386 if test "$with_system_neon" = "yes"; then
6387     AC_MSG_RESULT([external])
6388     PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
6389     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
6390     NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
6391     SYSTEM_NEON=YES
6392     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libtasn1-3.dll libgnutls-26.dll libneon-27.dll"
6393 else
6394     AC_MSG_RESULT([internal])
6395     SYSTEM_NEON=NO
6396     NEON_LIBS=-lneon
6397     NEON_CFLAGS=
6398     BUILD_TYPE="$BUILD_TYPE NEON"
6400 AC_SUBST(SYSTEM_NEON)
6401 AC_SUBST(NEON_VERSION)
6402 AC_SUBST(NEON_LIBS)
6403 AC_SUBST(NEON_CFLAGS)
6406 dnl ===================================================================
6407 dnl Check for system openssl
6408 dnl ===================================================================
6409 if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6410         "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
6411     with_system_openssl=yes
6413 AC_MSG_CHECKING([which libssl to use])
6414 if test "$with_system_openssl" = "yes"; then
6415     AC_MSG_RESULT([external])
6416     # Mac OS builds should get out without extra stuff is the Mac porters'
6417     # wish. And pkg-config is although Xcode ships a .pc for openssl
6418     if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6419             "$_os" = "DragonFly"; then
6420         OPENSSL_CFLAGS=
6421         OPENSSL_LIBS="-lssl -lcrypto"
6422     else
6423         PKG_CHECK_MODULES( OPENSSL, openssl )
6424     fi
6425     SYSTEM_OPENSSL=YES
6426     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libssl-8.dll libcrypto-8.dll"
6427 else
6428     AC_MSG_RESULT([internal])
6429     SYSTEM_OPENSSL=NO
6430     BUILD_TYPE="$BUILD_TYPE OPENSSL"
6432 AC_SUBST(SYSTEM_OPENSSL)
6433 AC_SUBST(OPENSSL_CFLAGS)
6434 AC_SUBST(OPENSSL_LIBS)
6436 dnl ===================================================================
6437 dnl Check for system redland
6438 dnl ===================================================================
6439 AC_MSG_CHECKING([which redland library to use])
6440 if test "$with_system_redland" = "yes"; then
6441     AC_MSG_RESULT([external])
6442     SYSTEM_REDLAND=YES
6443     dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
6444     PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
6445     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libraptor-1.dll librasqal-2.dll libsqlite3-0.dll librdf-0.dll"
6446 else
6447     AC_MSG_RESULT([internal])
6448     BUILD_TYPE="$BUILD_TYPE REDLAND"
6449     SYSTEM_REDLAND=NO
6451 AC_SUBST(SYSTEM_REDLAND)
6452 AC_SUBST(REDLAND_CFLAGS)
6453 AC_SUBST(REDLAND_LIBS)
6455 dnl ===================================================================
6456 dnl Check for system hunspell
6457 dnl ===================================================================
6458 AC_MSG_CHECKING([which libhunspell to use])
6459 if test "$with_system_hunspell" = "yes"; then
6460     AC_MSG_RESULT([external])
6461     SYSTEM_HUNSPELL=YES
6462     AC_LANG_PUSH([C++])
6463     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
6464     if test "$HUNSPELL_PC" != "TRUE"; then
6465         AC_CHECK_HEADER(hunspell.hxx, [],
6466             [
6467             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
6468             [AC_MSG_ERROR(hunspell headers not found.)], [])
6469             ], [])
6470         AC_CHECK_LIB(hunspell, main, [],
6471            [ AC_MSG_ERROR(hunspell library not found.) ], [])
6472         HUNSPELL_LIBS=-lhunspell
6473     fi
6474     AC_LANG_POP([C++])
6475     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhunspell-1.3-0.dll"
6476 else
6477     AC_MSG_RESULT([internal])
6478     SYSTEM_HUNSPELL=NO
6479     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
6481 AC_SUBST(SYSTEM_HUNSPELL)
6482 AC_SUBST(HUNSPELL_CFLAGS)
6483 AC_SUBST(HUNSPELL_LIBS)
6485 dnl ===================================================================
6486 dnl Checking for altlinuxhyph
6487 dnl ===================================================================
6488 AC_MSG_CHECKING([which altlinuxhyph to use])
6489 if test "$with_system_altlinuxhyph" = "yes"; then
6490     AC_MSG_RESULT([external])
6491     SYSTEM_HYPH=YES
6492     AC_CHECK_HEADER(hyphen.h, [],
6493        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
6494     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
6495        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
6496        [#include <hyphen.h>])
6497     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
6498         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6499     if test -z "$HYPHEN_LIB"; then
6500         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
6501            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6502     fi
6503     if test -z "$HYPHEN_LIB"; then
6504         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
6505            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6506     fi
6507     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhyphen-0.dll"
6508 else
6509     AC_MSG_RESULT([internal])
6510     SYSTEM_HYPH=NO
6511     BUILD_TYPE="$BUILD_TYPE HYPHEN"
6513 AC_SUBST(SYSTEM_HYPH)
6514 AC_SUBST(HYPHEN_LIB)
6516 dnl ===================================================================
6517 dnl Checking for mythes
6518 dnl ===================================================================
6519 AC_MSG_CHECKING([which mythes to use])
6520 if test "$with_system_mythes" = "yes"; then
6521     AC_MSG_RESULT([external])
6522     SYSTEM_MYTHES=YES
6523     AC_LANG_PUSH([C++])
6524     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
6525     if test "$MYTHES_PKGCONFIG" = "no"; then
6526         AC_CHECK_HEADER(mythes.hxx, [],
6527             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
6528         AC_CHECK_LIB(mythes-1.2, main, [],
6529             [ MYTHES_FOUND=no], [])
6530     if test "$MYTHES_FOUND" = "no"; then
6531         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
6532                 [ MYTHES_FOUND=no], [])
6533     fi
6534     if test "$MYTHES_FOUND" = "no"; then
6535         AC_MSG_ERROR([mythes library not found!.])
6536     fi
6537     fi
6538     AC_LANG_POP([C++])
6539     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libmythes-1.2-0.dll"
6540 else
6541     AC_MSG_RESULT([internal])
6542     SYSTEM_MYTHES=NO
6543     BUILD_TYPE="$BUILD_TYPE MYTHES"
6545 AC_SUBST(SYSTEM_MYTHES)
6546 AC_SUBST(MYTHES_CFLAGS)
6547 AC_SUBST(MYTHES_LIBS)
6549 dnl ===================================================================
6550 dnl Checking for lpsolve
6551 dnl ===================================================================
6552 AC_MSG_CHECKING([which lpsolve to use])
6553 if test "$with_system_lpsolve" = "yes"; then
6554     AC_MSG_RESULT([external])
6555     SYSTEM_LPSOLVE=YES
6556     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
6557        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
6558     # some systems need this. Like Ubuntu....
6559     AC_CHECK_LIB(m, floor)
6560     AC_CHECK_LIB(dl, dlopen)
6561     AC_CHECK_LIB(lpsolve55, make_lp, ,
6562         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
6563     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS lpsolve55.dll"
6564 else
6565     AC_MSG_RESULT([internal])
6566     SYSTEM_LPSOLVE=NO
6567     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
6569 AC_SUBST(SYSTEM_LPSOLVE)
6571 dnl ===================================================================
6572 dnl Checking for libexttextcat
6573 dnl ===================================================================
6574 AC_MSG_CHECKING([which libexttextcat to use])
6575 if test "$with_system_libexttextcat" = "yes"; then
6576     AC_MSG_RESULT([external])
6577     SYSTEM_LIBEXTTEXTCAT=YES
6578     PKG_CHECK_MODULES([LIBEXTTEXTCAT], [libexttextcat >= 3.1.1])
6579     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
6580 else
6581     AC_MSG_RESULT([internal])
6582     SYSTEM_LIBEXTTEXTCAT=NO
6583     BUILD_TYPE="$BUILD_TYPE LIBEXTTEXTCAT"
6585 AC_SUBST(SYSTEM_LIBEXTTEXTCAT)
6586 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
6587 AC_SUBST(LIBEXTTEXTCAT_CFLAGS)
6588 AC_SUBST(LIBEXTTEXTCAT_LIBS)
6590 dnl ***************************************
6591 dnl testing libc version for Linux...
6592 dnl ***************************************
6593 if test "$_os" = "Linux"; then
6594     AC_MSG_CHECKING([whether libc is >= 2.1.1])
6595     exec 6>/dev/null # no output
6596     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
6597     exec 6>&1 # output on again
6598     if test "$HAVE_LIBC"; then
6599         AC_MSG_RESULT([yes])
6600     else
6601         AC_MSG_ERROR([no, upgrade libc])
6602     fi
6605 if test "$_os" != "WINNT"; then
6606     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
6607     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
6608     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
6609         SYSTEM_LIBC=YES
6610     fi
6611 else
6612     HAVE_GETOPT=NO
6613     HAVE_READDIR_R=NO
6614     SYSTEM_LIBC=YES
6616 AC_SUBST(HAVE_GETOPT)
6617 AC_SUBST(HAVE_READDIR_R)
6618 AC_SUBST(SYSTEM_LIBC)
6620 dnl =========================================
6621 dnl Check for the Windows  SDK.
6622 dnl =========================================
6623 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
6624 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
6625 if test "$_os" = "WINNT"; then
6626     AC_MSG_CHECKING([for Windows SDK])
6627     if test "$build_os" = "cygwin"; then
6628         if test -z "$with_windows_sdk_home"; then
6629             # This first line will detect a February 2003 Microsoft Platform SDK
6630             WINDOWS_SDK_HOME=`./oowintool --windows-sdk-home`
6631             # But there might be also an April 2005 PSDK, unfortunately MS changed
6632             # the registry entry. (we prefer the old version!?)
6633             if test -z "$WINDOWS_SDK_HOME"; then
6634                 WINDOWS_SDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
6635             fi
6636             # normalize if found
6637             if test -n "$WINDOWS_SDK_HOME"; then
6638                 WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6639                 WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6640             fi
6641         else
6642             WINDOWS_SDK_HOME=`cygpath -u "$with_windows_sdk_home"`
6643         fi
6644     fi
6645     if test -n "$WINDOWS_SDK_HOME"; then
6646         # Remove a possible trailing backslash
6647         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6648         # Problem with current PSDK (iz 49865)
6649         # (What "current" does that mean?)
6650         if test -f "$WINDOWS_SDK_HOME/Lib/libcp.lib"; then
6651             AC_MSG_ERROR([
6652 Some modules do not build correctly with MS Platform SDK - April 2005
6653 Edition if the library ($WINDOWS_SDK_HOME/Lib/libcp.lib) is found.
6654 Remove/rename/backup that file and restart configure. Details about this
6655 problem can be found in issue 49856.])
6656         fi
6658         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6659              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6660              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6661             HAVE_PSDK_H="yes"
6662         else
6663             HAVE_PSDK_H="no"
6664         fi
6665         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6666             HAVE_PSDK_LIB="yes"
6667         else
6668             HAVE_PSDK_LIB="no"
6669         fi
6671         if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
6672             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6673 the  Windows SDK are installed.])
6674         fi
6676         if test ! -x "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
6677              -o ! -x "$WINDOWS_SDK_HOME/bin/msidb.exe" \
6678              -o ! -x "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
6679              -o ! -x "$WINDOWS_SDK_HOME/bin/msitran.exe" ; then
6680             AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
6681         fi
6682     fi
6684     if test -z "$WINDOWS_SDK_HOME"; then
6685         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6686     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
6687         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
6688     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
6689         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
6690     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
6691         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
6692     else
6693         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6694     fi
6696 AC_SUBST(WINDOWS_SDK_HOME)
6698 dnl =========================================
6699 dnl Check for the Microsoft DirectX SDK.
6700 dnl =========================================
6701 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
6702     AC_MSG_CHECKING([for DirectX SDK])
6703     if test "$build_os" = "cygwin"; then
6704         if test -z "$with_directx_home"; then
6705             dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
6706             if test -n "$DXSDK_DIR"; then
6707                 DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
6708                 DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
6709             fi
6710             # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
6711             # the "DirectX SDK not found" error later
6712         else
6713             DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
6714         fi
6715         # Remove a possible trailing backslash
6716         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
6717     elif test -n "$with_directx_home"; then
6718         DIRECTXSDK_HOME="$with_directx_home"
6719     fi
6721     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
6722         HAVE_DIRECTXSDK_H="yes"
6723     else
6724         HAVE_DIRECTXSDK_H="no"
6725     fi
6727     # MS changed the location of the libraries with Dec 2004 DirectX SDK
6728     if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
6729         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
6730     else
6731         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
6732     fi
6734     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
6735         HAVE_DIRECTXSDK_LIB="yes"
6736     else
6737         HAVE_DIRECTXSDK_LIB="no"
6738     fi
6740     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
6741         AC_MSG_RESULT([found])
6742     else
6743         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6744     fi
6746 AC_SUBST(DIRECTXSDK_HOME)
6747 AC_SUBST(DIRECTXSDK_LIB)
6749 dnl ============================================
6750 dnl Check for Nullsoft Scriptable Install System
6751 dnl ============================================
6752 NSIS_PATH=""
6753 if test "$_os" = "WINNT" ; then
6754     if test -z "$with_nsis_path"; then
6755         AC_PATH_PROG(NSIS_PATH, makensis)
6756         if test -n "$NSIS_PATH"; then
6757             NSIS_PATH=`dirname "$NSIS_PATH"`
6758         elif test "$build_os" = "cygwin"; then
6759             AC_MSG_CHECKING([for NSIS])
6760             nsistest=`./oowintool --nsis-dir`;
6761             nsistest=`cygpath -d -m "$nsistest"`
6762             nsistest=`cygpath -u "$nsistest"`
6763             if test -x "$nsistest/nsis.exe"; then
6764                 NSIS_PATH="$nsistest"
6765                 AC_MSG_RESULT([found ($NSIS_PATH)])
6766             else
6767                 AC_MSG_RESULT([no, no self-contained installer will be built.])
6768             fi
6769         fi
6770     else
6771         AC_MSG_CHECKING([for NSIS])
6772         if test "$build_os" = "cygwin"; then
6773             with_nsis_path=`cygpath -u "$with_nsis_path"`
6774         fi
6775         if test -e "$with_nsis_path/makensis$EXEEXT_FOR_BUILD"; then
6776             NSIS_PATH="$with_nsis_path"
6777         fi
6778         if test -z "$NSIS_PATH"; then
6779             AC_MSG_RESULT([no, no self-contained installer will be built.])
6780         else
6781             if test "$build_os" = "cygwin"; then
6782                 NSIS_PATH=`cygpath -d "$NSIS_PATH"`
6783                 NSIS_PATH=`cygpath -u "$NSIS_PATH"`
6784             fi
6785             AC_MSG_RESULT([found ($NSIS_PATH)])
6786         fi
6787     fi
6789 AC_SUBST(NSIS_PATH)
6791 dnl ***************************************
6792 dnl Checking for bison and flex
6793 dnl ***************************************
6794 AC_PATH_PROG(BISON, bison)
6795 if test -z "$BISON"; then
6796     AC_MSG_ERROR([no bison found in \$PATH, install it])
6797 else
6798     AC_MSG_CHECKING([the bison version])
6799     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
6800     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
6801     # Accept newer than 1.875 or older(equal) than 1.75
6802     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
6803         if test "$_bison_version" = "1.875" ; then
6804             AC_MSG_WARN([suspect ($BISON $_bison_version)])
6805             echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
6806         else
6807             AC_MSG_RESULT([checked ($BISON $_bison_version)])
6808         fi
6809     else
6810         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
6811     fi
6813 AC_PATH_PROG(FLEX, flex)
6814 if test -z "$FLEX"; then
6815     AC_MSG_ERROR([no flex found in \$PATH, install it])
6817 dnl ***************************************
6818 dnl Checking for patch
6819 dnl ***************************************
6820 AC_PATH_PROG(PATCH, patch)
6821 if test -z "$PATCH"; then
6822     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
6825 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
6826 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
6827     if test -z "$with_gnu_patch"; then
6828         GNUPATCH=$PATCH
6829     else
6830         if test -x "$with_gnu_patch"; then
6831             GNUPATCH=$with_gnu_patch
6832         else
6833             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
6834         fi
6835     fi
6837     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
6838     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
6839         AC_MSG_RESULT([yes])
6840     else
6841         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
6842     fi
6845 dnl We also need to check for --with-gnu-cp
6847 if test -z "$with_gnu_cp"; then
6848     # check the place where the good stuff is hidden on Solaris...
6849     if test -x /usr/gnu/bin/cp; then
6850         GNUCP=/usr/gnu/bin/cp
6851     else
6852         AC_PATH_PROGS(GNUCP, gnucp cp)
6853     fi
6854     if test -z $GNUCP; then
6855         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
6856     fi
6857 else
6858     if test -x "$with_gnu_cp"; then
6859         GNUCP=$with_gnu_cp
6860     else
6861         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
6862     fi
6865 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
6866 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
6867     AC_MSG_RESULT([yes])
6868 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
6869     AC_MSG_RESULT([yes])
6870 else
6871     case "$build_os" in
6872     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
6873         GNUCP=''
6874         AC_MSG_RESULT([no gnucp found - using the system's cp command])
6875         ;;
6876     *)
6877         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
6878         ;;
6879     esac
6882 AC_SUBST(GNUPATCH)
6883 AC_SUBST(GNUCP)
6885 dnl ***************************************
6886 dnl testing assembler path
6887 dnl ***************************************
6888 ML_EXE=""
6889 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
6890     if test "$CL_X64" = ""; then
6891         assembler=ml.exe
6892         assembler_bin=bin
6893     else
6894         assembler=ml64.exe
6895         assembler_bin=bin/amd64
6896     fi
6897     if test -n "$with_asm_home"; then
6898         with_asm_home=`cygpath -u "$with_asm_home"`
6899     fi
6900     if test -x "$with_asm_home/$assembler"; then
6901         AC_MSG_CHECKING([$assembler assembler path])
6902         AC_MSG_RESULT([$with_asm_home/$assembler])
6903         ML_EXE="$with_asm_home/$assembler"
6904     else
6905         AC_PATH_PROG(ML_EXE, $assembler)
6906         if test -z "$ML_EXE"; then
6907             AC_MSG_CHECKING([$with_cl_home/$assembler_bin/$assembler])
6908             if test -x "$with_cl_home/$assembler_bin/$assembler"; then
6909                 with_asm_home=$with_cl_home/$assembler_bin
6910                 AC_MSG_RESULT([found])
6911                 ML_EXE="$with_cl_home/$assembler_bin/$assembler"
6912             else
6913                 AC_MSG_ERROR([Configure did not find $assembler assembler.])
6914             fi
6915         else
6916             with_asm_home="ASM_IN_PATH"
6917             ML_EXE="$assembler"
6918         fi
6919     fi
6920 else
6921     with_asm_home="NO_ASM_HOME"
6923 ASM_HOME="$with_asm_home"
6924 AC_SUBST(ASM_HOME)
6925 AC_SUBST(ML_EXE)
6927 dnl ===================================================================
6928 dnl We need zip and unzip
6929 dnl ===================================================================
6930 AC_PATH_PROG(ZIP, zip)
6931 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
6932 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
6933     AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
6936 AC_PATH_PROG(UNZIP, unzip)
6937 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
6939 dnl ===================================================================
6940 dnl Zip must be a specific type for different build types.
6941 dnl ===================================================================
6942 if test $build_os = cygwin; then
6943     if test -n "`$ZIP -h | grep -i WinNT`" ; then
6944         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
6945     fi
6948 dnl ===================================================================
6949 dnl Test which vclplugs have to be built.
6950 dnl ===================================================================
6951 R=""
6952 GTK3_CFLAGS=""
6953 GTK3_LIBS=""
6954 ENABLE_GTK3=""
6955 if test "x$enable_gtk3" = "xyes"; then
6956     if test "$with_system_cairo" != yes; then
6957         echo "System cairo required for gtk3 support, please use --with-system-cairo"
6958     fi
6959     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
6960     if test "x$ENABLE_GTK3" = "xTRUE"; then
6961         R="gtk3"
6962     else
6963         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
6964     fi
6966 AC_SUBST(GTK3_LIBS)
6967 AC_SUBST(GTK3_CFLAGS)
6968 AC_SUBST(ENABLE_GTK3)
6970 AC_MSG_CHECKING([which VCLplugs shall be built])
6971 ENABLE_GTK=""
6972 if test "x$enable_gtk" = "xyes"; then
6973     ENABLE_GTK="TRUE"
6974     R="gtk $R"
6976 AC_SUBST(ENABLE_GTK)
6978 ENABLE_KDE=""
6979 if test "x$enable_kde" = "xyes"; then
6980     ENABLE_KDE="TRUE"
6981     R="$R kde"
6983 AC_SUBST(ENABLE_KDE)
6985 ENABLE_KDE4=""
6986 if test "x$enable_kde4" = "xyes"; then
6987     ENABLE_KDE4="TRUE"
6988     R="$R kde4"
6990 AC_SUBST(ENABLE_KDE4)
6992 if test -z "$R"; then
6993     AC_MSG_RESULT([none])
6994 else
6995     AC_MSG_RESULT([$R])
6998 dnl ===================================================================
6999 dnl GCONF check
7000 dnl ===================================================================
7002 ENABLE_GCONF=""
7003 AC_MSG_CHECKING([whether to enable GConf support])
7004 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gconf" = "yes"; then
7005     ENABLE_GCONF="TRUE"
7006     AC_MSG_RESULT([yes])
7007     PKG_CHECK_MODULES( GCONF, gconf-2.0 ORBit-2.0 )
7008 else
7009     AC_MSG_RESULT([no])
7011 AC_SUBST(ENABLE_GCONF)
7013 dnl ===================================================================
7014 dnl Gnome VFS check
7015 dnl ===================================================================
7017 ENABLE_GNOMEVFS=""
7018 AC_MSG_CHECKING([whether to enable GNOME VFS support])
7019 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
7020     ENABLE_GNOMEVFS="TRUE"
7021     AC_MSG_RESULT([yes])
7022     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
7023 else
7024     AC_MSG_RESULT([no])
7026 AC_SUBST(ENABLE_GNOMEVFS)
7028 dnl ===================================================================
7029 dnl Check whether the gtk 2.0 libraries are available.
7030 dnl ===================================================================
7032 GTK_CFLAGS=""
7033 GTK_LIBS=""
7034 ENABLE_SYSTRAY_GTK=""
7035 ENABLE_DBUS=""
7036 DBUS_CFLAGS=""
7037 DBUS_LIBS=""
7038 if test  "$test_gtk" = "yes"; then
7040     if test "$ENABLE_GTK" = "TRUE" ; then
7041         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]))
7042         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]))
7043         BUILD_TYPE="$BUILD_TYPE GTK"
7045         if test "x$enable_systray" = "xyes"; then
7046             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
7047                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
7048                             [ ENABLE_SYSTRAY_GTK="" ])
7049         fi
7051         AC_MSG_CHECKING([whether to enable DBUS support])
7052         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
7053             ENABLE_DBUS="TRUE"
7054             AC_MSG_RESULT([yes])
7055             PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
7056         else
7057             AC_MSG_RESULT([no])
7058         fi
7060         AC_MSG_CHECKING([whether to enable GIO support])
7061         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
7062             if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
7063                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
7064             fi
7065             ENABLE_GIO="TRUE"
7066             AC_MSG_RESULT([yes])
7067             PKG_CHECK_MODULES( GIO, gio-2.0 )
7068         else
7069             AC_MSG_RESULT([no])
7070         fi
7071     fi
7073 AC_SUBST(ENABLE_GIO)
7074 AC_SUBST(ENABLE_DBUS)
7075 AC_SUBST(ENABLE_SYSTRAY_GTK)
7076 AC_SUBST(GTK_CFLAGS)
7077 AC_SUBST(GTK_LIBS)
7078 AC_SUBST(GTHREAD_CFLAGS)
7079 AC_SUBST(GTHREAD_LIBS)
7080 AC_SUBST(DBUS_CFLAGS)
7081 AC_SUBST(DBUS_LIBS)
7083 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
7084 AC_SUBST(LIBPNG_LIBS)
7085 AC_SUBST(LIBPNG_CFLAGS)
7087 AC_MSG_CHECKING([whether to enable libpng linking in quickstarter])
7088 if test "x$unix_qstart_libpng" != "xno"; then
7089     AC_MSG_RESULT([yes])
7090 else
7091     AC_MSG_RESULT([no])
7092     ENABLE_QUICKSTART_LIBPNG=""
7094 AC_SUBST(ENABLE_QUICKSTART_LIBPNG)
7096 SPLIT_APP_MODULES=""
7097 if test "$enable_split_app_modules" = "yes"; then
7098     SPLIT_APP_MODULES="YES"
7100 AC_SUBST(SPLIT_APP_MODULES)
7102 SPLIT_OPT_FEATURES=""
7103 if test "$enable_split_opt_features" = "yes"; then
7104     SPLIT_OPT_FEATURES="YES"
7106 AC_SUBST(SPLIT_OPT_FEATURES)
7108 ENABLE_CAIRO_CANVAS="FALSE"
7109 if test "$enable_cairo_canvas" = "yes" ; then
7110    ENABLE_CAIRO_CANVAS="TRUE"
7112 AC_SUBST(ENABLE_CAIRO_CANVAS)
7114 dnl ===================================================================
7115 dnl Check whether the GStreamer libraries are available.
7116 dnl ===================================================================
7118 ENABLE_GSTREAMER=""
7120 if test  "$build_gstreamer" = "yes"; then
7122     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
7123     if test "x$enable_gstreamer" != "xno" ; then
7124         ENABLE_GSTREAMER="TRUE"
7125         AC_MSG_RESULT([yes])
7126         PKG_CHECK_MODULES( GSTREAMER, gstreamer-0.10 gstreamer-plugins-base-0.10 )
7127     else
7128         AC_MSG_RESULT([no])
7129     fi
7132 AC_SUBST(ENABLE_GSTREAMER)
7134 dnl ===================================================================
7135 dnl Check whether the OpenGL libraries are available
7136 dnl ===================================================================
7138 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
7139 ENABLE_OPENGL=
7141 if test "$_os" = "Darwin" ; then
7142     # We use frameworks on Mac OS X, no need for detail checks
7143     ENABLE_OPENGL=TRUE
7144     SYSTEM_MESA_HEADERS=YES
7145     AC_MSG_RESULT([yes])
7146 else
7147     if test "x$enable_opengl" != "xno" ; then
7148         if test "$_os" != "WINNT"; then
7149             save_LDFLAGS=$LDFLAGS
7150             LDFLAGS="$LDFLAGS -lm"
7151             AC_MSG_RESULT([yes])
7152             AC_CHECK_LIB(GL, main, [],
7153                       [AC_MSG_ERROR(libGL not installed or functional)], [])
7154             AC_CHECK_LIB(GLU, main, [],
7155                       [AC_MSG_ERROR(libGLU not installed or functional)], [])
7156             ENABLE_OPENGL=TRUE
7157             LDFLAGS=$save_LDFLAGS
7159             dnl ===================================================================
7160             dnl Check for system Mesa
7161             dnl ===================================================================
7162             AC_MSG_CHECKING([which Mesa headers to use])
7163             if test "$with_system_mesa_headers" = "yes"; then
7164                 AC_MSG_RESULT([external])
7165                 SYSTEM_MESA_HEADERS=YES
7166                 AC_LANG_PUSH(C)
7167                 AC_CHECK_HEADER(GL/glxext.h, [],
7168                    [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
7169                 AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
7170                 AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
7171                 AC_LANG_POP(C)
7172             else
7173                 AC_MSG_RESULT([internal])
7174                 SYSTEM_MESA_HEADERS=NO
7175                 BUILD_TYPE="$BUILD_TYPE MESA"
7176             fi
7177         else
7178             AC_MSG_RESULT([not on Windows])
7179         fi
7180     else
7181        AC_MSG_RESULT([no])
7182     fi
7185 AC_SUBST(SYSTEM_MESA_HEADERS)
7186 AC_SUBST(ENABLE_OPENGL)
7188 # presenter minimizer extension?
7189 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
7190 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
7191    AC_MSG_RESULT([yes])
7192    ENABLE_MINIMIZER=YES
7193 else
7194    AC_MSG_RESULT([no])
7195    ENABLE_MINIMIZER=NO
7196    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
7198 AC_SUBST(ENABLE_MINIMIZER)
7200 # presenter console extension?
7201 AC_MSG_CHECKING([whether to build the Presenter Console extension])
7202 if test "x$enable_ext_presenter_console" != "xno" -a "x$enable_extension_integration" != "xno"; then
7203    AC_MSG_RESULT([yes])
7204    ENABLE_PRESENTER_SCREEN=YES
7205 else
7206    AC_MSG_RESULT([no])
7207    ENABLE_PRESENTER_SCREEN=NO
7208    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PRESENTER_SCREEN"
7210 AC_SUBST(ENABLE_PRESENTER_SCREEN)
7212 # pdf import extension?
7213 AC_MSG_CHECKING([whether to build the PDF Import extension])
7214 if test "x$enable_ext_pdfimport" != "xno" -a "x$enable_extension_integration" != "xno"; then
7215   AC_MSG_RESULT([yes])
7216   ENABLE_PDFIMPORT=YES
7218   dnl ===================================================================
7219   dnl Check for system poppler
7220   dnl ===================================================================
7221   AC_MSG_CHECKING([which pdf backend to use])
7222   if test "$with_system_poppler" = "yes"; then
7223       AC_MSG_RESULT([external])
7224       SYSTEM_POPPLER=YES
7225       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
7226       AC_LANG_PUSH([C++])
7227       save_CXXFLAGS=$CXXFLAGS
7228       save_CPPFLAGS=$CPPFLAGS
7229       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
7230       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
7231       AC_CHECK_HEADER([cpp/poppler-version.h], [],
7232                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
7233       CXXFLAGS=$save_CXXFLAGS
7234       CPPFLAGS=$save_CPPFLAGS
7235       AC_LANG_POP([C++])
7236   else
7237       AC_MSG_RESULT([internal])
7238       SYSTEM_POPPLER=NO
7239       BUILD_TYPE="$BUILD_TYPE XPDF"
7240   fi
7241 else
7242   AC_MSG_RESULT([no])
7243   ENABLE_PDFIMPORT=NO
7244   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PDFIMPORT"
7246 AC_SUBST(ENABLE_PDFIMPORT)
7247 AC_SUBST(SYSTEM_POPPLER)
7248 AC_SUBST(POPPLER_CFLAGS)
7249 AC_SUBST(POPPLER_LIBS)
7252 if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
7253    AC_MSG_CHECKING([for sdext module])
7254    BUILD_TYPE="$BUILD_TYPE SDEXT"
7257 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
7258 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7259   AC_MSG_RESULT([yes])
7260   AC_MSG_CHECKING([for swext module])
7261   ENABLE_MEDIAWIKI=YES
7262   BUILD_TYPE="$BUILD_TYPE SWEXT"
7263   if test  "x$with_java" = "xno"; then
7264     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
7265   fi
7266 else
7267   AC_MSG_RESULT([no])
7268   ENABLE_MEDIAWIKI=NO
7269   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
7271 AC_SUBST(ENABLE_MEDIAWIKI)
7273 if test "$ENABLE_MEDIAWIKI" = "YES"; then
7274     AC_MSG_CHECKING([which Servlet API Jar to use])
7275     if test "$with_system_servlet_api" = "yes"; then
7276         AC_MSG_RESULT([external])
7277         SYSTEM_SERVLETAPI=YES
7278         if test -z "$SERVLETAPI_JAR"; then
7279             SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
7280         fi
7281         AC_CHECK_FILE($SERVLETAPI_JAR, [],
7282               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
7283     else
7284         AC_MSG_RESULT([internal])
7285         SYSTEM_SERVLETAPI=NO
7286         BUILD_TYPE="$BUILD_TYPE TOMCAT"
7287     fi
7289 AC_SUBST(SYSTEM_SERVLETAPI)
7290 AC_SUBST(SERVLETAPI_JAR)
7292 AC_MSG_CHECKING([whether to build the Report Builder extension])
7293 if test "$enable_ext_report_builder" != "no" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7294     AC_MSG_RESULT([yes])
7295     ENABLE_REPORTBUILDER=YES
7296     AC_MSG_CHECKING([for reportbuilder module])
7297     AC_MSG_CHECKING([which jfreereport libs to use])
7298     if test "$with_system_jfreereport" = "yes"; then
7299         SYSTEM_JFREEREPORT=YES
7300         AC_MSG_RESULT([external])
7301         if test -z $SAC_JAR; then
7302             SAC_JAR=/usr/share/java/sac.jar
7303         fi
7304         AC_CHECK_FILE($SAC_JAR, [],
7305              [AC_MSG_ERROR(sac.jar not found.)], [])
7307         if test -z $LIBXML_JAR; then
7308             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
7309                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
7310                 [
7311                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
7312                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
7313                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
7314                     )
7315                 ]
7316             )
7317         else
7318             AC_CHECK_FILE($LIBXML_JAR, [],
7319                  [AC_MSG_ERROR(libxml.jar not found.)], [])
7320         fi
7322         if test -z $FLUTE_JAR; then
7323             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
7324                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
7325                 [
7326                     AC_CHECK_FILE(/usr/share/java/flute.jar,
7327                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
7328                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
7329                     )
7330                 ]
7331             )
7332         else
7333             AC_CHECK_FILE($FLUTE_JAR, [],
7334                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
7335         fi
7337         if test -z $JFREEREPORT_JAR; then
7338             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
7339                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
7340                 [
7341                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
7342                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
7343                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
7344                     )
7345                 ]
7346             )
7347         else
7348             AC_CHECK_FILE($JFREEREPORT_JAR, [],
7349                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
7350         fi
7352         if test -z $LIBLAYOUT_JAR; then
7353             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
7354                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
7355                 [
7356                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
7357                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
7358                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
7359                     )
7360                 ]
7361             )
7362         else
7363             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
7364                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
7365         fi
7367         if test -z $LIBLOADER_JAR; then
7368             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
7369                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
7370                 [
7371                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
7372                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
7373                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
7374                     )
7375                 ]
7376             )
7377         else
7378             AC_CHECK_FILE($LIBLOADER_JAR, [],
7379                 [AC_MSG_ERROR(libloader.jar not found.)], [])
7380         fi
7382         if test -z $LIBFORMULA_JAR; then
7383             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
7384                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
7385                  [
7386                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
7387                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
7388                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
7389                      )
7390                  ]
7391             )
7392         else
7393             AC_CHECK_FILE($LIBFORMULA_JAR, [],
7394                 [AC_MSG_ERROR(libformula.jar not found.)], [])
7395         fi
7397         if test -z $LIBREPOSITORY_JAR; then
7398             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
7399                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
7400                 [
7401                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
7402                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
7403                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
7404                     )
7405                 ]
7406             )
7407         else
7408             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
7409                 [AC_MSG_ERROR(librepository.jar not found.)], [])
7410         fi
7412         if test -z $LIBFONTS_JAR; then
7413             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
7414                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
7415                 [
7416                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
7417                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
7418                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
7419                     )
7420                 ]
7421             )
7422         else
7423             AC_CHECK_FILE($LIBFONTS_JAR, [],
7424                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
7425         fi
7427         if test -z $LIBSERIALIZER_JAR; then
7428             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
7429                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
7430                 [
7431                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
7432                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
7433                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
7434                     )
7435                 ]
7436             )
7437         else
7438             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
7439                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
7440         fi
7443         if test -z $LIBBASE_JAR; then
7444             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
7445                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
7446                 [
7447                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
7448                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
7449                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
7450                     )
7451                 ]
7452             )
7453         else
7454             AC_CHECK_FILE($LIBBASE_JAR, [],
7455                 [AC_MSG_ERROR(libbase.jar not found.)], [])
7456         fi
7458     else
7459         AC_MSG_RESULT([internal])
7460         AC_MSG_CHECKING([for jfreereport module])
7461         SYSTEM_JFREEREPORT=NO
7462         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
7463     fi
7464     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
7465 else
7466     AC_MSG_RESULT([no])
7467     ENABLE_REPORTBUILDER=NO
7468     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_REPORTDESIGN"
7469     SYSTEM_JFREEREPORT=NO
7471 AC_SUBST(ENABLE_REPORTBUILDER)
7472 AC_SUBST(SYSTEM_JFREEREPORT)
7473 AC_SUBST(SAC_JAR)
7474 AC_SUBST(LIBXML_JAR)
7475 AC_SUBST(FLUTE_JAR)
7476 AC_SUBST(JFREEREPORT_JAR)
7477 AC_SUBST(LIBBASE_JAR)
7478 AC_SUBST(LIBLAYOUT_JAR)
7479 AC_SUBST(LIBLOADER_JAR)
7480 AC_SUBST(LIBFORMULA_JAR)
7481 AC_SUBST(LIBREPOSITORY_JAR)
7482 AC_SUBST(LIBFONTS_JAR)
7483 AC_SUBST(LIBSERIALIZER_JAR)
7485 # this has to be here because both the Wiki Publisher and the SRB use
7486 # commons-logging
7487 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7488     AC_MSG_CHECKING([which Apache commons-* libs to use])
7489     if test "$with_system_apache_commons" = "yes"; then
7490         SYSTEM_APACHE_COMMONS=YES
7491         AC_MSG_RESULT([external])
7492         if test "$ENABLE_MEDIAWIKI" = "YES"; then
7493             if test -z $COMMONS_CODEC_JAR; then
7494                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
7495                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
7496                     [
7497                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
7498                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
7499                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
7500                         )
7501                     ]
7502                 )
7503             else
7504                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
7505                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
7506             fi
7508             if test -z $COMMONS_LANG_JAR; then
7509                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
7510                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
7511                     [
7512                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
7513                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
7514                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
7515                             )
7516                     ]
7517                 )
7518             else
7519                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
7520                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
7521             fi
7523             if test -z $COMMONS_HTTPCLIENT_JAR; then
7524                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
7525                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
7526                     [
7527                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
7528                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
7529                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
7530                         )
7531                     ]
7532                 )
7533             else
7534                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
7535                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
7536             fi
7537         fi
7538         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7539             if test -z $COMMONS_LOGGING_JAR; then
7540                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
7541                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
7542                    [
7543                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
7544                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
7545                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
7546                         )
7547                     ]
7548                 )
7549             else
7550                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
7551                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
7552             fi
7553         fi
7554     else
7555         AC_MSG_RESULT([internal])
7556         SYSTEM_APACHE_COMMONS=NO
7557         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
7558     fi
7560 AC_SUBST(SYSTEM_APACHE_COMMONS)
7561 AC_SUBST(COMMONS_CODEC_JAR)
7562 AC_SUBST(COMMONS_LANG_JAR)
7563 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
7564 AC_SUBST(COMMONS_LOGGING_JAR)
7566 # scripting provider for BeanShell extension?
7567 AC_MSG_CHECKING([whether to build extension for support of scripts in BeanShell])
7568 if test "x$enable_ext_scripting_beanshell" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7569    AC_MSG_RESULT([yes])
7570    ENABLE_SCRIPTING_BEANSHELL=YES
7571 else
7572    AC_MSG_RESULT([no])
7573    ENABLE_SCRIPTING_BEANSHELL=NO
7574    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_BEANSHELL"
7576 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
7578 # scripting provider for JavaScript extension?
7579 AC_MSG_CHECKING([whether to build extension for support of scripts in JavaScript])
7580 if test "x$enable_ext_scripting_javascript" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7581    AC_MSG_RESULT([yes])
7582    ENABLE_SCRIPTING_JAVASCRIPT=YES
7583 else
7584    AC_MSG_RESULT([no])
7585    ENABLE_SCRIPTING_JAVASCRIPT=NO
7586    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_JAVASCRIPT"
7588 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
7590 dnl Scripting provider for Python extension?
7591 dnl We always provide this unless we have disabled Python completely
7592 if test $enable_python = no; then
7593     ENABLE_SCRIPTING_PYTHON=NO
7594 else
7595     ENABLE_SCRIPTING_PYTHON=YES
7597 AC_SUBST(ENABLE_SCRIPTING_PYTHON)
7599 supports_multilib=
7600 case "$host_cpu" in
7601 x86_64 | powerpc64 | s390x)
7602     if test "$SIZEOF_LONG" = "8"; then
7603         supports_multilib="yes"
7604     fi
7605     ;;
7607     ;;
7608 esac
7610 dnl ===================================================================
7611 dnl Check whether the Qt3 and KDE3 libraries are available.
7612 dnl ===================================================================
7614 KDE_CFLAGS=""
7615 KDE_LIBS=""
7616 if test "$_os" != "OpenBSD"; then
7617     MOC="moc"
7619 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
7620     dnl Search paths for Qt3 and KDE3
7621     if test -z "$supports_multilib" ; then
7622         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"
7623         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"
7624     else
7625         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"
7626         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"
7627     fi
7628     if test -n "$QTDIR" ; then
7629         qt_incdirs="$QTDIR/include $qt_incdirs"
7630         if test -z "$supports_multilib" ; then
7631             qt_libdirs="$QTDIR/lib $qt_libdirs"
7632         else
7633             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7634         fi
7635     fi
7636     if test -z "$supports_multilib" ; then
7637         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"
7638         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"
7639     else
7640         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"
7641         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"
7642     fi
7643     if test -n "$KDEDIR" ; then
7644         kde_incdirs="$KDEDIR/include $kde_incdirs"
7645         if test -z "$supports_multilib" ; then
7646             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7647         else
7648             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7649         fi
7650     fi
7652     dnl What to test
7653     qt_test_include="qstyle.h"
7654     kde_test_include="kapp.h"
7656     if test "$_os" != "OpenBSD"; then
7657         qt_test_library="libqt-mt.so"
7658         kde_test_library="libDCOP.so"
7659     else
7660         qt_test_library="libqt-mt.so*"
7661         kde_test_library="libDCOP.so*"
7662     fi
7664     dnl Check for Qt3 headers
7665     AC_MSG_CHECKING([for Qt3 headers])
7666     qt_incdir="no"
7667     for kde_check in $qt_incdirs ; do
7668         if test -r "$kde_check/$qt_test_include" ; then
7669             qt_incdir="$kde_check"
7670             break
7671         fi
7672     done
7673     AC_MSG_RESULT([$qt_incdir])
7674     if test "x$qt_incdir" = "xno" ; then
7675         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
7676 your Qt3 installation by exporting QTDIR before running "configure".])
7677     fi
7679     dnl Check for Qt3 libraries
7680     AC_MSG_CHECKING([for Qt3 libraries])
7681     qt_libdir="no"
7682     for qt_check in $qt_libdirs ; do
7683         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`" ; then
7684             qt_libdir="$qt_check"
7685             break
7686         fi
7687     done
7688     AC_MSG_RESULT([$qt_libdir])
7689     if test "x$qt_libdir" = "xno" ; then
7690         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
7691 your Qt3 installation by exporting QTDIR before running "configure".])
7692     fi
7694     dnl Check for Meta Object Compiler
7695     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
7696     if test "$MOC" = "no" ; then
7697         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
7698 the root of your Qt3 installation by exporting QTDIR before running "configure".])
7699     fi
7701     dnl Check for KDE3 headers
7702     AC_MSG_CHECKING([for KDE3 headers])
7703     kde_incdir="no"
7704     for kde_check in $kde_incdirs ; do
7705         if test -r "$kde_check/$kde_test_include" ; then
7706             kde_incdir="$kde_check"
7707             break
7708         fi
7709     done
7710     AC_MSG_RESULT([$kde_incdir])
7711     if test "x$kde_incdir" = "xno" ; then
7712         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
7713 your KDE3 installation by exporting KDEDIR before running "configure".])
7714     fi
7716     dnl Check for KDE3 libraries
7717     AC_MSG_CHECKING([for KDE3 libraries])
7718     kde_libdir="no"
7719     for kde_check in $kde_libdirs ; do
7720         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`" ; then
7721             kde_libdir="$kde_check"
7722             break
7723         fi
7724     done
7725     AC_MSG_RESULT([$kde_libdir])
7726     if test "x$kde_libdir" = "xno" ; then
7727         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
7728 your KDE3 installation by exporting KDEDIR before running "configure".])
7729     fi
7731     dnl Set the variables
7732     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7733     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
7735 AC_SUBST(KDE_CFLAGS)
7736 AC_SUBST(KDE_LIBS)
7737 AC_SUBST(MOC)
7739 dnl ===================================================================
7740 dnl KDE4 Integration
7741 dnl ===================================================================
7743 KDE4_CFLAGS=""
7744 KDE4_LIBS=""
7745 MOC4="moc"
7746 KDE_GLIB_CFLAGS=""
7747 KDE_GLIB_LIBS=""
7748 KDE_HAVE_GLIB=""
7749 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
7750     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
7751     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
7753     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
7754     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
7756     if test -n "$supports_multilib" ; then
7757         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
7758         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
7759     fi
7761     if test -n "$QTDIR" ; then
7762         qt_incdirs="$QTDIR/include $qt_incdirs"
7763         if test -z "$supports_multilib" ; then
7764             qt_libdirs="$QTDIR/lib $qt_libdirs"
7765         else
7766             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7767         fi
7768     fi
7769     if test -n "$QT4DIR" ; then
7770         qt_incdirs="$QT4DIR/include $qt_incdirs"
7771         if test -z "$supports_multilib" ; then
7772             qt_libdirs="$QT4DIR/lib $qt_libdirs"
7773         else
7774             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
7775         fi
7776     fi
7778     if test -n "$KDEDIR" ; then
7779         kde_incdirs="$KDEDIR/include $kde_incdirs"
7780         if test -z "$supports_multilib" ; then
7781             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7782         else
7783             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7784         fi
7785     fi
7786     if test -n "$KDE4DIR" ; then
7787         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
7788         if test -z "$supports_multilib" ; then
7789             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
7790         else
7791             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
7792         fi
7793     fi
7795     qt_test_include="Qt/qobject.h"
7796     qt_test_library="libQtCore.so"
7797     kde_test_include="kwindowsystem.h"
7798     kde_test_library="libsolid.so"
7800     AC_MSG_CHECKING([for Qt4 headers])
7801     qt_header_dir="no"
7802     for inc_dir in $qt_incdirs ; do
7803         if test -r "$inc_dir/$qt_test_include" ; then
7804             qt_header_dir="$inc_dir"
7805             break
7806         fi
7807     done
7809     AC_MSG_RESULT([$qt_header_dir])
7810     if test "x$qt_header_dir" = "xno" ; then
7811         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7812     fi
7814     AC_MSG_CHECKING([for Qt4 libraries])
7815     qt_lib_dir="no"
7816     for lib_dir in $qt_libdirs ; do
7817         if test -r "$lib_dir/$qt_test_library" ; then
7818             qt_lib_dir="$lib_dir"
7819             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
7820             break
7821         fi
7822     done
7824     AC_MSG_RESULT([$qt_lib_dir])
7826     if test "x$qt_lib_dir" = "xno" ; then
7827         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7828     fi
7830     dnl Check for Meta Object Compiler
7832     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7833     MOC4="$MOCQT4"
7834     if test "$MOC4" = "no" ; then
7835         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7836         if test "$MOC4" = "no" ; then
7837             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
7838 the root of your Qt installation by exporting QT4DIR before running "configure".])
7839         fi
7840     fi
7842     dnl Check for KDE4 headers
7843     AC_MSG_CHECKING([for KDE4 headers])
7844     kde_incdir="no"
7845     for kde_check in $kde_incdirs ; do
7846         if test -r "$kde_check/$kde_test_include" ; then
7847             kde_incdir="$kde_check"
7848             break
7849         fi
7850     done
7851     AC_MSG_RESULT([$kde_incdir])
7852     if test "x$kde_incdir" = "xno" ; then
7853         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7854     fi
7856     dnl Check for KDE4 libraries
7857     AC_MSG_CHECKING([for KDE4 libraries])
7858     kde_libdir="no"
7859     for kde_check in $kde_libdirs ; do
7860         if test -r "$kde_check/$kde_test_library" ; then
7861             kde_libdir="$kde_check"
7862             break
7863         fi
7864     done
7866     AC_MSG_RESULT([$kde_libdir])
7867     if test "x$kde_libdir" = "xno" ; then
7868         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7869     fi
7871     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7872     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
7874     AC_LANG_PUSH([C++])
7875     save_CXXFLAGS=$CXXFLAGS
7876     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
7877     AC_MSG_CHECKING([whether KDE is >= 4.2])
7878        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7879 #include <kdeversion.h>
7881 int main(int argc, char **argv) {
7882        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
7883        else return 1;
7885        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
7886     CXXFLAGS=$save_CXXFLAGS
7887     AC_LANG_POP([C++])
7889    # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled
7890     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
7891         [KDE_HAVE_GLIB=1],
7892         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
7894 AC_SUBST(KDE4_CFLAGS)
7895 AC_SUBST(KDE4_LIBS)
7896 AC_SUBST(MOC4)
7897 AC_SUBST(KDE_GLIB_CFLAGS)
7898 AC_SUBST(KDE_GLIB_LIBS)
7899 AC_SUBST(KDE_HAVE_GLIB)
7901 dnl ===================================================================
7902 dnl Test for the enabling the lockdown pieces
7903 dnl ===================================================================
7904 AC_MSG_CHECKING([whether to enable the lockdown pieces])
7905 ENABLE_LOCKDOWN=""
7906 if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
7907     ENABLE_LOCKDOWN=YES
7908     AC_MSG_RESULT([yes])
7909 else
7910     AC_MSG_RESULT([no])
7912 AC_SUBST(ENABLE_LOCKDOWN)
7914 dnl ===================================================================
7915 dnl Test whether to include Evolution 2 support
7916 dnl ===================================================================
7917 AC_MSG_CHECKING([whether to enable evolution 2 support])
7918 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
7919     AC_MSG_RESULT([yes])
7920     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
7921     ENABLE_EVOAB2="TRUE"
7922 else
7923     ENABLE_EVOAB2=""
7924     AC_MSG_RESULT([no])
7926 AC_SUBST(ENABLE_EVOAB2)
7927 AC_SUBST(GOBJECT_CFLAGS)
7928 AC_SUBST(GOBJECT_LIBS)
7930 dnl ===================================================================
7931 dnl Test whether to include KDE AB support
7932 dnl ===================================================================
7933 AC_MSG_CHECKING([whether to enable KDE address book support])
7934 if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
7935     AC_MSG_RESULT([yes])
7936     AC_LANG_PUSH([C++])
7937     save_CXXFLAGS=$CXXFLAGS
7938     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
7939     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
7940        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7941 #include <kdeversion.h>
7943 int main(int argc, char **argv) {
7944        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
7945        else return 1;
7947        ]])],[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])],[])
7948     CXXFLAGS=$save_CXXFLAGS
7949     AC_LANG_POP([C++])
7950     ENABLE_KAB=TRUE
7951 else
7952     AC_MSG_RESULT([no])
7953     ENABLE_KAB=
7955 AC_SUBST(ENABLE_KAB)
7957 dnl ===================================================================
7958 dnl Test whether to include MathMLDTD
7959 dnl ===================================================================
7960 AC_MSG_CHECKING([whether to include MathMLDTD])
7961 if test -n "$enable_mathmldtd"; then
7962     if test "$enable_mathmldtd" = "no"; then
7963         AC_MSG_RESULT([no])
7964         SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7965     else
7966         AC_MSG_RESULT([yes])
7967         BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7968     fi
7969 else
7970     AC_MSG_RESULT([no])
7971     SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7974 dnl ===================================================================
7975 dnl Test which themes to include
7976 dnl ===================================================================
7977 AC_MSG_CHECKING([which themes to include])
7978 # if none given, use all available themes
7979 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
7980     with_theme="default crystal hicontrast oxygen tango"
7983 WITH_THEMES=""
7984 for theme in $with_theme; do
7985     case $theme in
7986         default|crystal|hicontrast|oxygen|tango) : ;;
7987         *) AC_MSG_ERROR([Unknown value for --with-themes: $theme]) ;;
7988     esac
7989     WITH_THEMES="$WITH_THEMES $theme"
7990     SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
7991 done
7992 AC_MSG_RESULT([$WITH_THEMES])
7993 AC_SUBST([WITH_THEMES])
7995 dnl ===================================================================
7996 dnl Test whether to integrate helppacks into the product's installer
7997 dnl ===================================================================
7998 AC_MSG_CHECKING([for helppack integration])
7999 if test "z$with_helppack_integration" = "zno" ; then
8000     WITH_HELPPACK_INTEGRATION=NO
8001     AC_MSG_RESULT([no integration])
8002 else
8003     WITH_HELPPACK_INTEGRATION=YES
8004     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
8005     AC_MSG_RESULT([integration])
8007 AC_SUBST(WITH_HELPPACK_INTEGRATION)
8009 ###############################################################################
8010 # Extensions checking
8011 ###############################################################################
8012 dnl ===================================================================
8013 dnl Test whether to integrate extensions into the product's installer
8014 dnl ===================================================================
8015 AC_MSG_CHECKING([for extensions integration])
8016 if test "x$enable_extension_integration" != "xno"; then
8017     WITH_EXTENSION_INTEGRATION=YES
8018     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
8019     AC_MSG_RESULT([yes, use integration])
8020 else
8021     WITH_EXTENSION_INTEGRATION=NO
8022     AC_MSG_RESULT([no, do not integrate])
8024 AC_SUBST(WITH_EXTENSION_INTEGRATION)
8026 dnl ===================================================================
8027 dnl Test whether to include Lightproof extensions
8028 dnl ===================================================================
8029 AC_MSG_CHECKING([for Lightproof extensions integration (only supported languages displayed)])
8030 LIGHTPROOF_LANG=
8031 LIGHTPROOF_HU_PACK=
8032 LIGHTPROOF_RU_PACK=
8033 LIGHTPROOF_EN_US_PACK=
8034 if test "x$enable_ext_lightproof" = "xno" -o "x$enable_extension_integration" = "xno"; then
8035     AC_MSG_RESULT([no integration])
8036 else
8037     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LIGHTPROOF"
8038     if test "x$enable_ext_lightproof" = "xyes" -o "x$enable_ext_lightproof" = "x"; then
8039         wanted_lightproof="en-US hu ru"
8040     else
8041         for lang in $enable_ext_lightproof ; do
8042             case $lang in
8043                 en-US|hu|ru)
8044                     wanted_lightproof="$wanted_lightproof $lang"
8045                     ;;
8046                 *)
8047                     AC_MSG_ERROR([Unknown value for --enable-ext-lightproof: $lang])
8048                     ;;
8049                 esac
8050         done
8051     fi
8052     for lang in $wanted_lightproof ; do
8053         LIGHTPROOF_LANG="$LIGHTPROOF_LANG $lang"
8054         case $lang in
8055             en-US) LIGHTPROOF_EN_US_PACK="0ab55ac8e88f04258f1d3e79e984382f-lightproof-en_US-0.1.oxt" ;;
8056             hu) LIGHTPROOF_HU_PACK="76345f925e34fef2d29bade4f29108e9-lightproof-hu_1.3.oxt" ;;
8057             ru) LIGHTPROOF_RU_PACK="673860e8649cff2ebdc68bd46f2f7f1a-lightproof-ru_0.1.oxt" ;;
8058             *) AC_MSG_ERROR([Unknown value for --enable-ext-lightproof: $lang]) ;;
8059         esac
8060     done
8061     AC_MSG_RESULT([$LIGHTPROOF_LANG])
8063 AC_SUBST(LIGHTPROOF_LANG)
8064 AC_SUBST(LIGHTPROOF_HU_PACK)
8065 AC_SUBST(LIGHTPROOF_RU_PACK)
8066 AC_SUBST(LIGHTPROOF_EN_US_PACK)
8068 dnl ===================================================================
8069 dnl Test whether to include Watch Window extension
8070 dnl ===================================================================
8071 AC_MSG_CHECKING([for Watch Window extension integration])
8072 WATCH_WINDOW_EXTENSION_PACK=
8073 if test "x$enable_ext_watch_window" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8074     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_WATCH_WINDOW"
8075     WATCH_WINDOW_EXTENSION_PACK="23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt"
8076     AC_MSG_RESULT([yes])
8077 else
8078     AC_MSG_RESULT([no])
8080 AC_SUBST(WATCH_WINDOW_EXTENSION_PACK)
8082 dnl ===================================================================
8083 dnl Test whether to include SmART Gallery (Diagram) extension
8084 dnl ===================================================================
8085 AC_MSG_CHECKING([for SmART Gallery (Diagram) extension integration])
8086 DIAGRAM_EXTENSION_PACK=
8087 if test "x$enable_ext_diagram" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8088     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_DIAGRAM"
8089     DIAGRAM_EXTENSION_PACK="4a433efb6d385264ebc1d5513782d51c-SmART_0.9.4.oxt"
8090     AC_MSG_RESULT([yes])
8091 else
8092     AC_MSG_RESULT([no])
8094 AC_SUBST(DIAGRAM_EXTENSION_PACK)
8096 dnl ===================================================================
8097 dnl Test whether to include Validator extension
8098 dnl ===================================================================
8099 AC_MSG_CHECKING([for Validator extension integration])
8100 VALIDATOR_EXTENSION_PACK=
8101 if test "x$enable_ext_validator" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8102     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_VALIDATOR"
8103     VALIDATOR_EXTENSION_PACK="bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt"
8104     AC_MSG_RESULT([yes])
8105 else
8106     AC_MSG_RESULT([no])
8108 AC_SUBST(VALIDATOR_EXTENSION_PACK)
8110 dnl ===================================================================
8111 dnl Test whether to include Barcode extension
8112 dnl ===================================================================
8113 AC_MSG_CHECKING([for Barcode extension integration])
8114 BARCODE_EXTENSION_PACK=
8115 if test "x$enable_ext_barcode" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8116     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_BARCODE"
8117     BARCODE_EXTENSION_PACK="7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt"
8118     AC_MSG_RESULT([yes])
8119 else
8120     AC_MSG_RESULT([no])
8122 AC_SUBST([BARCODE_EXTENSION_PACK])
8124 dnl ===================================================================
8125 dnl Test whether to include ConvertTextToNumber extension
8126 dnl ===================================================================
8127 AC_MSG_CHECKING([for ConvertTextToNumber extension integration])
8128 CT2N_EXTENSION_PACK=
8129 if test "x$enable_ext_ct2n" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8130     BUILD_TYPE="$BUILD_TYPE CT2N"
8131     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_CT2N"
8132     CT2N_EXTENSION_PACK="451ccf439a36a568653b024534669971-ConvertTextToNumber_1.3.2.oxt"
8133     AC_MSG_RESULT([yes])
8134 else
8135     AC_MSG_RESULT([no])
8137 AC_SUBST(CT2N_EXTENSION_PACK)
8139 dnl ===================================================================
8140 dnl Test whether to include Numbertext extension
8141 dnl ===================================================================
8142 AC_MSG_CHECKING([for Numbertext extension integration])
8143 NUMBERTEXT_EXTENSION_PACK=
8144 if test "x$enable_ext_numbertext" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8145     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NUMBERTEXT"
8146     NUMBERTEXT_EXTENSION_PACK="b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt"
8147     AC_MSG_RESULT([yes])
8148 else
8149     AC_MSG_RESULT([no])
8151 AC_SUBST(NUMBERTEXT_EXTENSION_PACK)
8153 dnl ===================================================================
8154 dnl Test whether to include Hungarian Cross-reference Toolbar extension
8155 dnl ===================================================================
8156 AC_MSG_CHECKING([for Hungarian Cross-reference Toolbar extension integration])
8157 HUNART_EXTENSION_PACK=
8158 if test "x$enable_ext_hunart" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8159     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_HUNART"
8160     HUNART_EXTENSION_PACK="b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt"
8161     AC_MSG_RESULT([yes])
8162 else
8163     AC_MSG_RESULT([no])
8165 AC_SUBST(HUNART_EXTENSION_PACK)
8167 dnl ===================================================================
8168 dnl Test whether to include Typography Toolbar extension
8169 dnl ===================================================================
8170 AC_MSG_CHECKING([for Typography Toolbar extension integration])
8171 TYPO_EXTENSION_PACK=
8172 if test "x$enable_ext_typo" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8173     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_TYPO"
8174     TYPO_EXTENSION_PACK="9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt"
8175     AC_MSG_RESULT([yes])
8176 else
8177     AC_MSG_RESULT([no])
8179 AC_SUBST(TYPO_EXTENSION_PACK)
8181 dnl ===================================================================
8182 dnl Test whether to include Google Docs extension
8183 dnl ===================================================================
8184 AC_MSG_CHECKING([for Google Docs extension integration])
8185 GOOGLE_DOCS_EXTENSION_PACK=
8186 if test "x$enable_ext_google_docs" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8187     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_GOOGLE_DOCS"
8188     GOOGLE_DOCS_EXTENSION_PACK="cea0f63d5985ba4fcbd882031df44346-gdocs_3.0.0_modified.oxt"
8189     AC_MSG_RESULT([yes])
8190 else
8191     AC_MSG_RESULT([no])
8193 AC_SUBST(GOOGLE_DOCS_EXTENSION_PACK)
8195 dnl ===================================================================
8196 dnl Test whether to include NLPSolver extension
8197 dnl ===================================================================
8198 AC_MSG_CHECKING([for NLPSolver extension integration])
8199 if test "x$enable_ext_nlpsolver" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8200     BUILD_TYPE="$BUILD_TYPE NLPSOLVER"
8201     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NLPSOLVER"
8202     AC_MSG_RESULT([yes])
8203 else
8204     AC_MSG_RESULT([no])
8207 dnl ===================================================================
8208 dnl Test whether to include LanguageTool extension
8209 dnl ===================================================================
8210 AC_MSG_CHECKING([for LanguageTool extension integration])
8211 if test "x$enable_ext_languagetool" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8212     BUILD_TYPE="$BUILD_TYPE LANGUAGETOOL"
8213     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LANGUAGETOOL"
8214     AC_MSG_RESULT([yes])
8215 else
8216     AC_MSG_RESULT([no])
8219 dnl ===================================================================
8220 dnl Test whether to include oooblogger extension
8221 dnl ===================================================================
8222 AC_MSG_CHECKING([for oooblogger extension integration])
8223 OOOBLOGGER_EXTENSION_PACK=
8224 if test "x$enable_ext_oooblogger" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8225     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_OOOBLOGGER"
8226     OOOBLOGGER_EXTENSION_PACK="b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt"
8227     AC_MSG_RESULT([yes])
8228 else
8229     AC_MSG_RESULT([no])
8231 AC_SUBST(OOOBLOGGER_EXTENSION_PACK)
8232 ###############################################################################
8234 dnl ===================================================================
8235 dnl Test whether to include Sun Professional Template Pack
8236 dnl ===================================================================
8237 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
8238 if test "z$with_sun_templates" = "z" -o "z$with_sun_templates" = "zno" ; then
8239     SUNTEMPLATES_LANG=""
8240     AC_MSG_RESULT([no integration])
8241 else
8242     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
8243     sun_supported_langs="en-US de it fr es hu"
8244     if test "z$with_sun_templates" = "zyes" ; then
8245         wanted_sun_templates="$sun_supported_langs"
8246     else
8247         # check whether the langs are supported by Sun
8248         wanted_sun_templates=
8249         for lang in $with_sun_templates ; do
8250             if test -n "`echo $sun_supported_langs | grep "$lang"`" ; then
8251                 wanted_sun_templates="$wanted_sun_templates $lang"
8252             fi
8253         done
8254     fi
8255     SUNTEMPLATES_LANG=
8256     SUNTEMPLATES_DE_PACK=
8257     SUNTEMPLATES_EN_US_PACK=
8258     SUNTEMPLATES_ES_PACK=
8259     SUNTEMPLATES_FR_PACK=
8260     SUNTEMPLATES_HU_PACK=
8261     SUNTEMPLATES_IT_PACK=
8262     # check whether the langs are requested at all
8263     for lang in $wanted_sun_templates ; do
8264     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`" ; then
8265         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
8266         case $lang in
8267         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
8268         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
8269         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
8270         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
8271         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
8272         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
8273         esac
8274     fi
8275     done
8276     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
8278 AC_SUBST(SUNTEMPLATES_LANG)
8279 AC_SUBST(SUNTEMPLATES_DE_PACK)
8280 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
8281 AC_SUBST(SUNTEMPLATES_ES_PACK)
8282 AC_SUBST(SUNTEMPLATES_FR_PACK)
8283 AC_SUBST(SUNTEMPLATES_HU_PACK)
8284 AC_SUBST(SUNTEMPLATES_IT_PACK)
8286 dnl ===================================================================
8287 dnl Test whether to include fonts
8288 dnl ===================================================================
8289 AC_MSG_CHECKING([whether to include third-party fonts])
8290 if test "$with_fonts" != "no" ; then
8291     AC_MSG_RESULT([yes])
8292     WITH_FONTS=YES
8293     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
8294 else
8295     AC_MSG_RESULT([no])
8296     WITH_FONTS=NO
8297     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
8299 AC_SUBST(WITH_FONTS)
8301 AC_MSG_CHECKING([whether to include Agfa Monotype fonts])
8302 if test "$with_agfa_monotype_fonts" = "yes" ; then
8303     AC_MSG_RESULT([yes])
8304     WITH_AGFA_MONOTYPE_FONTS=YES
8305     SCPDEFS="$SCPDEFS -DWITH_AGFA_MONOTYPE_FONTS"
8306     BUILD_TYPE="$BUILD_TYPE AGFA_MONOTYPE_FONTS"
8307 else
8308     AC_MSG_RESULT([no])
8309     WITH_AGFA_MONOTYPE_FONTS=NO
8311 AC_SUBST(WITH_AGFA_MONOTYPE_FONTS)
8313 dnl ===================================================================
8314 dnl Test whether to include ppds
8315 dnl ===================================================================
8316 AC_MSG_CHECKING([whether to include PPDs])
8317 if test "$with_ppds" != "no"; then
8318     AC_MSG_RESULT([yes])
8319 else
8320     AC_MSG_RESULT([no])
8321     WITHOUT_PPDS=YES
8322     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
8324 AC_SUBST(WITHOUT_PPDS)
8326 dnl ===================================================================
8327 dnl Test whether to include afms
8328 dnl ===================================================================
8329 AC_MSG_CHECKING([whether to include AFMs])
8330 if test "$with_afms" != "no"; then
8331     AC_MSG_RESULT([yes])
8332     BUILD_TYPE="$BUILD_TYPE AFMS"
8333 else
8334     AC_MSG_RESULT([no])
8335     WITHOUT_AFMS=YES
8336     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
8338 AC_SUBST(WITHOUT_AFMS)
8340 dnl ===================================================================
8341 dnl Test whether to include extra galleries
8342 dnl ===================================================================
8343 AC_MSG_CHECKING([whether to include extra galleries])
8344 if test "z$enable_extra_gallery" = "z" -o "z$enable_extra_gallery" = "zno" ; then
8345     AC_MSG_RESULT([no])
8346     WITH_EXTRA_GALLERY=NO
8347     OOOP_GALLERY_PACK=""
8348 else
8349     AC_MSG_RESULT([yes])
8350     WITH_EXTRA_GALLERY=YES
8351     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
8352     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
8353     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
8355 AC_SUBST(WITH_EXTRA_GALLERY)
8356 AC_SUBST(OOOP_GALLERY_PACK)
8358 dnl ===================================================================
8359 dnl Test whether to include extra templates
8360 dnl ===================================================================
8361 AC_MSG_CHECKING([whether to include extra templates])
8362 if test "z$enable_extra_template" = "z" -o "z$enable_extra_template" = "zno" ; then
8363     AC_MSG_RESULT([no])
8364     WITH_EXTRA_TEMPLATE=NO
8365     OOOP_TEMPLATES_PACK=""
8366 else
8367     AC_MSG_RESULT([yes])
8368     WITH_EXTRA_TEMPLATE=YES
8369     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
8370     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
8371     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
8373 AC_SUBST(WITH_EXTRA_TEMPLATE)
8374 AC_SUBST(OOOP_TEMPLATES_PACK)
8376 dnl ===================================================================
8377 dnl Test whether to include extra samples
8378 dnl ===================================================================
8379 AC_MSG_CHECKING([whether to include extra samples])
8380 if test "z$enable_extra_sample" = "z" -o "z$enable_extra_sample" = "zno" ; then
8381     AC_MSG_RESULT([no])
8382     WITH_EXTRA_SAMPLE=NO
8383     OOOP_SAMPLES_PACK=""
8384 else
8385     AC_MSG_RESULT([yes])
8386     WITH_EXTRA_SAMPLE=YES
8387     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
8388     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
8389     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
8391 AC_SUBST(WITH_EXTRA_SAMPLE)
8392 AC_SUBST(OOOP_SAMPLES_PACK)
8394 dnl ===================================================================
8395 dnl Test whether to include extra fonts
8396 dnl ===================================================================
8397 AC_MSG_CHECKING([whether to include extra fonts])
8398 if test "z$enable_extra_font" = "z" -o "z$enable_extra_font" = "zno" ; then
8399     AC_MSG_RESULT([no])
8400     WITH_EXTRA_FONT=NO
8401     OOOP_FONTS_PACK=""
8402 else
8403     AC_MSG_RESULT([yes])
8404     WITH_EXTRA_FONT=YES
8405     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
8406     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
8407     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
8409 AC_SUBST(WITH_EXTRA_FONT)
8410 AC_SUBST(OOOP_FONTS_PACK)
8412 dnl ===================================================================
8413 dnl Test whether to build global menu support
8414 dnl ===================================================================
8415 AC_MSG_CHECKING([whether to build global menu support])
8416 if test "z$enable_lomenubar" = "z" -o "z$enable_lomenubar" = "zno" ; then
8417     AC_MSG_RESULT([no])
8418     ENABLE_LOMENUBAR="FALSE"
8419 else
8420     AC_MSG_RESULT([yes])
8421     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]))
8422     ENABLE_LOMENUBAR="TRUE"
8424 AC_SUBST(ENABLE_LOMENUBAR)
8426 dnl ===================================================================
8427 dnl Test whether to enable online update service
8428 dnl ===================================================================
8429 AC_MSG_CHECKING([whether to enable online update])
8430 ENABLE_ONLINE_UPDATE=
8431 if test "z$enable_online_update" = "z" ; then
8432     if test "$_os" = "WINNT" -o "$_os" = "Darwin" ; then
8433         AC_MSG_RESULT([yes])
8434         ENABLE_ONLINE_UPDATE="TRUE"
8435     else
8436         AC_MSG_RESULT([no])
8437     fi
8438 else
8439     if test "z$enable_online_update" = "zyes" ; then
8440         AC_MSG_RESULT([yes])
8441         ENABLE_ONLINE_UPDATE="TRUE"
8442     else
8443         AC_MSG_RESULT([no])
8444     fi
8446 AC_SUBST(ENABLE_ONLINE_UPDATE)
8448 dnl ===================================================================
8449 dnl Test whether build target is Release Build
8450 dnl ===================================================================
8451 AC_MSG_CHECKING([whether build target is Release Build])
8452 if test "z$enable_release_build" = "z" -o "z$enable_release_build" = "zno" ; then
8453     AC_MSG_RESULT([no])
8454     ENABLE_RELEASE_BUILD="FALSE"
8455 else
8456     AC_MSG_RESULT([yes])
8457     ENABLE_RELEASE_BUILD="TRUE"
8459 AC_SUBST(ENABLE_RELEASE_BUILD)
8461 dnl ===================================================================
8462 dnl Test whether to create MSI with LIMITUI=1 (silent install)
8463 dnl ===================================================================
8464 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
8465 if test "z$enable_silent_msi" = "z" -o "z$enable_silent_msi" = "zno" ; then
8466     AC_MSG_RESULT([no])
8467     ENABLE_SILENT_MSI="FALSE"
8468 else
8469     AC_MSG_RESULT([yes])
8470     ENABLE_SILENT_MSI="TRUE"
8471     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
8473 AC_SUBST(ENABLE_SILENT_MSI)
8475 dnl ===================================================================
8476 dnl Test whether to enable ActiveX embedding
8477 dnl ===================================================================
8478 if test "$_os" = "WINNT"; then
8479     AC_MSG_CHECKING([whether to enable ActiveX embedding of LibreOffice components])
8480     if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
8481         ENABLE_ACTIVEX_COMPONENT="TRUE"
8482         AC_MSG_RESULT([yes])
8483         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
8484     else
8485         ENABLE_ACTIVEX_COMPONENT=""
8486         AC_MSG_RESULT([no])
8487     fi
8488     AC_SUBST(ENABLE_ACTIVEX_COMPONENT)
8489     AC_SUBST(SCPDEFS)
8492 AC_MSG_CHECKING([whether and how to use Xinerama])
8493 if test "$_os" = "Darwin"; then
8494     USE_XINERAMA=YES
8495     XINERAMA_LINK=dynamic
8496     AC_MSG_RESULT([yes])
8497 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
8498     if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
8499         # we have both versions, let the user decide but use the dynamic one
8500         # per default
8501         USE_XINERAMA=YES
8502         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
8503             XINERAMA_LINK=dynamic
8504         else
8505             XINERAMA_LINK=static
8506         fi
8507     elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
8508         # we have only the dynamic version
8509         USE_XINERAMA=YES
8510         XINERAMA_LINK=dynamic
8511     elif test -e "$XLIB/libXinerama.a"; then
8512         # static version
8513         if echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
8514             USE_XINERAMA=YES
8515             XINERAMA_LINK=static
8516         else
8517             USE_XINERAMA=NO
8518             XINERAMA_LINK=none
8519         fi
8520     else
8521         # no Xinerama
8522         USE_XINERAMA=NO
8523         XINERAMA_LINK=none
8524     fi
8525     if test "$USE_XINERAMA" = "YES"; then
8526         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
8527         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
8528             [AC_MSG_ERROR(Xinerama header not found.)], [])
8529         XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
8530         if test "$_os" = "FreeBSD"; then
8531             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
8532         fi
8533         if test "$_os" = "Linux"; then
8534             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
8535         fi
8536         AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
8537             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
8538     else
8539         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
8540     fi
8541 else
8542     USE_XINERAMA=NO
8543     XINERAMA_LINK=none
8544     AC_MSG_RESULT([no])
8546 AC_SUBST(USE_XINERAMA)
8547 AC_SUBST(XINERAMA_LINK)
8549 dnl ===================================================================
8550 dnl Checks for librsvg
8551 dnl ===================================================================
8553 dnl ENABLE_LIBRSVG is set to "" (for NO), SYSTEM or INTERNAL. The
8554 dnl SYSTEM_LIBRSVG, SYSTEM_GDKPIXBUF etc are redundant.
8556 ENABLE_LIBRSVG=""
8557 LIBRSVG_CFLAGS=""
8558 LIBRSVG_LIBS=""
8560 AC_MSG_CHECKING([what librsvg to use])
8562 case "$enable_librsvg" in
8563 no|disable)
8564     AC_MSG_RESULT([none])
8565     enable_librsvg=no
8566     ;;
8568 ""|yes|auto)
8569     if test $build_os = cygwin -o \
8570            $_os = Darwin; then
8571         dnl When building on/for these OSes always use the internal one,
8572         dnl if at all. Add more OSes above as needed.
8573         AC_MSG_RESULT([internal])
8574         enable_librsvg=internal
8575     elif test  $_os = iOS -o $_os = Android; then
8576         AC_MSG_RESULT([none])
8577         enable_librsvg=no
8578     else
8579         if test "$with_system_libs" = yes; then
8580             AC_MSG_RESULT([system])
8581             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8582             enable_librsvg=system
8583         elif test "$with_system_libs" = no; then
8584             AC_MSG_RESULT([internal])
8585             enable_librsvg=internal
8586         else
8587             AC_MSG_RESULT([checking further])
8588             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14,, [:])
8589             if test -z "$LIBRSVG_PKG_ERRORS"; then
8590                 enable_librsvg=system
8591             else
8592                 enable_librsvg=internal
8593             fi
8594         fi
8595     fi
8596     ;;
8598 internal)
8599     AC_MSG_RESULT([internal])
8600     ;;
8602 system)
8603     if test $_os = WINNT -a "$WITH_MINGW" != yes; then
8604         AC_MSG_ERROR([Must use internal librsvg when building with MSVC])
8605     fi
8606     AC_MSG_RESULT([system])
8607     PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8608     ;;
8611     AC_MSG_ERROR([Incorrect --enable-librsvg option])
8612     ;;
8613 esac
8615 dnl By now enable_librsvg should be "system", "internal" or "no"
8616 case $enable_librsvg in
8617 system)
8618     ENABLE_LIBRSVG=SYSTEM
8619     SYSTEM_LIBRSVG=YES
8620     ;;
8622 internal)
8623     ENABLE_LIBRSVG=INTERNAL
8624     SYSTEM_LIBRSVG=NO
8625     BUILD_TYPE="$BUILD_TYPE LIBRSVG"
8626     ;;
8629     ENABLE_LIBRSVG=NO
8630     SYSTEM_LIBRSVG=NO
8631     ;;
8634     AC_MSG_ERROR([Internal configure script error, invalid enable_librsvg value "$enable_librsvg"])
8635     ;;
8636 esac
8638 AC_SUBST(ENABLE_LIBRSVG)
8639 AC_SUBST(LIBRSVG_CFLAGS)
8640 AC_SUBST(LIBRSVG_LIBS)
8641 AC_SUBST(SYSTEM_LIBRSVG)
8643 dnl ===================================================================
8644 dnl Test whether to build cairo or rely on the system version
8645 dnl ===================================================================
8648 SYSTEM_CAIRO=""
8650 AC_MSG_CHECKING([whether to use the system cairo])
8652 if test "$with_system_cairo" = "yes"; then
8653     SYSTEM_CAIRO=YES
8654     AC_MSG_RESULT([yes])
8656     PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
8658     if test "$test_xrender" = "yes"; then
8659         if test "$with_system_xextensions_headers" != "no"; then
8660             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
8661             AC_LANG_PUSH([C])
8662             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
8663 #ifdef PictStandardA8
8664 #else
8665       return fail;
8666 #endif
8667 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
8669             AC_LANG_POP([C])
8670         fi
8671     fi
8672     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libfontconfig-1.dll libfreetype-6.dll libpixman-1-0.dll libpng15-15.dll libcairo-2.dll"
8673 else
8674     AC_MSG_RESULT([no])
8676     if test $_os = Android; then
8677         dnl For Android cairo isn't
8678         dnl buildable yet.
8679         :
8680     elif test $_os = WINNT; then
8681         dnl We only need cairo for Windows if we
8682         dnl build librsvg or directx disabled
8683         if test "$ENABLE_LIBRSVG" != NO -o -z "$ENABLE_DIRECTX"; then
8684             BUILD_TYPE="$BUILD_TYPE CAIRO"
8685         fi
8686     else
8687         BUILD_TYPE="$BUILD_TYPE CAIRO"
8688     fi
8691 AC_SUBST(SYSTEM_CAIRO)
8692 AC_SUBST(CAIRO_CFLAGS)
8693 AC_SUBST(CAIRO_LIBS)
8696 dnl ===================================================================
8697 dnl Test whether to build gdk-pixbuf or rely on the system version
8698 dnl ===================================================================
8700 AC_MSG_CHECKING([whether to use the system gdk-pixbuf])
8702 dnl As long as the only thing we need gdk-pixbuf for is below
8703 dnl librsvg, use the same --enable-librsvg (possibly implied
8704 dnl by --with-system-libs) to override this.
8706 if test "$SYSTEM_LIBRSVG" = YES; then
8707     SYSTEM_GDKPIXBUF=YES
8708     AC_MSG_RESULT([yes])
8709 else
8710     case "$_os" in
8711     WINNT|Darwin|iOS|Android)
8712         SYSTEM_GDKPIXBUF=NO
8713         AC_MSG_RESULT([no])
8714         ;;
8715     *)
8716         SYSTEM_GDKPIXBUF=YES
8717         AC_MSG_RESULT([yes])
8718         ;;
8719     esac
8721 AC_SUBST(SYSTEM_GDKPIXBUF)
8723 dnl ===================================================================
8724 dnl Test whether to build GLib or rely on the system version
8725 dnl ===================================================================
8727 AC_MSG_CHECKING([whether to use the system GLib])
8729 dnl As long as the only thing we need GLib for is below
8730 dnl librsvg, use the same --enable-librsvg (possibly implied
8731 dnl by --with-system-libs) to override this.
8733 if test "$SYSTEM_LIBRSVG" = YES; then
8734     SYSTEM_GLIB=YES
8735     AC_MSG_RESULT([yes])
8736 else
8737     case "$_os" in
8738     WINNT|Darwin|iOS|Android)
8739         SYSTEM_GLIB=NO
8740         AC_MSG_RESULT([no])
8741         ;;
8742     *)
8743         SYSTEM_GLIB=YES
8744         AC_MSG_RESULT([yes])
8745         ;;
8746     esac
8748 AC_SUBST(SYSTEM_GLIB)
8750 dnl ===================================================================
8751 dnl Test whether to build gettext runtime (libintl) or rely on the
8752 dnl system version
8753 dnl ===================================================================
8755 AC_MSG_CHECKING([whether to use the system gettext runtime])
8757 if test "$with_system_gettext" = yes; then
8758     SYSTEM_GETTEXT=YES
8759     AC_MSG_RESULT([yes])
8760 else
8761     case "$_os" in
8762     WINNT|Darwin|iOS|Android)
8763         SYSTEM_GETTEXT=NO
8764         AC_MSG_RESULT([no])
8765         ;;
8766     *)
8767         SYSTEM_GETTEXT=YES
8768         AC_MSG_RESULT([yes])
8769         ;;
8770     esac
8772 AC_SUBST(SYSTEM_GETTEXT)
8774 dnl ===================================================================
8775 dnl Test whether to build libcroco or rely on the system version
8776 dnl ===================================================================
8778 AC_MSG_CHECKING([whether to use the system libcroco])
8780 dnl As long as the only thing we need libcroco for is below
8781 dnl librsvg, use the same --enable-librsvg (possibly implied
8782 dnl by --with-system-libs) to override this.
8784 if test "$SYSTEM_LIBRSVG" = YES; then
8785     SYSTEM_LIBCROCO=YES
8786     AC_MSG_RESULT([yes])
8787 else
8788     case "$_os" in
8789     WINNT|Darwin|iOS|Android)
8790         SYSTEM_LIBCROCO=NO
8791         AC_MSG_RESULT([no])
8792         ;;
8793     *)
8794         SYSTEM_LIBCROCO=YES
8795         AC_MSG_RESULT([yes])
8796         ;;
8797     esac
8799 AC_SUBST(SYSTEM_LIBCROCO)
8801 dnl ===================================================================
8802 dnl Test whether to build Pango or rely on the system version
8803 dnl ===================================================================
8805 AC_MSG_CHECKING([whether to use the system pango])
8807 dnl As long as the only thing we need Pango for is below
8808 dnl librsvg, use the same --enable-librsvg (possibly implied
8809 dnl by --with-system-libs) to override this.
8811 if test "$SYSTEM_LIBRSVG" = YES; then
8812     SYSTEM_PANGO=YES
8813     AC_MSG_RESULT([yes])
8814 else
8815     case "$_os" in
8816     WINNT|Darwin|iOS|Android)
8817         SYSTEM_PANGO=NO
8818         AC_MSG_RESULT([no])
8819         ;;
8820     *)
8821         SYSTEM_PANGO=YES
8822         AC_MSG_RESULT([yes])
8823         ;;
8824     esac
8826 AC_SUBST(SYSTEM_PANGO)
8828 dnl ===================================================================
8829 dnl Test whether to build libgsf or rely on the system version
8830 dnl ===================================================================
8832 AC_MSG_CHECKING([whether to use the system libgsf])
8834 dnl As long as the only thing we need libgsf for is below librsvg (is
8835 dnl it?), use the same --enable-librsvg (possibly implied by
8836 dnl --with-system-libs) to override this.
8838 if test "$SYSTEM_LIBRSVG" = YES; then
8839     SYSTEM_LIBGSF=YES
8840     AC_MSG_RESULT([yes])
8841 else
8842     case "$_os" in
8843     WINNT|Darwin|iOS|Android)
8844         SYSTEM_LIBGSF=NO
8845         AC_MSG_RESULT([no])
8846         ;;
8847     *)
8848         SYSTEM_LIBGSF=YES
8849         AC_MSG_RESULT([yes])
8850         ;;
8851     esac
8853 AC_SUBST(SYSTEM_LIBGSF)
8855 dnl ===================================================================
8856 dnl Test whether to build libpng or rely on the system version
8857 dnl ===================================================================
8859 AC_MSG_CHECKING([whether to use the system libpng])
8861 dnl How should and does this interact with the checks for libpng
8862 dnl related to use of libpng in the quickstarter above? This needs to
8863 dnl be unified.
8865 if test "$with_system_libpng" = yes; then
8866     SYSTEM_LIBPNG=YES
8867     AC_MSG_RESULT([yes])
8868 else
8869     case "$_os" in
8870     WINNT|Darwin|iOS|Android)
8871         SYSTEM_LIBPNG=NO
8872         AC_MSG_RESULT([no])
8873         ;;
8874     *)
8875         SYSTEM_LIBPNG=YES
8876         AC_MSG_RESULT([no])
8877         ;;
8878     esac
8880 AC_SUBST(SYSTEM_LIBPNG)
8882 dnl ===================================================================
8883 dnl Test whether to build libjpeg or rely on the system version
8884 dnl ===================================================================
8885 dnl FIXME: this is currently because we have jpeg-6b for our filters
8886 dnl        and jpeg-8 as dependency for librsvg
8887 dnl        this should be unified into using only one version for both
8889 AC_MSG_CHECKING([whether to use the system libjpeg])
8891 if test "$SYSTEM_JPEG" == "YES"; then
8892     SYSTEM_LIBJPEG=YES
8893     AC_MSG_RESULT([yes])
8894 else
8895     case "$_os" in
8896     WINNT|Darwin|iOS|Android)
8897         SYSTEM_LIBJPEG=NO
8898         AC_MSG_RESULT([no])
8899         ;;
8900     *)
8901         SYSTEM_LIBJPEG=YES
8902         AC_MSG_RESULT([yes])
8903         ;;
8904     esac
8906 AC_SUBST(SYSTEM_LIBJPEG)
8908 dnl ===================================================================
8909 dnl Check for runtime JVM search path
8910 dnl ===================================================================
8911 if test "$SOLAR_JAVA" != ""; then
8912     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
8913     if test -n "$with_jvm_path" && test "$with_jvm_path" != "no"; then
8914         AC_MSG_RESULT([yes])
8915         if ! test -d "$with_jvm_path"; then
8916             AC_MSG_ERROR(["$with_jvm_path" not a directory])
8917         fi
8918         if ! test -d "$with_jvm_path"jvm; then
8919             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
8920         fi
8921         JVM_ONE_PATH_CHECK="$with_jvm_path"
8922         AC_SUBST(JVM_ONE_PATH_CHECK)
8923     else
8924         AC_MSG_RESULT([no])
8925     fi
8928 dnl ===================================================================
8929 dnl Test for the presence of Ant and that it works
8930 dnl ===================================================================
8932 if test "$SOLAR_JAVA" != ""; then
8933     ANT_HOME=; export ANT_HOME
8934     WITH_ANT_HOME=; export WITH_ANT_HOME
8935     if test -z "$with_ant_home"; then
8936         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
8937     else
8938         if test "$_os" = "WINNT"; then
8939             with_ant_home=`cygpath -u "$with_ant_home"`
8940         fi
8941         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
8942         WITH_ANT_HOME=$with_ant_home
8943         ANT_HOME=$with_ant_home
8944     fi
8946     if test -z "$ANT"; then
8947         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
8948     else
8949         # resolve relative or absolute symlink
8950         while test -h "$ANT"; do
8951             a_cwd=`pwd`
8952             a_basename=`basename "$ANT"`
8953             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
8954             cd "`dirname "$ANT"`"
8955             cd "`dirname "$a_script"`"
8956             ANT="`pwd`"/"`basename "$a_script"`"
8957             cd "$a_cwd"
8958         done
8960         AC_MSG_CHECKING([if $ANT works])
8961         cat > conftest.java << EOF
8962         public class conftest {
8963             int testmethod(int a, int b) {
8964                     return a + b;
8965             }
8966         }
8969         cat > conftest.xml << EOF
8970         <project name="conftest" default="conftest">
8971         <target name="conftest">
8972             <javac srcdir="." includes="conftest.java">
8973             </javac>
8974         </target>
8975         </project>
8978         oldJAVA_HOME=$JAVA_HOME
8979         if test "$JAVACISGCJ" = "yes"; then
8980             JAVA_HOME=; export JAVA_HOME
8981             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
8982         else
8983             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
8984         fi
8985         AC_TRY_EVAL(ant_cmd)
8986         if test $? = 0 && test -f ./conftest.class ; then
8987             AC_MSG_RESULT([Ant works])
8988             if test -z "$WITH_ANT_HOME"; then
8989                 ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
8990                 if test -z "$ANT_HOME"; then
8991                     ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
8992                 fi
8993             else
8994                 ANT_HOME="$WITH_ANT_HOME"
8995             fi
8996         else
8997             echo "configure: Ant test failed" >&5
8998             cat conftest.java >&5
8999             cat conftest.xml >&5
9000             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
9001             ANT_HOME=""
9002             echo "Ant does not work - Some Java projects will not build!" >>warn
9003         fi
9004         JAVA_HOME=$oldJAVA_HOME
9005         rm -f conftest* core core.* *.core
9006     fi
9007     if test -z "$ANT_HOME"; then
9008         ANT_HOME="NO_ANT_HOME"
9009     fi
9010     AC_SUBST(ANT_HOME)
9012     dnl Checking for ant.jar
9013     if test "$ANT_HOME" != "NO_ANT_HOME"; then
9014         AC_MSG_CHECKING([Ant lib directory])
9015         if test -f $ANT_HOME/lib/ant.jar; then
9016             ANT_LIB="$ANT_HOME/lib"
9017         else
9018             if test -f $ANT_HOME/ant.jar; then
9019                 ANT_LIB="$ANT_HOME"
9020             else
9021                 if test -f /usr/share/java/ant.jar; then
9022                     ANT_LIB=/usr/share/java
9023                 else
9024                     if test -f /usr/share/ant-core/lib/ant.jar; then
9025                         ANT_LIB=/usr/share/ant-core/lib
9026                     else
9027                         if test -f $ANT_HOME/lib/ant/ant.jar; then
9028                             ANT_LIB="$ANT_HOME/lib/ant"
9029                         else
9030                             if test -f /usr/share/lib/ant/ant.jar; then
9031                                 ANT_LIB=/usr/share/lib/ant
9032                             else
9033                                 AC_MSG_ERROR([Ant libraries not found!])
9034                             fi
9035                         fi
9036                     fi
9037                 fi
9038             fi
9039         fi
9040         AC_MSG_RESULT([Ant lib directory found.])
9041     fi
9042     AC_SUBST(ANT_LIB)
9044     ant_minver=1.6.0
9045     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
9047     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
9048     ant_version=`$ANT -version | $AWK '{ print $4; }'`
9049     ant_version_major=`echo $ant_version | cut -d. -f1`
9050     ant_version_minor=`echo $ant_version | cut -d. -f2`
9051     echo "configure: ant_version $ant_version " >&5
9052     echo "configure: ant_version_major $ant_version_major " >&5
9053     echo "configure: ant_version_minor $ant_version_minor " >&5
9054     if test "$ant_version_major" -ge "2"; then
9055         AC_MSG_RESULT([yes, $ant_version])
9056     elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
9057         AC_MSG_RESULT([yes, $ant_version])
9058     else
9059         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
9060     fi
9062     if test "$ENABLE_MEDIAWIKI" = "YES"; then
9063         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
9064         rm -rf confdir
9065         mkdir confdir
9066         cat > conftest.java << EOF
9067             public class conftest {
9068                 int testmethod(int a, int b) {
9069                     return a + b;
9070                 }
9071             }
9074         cat > conftest.xml << EOF
9075             <project name="conftest" default="conftest">
9076             <target name="conftest" depends="copytest">
9077                 <javac srcdir="." includes="conftest.java">
9078                 </javac>
9079             </target>
9080             <target name="copytest">
9081                  <copy todir="confdir">
9082                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
9083                  <filterset/>
9084                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
9085                  </copy>
9086             </target>
9087             </project>
9090         if test "$JAVACISGCJ" = "yes"; then
9091             JAVA_HOME=; export JAVA_HOME
9092             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
9093         else
9094             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
9095         fi
9096         AC_TRY_EVAL(ant_cmd)
9097         if test $? = 0 && test -f ./conftest.class ; then
9098             AC_MSG_RESULT([yes])
9099             rm -rf confdir
9100         else
9101             echo "configure: Ant test failed" >&5
9102             cat conftest.java >&5
9103             cat conftest.xml >&5
9104             rm -rf confdir
9105             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
9106         fi
9107     fi
9108     rm -f conftest* core core.* *.core
9111 OOO_JUNIT_JAR=
9112 if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
9113     AC_MSG_CHECKING([for JUnit 4])
9114     if test "$with_junit" = "yes"; then
9115         if test -e /usr/share/java/junit4.jar; then
9116             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
9117         else
9118            if test -e /usr/share/lib/java/junit.jar; then
9119               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
9120            else
9121               OOO_JUNIT_JAR=/usr/share/java/junit.jar
9122            fi
9123         fi
9124     else
9125         OOO_JUNIT_JAR=$with_junit
9126     fi
9127     if test "$_os" = "WINNT"; then
9128         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
9129     fi
9130     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
9131         grep org/junit/Before.class > /dev/null 2>&5
9132     if test $? -eq 0; then
9133         # check if either class-path entry is available for hamcrest or
9134         # it's bundled
9135         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |grep -q hamcrest || \
9136             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |grep -q 'Class-Path: hamcrest'; then
9137             AC_MSG_RESULT([$OOO_JUNIT_JAR])
9138         else
9139             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
9140 provide a full junit jar or use --without-junit])
9141         fi
9142     else
9143         AC_MSG_RESULT([no])
9144         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
9145 location (/usr/share/java), specify its pathname via
9146 --with-junit=..., or disable it via --without-junit])
9147     fi
9149 AC_SUBST(OOO_JUNIT_JAR)
9151 dnl ===================================================================
9152 dnl Product version
9153 dnl ===================================================================
9154 AC_MSG_CHECKING([for product version])
9155 PRODUCTVERSION=AC_PACKAGE_VERSION
9156 AC_MSG_RESULT([$PRODUCTVERSION])
9157 AC_SUBST(PRODUCTVERSION)
9159 dnl ===================================================================
9160 dnl Dealing with l10n options
9161 dnl ===================================================================
9162 AC_MSG_CHECKING([which languages to be built])
9163 # get list of all languages
9164 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
9165 # the sed command does the following:
9166 #   + if a line ends with a backslash, append the next line to it
9167 #   + adds " on the beginning of the value (after =)
9168 #   + adds " at the end of the value
9169 #   + removes en-US; we want to put it on the beginning
9170 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
9171 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' solenv/inc/langlist.mk)]
9172 ALL_LANGS="en-US $completelangiso"
9173 # check the configured localizations
9174 WITH_LANG="$with_lang"
9175 if test -z "$WITH_LANG"; then
9176     AC_MSG_RESULT([en-US])
9177 else
9178     AC_MSG_RESULT([$WITH_LANG])
9179     GIT_REPO_NAMES="$GIT_REPO_NAMES translations"
9181 # check that the list is valid
9182 for lang in $WITH_LANG ; do
9183     test "$lang" = "ALL" && continue;
9184     # need to check for the exact string, so add space before and after the list of all languages
9185     for vl in $ALL_LANGS ; do
9186         if test "$vl" = "$lang" ; then
9187            break;
9188         fi
9189     done
9190     if test "$vl" != "$lang" ; then
9191         AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
9192     fi
9193 done
9194 # list with substituted ALL
9195 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
9196 # this variable is used only by bin/distro-install-* helper scripts
9197 # they need a real list of languages
9198 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
9199 AC_SUBST(ALL_LANGS)
9200 AC_SUBST(WITH_LANG)
9201 AC_SUBST(WITH_LANG_LIST)
9202 AC_SUBST(GIT_REPO_NAMES)
9204 dnl git-new-workdir
9205 dnl ===================================================================
9206 if test -n "${GIT_LINK_SRC}"; then
9207     for repo in ${GIT_REPO_NAMES}; do
9208         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
9209             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
9210         fi
9211     done
9213 AC_SUBST(GIT_LINK_SRC)
9215 AC_MSG_CHECKING([for another 'intro' bitmap])
9216 INTRO_BITMAP=
9217 if test -z "$with_intro_bitmap" -o "$with_intro_bitmap" = "no" ; then
9218     INTRO_BITMAP=
9219     AC_MSG_RESULT([none])
9220 else
9221     case "$with_intro_bitmap" in
9222     *.png) INTRO_BITMAP="$with_intro_bitmap" ;;
9223     *)     AC_MSG_WARN([Intro bitmap should be a .png file!]) ;;
9224     esac
9225     AC_MSG_RESULT([$INTRO_BITMAP])
9227 AC_SUBST(INTRO_BITMAP)
9229 AC_MSG_CHECKING([for custom 'intro' progress bar color])
9230 PROGRESSBARCOLOR=
9231 if test -z "$with_intro_progressbar_color" ; then
9232    PROGRESSBARCOLOR="126,170,23"
9233    AC_MSG_RESULT([none])
9234 else
9235    PROGRESSBARCOLOR="$with_intro_progressbar_color"
9236    AC_MSG_RESULT([$PROGRESSBARCOLOR])
9238 AC_SUBST(PROGRESSBARCOLOR)
9240 AC_MSG_CHECKING([for custom 'intro' progress bar size])
9241 PROGRESSSIZE=
9242 if test -z "$with_intro_progressbar_size" ; then
9243    PROGRESSSIZE="319,10"
9244    AC_MSG_RESULT([none])
9245 else
9246    PROGRESSSIZE="$with_intro_progressbar_size"
9247    AC_MSG_RESULT([$PROGRESSSIZE])
9249 AC_SUBST(PROGRESSSIZE)
9251 AC_MSG_CHECKING([for custom 'intro' progress bar position])
9252 PROGRESSPOSITION=
9253 if test -z "$with_intro_progressbar_position" ; then
9254    PROGRESSPOSITION="164,225"
9255    AC_MSG_RESULT([none])
9256 else
9257    PROGRESSPOSITION="$with_intro_progressbar_position"
9258    AC_MSG_RESULT([$PROGRESSPOSITION])
9260 AC_SUBST(PROGRESSPOSITION)
9262 AC_MSG_CHECKING([for custom 'intro' progress bar frame color])
9263 PROGRESSFRAMECOLOR=
9264 if test -z "$with_intro_progressbar_frame_color" ; then
9265    PROGRESSFRAMECOLOR="207,208,211"
9266    AC_MSG_RESULT([none])
9267 else
9268    PROGRESSFRAMECOLOR="$with_intro_progressbar_frame_color"
9269    AC_MSG_RESULT([$PROGRESSFRAMECOLOR])
9271 AC_SUBST(PROGRESSFRAMECOLOR)
9273 AC_MSG_CHECKING([for another 'about' bitmap])
9274 ABOUT_BITMAP=
9275 if test -z "$with_about_bitmap" -o "$with_about_bitmap" = "no" ; then
9276     ABOUT_BITMAP=
9277     AC_MSG_RESULT([none])
9278 else
9279    case "$with_about_bitmap" in
9280    *.png) ABOUT_BITMAP="$with_about_bitmap" ;;
9281    *)     AC_MSG_WARN([About bitmap should be a .png file!]) ;;
9282    esac
9283    AC_MSG_RESULT([$ABOUT_BITMAP])
9285 AC_SUBST(ABOUT_BITMAP)
9287 AC_MSG_CHECKING([for another 'start center left' bitmap])
9288 STARTCENTER_LEFT_BITMAP=
9289 if test -z "$with_startcenter_left_bitmap" -o "$with_startcenter_left_bitmap" = "no" ; then
9290    STARTCENTER_LEFT_BITMAP=
9291    AC_MSG_RESULT([none])
9292 else
9293    case "$with_startcenter_left_bitmap" in
9294       *.png) STARTCENTER_LEFT_BITMAP="$with_startcenter_left_bitmap" ;;
9295       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9296    esac
9297    AC_MSG_RESULT([$STARTCENTER_LEFT_BITMAP])
9299 AC_SUBST(STARTCENTER_LEFT_BITMAP)
9301 AC_MSG_CHECKING([for another 'start center right' bitmap])
9302 STARTCENTER_RIGHT_BITMAP=
9303 if test -z "$with_startcenter_right_bitmap" -o "$with_startcenter_right_bitmap" = "no" ; then
9304    STARTCENTER_RIGHT_BITMAP=
9305    AC_MSG_RESULT([none])
9306 else
9307    case "$with_startcenter_right_bitmap" in
9308       *.png) STARTCENTER_RIGHT_BITMAP="$with_startcenter_right_bitmap" ;;
9309       *)     AC_MSG_WARN([Startcenter right bitmap should be a .png file!]) ;;
9310    esac
9311    AC_MSG_RESULT([$STARTCENTER_RIGHT_BITMAP])
9313 AC_SUBST(STARTCENTER_RIGHT_BITMAP)
9315 AC_MSG_CHECKING([for another 'start center rtl left' bitmap])
9316 STARTCENTER_RTL_LEFT_BITMAP=
9317 if test -z "$with_startcenter_rtl_left_bitmap" -o "$with_startcenter_rtl_left_bitmap" = "no" ; then
9318    STARTCENTER_RTL_LEFT_BITMAP=
9319    AC_MSG_RESULT([none])
9320 else
9321    case "$with_startcenter_rtl_left_bitmap" in
9322       *.png) STARTCENTER_RTL_LEFT_BITMAP="$with_startcenter_rtl_left_bitmap" ;;
9323       *)     AC_MSG_WARN([Startcenter rtl left bitmap should be a .png file!]) ;;
9324    esac
9325    AC_MSG_RESULT([$STARTCENTER_RTL_LEFT_BITMAP])
9327 AC_SUBST(STARTCENTER_RTL_LEFT_BITMAP)
9329 AC_MSG_CHECKING([for another 'start center rtl right' bitmap])
9330 STARTCENTER_RTL_RIGHT_BITMAP=
9331 if test -z "$with_startcenter_rtl_right_bitmap" -o "$with_startcenter_rtl_right_bitmap" = "no" ; then
9332    STARTCENTER_RTL_RIGHT_BITMAP=
9333    AC_MSG_RESULT([none])
9334 else
9335    case "$with_startcenter_rtl_right_bitmap" in
9336       *.png) STARTCENTER_RTL_RIGHT_BITMAP="$with_startcenter_rtl_right_bitmap" ;;
9337       *)     AC_MSG_WARN([Startcenter rtl right bitmap should be a .png file!]) ;;
9338    esac
9339    AC_MSG_RESULT([$STARTCENTER_RTL_RIGHT_BITMAP])
9341 AC_SUBST(STARTCENTER_RTL_RIGHT_BITMAP)
9343 AC_MSG_CHECKING([for another 'start center space' bitmap])
9344 STARTCENTER_SPACE_BITMAP=
9345 if test -z "$with_startcenter_space_bitmap" -o "$with_startcenter_space_bitmap" = "no" ; then
9346    STARTCENTER_SPACE_BITMAP=
9347    AC_MSG_RESULT([none])
9348 else
9349    case "$with_startcenter_space_bitmap" in
9350       *.png) STARTCENTER_SPACE_BITMAP="$with_startcenter_space_bitmap" ;;
9351       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9352    esac
9353    AC_MSG_RESULT([$STARTCENTER_SPACE_BITMAP])
9355 AC_SUBST(STARTCENTER_SPACE_BITMAP)
9357 OOO_VENDOR=
9358 AC_MSG_CHECKING([for vendor])
9359 if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
9360     AC_MSG_RESULT([not set])
9361 else
9362     OOO_VENDOR="$with_vendor"
9363     AC_MSG_RESULT([$OOO_VENDOR])
9365 AC_SUBST(OOO_VENDOR)
9367 UNIXWRAPPERNAME=
9368 AC_MSG_CHECKING([for UNIX wrapper name])
9369 if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
9370     AC_MSG_RESULT([not set])
9371 else
9372     UNIXWRAPPERNAME="$with_unix_wrapper"
9373     AC_MSG_RESULT([$UNIXWRAPPERNAME])
9375 AC_SUBST(UNIXWRAPPERNAME)
9377 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
9378 if test "$with_compat_oowrappers" = "yes" ; then
9379     WITH_COMPAT_OOWRAPPERS=YES
9380     AC_MSG_RESULT(yes)
9381 else
9382     WITH_COMPAT_OOWRAPPERS=
9383     AC_MSG_RESULT(no)
9385 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
9387 AC_MSG_CHECKING([for product name])
9388 PRODUCTNAME=AC_PACKAGE_NAME
9389 AC_MSG_RESULT([$PRODUCTNAME])
9390 AC_SUBST(PRODUCTNAME)
9392 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
9393 AC_MSG_CHECKING([for install dirname])
9394 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes" ; then
9395    INSTALLDIRNAME="$with_install_dirname"
9397 AC_MSG_RESULT([$INSTALLDIRNAME])
9398 AC_SUBST(INSTALLDIRNAME)
9400 AC_MSG_CHECKING([for prefix])
9401 test "x$prefix" = xNONE && prefix=$ac_default_prefix
9402 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
9403 PREFIXDIR="$prefix"
9404 AC_MSG_RESULT([$PREFIXDIR])
9405 AC_SUBST(PREFIXDIR)
9407 AC_MSG_CHECKING([for libdir])
9408 LIBDIR=[$(eval echo $(eval echo $libdir))]
9409 AC_MSG_RESULT([$LIBDIR])
9410 AC_SUBST(LIBDIR)
9412 AC_MSG_CHECKING([for data dir])
9413 DATADIR=[$(eval echo $(eval echo $datadir))]
9414 AC_MSG_RESULT([$DATADIR])
9415 AC_SUBST(DATADIR)
9417 AC_MSG_CHECKING([for man dir])
9418 MANDIR=[$(eval echo $(eval echo $mandir))]
9419 AC_MSG_RESULT([$MANDIR])
9420 AC_SUBST(MANDIR)
9422 AC_MSG_CHECKING([for doc dir])
9423 DOCDIR=[$(eval echo $(eval echo $docdir))]
9424 AC_MSG_RESULT([$DOCDIR])
9425 AC_SUBST(DOCDIR)
9427 AC_MSG_CHECKING([for install dir])
9428 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
9429 AC_MSG_RESULT([$INSTALLDIR])
9430 AC_SUBST(INSTALLDIR)
9432 AC_MSG_CHECKING([whether to statically link to Gtk])
9433 if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
9434     ENABLE_STATIC_GTK="TRUE"
9435     AC_MSG_RESULT([yes])
9436 else
9437     ENABLE_STATIC_GTK="FALSE"
9438     AC_MSG_RESULT([no])
9440 AC_SUBST(ENABLE_STATIC_GTK)
9442 # ===================================================================
9443 # De- or increase default verbosity of build process
9444 # ===================================================================
9445 AC_MSG_CHECKING([build verbosity])
9446 if test -n "$enable_verbose"; then
9447     if test "$enable_verbose" = "yes"; then
9448         VERBOSE="TRUE"
9449         AC_MSG_RESULT([high])
9450     fi
9451     if test "$enable_verbose" = "no"; then
9452         VERBOSE="FALSE"
9453         AC_MSG_RESULT([low])
9454     fi
9455 else
9456     AC_MSG_RESULT([not set])
9458 AC_SUBST(VERBOSE)
9460 dnl ===================================================================
9461 dnl Use zenity during build
9462 dnl ===================================================================
9463 AC_MSG_CHECKING([whether to use zenity during build])
9464 if test "$enable_zenity" = "yes"; then
9465     AC_MSG_RESULT([yes])
9466     AC_PATH_PROGS( ZNTY, zenity )
9467     if test -z "$ZNTY"; then
9468         ENABLE_ZENITY=FALSE
9469     else
9470         ENABLE_ZENITY=TRUE
9471     fi
9472 else
9473     ENABLE_ZENITY=FALSE
9474     AC_MSG_RESULT([no])
9476 AC_SUBST(ENABLE_ZENITY)
9479 dnl ===================================================================
9480 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
9481 dnl --enable-dependency-tracking configure option
9482 dnl ===================================================================
9483 AC_MSG_CHECKING([whether to enable dependency tracking])
9484 if test "$enable_dependency_tracking" = "no"; then
9485     nodep=TRUE
9486     AC_MSG_RESULT([no])
9487 else
9488     AC_MSG_RESULT([yes])
9490 AC_SUBST(nodep)
9492 dnl ===================================================================
9493 dnl Number of CPUs to use during the build
9494 dnl ===================================================================
9495 AC_MSG_CHECKING([for number of processors to use])
9496 if test -n "$with_num_cpus"; then
9497     BUILD_NCPUS=$with_num_cpus
9498 else
9499     case `uname -s` in
9501     Darwin|FreeBSD|NetBSD|OpenBSD)
9502         BUILD_NCPUS=`sysctl -n hw.ncpu`
9503         ;;
9505     Linux)
9506         BUILD_NCPUS=`getconf _NPROCESSORS_ONLN`
9507         ;;
9508     # what else than above does profit here *and* has /proc?
9509     *)
9510         BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
9511         ;;
9512     esac
9514     # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
9515     # unexpected format, 'wc -l' will have returned 0.
9516     if test "$BUILD_NCPUS" -eq 0; then
9517         BUILD_NCPUS=1
9518     fi
9520 AC_MSG_RESULT([$BUILD_NCPUS])
9521 AC_SUBST(BUILD_NCPUS)
9523 # ===================================================================
9524 # Creating bigger shared library to link against
9525 # ===================================================================
9526 AC_MSG_CHECKING([whether to create a big library for better performance])
9527 MERGELIBS=
9528 if test "$enable_mergelibs" = "yes"; then
9529     MERGELIBS="TRUE"
9530     AC_MSG_RESULT([yes])
9531 else
9532     AC_MSG_RESULT([no])
9534 AC_SUBST(MERGELIBS)
9536 dnl ===================================================================
9537 dnl Number of parallel jobs to be executed by dmake
9538 dnl ===================================================================
9539 AC_MSG_CHECKING([for maximum of jobs per processor])
9540 BUILD_MAX_JOBS="1"
9541 if test "z$with_max_jobs" != "z"; then
9542     BUILD_MAX_JOBS="$with_max_jobs"
9543 else
9544     if test "$enable_icecream" = "yes" ; then
9545         BUILD_MAX_JOBS="10"
9546     fi
9548 AC_MSG_RESULT([$BUILD_MAX_JOBS])
9549 AC_SUBST(BUILD_MAX_JOBS)
9551 # =====================================================================
9552 # determine the parallelism for gnu make
9553 # =====================================================================
9554 AC_MSG_CHECKING([for maximum parallelism for gmake])
9555 if test $BUILD_MAX_JOBS -gt $BUILD_NCPUS ; then
9556     GMAKE_PARALLELISM="$BUILD_MAX_JOBS"
9557 else
9558     GMAKE_PARALLELISM="$BUILD_NCPUS"
9560 GMAKE_MODULE_PARALLELISM="$BUILD_MAX_JOBS"
9561 if test "$no_parallelism_make" = "YES" ; then
9562     if test -z "$with_num_cpus"; then
9563         GMAKE_PARALLELISM="1";
9564         if test $GMAKE_MODULE_PARALLELISM -gt 1 ; then
9565             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
9566             if test -z "$with_num_cpus"; then
9567                 echo "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this." >> warn
9568             fi
9569             GMAKE_MODULE_PARALLELISM="1"
9570         fi
9571     else
9572         GMAKE_PARALLELISM="$BUILD_NCPUS";
9573         echo "make 3.81 is prone to crashes with parallelism > 1. Since --with-num-cpus was explicitely given, it is honored, but do not complain when make segfault on you." >> warn
9574     fi
9577 # GMAKE_PARALLELISM is used in tail_build
9578 # GMAKE_MODULE_PARALLELISM is used when building individual gbuildified module
9579 AC_MSG_RESULT([per module:$GMAKE_MODULE_PARALLELISM, for tail_build:$GMAKE_PARALLELISM])
9580 AC_SUBST(GMAKE_PARALLELISM)
9581 AC_SUBST(GMAKE_MODULE_PARALLELISM)
9583 dnl ===================================================================
9584 dnl Setting up the environment.
9585 dnl ===================================================================
9586 echo "setting up the build environment variables..."
9588 if test -z "$COMPATH"; then
9589     AC_MSG_ERROR([No compiler found.])
9591 AC_SUBST(COMPATH)
9593 AC_MSG_CHECKING([solver path])
9594 if test -z "$with_local_solver"; then
9595     LOCAL_SOLVER="DEFAULT"
9596     AC_MSG_RESULT([default])
9597 else
9598     LOCAL_SOLVER=$with_local_solver
9599     AC_MSG_RESULT([$with_local_solver])
9601 AC_SUBST(LOCAL_SOLVER)
9603 AC_SUBST(BUILD_TYPE)
9605 if test "$WITH_MINGW" != "yes" ; then
9606     MINGW_EXTERNAL_DLLS=
9607 else
9608     mingw_dlldir=`$CC -print-sysroot`/mingw/bin
9609     for DLL in $MINGW_EXTERNAL_DLLS ; do
9610         AC_MSG_CHECKING([for $DLL])
9611         if ! test -f "$mingw_dlldir/$DLL" ; then
9612             AC_MSG_ERROR([Could not find $DLL, install the appropriate mingw32-<package>, not only mingw32-<package>-devel.])
9613         fi
9614         AC_MSG_RESULT([$mingw_dlldir/$DLL])
9615     done
9617 AC_SUBST(MINGW_EXTERNAL_DLLS)
9619 # make sure config.guess is +x; we execute config.guess, so it has to be so;
9620 chmod +x ./config.guess
9622 dnl Setting up the post_download check script
9623 dnl Using autoconf here, so that the migration from the previous state
9624 dnl (checks for the additional Windows downloads were directly in
9625 dnl configure.in) is as easy as possible
9626 echo "setting up the post_download check script"
9627 autoconf post_download.in > post_download
9628 chmod +x post_download
9630 # Generate a configuration timestamp we can use for deps
9631 if test -f set_soenv; then
9632     mv -f set_soenv set_soenv.last
9633 else
9634     echo > set_soenv.last
9637 AC_CONFIG_FILES([ooo.lst set_soenv Makefile bin/repo-list desktop/scripts/soffice.sh build_env])
9638 AC_OUTPUT
9640 # make sure this is executable
9641 chmod +x desktop/scripts/soffice.sh
9643 # touch the config timestamp file set_soenv.stamp
9644 if test ! -f set_soenv.stamp; then
9645     echo > set_soenv.stamp
9646 elif diff set_soenv set_soenv.last >/dev/null 2>&1; then
9647     echo "Configuration unchanged - avoiding scp2 stamp update"
9648 else
9649     echo > set_soenv.stamp
9652 dnl Run the set_soenv script to setup the Env.Host.sh script that sets
9653 dnl environment variables for the build.
9654 chmod +x set_soenv
9656 ./set_soenv
9658 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: