gdb stacktraces for subsequentchecks
[LibreOffice.git] / configure.in
blob6b2d37adb60991940df3671159045e7ee8445855
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(system-sampleicc,
955     AS_HELP_STRING([--with-system-sampleicc],
956         [Use SampleICC libraries already on system (used only during build).]),,
957     [with_system_sampleicc="$with_system_libs"])
959 AC_ARG_WITH(mozilla-version,
960     AS_HELP_STRING([--with-mozilla-version],
961         [Choose which version of Mozilla to use while building Mozilla.
962          (default=1.7.5) Note that not all versions are supported.]),
965 AC_ARG_WITH(mozilla-toolkit,
966     AS_HELP_STRING([--with-mozilla-toolkit],
967         [Choose which GUI toolkit to use while building Mozilla components. (default=gtk2)]),
970 AC_ARG_WITH(myspell-dicts,
971     AS_HELP_STRING([--without-myspell-dicts],
972         [Removes myspell dictionaries from LibreOffice installation set, for
973          people building for specific distributions where the myspell dictionaries
974          are installed from other sources.]),
977 AC_ARG_WITH(system-dicts,
978     AS_HELP_STRING([--with-system-dicts],
979         [Use dictionaries from system paths- Specify them via
980          --with-{dict,hyph,thes}-path=/path if you want to override the default ones.]),
983 AC_ARG_WITH(external-dict-dir,
984     AS_HELP_STRING([--with-external-dict-dir],
985         [Specify external dictionary dir.]),
988 AC_ARG_WITH(external-hyph-dir,
989     AS_HELP_STRING([--with-external-hyph-dir],
990         [Specify external hyphenation pattern dir.]),
993 AC_ARG_WITH(external-thes-dir,
994     AS_HELP_STRING([--with-external-thes-dir],
995         [Specify external thesaurus dir.]),
998 AC_ARG_WITH(system-zlib,
999     AS_HELP_STRING([--with-system-zlib],
1000         [Use zlib already on system.]),,
1001  [if test "$_os" != "WINNT"; then
1002     with_system_zlib=yes
1003   else
1004     with_system_zlib="$with_system_libs"
1005   fi])
1007 AC_ARG_WITH(system-openssl,
1008     AS_HELP_STRING([--with-system-openssl],
1009         [Use OpenSSL already on system.]),,
1010     [with_system_openssl="$with_system_libs"])
1012 AC_ARG_WITH(system-jpeg,
1013     AS_HELP_STRING([--with-system-jpeg],
1014         [Use jpeg already on system.]),,
1015  [if test "$_os" = "Linux"; then
1016     with_system_jpeg=yes
1017   else
1018     with_system_jpeg="$with_system_libs"
1019   fi])
1021 AC_ARG_WITH(system-expat,
1022     AS_HELP_STRING([--with-system-expat],
1023         [Use expat already on system.]),,
1024     [with_system_expat="$with_system_libs"])
1026 AC_ARG_WITH(system-libcmis,
1027     AS_HELP_STRING([--with-system-libcmis],
1028         [Use libcmis already on system.]),,
1029     [with_system_libcmis="$with_system_libs"])
1031 AC_ARG_WITH(system-libvisio,
1032     AS_HELP_STRING([--with-system-libvisio],
1033         [Use libvisio already on system.]),,
1034     [with_system_libvisio="$with_system_libs"])
1036 AC_ARG_WITH(system-libwpd,
1037     AS_HELP_STRING([--with-system-libwpd],
1038         [Use libwpd already on system.]),,
1039     [with_system_libwpd="$with_system_libs"])
1041 AC_ARG_WITH(system-libwps,
1042     AS_HELP_STRING([--with-system-libwps],
1043         [Use libwps already on system.]),,
1044     [with_system_libwps="$with_system_libs"])
1046 AC_ARG_WITH(system-libwpg,
1047     AS_HELP_STRING([--with-system-libwpg],
1048         [Use libwpg already on system.]),,
1049     [with_system_libwpg="$with_system_libs"])
1051 AC_ARG_WITH(system-libxml,
1052     AS_HELP_STRING([--with-system-libxml],
1053         [Use libxml/libxslt already on system.]),,
1054  [if test "$_os" = "Darwin"; then
1055     with_system_libxml=yes
1056   else
1057     with_system_libxml="$with_system_libs"
1058   fi])
1060 AC_ARG_WITH(system-icu,
1061     AS_HELP_STRING([--with-system-icu],
1062         [Use icu already on system.]),,
1063     [with_system_icu="$with_system_libs"])
1065 AC_ARG_WITH(system-poppler,
1066     AS_HELP_STRING([--with-system-poppler],
1067         [Use system poppler. (only needed for pdfimport extension)]),,
1068     [with_system_poppler="$with_system_libs"])
1070 AC_ARG_WITH(system-db,
1071     AS_HELP_STRING([--with-system-db],
1072         [Use Berkeley db already on system.]),,
1073     [with_system_db="$with_system_libs"])
1075 AC_ARG_WITH(system-lucene,
1076     AS_HELP_STRING([--with-system-lucene],
1077         [Use Lucene already on system.]),,
1078     [with_system_lucene="$with_system_jars"])
1080 AC_ARG_WITH(system-apache-commons,
1081     AS_HELP_STRING([--with-system-apache-commons],
1082         [Use Apache commons libraries already on system.]),,
1083     [with_system_apache_commons="$with_system_jars"])
1085 AC_ARG_WITH(lucene-core-jar,
1086     AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
1087         [Specify path to jarfile manually.]),
1088     LUCENE_CORE_JAR=$withval)
1090 AC_ARG_WITH(lucene-analyzers-jar,
1091     AS_HELP_STRING([--with-lucene-analyzers-jar=JARFILE],
1092         [Specify path to jarfile manually.]),
1093     LUCENE_ANALYZERS_JAR=$withval ,)
1095 AC_ARG_WITH(system-mysql,
1096     AS_HELP_STRING([--with-system-mysql],
1097         [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice
1098          extension. If the the mysql_config executable is not in PATH, use MYSQLCONFIG to
1099          point to it.]),,
1100     [with_system_mysql="$with_system_libs"])
1102 AC_ARG_WITH(libmysql-path,
1103     AS_HELP_STRING([--with-libmysql-path],
1104         [Use Connector/C (libmysql) installation for building the MySQL
1105          Connector/LibreOffice extension.])
1106     [
1107                           Usage:     --with-libmysql-path=<absolute path to
1108                                                   your Connector/C installation>
1109     ],
1112 AC_ARG_WITH(system-mysql-cppconn,
1113     AS_HELP_STRING([--with-system-mysql-cppconn],
1114         [Use MySQL C++ Connector libraries already on system.]),,
1115     [with_system_mysql_cppconn="$with_system_libs"])
1117 AC_ARG_WITH(system-postgresql,
1118     AS_HELP_STRING([--with-system-postgresql],
1119         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1120          extension. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1121     [with_system_postgresql="$with_system_libs"])
1123 AC_ARG_WITH(libpq-path,
1124     AS_HELP_STRING([--with-libpq-path],
1125         [Use this PostgreSQL C interface (libpq) installation for building
1126          the PostgreSQL-SDBC extension.])
1127     [
1128                           Usage:     --with-libpq-path=<absolute path to
1129                                                   your libq installation>
1130     ],
1133 AC_ARG_WITH(system-hsqldb,
1134     AS_HELP_STRING([--with-system-hsqldb],
1135         [Use hsqldb already on system.]),,
1136     [with_system_hsqldb="$with_system_jars"])
1138 AC_ARG_WITH(hsqldb-jar,
1139     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1140         [Specify path to jarfile manually.]),
1141     HSQLDB_JAR=$withval)
1143 AC_ARG_WITH(system-beanshell,
1144     AS_HELP_STRING([--with-system-beanshell],
1145         [Use beanshell already on system.]),,
1146     [with_system_beanshell="$with_system_jars"])
1148 AC_ARG_WITH(beanshell-jar,
1149     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1150         [Specify path to jarfile manually.]),
1151     BSH_JAR=$withval)
1153 AC_ARG_WITH(commons-codec-jar,
1154     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1155         [Specify path to jarfile manually.]),
1156     COMMONS_CODEC_JAR=$withval)
1158 AC_ARG_WITH(commons-lang-jar,
1159     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1160         [Specify path to jarfile manually.]),
1161     COMMONS_LANG_JAR=$withval)
1163 AC_ARG_WITH(commons-httpclient-jar,
1164     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1165         [Specify path to jarfile manually.]),
1166     COMMONS_HTTPCLIENT_JAR=$withval)
1168 AC_ARG_WITH(commons-logging-jar,
1169     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1170         [Specify path to jarfile manually.]),
1171     COMMONS_LOGGING_JAR=$withval)
1173 AC_ARG_WITH(system-servlet-api,
1174     AS_HELP_STRING([--with-system-servlet-api],
1175         [Use servlet-api already on system.]),,
1176     [with_system_servlet_api="$with_system_jars"])
1178 AC_ARG_WITH(servlet-api-jar,
1179     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1180         [Specify path to jarfile manually.]),
1181     SERVLETAPI_JAR=$withval)
1183 AC_ARG_WITH(system-jfreereport,
1184     AS_HELP_STRING([--with-system-jfreereport],
1185         [Use JFreeReport already on system.]),,
1186     [with_system_jfreereport="$with_system_jars"])
1188 AC_ARG_WITH(sac-jar,
1189     AS_HELP_STRING([--with-sac-jar=JARFILE],
1190         [Specify path to jarfile manually.]),
1191     SAC_JAR=$withval)
1193 AC_ARG_WITH(libxml-jar,
1194     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1195         [Specify path to jarfile manually.]),
1196     LIBXML_JAR=$withval)
1198 AC_ARG_WITH(flute-jar,
1199     AS_HELP_STRING([--with-flute-jar=JARFILE],
1200         [Specify path to jarfile manually.]),
1201     FLUTE_JAR=$withval)
1203 AC_ARG_WITH(jfreereport-jar,
1204     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1205         [Specify path to jarfile manually.]),
1206     JFREEREPORT_JAR=$withval)
1208 AC_ARG_WITH(liblayout-jar,
1209     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1210         [Specify path to jarfile manually.]),
1211     LIBLAYOUT_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(libloader-jar,
1219     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1220         [Specify path to jarfile manually.]),
1221     LIBLOADER_JAR=$withval)
1223 AC_ARG_WITH(libformula-jar,
1224     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1225         [Specify path to jarfile manually.]),
1226     LIBFORMULA_JAR=$withval)
1228 AC_ARG_WITH(librepository-jar,
1229     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1230         [Specify path to jarfile manually.]),
1231     LIBREPOSITORY_JAR=$withval)
1233 AC_ARG_WITH(libfonts-jar,
1234     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1235         [Specify path to jarfile manually.]),
1236     LIBFONTS_JAR=$withval)
1238 AC_ARG_WITH(libserializer-jar,
1239     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1240         [Specify path to jarfile manually.]),
1241     LIBSERIALIZER_JAR=$withval)
1243 AC_ARG_WITH(libbase-jar,
1244     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1245         [Specify path to jarfile manually.]),
1246     LIBBASE_JAR=$withval)
1248 AC_ARG_WITH(system-saxon,
1249     AS_HELP_STRING([--with-system-saxon],
1250         [Use saxon already on system.]),,
1251     [with_system_saxon="$with_system_jars"])
1253 AC_ARG_WITH(saxon-jar,
1254     AS_HELP_STRING([--with-saxon-jar=JARFILE],
1255         [Specify path to jarfile manually.]),
1256     SAXON_JAR=$withval)
1258 AC_ARG_WITH(system-odbc,
1259     AS_HELP_STRING([--with-system-odbc],
1260         [Use the odbc headers already on system.]),,
1261     [with_system_odbc="$with_system_headers"])
1263 AC_ARG_WITH(system-sane,
1264     AS_HELP_STRING([--with-system-sane],
1265         [Use sane.h already on system.]),,
1266     [with_system_sane="$with_system_headers"])
1268 AC_ARG_WITH(system-xextensions-headers,
1269     AS_HELP_STRING([--with-system-xextensions-headers],
1270         [To build without system X11 extensions headers, use
1271          --without-system-xextensions-headers. This is possibly
1272          useful on legacy unix systems which ship with the libs
1273          but without the headers.]))
1275 AC_ARG_WITH(system-mesa-headers,
1276     AS_HELP_STRING([--with-system-mesa-headers],
1277         [Use Mesa headers already on system.]),,
1278     [with_system_mesa_headers="$with_system_headers"])
1280 AC_ARG_WITH(system-curl,
1281     AS_HELP_STRING([--with-system-curl],
1282         [Use curl already on system.]),,
1283  [if test "$_os" = "Darwin"; then
1284     with_system_curl=yes
1285   else
1286     with_system_curl="$with_system_libs"
1287   fi])
1289 AC_ARG_WITH(system-boost,
1290     AS_HELP_STRING([--with-system-boost],
1291         [Use boost already on system.]),,
1292     [with_system_boost="$with_system_headers"])
1294 AC_ARG_WITH(system-mdds,
1295     AS_HELP_STRING([--with-system-mdds],
1296         [Use mdds already on system.]),,
1297     [with_system_mdds="$with_system_headers"])
1299 AC_ARG_WITH(system-vigra,
1300     AS_HELP_STRING([--with-system-vigra],
1301         [Use vigra already on system.]),,
1302     [with_system_vigra="$with_system_headers"])
1304 AC_ARG_WITH(system-neon,
1305     AS_HELP_STRING([--with-system-neon],
1306         [Use neon already on system.]),,
1307     [with_system_neon="$with_system_libs"])
1309 AC_ARG_WITH(system-hunspell,
1310     AS_HELP_STRING([--with-system-hunspell],
1311         [Use libhunspell already on system.]),,
1312     [with_system_hunspell="$with_system_libs"])
1314 AC_ARG_WITH(system-mythes,
1315     AS_HELP_STRING([--with-system-mythes],
1316         [Use mythes already on system.]),,
1317     [with_system_mythes="$with_system_libs"])
1319 AC_ARG_WITH(system-altlinuxhyph,
1320     AS_HELP_STRING([--with-system-altlinuxhyph],
1321         [Use ALTLinuxhyph already on system.]),,
1322     [with_system_altlinuxhyph="$with_system_libs"])
1324 AC_ARG_WITH(system-lpsolve,
1325     AS_HELP_STRING([--with-system-lpsolve],
1326         [Use lpsolve already on system.]),,
1327     [with_system_lpsolve="$with_system_libs"])
1329 AC_ARG_WITH(system-libexttextcat,
1330     AS_HELP_STRING([--with-system-libexttextcat],
1331         [Use libexttextcat already on system.]),,
1332     [with_system_libexttextcat="$with_system_libs"])
1334 AC_ARG_WITH(system-cppunit,
1335     AS_HELP_STRING([--with-system-cppunit],
1336         [Use cppunit already on system.]),,
1337     [with_system_cppunit="$with_system_libs"])
1339 AC_ARG_WITH(system-redland,
1340     AS_HELP_STRING([--with-system-redland],
1341         [Use redland library already on system.]),,
1342     [with_system_redland="$with_system_libs"])
1344 AC_ARG_WITH(system-mozilla,
1345     AS_HELP_STRING([--with-system-mozilla],
1346         [Use Mozilla already on system. Note that some components cannot be built
1347          against a contemporary Mozilla. The flavour used can be specified by
1348          --with-system-mozilla=<flavour>. Supported are: libxul (default),
1349          xulrunner, firefox, seamonkey, mozilla, iceape.]),
1350     WITH_SYSTEM_MOZILLA=$withval ,
1351 WITH_SYSTEM_MOZILLA=no)
1353 AC_ARG_WITH(system-mozilla-headers,
1354     AS_HELP_STRING([--with-system-mozilla-headers],
1355         [Use mozilla headers provided by system instead of bundled ones. Used in
1356          nsplugin]),,
1357     [with_system_mozilla_headers="$with_system_headers"]
1360 AC_ARG_WITH(system-gettext,
1361     AS_HELP_STRING([--with-system-gettext],
1362         [Use gettext runtime library already on system.]),,
1363     [with_system_gettext="$with_system_libs"])
1365 AC_ARG_WITH(system-libpng,
1366     AS_HELP_STRING([--with-system-libpng],
1367         [Use libpng already on system.]),,
1368     [with_system_libpng="$with_system_libs"])
1370 AC_ARG_WITH(linker-hash-style,
1371     AS_HELP_STRING([--with-linker-hash-style],
1372         [Use linker with --hash-style=<style> when linking shared objects.
1373          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1374          if supported on the build system, and "sysv" otherwise.]))
1376 AC_ARG_WITH(stlport,
1377     AS_HELP_STRING([--with-stlport],
1378         [Build the STLPort library for compatibility with old extensions for
1379          architectures where STLPort used to be used.]),
1380     with_stlport=$withval ,
1381 with_stlport=auto)
1383 AC_ARG_WITH(jdk-home,
1384     AS_HELP_STRING([--with-jdk-home],
1385         [If you have installed JDK 1.3 or later on your system please supply the
1386          path here. Note that this is not the location of the java command but the
1387          location of the entire distribution.])
1388     [
1389                           Usage:     --with-jdk-home=<absolute path to JDK home>
1390     ],
1393 AC_ARG_WITH(gxx_include_path,
1394     AS_HELP_STRING([--with-gxx-include-path],
1395         [If you want to override the autodetected g++ include path.])
1396     [
1397                           Usage:     --with-gxx-include-path=<absolute path to
1398                                                                 g++ include dir>
1399     ],
1402 AC_ARG_WITH(help,
1403     AS_HELP_STRING([--with-help],
1404         [Enable the build of help.
1406          To build without help, use --without-help.]))
1408 AC_ARG_WITH(java,
1409     AS_HELP_STRING([--with-java],
1410         [Specify the name of the Java interpreter command. Typically "java"
1411          which is the default.
1413          To build without support for Java components, applets, accessibility
1414          or the XML filters written in Java, use --without-java or --with-java=no.])
1415     [
1416                           Usage:     --with-java==<java command>
1417                                      --without-java
1418     ],
1419     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1420     [ with_java=java ]
1423 AC_ARG_WITH(java_target_version,
1424     AS_HELP_STRING([--with-java-target-version],
1425         [Generate class files that will work on JVMs with the specified version.
1426          For example, use --with-java-target-version=1.4 to make sure that the
1427          application will work with JVM 1.4 even when compiled with JDK 1.5.])
1428     [
1429                           This option is ignored when you compile with gcj/gij.
1431                           Usage:     --with-java-target-version=<jvm version>
1432     ],
1435 AC_ARG_WITH(jvm-path,
1436     AS_HELP_STRING([--with-jvm-path],
1437         [Use a specific JVM search path at runtime.])
1438     [
1439                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1441                           e. g.: --with-jvm-path=/usr/lib/
1442                                  to find JRE/JDK in /usr/lib/jvm/
1443     ],
1446 AC_ARG_WITH(ant-home,
1447     AS_HELP_STRING([--with-ant-home],
1448         [If you have installed Jakarta Ant on your system, please supply the path here.
1449          Note that this is not the location of the Ant binary but the location
1450          of the entire distribution.])
1451     [
1452                           Usage:     --with-ant-home=<absolute path to Ant home>
1453     ],
1456 AC_ARG_WITH(junit,
1457     AS_HELP_STRING([--with-junit],
1458         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1459          --without-junit disables those tests. Not relevant in the --without-java case.])
1460     [
1461                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1462     ],
1463 ,with_junit=yes)
1465 AC_ARG_WITH(perl-home,
1466     AS_HELP_STRING([--with-perl-home],
1467         [If you have installed Perl 5 Distribution, on your system, please
1468          supply the path here. Note that this is not the location of the Perl
1469          binary but the location of the entire distribution.])
1470     [
1471                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1472     ],
1475 AC_ARG_WITH(cl-home,
1476     AS_HELP_STRING([--with-cl-home],
1477         [For Windows NT users, please supply the path for the Microsoft C/C++
1478          compiler. Note that this is not the location of the compiler binary but
1479          the location of the entire distribution.])
1480     [
1481                           Usage:     --with-cl-home=<absolute path to Microsoft
1482                                                             C/C++ compiler home>
1483     ],
1486 AC_ARG_WITH(mspdb-path,
1487     AS_HELP_STRING([--with-mspdb-path],
1488         [For Microsoft C/C++ compiler users, please supply the path pointing to
1489          the mspdb80.dll (if using Visual Studio 2008) or mspdb100.dll (if using
1490          Visual Studio 2010).])
1491     [
1492                           Usage:     --with-mspdb-path=<path to
1493                                                        mspdb80.dll/mspdb100.dll>
1494     ],
1497 AC_ARG_WITH(midl-path,
1498     AS_HELP_STRING([--with-midl-path],
1499         [For Microsoft compiler users, please supply the path pointing to the midl.exe.])
1500     [
1501                           Usage:     --with-midl-path=<abs. path to midl.exe>
1502     ],
1505 AC_ARG_WITH(csc-path,
1506     AS_HELP_STRING([--with-csc-path],
1507         [For Windows builds, please supply the path pointing to the csc.exe.
1508          Usually found automatically when building on Windows.])
1509     [
1510                           Usage:     --with-csc-path=<abs. path to csc.exe>
1511     ],
1514 AC_ARG_WITH(nsis-path,
1515     AS_HELP_STRING([--with-nsis-path],
1516         [For Windows builds, please supply the directory where makensis
1517          is located. If makensis is found in PATH or this option is
1518          properly supplied a self-contained executable installer for
1519          LibreOffice will be created.])
1520     [
1521                           Usage:     --with-nsis-path=<path to directory containing makensis>
1522     ],
1525 AC_ARG_WITH(dotnet-framework-home,
1526     AS_HELP_STRING([--with-dotnet-framework-home],
1527         [For Microsoft compiler users, please supply the path pointing to
1528          lib/mscoree.lib, usually something like:
1529          "/cygdrive/c/Program Files/Windows SDKs/Windows/v7.0"])
1530     [
1531                           Note that in most cases it will be automatically
1532                           found, though.
1534                           Usage:     --with-dotnet-framework-home=<absolute path to .NET
1535                                                           Framework>
1536     ],
1539 AC_ARG_WITH(windows-sdk-home,
1540     AS_HELP_STRING([--with-windows-sdk-home],
1541         [For Windows builds, please supply the path to the Windows SDK.
1542          Usually found automatically when building on Windows.])
1543     [
1544                           Usage:     --with-windows-sdk-home=<absolute path to Windows SDK>
1545     ],
1548 AC_ARG_WITH(directx-home,
1549     AS_HELP_STRING([--with-directx-home],
1550         [For Windows users, please supply the path to the Microsoft DirectX SDK.])
1551     [
1552                           Usage:     --with-directx-home=<absolute path to
1553                                                           Microsoft DirectX SDK>
1554     ],
1557 AC_ARG_WITH(mozilla-build,
1558     AS_HELP_STRING([--with-mozilla-build],
1559         [For Windows users, please supply the path to the Mozilla build tools.])
1560     [
1561                           Usage:     --with-mozilla-build=<absolute path to
1562                                                           Mozilla build tools>
1564                           At the moment of this writing, an installer for the
1565                           mozilla build tools can be obtained from http://ftp.
1566                           mozilla.org/pub/mozilla.org/mozilla/libraries/win32.
1567     ],
1568     MOZILLABUILD=$withval ,
1571 AC_ARG_WITH(local-solver,
1572     AS_HELP_STRING([--with-local-solver],
1573         [If you have solver in a location other than ./solver, please supply the path here.])
1574     [
1575                           Usage:     --with-local-solver=<abs. path to solver>
1576     ],
1579 AC_ARG_WITH(lang,
1580     AS_HELP_STRING([--with-lang],
1581         [Use this option to build LibreOffice with additional language support.
1582          English (US) is always included by default.
1583          Separate multiple languages with space.
1584          For all languages, use --with-lang=ALL.])
1585     [
1586                           Usage:     --with-lang="es sw tu cs sk"
1587     ],
1590 dnl ===================================================================
1591 dnl Branding
1592 dnl ===================================================================
1594 AC_ARG_WITH(intro-bitmap,
1595 [  --with-intro-bitmap    Prefer the specified intro bitmap over the
1596                           the default one.
1598                           Usage:     --with-intro-bitmap=/path/my_ooo_intro.png
1599 ],,)
1601 AC_ARG_WITH(intro-progressbar-color,
1602 [  --with-intro-progressbar-color    Set color of progress bar on intro screen.
1603                                      Comma separated RGB values in decimal format.
1605                           Usage: --with-intro-progressbar-color=126,170,23
1606 ],,)
1608 AC_ARG_WITH(intro-progressbar-size,
1609 [  --with-intro-progressbar-size     Set size of progress bar on intro screen.
1610                                      Comma separated values in decimal format.
1612                           Usage: --with-intro-progressbar-size=319,10
1613 ],,)
1615 AC_ARG_WITH(intro-progressbar-position,
1616 [  --with-intro-progressbar-position Set position of progress bar on intro screen.
1617                                      Comma separated values in decimal format.
1619                           Usage: --with-intro-progressbar-position=164,225
1620 ],,)
1622 AC_ARG_WITH(intro-progressbar-frame-color,
1623 [  --with-intro-progressbar-frame-color    Set color of progress bar frame on intro screen.
1624                                            Comma separated RGB values in decimal format.
1626                           Usage: --with-intro-progressbar-frame-color=207,208,211
1627 ],,)
1629 AC_ARG_WITH(about-bitmap,
1630 [  --with-about-bitmap    Similarly to --with-intro-bitmap, this allows
1631                           specification of bitmap for the About box.
1633                           Usage:     --with-about-bitmap=/path/my_ooo_about.png
1634 ],,)
1636 AC_ARG_WITH(startcenter-left-bitmap,
1637 [  --with-startcenter-left-bitmap    Similarly to --with-intro-bitmap, this allows
1638                                      specification of bitmap for the Start center.
1640                           Usage: --with-startcenter-left-bitmap=/path/my_backing_left.png
1641 ],,)
1643 AC_ARG_WITH(startcenter-right-bitmap,
1644 [  --with-startcenter-right-bitmap    Similarly to --with-intro-bitmap, this allows
1645                                       specification of bitmap for the Start center.
1647                           Usage: --with-startcenter-right-bitmap=/path/my_backing_right.png
1648 ],,)
1650 AC_ARG_WITH(startcenter-rtl-left-bitmap,
1651 [  --with-startcenter-rtl-left-bitmap    Similarly to --with-intro-bitmap, this allows
1652                                          specification of bitmap for the Start center.
1654                           Usage: --with-startcenter-rtl-left-bitmap=/path/my_backing_rtl_left.png
1655 ],,)
1657 AC_ARG_WITH(startcenter-rtl-right-bitmap,
1658 [  --with-startcenter-rtl-right-bitmap    Similarly to --with-intro-bitmap, this allows
1659                                           specification of bitmap for the Start center.
1661                           Usage: --with-startcenter-rtl-right-bitmap=/path/my_backing_rtl_right.png
1662 ],,)
1664 AC_ARG_WITH(startcenter-space-bitmap,
1665 [  --with-startcenter-space-bitmap    Similarly to --with-intro-bitmap, this allows
1666                                       specification of bitmap for the Start center.
1668                           Usage: --with-startcenter-space-bitmap=/path/my_backing_space.png
1669 ],,)
1671 AC_ARG_WITH(vendor,
1672     AS_HELP_STRING([--with-vendor],
1673         [Set vendor of the build.])
1674     [
1675                           Usage:     --with-vendor="John the Builder"
1676     ],
1679 AC_ARG_WITH(unix-wrapper,
1680     AS_HELP_STRING([--with-unix-wrapper],
1681         [Redefines the name of the UNIX wrapper that will be used in the desktop
1682          files and in the desktop-integration RPMs.])
1683     [
1684                           Usage:     --with-unix-wrapper=ooffice
1685     ],
1688 AC_ARG_WITH(compat-oowrappers,
1689     AS_HELP_STRING([--with-compat-oowrappers],
1690         [Install oo* wrappers in parallel with
1691          lo* ones to keep backward compatibility.
1692          Has effect only with make distro-pack-install]),
1695 AC_ARG_WITH(asm-home,
1696     AS_HELP_STRING([--with-asm-home],
1697         [For Windows, please supply the path for the ml.exe or ml64.exe assembler.])
1698     [
1699                           Usage:     --with-asm-home=<path to assembler directory>
1700     ],
1703 AC_ARG_WITH(os-version,
1704     AS_HELP_STRING([--with-os-version],
1705         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1706     [
1707                           Usage:     --with-os-version=<OSVERSION>
1708     ],
1711 AC_ARG_WITH(mingw-cross-compiler,
1712     AS_HELP_STRING([--with-mingw-cross-compiler],
1713         [Specify the MinGW cross-compiler to use.])
1714     [
1715                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1717                           When building on the ODK on Unix and building unowinreg.dll,
1718                           specify the MinGW C++ cross-compiler.
1719     ],
1722 AC_ARG_WITH(build-version,
1723     AS_HELP_STRING([--with-build-version],
1724         [Allows the builder to add a custom version tag that will appear in the
1725          Help/About box for QA purposes.])
1726     [
1727                           Usage:     --with-build-version="Built by Jim"
1728     ],
1729     with_build_version=$withval ,
1732 AC_ARG_WITH(alloc,
1733     AS_HELP_STRING([--with-alloc],
1734         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1735          Note that on FreeBSD/NetBSD system==jemalloc]),
1738 AC_ARG_WITH(sun-templates,
1739     AS_HELP_STRING([--with-sun-templates],
1740         [Integrate Sun template packages.]),
1743 AC_ARG_WITH(num-cpus,
1744     AS_HELP_STRING([--with-num-cpus],
1745         [Number of build processes/cpus to use (number of projects that will build at the same time).
1746          Multi-process/multi-cpu builds can save a lot of time on multi-cpu machines.
1747          Defaults to the number of CPUs on the machine.]),
1750 AC_ARG_WITH(max-jobs,
1751     AS_HELP_STRING([--with-max-jobs],
1752         [Maximum number of jobs that will be issued at the same time per dmake or gbuild subproject.
1753          The real number of the jobs is affected by the --with-num-cpus too, it can get up to CPUS*max_jobs.
1754          Defaults to 1, unless you configure --enable-icecream - then to 10.]),
1757 dnl ===================================================================
1758 dnl MacOSX build and runtime environment options
1759 dnl ===================================================================
1761 AC_ARG_WITH(macosx-sdk,
1762     AS_HELP_STRING([--with-macosx-sdk],
1763         [Use a specific SDK for building.])
1764     [
1765                           Usage:     --with-macosx-sdk=<version>
1767                           e. g.: --with-macosx-sdk=10.4
1769                           there are 3 options to controle the MacOSX build:
1770                           --with-macosx-sdk (refered as 'sdl' below)
1771                           --with-macosx-version-min-required (refered as 'min' below)
1772                           --with-macosx-version-max-allowed (refered as 'max' below)
1774                           the connection between these value and the default they take is as follow:
1775                           ( ? means not specified on the command line, constraint: x <= y <= z)
1777                           ==========================================
1778                            command line      || config result
1779                           ==========================================
1780                           min  | max  | sdk  || min  | max  | sdk  |
1781                           ?    | ?    | ?    || 10.4 | 10.4 | 10.4 |
1782                           ?    | ?    | 10.x || 10.4 | 10.4 | 10.x |
1783                           ?    | 10.x | ?    || 10.4 | 10.x | 10.x |
1784                           ?    | 10.x | 10.y || 10.4 | 10.x | 10.y |
1785                           10.x | ?    | ?    || 10.x | 10.x | 10.x |
1786                           10.x | ?    | 10.y || 10.x | 10.x | 10.y |
1787                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1788                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1791                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1792                           for a detailled technical explanation of these variables
1794                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1796     ],
1799 AC_ARG_WITH(macosx-version-min-required,
1800     AS_HELP_STRING([--with-macosx-version-min-required],
1801         [set the minimum OS version needed to run the built LibreOffice])
1802     [
1803                           Usage:     --with-macosx-version-min-required=<version>
1805                           e. g.: --with-macos-version-min-required=10.4
1806                           see --with-macosx-sdk for more info
1807     ],
1810 AC_ARG_WITH(macosx-version-max-allowed,
1811     AS_HELP_STRING([--with-macosx-version-max-allowed],
1812         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1813     [
1814                           Usage:     --with-macosx-version-max-allowed=<version>
1816                           e. g.: --with-macos-version-max-allowed=10.6
1817                           see --with-macosx-sdk for more info
1818     ],
1822 dnl ===================================================================
1823 dnl check for required programs (grep, awk, sed, bash)
1824 dnl ===================================================================
1825 AC_PROG_EGREP
1826 AC_PROG_AWK
1827 AC_PATH_PROG( AWK, $AWK)
1828 if test -z "$AWK"; then
1829     AC_MSG_ERROR([install awk to run this script])
1832 AC_PATH_PROG(BASH, bash)
1833 if test -z "$BASH"; then
1834     AC_MSG_ERROR([bash not found in \$PATH])
1836 AC_SUBST(BASH)
1838 AC_MSG_CHECKING([for GNU or BSD tar])
1839 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
1840     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
1841     if test $? -eq 0;  then
1842         GNUTAR=$a
1843         break
1844     fi
1845 done
1846 AC_MSG_RESULT($GNUTAR)
1847 if test -z "$GNUTAR"; then
1848     AC_MSG_ERROR([not found. install GNU or BSD tar.])
1850 AC_SUBST(GNUTAR)
1852 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
1853 dnl desktop OSes from "mobile" ones.
1855 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
1856 dnl In other words, that when building for an OS that is not a
1857 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
1859 dnl Note the direction of the implication; there is no assumption that
1860 dnl cross-compiling would imply a non-desktop OS.
1862 if test $_os != iOS -a $_os != Android; then
1863     BUILD_TYPE="$BUILD_TYPE DESKTOP"
1866 dnl ===================================================================
1867 dnl Extra check for Windows. Cygwin builds need gcc to build dmake
1868 dnl although MSVC is used to build other build-time tools and 
1869 dnl LibreOffice itself.
1870 dnl ===================================================================
1871 if test "$build_os" = "cygwin" ; then
1872     AC_MSG_CHECKING([for Cygwin gcc/g++])
1873     if which gcc > /dev/null && which g++ > /dev/null ; then
1874         AC_MSG_RESULT([found])
1875     else
1876         AC_MSG_ERROR([Cygwin gcc and g++ are needed, please install them.])
1877     fi
1882 dnl ===================================================================
1883 dnl  Checks if ccache is available
1884 dnl ===================================================================
1885 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \) ; then
1886     if test -z "$CC" ; then
1887         if test -z "$CXX" ; then
1888             AC_PATH_PROG([CCACHE],[ccache],[not found])
1889             if test "$CCACHE" = "not found" ; then
1890                 CCACHE=""
1891             else
1892                 CCACHE="ccache"
1893                 # need to check for ccache version: otherwise prevents
1894                 # caching of the results (like "-x objective-c++" for Mac)
1895                 if test $_os = Darwin -o $_os = iOS; then
1896                     # check ccache version
1897                     AC_MSG_CHECKING([whether version of ccache is suitable])
1898                     CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
1899                     CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1900                     if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
1901                         AC_MSG_RESULT([yes])
1902                     else
1903                         AC_MSG_RESULT([no])
1904                         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. ccache will not be used.])
1905                         CCACHE=""
1906                     fi
1907                 fi
1908             fi
1909         else
1910             AC_MSG_NOTICE([Automatic ccache detection ingored: CXX is pre-defined])
1911             CCACHE=""
1912         fi
1913     else
1914         AC_MSG_NOTICE([Automatic ccache detection ingored: CC is pre-defined])
1915         CCACHE=""
1916     fi
1917 else
1918     CCACHE=""
1921 if test "$CCACHE" != "" ; then
1922     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
1923     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
1924     if test "$ccache_size" = "" ; then
1925         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
1926         if test "$ccache_size" = "" ; then
1927             ccache_size=0
1928         fi
1929         # we could not determine the size or it was less than 1GB -> disable auto-ccache
1930         if test $ccache_size -lt 1024 ; then
1931             CCACHE=""
1932             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
1933             echo "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled" >> warn
1934         else
1935             # warn that ccache may be too small for debug build
1936             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1937             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1938         fi
1939     else
1940         if test $ccache_size -lt 5  ; then
1941             #warn that ccache may be too small for debug build
1942             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1943             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1944         fi
1945     fi
1948 dnl ===================================================================
1949 dnl  Checks for C compiler,
1950 dnl  The check for the C++ compiler is later on.
1951 dnl ===================================================================
1952 GCC_HOME_SET="true"
1953 AC_MSG_CHECKING([gcc home])
1954 if test -z "$with_gcc_home"; then
1955     if test "$enable_icecream" = "yes" ; then
1956         GCC_HOME="/opt/icecream"
1957     else
1958         GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1959         GCC_HOME_SET="false"
1960     fi
1961 else
1962     GCC_HOME="$with_gcc_home"
1964 AC_MSG_RESULT($GCC_HOME)
1965 AC_SUBST(GCC_HOME)
1967 if test "$GCC_HOME_SET" = "true" ; then
1968     if test -z "$CC"; then
1969         CC="$GCC_HOME/bin/gcc"
1970     fi
1971     if test -z "$CXX"; then
1972         CXX="$GCC_HOME/bin/g++"
1973     fi
1976 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1977 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
1978     AC_PROG_CC
1981 COMPATH=`dirname "$CC"`
1982 if test "$COMPATH" = "." ; then
1983     AC_PATH_PROGS(COMPATH, $CC)
1984     dnl double square bracket to get single because of M4 quote...
1985     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1987 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1992 dnl ===================================================================
1993 dnl  Test MacOSX sdk and version requirement
1994 dnl ===================================================================
1995 if test "$_os" = "Darwin" ; then
1997     if test "$with_macosx_version_min_required" = "" ; then
1998         with_macosx_version_min_required="10.4"
1999     fi
2001     if test "$with_macosx_version_max_allowed" = "" ; then
2002         with_macosx_version_max_allowed="$with_macosx_version_min_required"
2003     fi
2005     if test "$with_macosx_sdk" = "" ; then
2006         with_macosx_sdk="$with_macosx_version_max_allowed"
2007     fi
2009     case "$with_macosx_sdk" in
2011     10.4)
2012         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.4u.sdk"
2013         if test ! -d "$MACOSX_SDK_PATH"; then
2014           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.4u.sdk"
2015         fi
2016         macosx_sdk_value="1040"
2017         ;;
2018     10.5)
2019         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"
2020         if test ! -d "$MACOSX_SDK_PATH"; then
2021           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.5.sdk"
2022         fi
2023         macosx_sdk_value="1050"
2024         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
2025         echo "Building with a SDK > 10.4 is experimental" >> warn
2026         ;;
2027     10.6)
2028         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk"
2029         macosx_sdk_value="1060"
2030         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
2031         echo "Building with a SDK > 10.4 is experimental" >> warn
2032         ;;
2033     10.7)
2034         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.7.sdk"
2035         macosx_sdk_value="1070"
2036         AC_MSG_WARN([Building with SDK 10.7 is known to fail in vcl])
2037         echo "Building with SDK 10.7 is known to fail in vcl" >> warn
2038         ;;
2039     *)
2040         AC_MSG_ERROR([$with_macosx_sdk is not a supported SDK value, supported value are 10.4, 10.5, 10.6 and 10.7])
2041         ;;
2042     esac
2043     AC_MSG_CHECKING([the presence of the SDK $with_macosx_sdk])
2044     if test -d "$MACOSX_SDK_PATH" ; then
2045         AC_MSG_RESULT([$MACOSX_SDK_PATH ok])
2046     else
2047         AC_MSG_ERROR([$MACOSX_SDK_PATH not found])
2048     fi
2049     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2051     case "$with_macosx_version_min_required" in
2053     10.4)
2054         MAC_OS_X_VERSION_MIN_REQUIRED="1040"
2055         ;;
2056     10.5)
2057         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2058         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2059         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2060         if test -z "$save_CC" ; then
2061             CC="gcc-4.2 -m32"
2062             CXX="g++-4.2 -m32"
2063         fi
2064         ;;
2065     10.6)
2066         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2067         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2068         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2069         if test -z "$save_CC" ; then
2070             CC="gcc-4.2 -m32"
2071             CXX="g++-4.2 -m32"
2072         fi
2073         ;;
2074     10.7)
2075         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2076         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
2077         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
2078         if test -z "$save_CC" ; then
2079             CC="gcc-4.2 -m32"
2080             CXX="g++-4.2 -m32"
2081         fi
2082         ;;
2083     *)
2084         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.4, 10.5, 10.6 and 10.7])
2085         ;;
2086     esac
2088     case "$with_macosx_version_max_allowed" in
2090     10.4)
2091         MAC_OS_X_VERSION_MAX_ALLOWED="1040"
2092         ;;
2093     10.5)
2094         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2095         ;;
2096     10.6)
2097         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2098         ;;
2099     10.7)
2100         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2101         ;;
2102     *)
2103         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.4, 10.5, 10.6 and 10.7])
2104         ;;
2105     esac
2107     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2108     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED ; then
2109         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2110     else
2111         AC_MSG_RESULT([ok])
2112     fi
2114     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent macos-with-sdk])
2115     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $macosx_sdk_value ; then
2116         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2117     else
2118         AC_MSG_RESULT([ok])
2119     fi
2120     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2121     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2123 AC_SUBST(MACOSX_SDK_PATH)
2124 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2125 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2126 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2128 dnl ===================================================================
2129 dnl  Test the gcc version,  3 is OK
2130 dnl ===================================================================
2131 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) -a "$GCC" = "yes"; then
2132     AC_MSG_CHECKING([the GNU C compiler version])
2133     _gcc_version=`$CC -dumpversion`
2134     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2135     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2137     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$GCCVER" -ge "040100" ; then
2138         if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
2139             export CC="$GCC_HOME/bin/gcc-4.0"
2140             #  export CC to have it available in set_soenv -> config.guess
2141             GCCVER2=`$CC -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2142             if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
2143                 GCCVER=$GCCVER2
2144             fi
2145         fi
2146         if test "$GCCVER" -ge "040100" ; then
2147             AC_MSG_ERROR([You need to use the gcc-4.0 compiler (gcc $_gcc_version won't work with the MacOSX10.4u.sdk) - set CC accordingly])
2148         else
2149             AC_MSG_RESULT([implicitly using CC=$CC])
2150         fi
2151     else
2152         AC_MSG_RESULT([checked (gcc $_gcc_version)])
2153     fi
2158 # prefix C with ccache if needed
2160 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" ; then
2161     if test "$CCACHE" != "" ; then
2162         AC_MSG_CHECKING([whether $CC is already ccached])
2165         AC_LANG_PUSH([C])
2166         save_CFLAGS=$CFLAGS
2167         CFLAGS="$CFLAGS --ccache-skip -O2"
2168         dnl an empty program will do, we're checking the compiler flags
2169         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2170                           [use_ccache=yes], [use_ccache=no])
2171         if test $use_ccache = yes ; then
2172             AC_MSG_RESULT([yes])
2173         else
2174             CC="$CCACHE $CC"
2175             AC_MSG_RESULT([no])
2176         fi
2177         CFLAGS=$save_CFLAGS
2178         AC_LANG_POP([C])
2179     fi
2183 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2184 if test "$GCC" = "yes"; then
2185     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2186     bsymbolic_functions_ldflags_save=$LDFLAGS
2187     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2188     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2189 #include <stdio.h>
2190         ],[
2191 printf ("hello world\n");
2192         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2193     if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
2194         AC_MSG_RESULT( found )
2195     else
2196         AC_MSG_RESULT( not found )
2197     fi
2198     LDFLAGS=$bsymbolic_functions_ldflags_save
2200 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2202 dnl ===================================================================
2203 dnl Set up a different compiler to produce tools to run on the build
2204 dnl machine when doing cross-compilation
2205 dnl ===================================================================
2207 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
2208 if test "$cross_compiling" = "yes"; then
2209     AC_MSG_CHECKING([for BUILD platform configuration])
2210     echo
2211     rm -rf CONF-FOR-BUILD Env.Build.sh
2212     mkdir CONF-FOR-BUILD
2213     tar cf - \
2214         Makefile.in \
2215         bin/repo-list.in \
2216         build_env.in \
2217         config.guess \
2218         configure \
2219         ooo.lst.in \
2220         oowintool \
2221         post_download.in \
2222         set_soenv.in \
2223         solenv/inc/langlist.mk \
2224         solenv/inc/postset.mk \
2225         desktop/scripts/soffice.sh.in \
2226     | (cd CONF-FOR-BUILD && tar xf -)
2227     (
2228     unset COM GUI GUIBASE OS CPU CPUNAME
2229     unset CC CXX SYSBASE CFLAGS
2230     unset PYTHON_CFLAGS PYTHON_LIBS
2231     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
2232     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
2233     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
2234     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
2235     cd CONF-FOR-BUILD
2236     sub_conf_opts=""
2237     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
2238     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
2239     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
2240     ./configure \
2241         --disable-mozilla \
2242         --disable-build-mozilla \
2243         --disable-zenity \
2244         --with-num-cpus="$with_num_cpus" \
2245         --with-max-jobs="$with_max_jobs" \
2246         $sub_conf_opts \
2247         2>&1 | sed -e 's/^/    /'
2248     test -f ./Env.Host.sh 2>/dev/null || exit
2249     cp Env.Host.sh ../Env.Build.sh
2250     . ./Env.Host.sh
2251     for V in COM GUI GUIBASE OS CPU CPUNAME CC CXX GXX_INCLUDE_PATH MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
2252              SYSTEM_LIBXSLT; do
2253         VV='$'$V
2254         VV=`eval "echo $VV"`
2255         if test -n "$VV"; then
2256             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
2257             echo "$line" >>build-config
2258         fi
2259     done
2261     for V in OUTDIR PATH SOLARINC SOLARLIB WORKDIR; do
2262         VV='$'$V
2263         VV=`eval "echo $VV"`
2264         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
2265         if test -n "$VV"; then
2266             line="${V}_FOR_BUILD='$VV'"
2267             echo "$line" >>build-config
2268         fi
2269     done
2270     )
2271     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
2272     test -f Env.Build.sh || AC_MSG_ERROR([A file called Env.Build.sh was supposed to have been copied here, but it isn't found])
2273     perl -pi -e 's,/CONF-FOR-BUILD,,g' Env.Build.sh
2274     eval `cat CONF-FOR-BUILD/build-config`
2275     AC_MSG_RESULT([checking for BUILD platform configuration... done])
2276     rm -rf CONF-FOR-BUILD
2277 else
2278     CC_FOR_BUILD="$CC"
2279     CXX_FOR_BUILD="$CXX"
2281 AC_SUBST(COM_FOR_BUILD)
2282 AC_SUBST(GUI_FOR_BUILD)
2283 AC_SUBST(GUIBASE_FOR_BUILD)
2284 AC_SUBST(OS_FOR_BUILD)
2285 AC_SUBST(CPU_FOR_BUILD)
2286 AC_SUBST(CPUNAME_FOR_BUILD)
2287 AC_SUBST(CC_FOR_BUILD)
2288 AC_SUBST(CXX_FOR_BUILD)
2289 AC_SUBST(GXX_INCLUDE_PATH_FOR_BUILD)
2290 AC_SUBST(INPATH_FOR_BUILD)
2291 AC_SUBST(OUTPATH_FOR_BUILD)
2292 AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD)
2293 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
2295 AC_SUBST(OUTDIR_FOR_BUILD)
2296 AC_SUBST(PATH_FOR_BUILD)
2297 AC_SUBST(SOLARINC_FOR_BUILD)
2298 AC_SUBST(SOLARLIB_FOR_BUILD)
2299 AC_SUBST(WORKDIR_FOR_BUILD)
2301 UPD="`echo AC_PACKAGE_VERSION | sed "s/\.//"`0"
2302 SOURCEVERSION="OOO$UPD"
2303 AC_SUBST(UPD)
2304 AC_SUBST(SOURCEVERSION)
2306 dnl ===================================================================
2307 dnl Set the ENABLE_CRASHDUMP variable.
2308 dnl ===================================================================
2309 AC_MSG_CHECKING([whether to enable crashdump feature])
2310 if test "$enable_crashdump" = "yes"; then
2311     ENABLE_CRASHDUMP="TRUE"
2312     BUILD_TYPE="$BUILD_TYPE CRASHREP"
2313     AC_MSG_RESULT([yes])
2314 else
2315     ENABLE_CRASHDUMP=""
2316     AC_MSG_RESULT([no])
2318 AC_SUBST(ENABLE_CRASHDUMP)
2321 dnl ===================================================================
2322 dnl Windows specific tests and stuff
2323 dnl ===================================================================
2324 if test "$_os" = "WINNT"; then
2326     dnl Include twain scanners
2327     BUILD_TYPE="$BUILD_TYPE TWAIN"
2329     dnl Set the CL_X64 variable if we are building a 64-bit LibreOffice.
2330     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2331     if test "z$enable_cl_x64" = "z" -o "$enable_cl_x64" = "no"; then
2332         CL_X64=""
2333         AC_MSG_RESULT([no])
2334     else
2335         CL_X64="TRUE"
2336         AC_MSG_RESULT([yes])
2337     fi
2338     AC_SUBST(CL_X64)
2340     AC_MSG_CHECKING([whether to use DirectX])
2341     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2342         ENABLE_DIRECTX="TRUE"
2343         AC_MSG_RESULT([yes])
2344     else
2345         ENABLE_DIRECTX=""
2346         AC_MSG_RESULT([no])
2347     fi
2348     AC_SUBST(ENABLE_DIRECTX)
2350     AC_MSG_CHECKING([whether to use ActiveX])
2351     if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
2352         DISABLE_ACTIVEX=""
2353         AC_MSG_RESULT([yes])
2354     else
2355         DISABLE_ACTIVEX="TRUE"
2356         AC_MSG_RESULT([no])
2357     fi
2358     AC_SUBST(DISABLE_ACTIVEX)
2360     AC_MSG_CHECKING([whether to use ATL])
2361     if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE"; then
2362         DISABLE_ATL=""
2363         AC_MSG_RESULT([yes])
2364     elif test "$enable_atl" = ""; then
2365         if test "$WITH_MINGW" = "yes"; then
2366             DISABLE_ATL="TRUE"
2367             AC_MSG_RESULT([no])
2368         else
2369             DISABLE_ATL=""
2370             AC_MSG_RESULT([yes])
2371         fi
2372     else
2373         DISABLE_ATL="TRUE"
2374         AC_MSG_RESULT([no])
2375     fi
2376     AC_SUBST(DISABLE_ATL)
2379 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
2380 dnl ===================================================================
2381 AC_MSG_CHECKING([whether to turn warnings to errors])
2382 if test -n "$enable_werror" && test "$enable_werror" != "no"; then
2383     ENABLE_WERROR="TRUE"
2384     AC_MSG_RESULT([yes])
2385 else
2386     ENABLE_WERROR="FALSE"
2387     AC_MSG_RESULT([no])
2389 AC_SUBST(ENABLE_WERROR)
2391 dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
2392 dnl ===================================================================
2393 AC_MSG_CHECKING([whether to do a debug build])
2394 if test -n "$enable_debug" && test "$enable_debug" != "no"; then
2395     ENABLE_DEBUG="TRUE"
2396     enable_symbols="yes"
2397     AC_MSG_RESULT([yes])
2398 else
2399     ENABLE_DEBUG="FALSE"
2400     AC_MSG_RESULT([no])
2402 AC_SUBST(ENABLE_DEBUG)
2404 dnl Set the ENABLE_DBGUTIL variable
2405 dnl ===================================================================
2406 AC_MSG_CHECKING([whether to build with additional debug utilities])
2407 if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2408     PROEXT=""
2409     PRODUCT=""
2411     # Compiling with MSVC using --enable-dbgutil (i.e. using the
2412     # debugging runtime, and defining _DEBUG when compiling) just
2413     # causes too many compilation errors. After having spent some
2414     # months slowly fixing them one by one, having reached sw, I give
2415     # up. Feel free to try again.
2416     if test "$_os" = WINNT -a "$WITH_MINGW" != yes; then
2417         AC_MSG_ERROR([Sorry, --enable-dbgutil won't work with MSVC])
2418     fi
2420     AC_MSG_RESULT([yes])
2421     # cppunit and graphite expose STL in public headers
2422     if test "$with_system_cppunit" = "yes"; then
2423         AC_MSG_ERROR([--with-system-cppunit conflicts with DBG_UTIL build])
2424     else
2425         with_system_cppunit=no
2426     fi
2427     if test "$with_system_graphite" = "yes"; then
2428         AC_MSG_ERROR([--with-system-graphite conflicts with DBG_UTIL build])
2429     else
2430         with_system_graphite=no
2431     fi
2432     if test "$with_system_mysql_cppconn" = "yes"; then
2433         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with DBG_UTIL build])
2434     else
2435         with_system_mysql_cppconn=no
2436     fi
2437     if test $_os = WINNT -a \
2438             \( "$enable_mozilla" != no -o \
2439                "$enable_build_mozilla" != no \); then
2440         # We can't build against the Mozilla stuff if using _DEBUG, will get linking errors
2441         # See connectivity/drivers/mozab
2442         AC_MSG_WARN([Also disabling Mozilla stuff then])
2443         enable_mozilla=no
2444         enable_build_mozilla=no
2445     fi
2446 else
2447     PRODUCT="full"
2448     PROEXT=".pro"
2449     AC_MSG_RESULT([no, full product build])
2451 AC_SUBST(PRODUCT)
2452 AC_SUBST(PROEXT)
2454 dnl Determine whether to use linkoo for the smoketest installation
2455 dnl ===================================================================
2456 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
2457 if test "$enable_linkoo" = "no"; then
2458     DISABLE_LINKOO="TRUE"
2459     AC_MSG_RESULT([no])
2460 else
2461     DISABLE_LINKOO=
2462     AC_MSG_RESULT([yes])
2464 AC_SUBST(DISABLE_LINKOO)
2466 # Set the ENABLE_LTO variable
2467 # ===================================================================
2468 AC_MSG_CHECKING([whether to use link-time optimization])
2469 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2470     ENABLE_LTO="TRUE"
2471     AC_MSG_RESULT([yes])
2472 else
2473     ENABLE_LTO=""
2474     AC_MSG_RESULT([no])
2476 AC_SUBST(ENABLE_LTO)
2478 dnl whether to include symbols into final build.
2479 dnl ===================================================================
2480 AC_MSG_CHECKING([whether to include symbols])
2481 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
2482     ENABLE_SYMBOLS="TRUE"
2483     AC_MSG_RESULT([yes])
2484 else
2485     ENABLE_SYMBOLS=
2486     AC_MSG_RESULT([no])
2488 AC_SUBST(ENABLE_SYMBOLS)
2490 dnl Determine if the solver is to be stripped or not.
2491 dnl ===================================================================
2492 AC_MSG_CHECKING([whether to strip the solver or not.])
2493 if test "z$enable_strip_solver" = "zno"; then
2494     DISABLE_STRIP="TRUE"
2495     AC_MSG_RESULT([no])
2496 else
2497     if test -n "$ENABLE_SYMBOLS"; then
2498         DISABLE_STRIP="TRUE"
2499         AC_MSG_RESULT([no])
2500     else
2501         DISABLE_STRIP=
2502         AC_MSG_RESULT([yes])
2503     fi
2505 AC_SUBST(DISABLE_STRIP)
2507 dnl check for cups support
2508 dnl ===================================================================
2509 if test "$test_cups" = "yes"; then
2510     AC_MSG_CHECKING([whether cups support is present])
2511     AC_CHECK_LIB(cups, cupsPrintFiles)
2512     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
2513     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
2514         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
2515     fi
2519 # check for fontconfig support
2520 AC_MSG_CHECKING([whether we need fontconfig])
2521 if test "z$test_fontconfig" = "zyes"; then
2522     ENABLE_FONTCONFIG="TRUE"
2523     AC_MSG_RESULT([yes])
2524     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
2525 else
2526     ENABLE_FONTCONFIG=""
2527     AC_MSG_RESULT([no])
2529 AC_SUBST(ENABLE_FONTCONFIG)
2530 AC_SUBST(FONTCONFIG_CFLAGS)
2531 AC_SUBST(FONTCONFIG_LIBS)
2533 dnl whether to find & fetch external tarballs?
2534 dnl ===================================================================
2535 if test -z "$TARFILE_LOCATION"; then
2536     TARFILE_LOCATION="DEFAULT"
2538 AC_SUBST(TARFILE_LOCATION)
2540 if test "z$enable_fetch_external" != "zno" ; then
2541     DO_FETCH_TARBALLS="YES"
2543 AC_SUBST(DO_FETCH_TARBALLS)
2546 dnl Disable legacy binary file formats filters
2547 dnl ===================================================================
2548 AC_MSG_CHECKING([whether to enable filters for legacy binary file formats (StarOffice 5.2)])
2549 if test "$enable_binfilter" = "no"; then
2550     WITH_BINFILTER="NO"
2551     AC_MSG_RESULT([no])
2552 else
2553     WITH_BINFILTER="YES"
2554     BUILD_TYPE="$BUILD_TYPE BINFILTER"
2555     GIT_REPO_NAMES="$GIT_REPO_NAMES binfilter"
2556     AC_MSG_RESULT([yes])
2558 AC_SUBST(WITH_BINFILTER)
2560 AC_MSG_CHECKING([whether to build help])
2561 if test "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
2562     AC_MSG_RESULT([yes])
2563     BUILD_TYPE="$BUILD_TYPE HELP"
2564     SCPDEFS="$SCPDEFS -DWITH_HELP"
2565     GIT_REPO_NAMES="$GIT_REPO_NAMES help"
2566 else
2567     AC_MSG_RESULT([no])
2570 dnl Enable ugly pieces of code we're better off without
2571 dnl ===================================================================
2572 if test "$enable_ugly" = "yes"; then
2573     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2574     SCPDEFS="$SCPDEFS -DWITH_UGLY"
2575     ENABLE_UGLY=YES
2576 else
2577     ENABLE_UGLY=NO
2579 AC_SUBST(ENABLE_UGLY)
2581 dnl ===================================================================
2582 dnl Disable rpath in shared libraries?
2583 dnl ===================================================================
2584 AC_MSG_CHECKING([whether to use RPATH in shared libraries])
2585 if test "$enable_rpath" = "no"; then
2586     ENABLE_RPATH="no"
2587 else
2588     ENABLE_RPATH="yes"
2590 AC_MSG_RESULT([$ENABLE_RPATH])
2591 AC_SUBST(ENABLE_RPATH)
2593 dnl Test whether to include MySpell dictionaries
2594 dnl ===================================================================
2595 AC_MSG_CHECKING([whether to include MySpell dictionaries])
2596 if test -z "$with_myspell_dicts" || test "$with_myspell_dicts" = "yes"; then
2597     AC_MSG_RESULT([yes])
2598     WITH_MYSPELL_DICTS=YES
2599     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2600     GIT_REPO_NAMES="$GIT_REPO_NAMES dictionaries"
2601 else
2602     AC_MSG_RESULT([no])
2603     WITH_MYSPELL_DICTS=NO
2605 AC_SUBST(WITH_MYSPELL_DICTS)
2607 AC_MSG_CHECKING([whether to use dicts from external paths])
2608 if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
2609     AC_MSG_RESULT([yes])
2610     SYSTEM_DICTS=YES
2611     AC_MSG_CHECKING([for spelling dictionary directory])
2612     if test -n "$with_external_dict_dir"; then
2613         DICT_SYSTEM_DIR=file://$with_external_dict_dir
2614     else
2615         DICT_SYSTEM_DIR=file:///usr/share/hunspell
2616     fi
2617     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
2618     AC_MSG_CHECKING([for hyphenation patterns directory])
2619     if test -n "$with_external_hyph_dir"; then
2620         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
2621     else
2622         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
2623     fi
2624     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
2625     AC_MSG_CHECKING([for thesaurus directory])
2626     if test -n "$with_external_thes_dir"; then
2627         THES_SYSTEM_DIR=file://$with_external_thes_dir
2628     else
2629         THES_SYSTEM_DIR=file:///usr/share/mythes
2630     fi
2631     AC_MSG_RESULT([$THES_SYSTEM_DIR])
2632 else
2633     AC_MSG_RESULT([no])
2634     SYSTEM_DICTS=NO
2636 AC_SUBST(SYSTEM_DICTS)
2637 AC_SUBST(DICT_SYSTEM_DIR)
2638 AC_SUBST(HYPH_SYSTEM_DIR)
2639 AC_SUBST(THES_SYSTEM_DIR)
2641 dnl ===================================================================
2642 dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
2643 dnl ===================================================================
2644 AC_MSG_CHECKING([whether to enable pch feature])
2645 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
2646     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2647         ENABLE_PCH="TRUE"
2648         AC_MSG_RESULT([yes])
2649 dnl There is no PCH support in GCC versions prior to this
2650     elif test "$GCC" = "yes"; then
2651         ENABLE_PCH="TRUE"
2652         AC_MSG_RESULT([yes])
2653     else
2654         ENABLE_PCH=""
2655         AC_MSG_WARN([Precompiled header not yet supported for your platform/compiler])
2656     fi
2657 else
2658     ENABLE_PCH=""
2659     AC_MSG_RESULT([no])
2661 AC_SUBST(ENABLE_PCH)
2663 dnl ===================================================================
2664 dnl Search all the common names for GNU make
2665 dnl ===================================================================
2666 AC_MSG_CHECKING([for GNU make])
2668 # try to use our own make if it is available and GNUMAKE was not already defined
2669 if test -z "$GNUMAKE"; then
2670     if test -x "/opt/lo/bin/make"; then
2671         GNUMAKE="/opt/lo/bin/make"
2672     fi
2675 for a in "$MAKE" $GNUMAKE make gmake gnumake; do
2676     $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
2677     if test $? -eq 0;  then
2678         GNUMAKE=$a
2679         break
2680     fi
2681 done
2682 AC_MSG_RESULT($GNUMAKE)
2683 if test -z "$GNUMAKE"; then
2684     AC_MSG_ERROR([not found. install GNU make.])
2687 AC_MSG_CHECKING([the GNU make version])
2688 _make_version=`$GNUMAKE --version | grep GNU | grep -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
2689 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2690 if test "$_make_longver" -ge "038200" ; then
2691     AC_MSG_RESULT([$GNUMAKE $_make_version])
2693 elif test "$_make_longver" -ge "038100" ; then
2694     AC_MSG_RESULT([$GNUMAKE $_make_version])
2695     AC_MSG_CHECKING([for GNU make bug 20033])
2696     TESTGMAKEBUG20033=`mktemp -d`
2697     cat > $TESTGMAKEBUG20033/Makefile << EOF
2698 A := \$(wildcard *.a)
2700 .PHONY: all
2701 all: \$(A:.a=.b)
2702         @echo survived bug20033. #dont kill these tabs, you will break the Makefile!!!!
2704 .PHONY: setup
2705 setup:
2706         @touch 1.a 2.a 3.a 4.a 5.a 6.a
2708 define d1
2709 @echo lala \$(1)
2710 @sleep 1
2711 endef
2713 define d2
2714 @echo tyty \$(1)
2715 @sleep 1
2716 endef
2718 %.b : %.a
2719         \$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | sha1sum))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
2720         \$(call d1,\$(CHECKSUM)),\
2721         \$(call d2,\$(CHECKSUM)))
2723     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
2724         no_parallelism_make="YES"
2725         AC_MSG_RESULT([yes, disable parallelism])
2726     else
2727         AC_MSG_RESULT([no, keep parallelism enabled])
2728     fi
2729     rm -rf $TESTGMAKEBUG20033
2730 else
2731     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
2733 AC_SUBST(GNUMAKE)
2735 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`;
2736 STALE_MAKE=
2737 make_warning=
2738 if test "z$_make_ver_check" = "z"; then
2739    STALE_MAKE=TRUE
2741 AC_SUBST(STALE_MAKE)
2743 dnl ===================================================================
2744 dnl  Test the Solaris compiler version
2745 dnl ===================================================================
2746 if test "$_os" = "SunOS"; then
2747     if test "$CC" = "cc"; then
2748         AC_PATH_PROGS(_cc, cc)
2749         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2750         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2751         dnl cc -V outputs to standard error!!!!
2752         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2753         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2754         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2755         if test "$_sunstudio_major" != "5"; then
2756             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2757         else
2758             _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" }'`
2759             if test "$_sunstudio_minor" = "false"; then
2760                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2761             else
2762                 dnl compiler will do
2763                 AC_MSG_RESULT([checked])
2764             fi
2765         fi
2766     fi
2769 HAVE_LD_HASH_STYLE=FALSE
2770 WITH_LINKER_HASH_STYLE=
2771 AC_MSG_CHECKING( for --hash-style gcc linker support )
2772 if test "$GCC" = "yes" ; then
2773     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes" ; then
2774         hash_styles="gnu sysv"
2775     elif test "$with_linker_hash_style" = "no" ; then
2776         hash_styles=
2777     else
2778         hash_styles="$with_linker_hash_style"
2779     fi
2781     for hash_style in $hash_styles ; do
2782         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
2783         hash_style_ldflags_save=$LDFLAGS
2784         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
2786         AC_LINK_IFELSE([AC_LANG_PROGRAM(
2787             [
2788 #include <stdio.h>
2789             ],[
2790 printf ("");
2791             ])],
2792             [ if ./conftest$EXEEXT; then
2793                   HAVE_LD_HASH_STYLE=TRUE
2794                   WITH_LINKER_HASH_STYLE=$hash_style
2795               fi],
2796             [HAVE_LD_HASH_STYLE=FALSE])
2797         LDFLAGS=$hash_style_ldflags_save
2798     done
2800     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
2801         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
2802     else
2803         AC_MSG_RESULT( no )
2804     fi
2805     LDFLAGS=$hash_style_ldflags_save
2806 else
2807     AC_MSG_RESULT( no )
2809 AC_SUBST(HAVE_LD_HASH_STYLE)
2810 AC_SUBST(WITH_LINKER_HASH_STYLE)
2812 dnl ===================================================================
2813 dnl Check whether there's a Perl version available.
2814 dnl ===================================================================
2815 if test -z "$with_perl_home"; then
2816     AC_PATH_PROG(PERL, perl)
2817 else
2818     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
2819     _perl_path="$with_perl_home/bin/perl"
2820     if test -x "$_perl_path"; then
2821         PERL=$_perl_path
2822     else
2823         AC_MSG_ERROR([$_perl_path not found])
2824     fi
2827 dnl ===================================================================
2828 dnl Testing for Perl version 5 or greater.
2829 dnl $] is the Perl version variable, it is returned as an integer
2830 dnl ===================================================================
2831 if test "$PERL"; then
2832     AC_MSG_CHECKING([the Perl version])
2833     ${PERL} -e "exit($]);"
2834     _perl_version=$?
2835     if test "$_perl_version" -lt 5; then
2836         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2837     fi
2838     AC_MSG_RESULT([checked (perl $_perl_version)])
2839 else
2840     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2842 AC_SUBST(PERL)
2844 dnl ===================================================================
2845 dnl Testing for required Perl modules
2846 dnl ===================================================================
2848 AC_MSG_CHECKING([for required Perl modules])
2849 if `$PERL -e 'use Archive::Zip; use Cwd;'`; then
2850     AC_MSG_RESULT([all modules found])
2851 else
2852     AC_MSG_ERROR([Failed to find some modules])
2855 dnl ===================================================================
2856 dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2857 dnl ===================================================================
2858 SHOWINCLUDES_PREFIX=
2859 if test "$_os" = "WINNT"; then
2860     if test "$WITH_MINGW" != "yes"; then
2861         AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
2862         if test -z "$with_cl_home"; then
2863             vctest=`./oowintool --msvc-productdir`;
2864             if test "$CL_X64" = ""; then
2865                 if test -x "$vctest/bin/cl.exe"; then
2866                     with_cl_home=$vctest;
2867                 fi
2868             else
2869                 if test -x "$vctest/bin/amd64/cl.exe"; then
2870                     with_cl_home=$vctest;
2871                 fi
2872             fi
2873         else
2874             with_cl_home=`cygpath -u "$with_cl_home"`
2875         fi
2876         with_cl_home=`cygpath -d "$with_cl_home"`
2877         with_cl_home=`cygpath -u "$with_cl_home"`
2878         AC_MSG_RESULT([$with_cl_home])
2880         dnl ===========================================================
2881         dnl  Check for mspdb80.dll/mspdb100.dll
2882         dnl ===========================================================
2883         dnl MSVS 2008/10 Compiler
2884         if test -n "$with_mspdb_path";then
2885             with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2886         fi
2887         if test -e "$with_mspdb_path/mspdb80.dll" -o -e "$with_mspdb_path/mspdb100.dll"; then
2888             MSPDB_PATH="$with_mspdb_path"
2889         fi
2890         dnl MSVS 2008 case
2891         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2892             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2893         fi
2894         dnl Windows SDK 6.0 case
2895         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2896             MSPDB_PATH="$with_cl_home/bin"
2897         fi
2898         dnl MSVS 2010 case
2899         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb100.dll"; then
2900             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2901         fi
2903         if test -z "$MSPDB_PATH";then
2904             dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2905             AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2906             AC_PATH_PROG(MSPDB_PATH, mspdb100.dll)
2907             MSPDB_PATH=`dirname "$MSPDB_PATH"`
2908         fi
2910         if test -z "$MSPDB_PATH"; then
2911             AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
2912         fi
2913         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2914         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2915         dnl The path needs to be added before cl is called
2916         PATH="$MSPDB_PATH:$PATH"
2918         AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2919         if test -z "$CC"; then
2920             if test "$CL_X64" = ""; then
2921                 if test -x "$with_cl_home/bin/cl.exe"; then
2922                     CC="$with_cl_home/bin/cl.exe"
2923                 fi
2924             else
2925                 if test -x "$with_cl_home/bin/amd64/cl.exe"; then
2926                     CC="$with_cl_home/bin/amd64/cl.exe"
2927                 fi
2928             fi
2929             if test -z "$CC"; then
2930                 AC_PATH_PROG(CC, cl.exe)
2931             fi
2932             # This gives us a posix path with 8.3 filename restrictions
2933             CC=`cygpath -d "$CC"`
2934             CC=`cygpath -u "$CC"`
2935         fi
2937         if test -n "$CC"; then
2938             # Remove /cl.exe from CC case insensitive
2939             AC_MSG_RESULT([found ($CC)])
2940             if test "$CL_X64" = ""; then
2941                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
2942             else
2943                 if test -n "$with_cl_home"; then
2944                     COMPATH=`echo $with_cl_home`
2945                 fi
2946             fi
2947             export INCLUDE=`cygpath -d "$COMPATH/Include"`
2948             dnl  Check which Microsoft C/C++ compiler is found
2949             AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2950             # The following finds Microsoft, matches nn.nn.nnnn then pulls numbers out.
2951             CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft/ && /..\\...\\...../ {
2952                             x = match( \\\$0, /..\\...\\...../ )
2953                             CCversion = substr( \\\$0, RSTART, RLENGTH)
2954                             tokencount = split (CCversion,vertoken,\".\")
2955                             for ( i = 1 ; i <= tokencount ; i++ ) {
2956                                 printf (\"%04d\",vertoken[[i]] )
2957                             }
2958                             }"`
2959             if test "$CCNUMVER" -ge "001600000000"; then
2960                 COMEX=13
2961                 MSVSVER=2010
2962             elif test "$CCNUMVER" -ge "001500000000"; then
2963                 COMEX=12
2964                 MSVSVER=2008
2965             else
2966                 AC_MSG_ERROR([Compiler too old. Use Microsoft Visual Studio 2008 or 2010.])
2967             fi
2968             AC_MSG_RESULT([found compiler version $CCNUMVER (MSVS $MSVSVER).])
2969         else
2970             AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
2971         fi
2973         dnl We need to guess the prefix of the -showIncludes output, it can be
2974         dnl localized
2975         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
2976         echo "#include <stdlib.h>" > conftest.c
2977         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
2978             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
2979         rm -f conftest.c conftest.obj
2980         if test -z "$SHOWINCLUDES_PREFIX" ; then
2981             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
2982         else
2983             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
2984         fi
2986         # Check for 64-bit (cross-)compiler to use to build the 64-bit
2987         # version of the Explorer extension (and maybe other small
2988         # bits, too) needed when installing a 32-bit LibreOffice on a
2989         # 64-bit OS. The 64-bit Explorer extension is a feature that
2990         # has been present since long in OOo. Don't confuse it with
2991         # building LibreOffice itself as 64-bit code, which is
2992         # unfished work and highly experimental.
2994         BUILD_X64=
2995         CC_X64_BINARY=
2996         LINK_X64_BINARY=
2997         LIBMGR_X64_BINARY=
2999         AC_MSG_CHECKING([for a x64 compiler and libraries for 64bit ActiveX component])
3000         if test "$CL_X64" = "" -a -f "$with_cl_home/atlmfc/lib/amd64/atls.lib"; then
3001             # Prefer native x64 compiler to cross-compiler, in case we are running
3002             # the build on a 64-bit OS.
3003             if "$with_cl_home/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3004                 BUILD_X64=TRUE
3005                 CC_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
3006                 CXX_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
3007                 LINK_X64_BINARY="$with_cl_home/bin/amd64/link.exe"
3008                 LIBMGR_X64_BINARY="$with_cl_home/bin/amd64/lib.exe"
3009             elif "$with_cl_home/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3010                 BUILD_X64=TRUE
3011                 CC_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
3012                 CXX_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
3013                 LINK_X64_BINARY="$with_cl_home/bin/x86_amd64/link.exe"
3014                 LIBMGR_X64_BINARY="$with_cl_home/bin/x86_amd64/lib.exe"
3015             fi
3016         fi
3017         if test "$BUILD_X64" = TRUE; then
3018             AC_MSG_RESULT([found])
3019         else
3020             AC_MSG_RESULT([not found])
3021             AC_MSG_WARN([Installation set will not contain the 64-bit Explorer extension])
3022         fi
3023         AC_SUBST(BUILD_X64)
3025         # These are passed to the environment through set_soenv.in as usual, and then
3026         # used in set_wntx64.mk
3027         AC_SUBST(CC_X64_BINARY)
3028         AC_SUBST(CXX_X64_BINARY)
3029         AC_SUBST(LINK_X64_BINARY)
3030         AC_SUBST(LIBMGR_X64_BINARY)
3032     else
3033         AC_MSG_CHECKING([the compiler is MinGW])
3034         MACHINE_PREFIX=`$CC -dumpmachine`
3035         if echo $MACHINE_PREFIX | grep -q mingw32; then
3036             AC_MSG_RESULT([yes])
3037         else
3038             AC_MSG_ERROR([Compiler is not MinGW.])
3039         fi
3040     fi
3042 AC_SUBST(COMEX)
3043 AC_SUBST(MSPDB_PATH)
3044 AC_SUBST(SHOWINCLUDES_PREFIX)
3046 dnl ===================================================================
3047 dnl Check for pkg-config
3048 dnl ===================================================================
3049 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3050     PKG_PROG_PKG_CONFIG
3053 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3055     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
3056     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
3057     # explicitly. Or put /path/to/compiler in PATH yourself.
3059     AC_CHECK_TOOL(AR,ar)
3060     AC_CHECK_TOOL(NM,nm)
3061     AC_CHECK_TOOL(OBJDUMP,objdump)
3062     AC_CHECK_TOOL(RANLIB,ranlib)
3063     AC_CHECK_TOOL(STRIP,strip)
3064     if test "$_os" = "WINNT"; then
3065         AC_CHECK_TOOL(DLLTOOL,dlltool)
3066         AC_CHECK_TOOL(WINDRES,windres)
3067     fi
3069 AC_SUBST(AR)
3070 AC_SUBST(DLLTOOL)
3071 AC_SUBST(NM)
3072 AC_SUBST(OBJDUMP)
3073 AC_SUBST(PKG_CONFIG)
3074 AC_SUBST(RANLIB)
3075 AC_SUBST(STRIP)
3076 AC_SUBST(WINDRES)
3078 dnl ===================================================================
3079 dnl pkg-config checks on Mac OS X
3080 dnl ===================================================================
3082 if test $_os = Darwin; then
3083     AC_MSG_CHECKING([for bogus pkg-config])
3084     if test -n "$PKG_CONFIG"; then
3085         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | grep -q Mono.framework; then
3086             AC_MSG_RESULT([yes, from Mono])
3087         else
3088             AC_MSG_RESULT([yes, from unknown origin])
3089         fi
3090         AC_MSG_WARN([This might have unexpected consequences, please consider hiding $PKG_CONFIG])
3091         echo "Having a $PKG_CONFIG might have unexpected consequences, please consider hiding it" >>warn
3092     else
3093         AC_MSG_RESULT([no])
3094     fi
3097 dnl ===================================================================
3098 dnl  .NET needs special treatment
3099 dnl (does the above comment really mean .NET, or is it misusing
3100 dnl that to mean Visual Studio .NET 2003 ? And does this also
3101 dnl in fact apply equally to what we actually support, i.e.
3102 dnl Visual Studio 2008 and 2010?)
3103 dnl ===================================================================
3104 if test "$build_os" = "cygwin"; then
3105     dnl Check midl.exe
3106     AC_PATH_PROG(MIDL_PATH, midl.exe)
3107     if test -n "$MIDL_PATH";then
3108         MIDL_PATH=`dirname "$MIDL_PATH"`
3109     fi
3110     if test -n "$with_midl_path";then
3111         with_midl_path=`cygpath -u "$with_midl_path"`
3112     fi
3113     if test -x "$with_midl_path/midl.exe"; then
3114         MIDL_PATH="$with_midl_path"
3115     fi
3116     if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
3117         MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
3118     fi
3119     if test -z "$MIDL_PATH" ; then
3120         vstest=`./oowintool --msvs-productdir`;
3121         if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
3122             MIDL_PATH="$vstest/Common7/Tools/Bin"
3123         fi
3124     fi
3125     if test -z "$MIDL_PATH" ; then
3126         winsdktest=`./oowintool --windows-sdk-home`
3127         if test -x "$winsdktest/Bin/midl.exe" ; then
3128             MIDL_PATH="$winsdktest/Bin"
3129         fi
3130     fi
3131     if test ! -x "$MIDL_PATH/midl.exe"; then
3132         AC_MSG_ERROR([midl.exe not found. Make sure it's in PATH or use --with-midl-path])
3133     fi
3134     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3135     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
3136     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
3138     dnl Check csc.exe
3139     AC_PATH_PROG(CSC_PATH, csc.exe)
3140     if test -n "$CSC_PATH";then
3141         CSC_PATH=`dirname "$CSC_PATH"`
3142     fi
3143     if test -n "$with_csc_path";then
3144         with_csc_path=`cygpath -u "$with_csc_path"`
3145     fi
3146     if test -x "$with_csc_path/csc.exe"; then
3147         CSC_PATH="$with_csc_path"
3148     else
3149        csctest=`./oowintool --csc-compilerdir`;
3150        if test -x "$csctest/csc.exe"; then
3151            CSC_PATH="$csctest"
3152        fi
3153     fi
3154     if test ! -x "$CSC_PATH/csc.exe"; then
3155         AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
3156     fi
3157     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3158     CSC_PATH=`cygpath -d "$CSC_PATH"`
3159     CSC_PATH=`cygpath -u "$CSC_PATH"`
3161     dnl Check mscoree.lib / .NET Framework dir
3162     AC_MSG_CHECKING(.NET Framework)
3163     if test -n "$with_dotnet_framework_home"; then
3164         with_dotnet_framework_home=`cygpath -u "$with_dotnet_framework_home"`
3165     fi
3166     if test -f "$with_dotnet_framework_home/lib/mscoree.lib"; then
3167         DOTNET_FRAMEWORK_HOME="$with_dotnet_framework_home"
3168     fi
3169     if test -z "$DOTNET_FRAMEWORK_HOME" ; then
3170         frametest=`./oowintool --dotnetsdk-dir`
3171         if test -f "$frametest/lib/mscoree.lib"; then
3172             DOTNET_FRAMEWORK_HOME="$frametest"
3173         else
3174             frametest=`./oowintool --windows-sdk-home`
3175             if test -f "$frametest/lib/mscoree.lib"; then
3176                 DOTNET_FRAMEWORK_HOME="$frametest"
3177             fi
3178         fi
3179     fi
3180     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
3181         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-dotnet-framework-home])
3182     fi
3183     AC_MSG_RESULT(found)
3184     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3185     DOTNET_FRAMEWORK_HOME=`cygpath -d "$DOTNET_FRAMEWORK_HOME"`
3186     DOTNET_FRAMEWORK_HOME=`cygpath -u "$DOTNET_FRAMEWORK_HOME"`
3187     AC_SUBST(MIDL_PATH)
3188     AC_SUBST(CSC_PATH)
3189     AC_SUBST(DOTNET_FRAMEWORK_HOME)
3192 dnl ===================================================================
3193 dnl Check if stdc headers are available excluding MSVC.
3194 dnl ===================================================================
3195 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3196     AC_HEADER_STDC
3199 dnl ===================================================================
3200 dnl Testing for C++ compiler and version...
3201 dnl ===================================================================
3203 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3204     AC_PROG_CXX
3205 else
3206     if test -n "$CC" -a -z "$CXX"; then
3207         CXX="$CC"
3208     fi
3211 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
3212 if test "$GXX" = "yes"; then
3213     AC_MSG_CHECKING([the GNU C++ compiler version])
3215     _gpp_version=`$CXX -dumpversion`
3216     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
3218     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$_gpp_majmin" -ge "401" ; then
3219         if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
3220             export CXX="$GCC_HOME/bin/g++-4.0"
3221             _gpp_majmin_2=`$CXX -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
3222             if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
3223                 _gpp_majmin=$_gpp_majmin_2
3224             fi
3225         fi
3226         if test "$_gpp_majmin" -ge "401" ; then
3227             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])
3228         else
3229             AC_MSG_RESULT([implicitly using CXX=$CXX])
3230         fi
3231     else
3232         AC_MSG_RESULT([checked (g++ $_gpp_version)])
3233     fi
3235     if test "$_gpp_majmin" = "304"; then
3236         AC_MSG_CHECKING([whether $CXX has the enum bug])
3237         AC_RUN_IFELSE([AC_LANG_SOURCE([[
3238             extern "C" void abort (void);
3239             extern "C" void exit (int status);
3241             enum E { E0, E1, E2, E3, E4, E5 };
3243             void test (enum E e)
3244             {
3245                 if (e == E2 || e == E3 || e == E1)
3246                     exit (1);
3247             }
3249             int main (void)
3250             {
3251                 test (E4);
3252                 test (E5);
3253                 test (E0);
3254                 return 0;
3255             }
3256             ]])],[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])],[])
3257     fi
3261 # prefx CXX with ccache if needed
3263 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3264     if test "$CCACHE" != "" ; then
3265         AC_MSG_CHECKING([whether $CXX is already ccached])
3266         AC_LANG_PUSH([C++])
3267         save_CXXFLAGS=$CXXFLAGS
3268         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
3269         dnl an empty program will do, we're checking the compiler flags
3270         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3271                           [use_ccache=yes], [use_ccache=no])
3272         if test $use_ccache = yes ; then
3273             AC_MSG_RESULT([yes])
3274         else
3275             CXX="$CCACHE $CXX"
3276             AC_MSG_RESULT([no])
3277         fi
3278         CXXFLAGS=$save_CXXFLAGS
3279         AC_LANG_POP([C++])
3280     fi
3283 dnl ===================================================================
3284 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
3285 dnl ===================================================================
3287 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3288     AC_PROG_CXXCPP
3290     dnl Check whether there's a C pre-processor.
3291     dnl ===================================================================
3292     dnl When using SunStudio compiler, there is a bug with the cc
3293     dnl preprocessor, so use CC preprocessor as the cc preprocessor
3294     dnl See Issuezilla #445.
3295     dnl ===================================================================
3296     if test "$_os" = "SunOS"; then
3297         CPP=$CXXCPP
3298     else
3299         AC_PROG_CPP
3300     fi
3304 dnl ===================================================================
3305 dnl Find integral type sizes and alignments
3306 dnl ===================================================================
3308 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3310     AC_CHECK_SIZEOF(long)
3311     AC_CHECK_SIZEOF(short)
3312     AC_CHECK_SIZEOF(int)
3313     AC_CHECK_SIZEOF(long long)
3314     AC_CHECK_SIZEOF(double)
3315     AC_CHECK_SIZEOF(void*)
3317     SIZEOF_SHORT=$ac_cv_sizeof_short
3318     SIZEOF_INT=$ac_cv_sizeof_int
3319     SIZEOF_LONG=$ac_cv_sizeof_long
3320     SIZEOF_LONGLONG=$ac_cv_sizeof_long_long
3321     SIZEOF_DOUBLE=$ac_cv_sizeof_double
3322     SIZEOF_POINTER=$ac_cv_sizeof_voidp
3324     dnl Allow build without AC_CHECK_ALIGNOF, grrr
3325     m4_pattern_allow([AC_CHECK_ALIGNOF])
3326     m4_ifdef([AC_CHECK_ALIGNOF],
3327       ,
3328       [
3329          dnl We know that the ALIGNOF_ variables are used only when cross-compiling
3330          dnl in sal/typesconfig/makefile.mk...
3331          if test "$cross_compiling" = "yes"; then
3332             AC_MSG_ERROR([When cross-compiling you must use a recent Autoconf with [AC_][CHECK_ALIGNOF]])
3333          fi
3334          m4_define([AC_CHECK_ALIGNOF],
3335             [
3336                AC_MSG_WARN([Cannot determine alignment of $1])
3337                AS_TR_SH([ac_cv_alignof_$3])=unknown
3338             ])
3339       ])
3341     AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
3342     AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
3343     AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
3344     AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
3346     ALIGNOF_SHORT=$ac_cv_alignof_short
3347     ALIGNOF_INT=$ac_cv_alignof_int
3348     ALIGNOF_LONG=$ac_cv_alignof_long
3349     ALIGNOF_DOUBLE=$ac_cv_alignof_double
3351     AC_C_BIGENDIAN
3352     WORDS_BIGENDIAN=$ac_cv_c_bigendian
3354     dnl Check for large file support
3355     AC_SYS_LARGEFILE
3356     if test -n "$ac_cv_sys_file_offset_bits"; then
3357         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
3358     fi
3359     if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
3360         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
3361     fi
3362 else
3363     # Hardcode for MSVC
3364     SIZEOF_SHORT=2
3365     SIZEOF_INT=4
3366     SIZEOF_LONG=4
3367     SIZEOF_LONGLONG=8
3368     if test "$CL_X64" = ""; then
3369         SIZEOF_POINTER=4
3370     else
3371         SIZEOF_POINTER=8
3372     fi
3373     ALIGNOF_SHORT=2
3374     ALIGNOF_INT=4
3375     ALIGNOF_LONG=4
3376     ALIGNOF_DOUBLE=8
3377     WORDS_BIGENDIAN=no
3378     LFS_CFLAGS=''
3380 AC_SUBST(WORDS_BIGENDIAN)
3381 AC_SUBST(LFS_CFLAGS)
3383 AC_SUBST(SIZEOF_SHORT)
3384 AC_SUBST(SIZEOF_INT)
3385 AC_SUBST(SIZEOF_LONG)
3386 AC_SUBST(SIZEOF_LONGLONG)
3387 AC_SUBST(SIZEOF_DOUBLE)
3388 AC_SUBST(SIZEOF_POINTER)
3389 AC_SUBST(ALIGNOF_SHORT)
3390 AC_SUBST(ALIGNOF_INT)
3391 AC_SUBST(ALIGNOF_LONG)
3392 AC_SUBST(ALIGNOF_DOUBLE)
3394 dnl ===================================================================
3395 dnl Check if valgrind.h is available
3396 dnl ===================================================================
3397 if test "$cross_compiling" != "yes" -a "$enable_dbgutil" != "no" -a \
3398         -z "$VALGRIND_CFLAGS"; then
3399     dnl Test $prefix (currently only testing for /usr and /usr/local)
3400     dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
3401     prev_cppflags=$CPPFLAGS
3402     CPPFLAGS="-I/usr/include/valgrind"
3403     AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
3404     if test -z "$VALGRIND_CFLAGS"; then
3405         CPPFLAGS="-I/usr/local/include/valgrind"
3406         AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
3407     fi
3408     if test -n "$VALGRIND_CFLAGS"; then
3409         CPPFLAGS=$VALGRIND_CFLAGS
3410         AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
3411     fi
3412     CPPFLAGS=$prev_cppflags
3414 AC_SUBST([VALGRIND_CFLAGS])
3416 dnl ===================================================================
3417 dnl Set the gcc/gxx include directories
3418 dnl ===================================================================
3419 # Removed the special FreeBSD treatment. The problem was that with_gxx_include_path
3420 # often contains an i386 which is expanded as a macro.
3421 if test "$GXX" = "yes"; then
3422     AC_MSG_CHECKING([for g++ include path])
3423     if test -z "$with_gxx_include_path"; then
3424         with_gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
3425         if test "$with_gxx_include_path" = "/usr/libexec/(null)/include"; then
3426             with_gxx_include_path="/usr/include"
3427         fi
3428         if echo $with_gxx_include_path | grep -q linux; then
3429             # workaround for Mandriva - issue 100049
3430             with_gxx_include_path=`cd $with_gxx_include_path && pwd`
3431         fi
3432     fi
3433     dnl This is the original code...
3434     dnl with_gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include
3435     if test -z "$with_gxx_include_path"; then
3436         with_gxx_include_path="NO_GXX_INCLUDE"
3437         AC_MSG_RESULT([none])
3438     else
3439         AC_MSG_RESULT([$with_gxx_include_path])
3440     fi
3441 else
3442     with_gxx_include_path="NO_GXX_INCLUDE"
3444 GXX_INCLUDE_PATH="$with_gxx_include_path"
3445 AC_SUBST(GXX_INCLUDE_PATH)
3447 dnl ===================================================================
3448 dnl Set the MinGW include directories
3449 dnl ===================================================================
3450 if test "$WITH_MINGW" = "yes"; then
3451     AC_MSG_CHECKING([for MinGW include path])
3452     cat >conftest.$ac_ext <<_ACEOF
3453 #include <stddef.h>
3454 #include <bits/c++config.h>
3455 _ACEOF
3456     _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`
3457     rm conftest.$ac_ext
3458     if test -z "$_mingw_lib_include_path"; then
3459         _mingw_lib_include_path="NO_LIB_INCLUDE"
3460         AC_MSG_RESULT([no MinGW include path])
3461     else
3462         AC_MSG_RESULT([$_mingw_lib_include_path])
3463     fi
3464     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
3465     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
3467     mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
3468     MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
3470     AC_LANG_PUSH([C++])
3472     AC_MSG_CHECKING([for dynamic libgcc])
3473     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3474 #include <iostream>
3475 using namespace std;
3476 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[   
3477             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
3478             if test -n "$MINGW_GCCDLL"; then
3479                 MINGW_SHARED_GCCLIB=YES
3480                 AC_MSG_RESULT([ $MINGW_GCCDLL])
3481             else
3482                 MINGW_SHARED_GCCLIB=NO
3483                 AC_MSG_RESULT([no])
3484             fi
3485        ],[ AC_MSG_RESULT([no])
3486        
3487     ])
3489     AC_MSG_CHECKING([for dynamic libstdc++])
3490     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3491 #include <iostream>
3492 using namespace std;
3493 ]], [[ cout << "Hello there." << endl; ]])],[   
3494             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
3495             if test -n "$MINGW_GXXDLL"; then
3496                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
3497                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
3498                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
3499                 MINGW_SHARED_GXXLIB=YES
3500                 AC_MSG_RESULT([$MINGW_GXXDLL])
3501             else
3502                 MINGW_SHARED_GXXLIB=NO
3503                 AC_MSG_RESULT([no])
3504             fi
3505        ],[ AC_MSG_RESULT([no])
3506        
3507     ])
3509     AC_LANG_POP([C++])
3511     AC_SUBST(MINGW_CLIB_DIR)
3512     AC_SUBST(MINGW_SHARED_GCCLIB)
3513     AC_SUBST(MINGW_SHARED_GXXLIB)
3514     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
3515     AC_SUBST(MINGW_GCCDLL)
3516     AC_SUBST(MINGW_GXXDLL)
3519 dnl ===================================================================
3520 dnl Extra checking for the SunOS compiler
3521 dnl ===================================================================
3522 if test "$_os" = "SunOS"; then
3523     dnl SunStudio C++ compiler packaged with SunStudio C compiler
3524     if test "$CC" = "cc"; then
3525     AC_MSG_CHECKING([SunStudio C++ Compiler])
3526         if test "$CXX" != "CC"; then
3527             AC_MSG_WARN([SunStudio C++ was not found])
3528             echo "SunStudio C++ was not found" >> warn
3529         else
3530             AC_MSG_RESULT([checked])
3531         fi
3532     fi
3535 dnl *************************************************************
3536 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
3537 dnl *************************************************************
3538 if test "$WITH_MINGW" = "yes"; then
3539     AC_MSG_CHECKING([exception type])
3540     AC_LANG_PUSH([C++])
3541     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
3543         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
3545         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
3546     ])
3547     AC_MSG_RESULT($exceptions_type)
3548     AC_LANG_POP([C++])
3551 EXCEPTIONS="$exceptions_type"
3552 AC_SUBST(EXCEPTIONS)
3554 dnl ===================================================================
3555 dnl Checks for what the default STL should be
3556 dnl ===================================================================
3557 AC_MSG_CHECKING([Whether building STLPort library makes sense])
3558 BUILD_STLPORT="no"
3559 if test "$_os" = "Linux"; then
3560     case "$host_cpu" in
3561     i?86)
3562         case "$host_os" in
3563         k*bsd*-gnu*)
3564             BUILD_STLPORT="no"
3565             ;;
3566         *)
3567             BUILD_STLPORT="yes"
3568             ;;
3569         esac
3570         ;;
3571     *)
3572         BUILD_STLPORT="no"
3573         ;;
3574     esac
3575 elif test "$_os" = "SunOS"; then
3576     BUILD_STLPORT="yes"
3577 elif test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
3578     BUILD_STLPORT="yes"
3579 elif test "$_os" = "FreeBSD"; then
3580     BUILD_STLPORT="yes"
3582 if test "$BUILD_STLPORT" = "yes" ; then
3583     AC_MSG_RESULT([yes])
3584 else
3585     AC_MSG_RESULT([no])
3588 AC_MSG_CHECKING([Whether STLPort library will be actually built])
3589 if test "$with_stlport" = "auto" -o "$BUILD_STLPORT" = "no"; then
3590     with_stlport=$BUILD_STLPORT
3592 if test "$with_stlport" = "yes" ; then
3593     AC_MSG_RESULT([yes])
3594     WITH_STLPORT=YES
3595     SCPDEFS="$SCPDEFS -DWITH_STLPORT"
3596     BUILD_TYPE="$BUILD_TYPE STLPORT"
3597 else
3598     WITH_STLPORT=NO
3599     AC_MSG_RESULT([no])
3602 AC_SUBST(WITH_STLPORT)
3604 dnl ===================================================================
3605 dnl thread-safe statics
3606 dnl ===================================================================
3607 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
3608 unset HAVE_THREADSAFE_STATICS
3609 if test "$GCC" = "yes"; then
3610     save_CXXFLAGS=$CXXFLAGS
3611     CXXFLAGS="$CXXFLAGS -fthreadsafe-statics"
3612     AC_LANG_PUSH([C++])
3613     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)],[HAVE_THREADSAFE_STATICS=TRUE],[])
3614     AC_LANG_POP([C++])
3615     CXXFLAGS=$save_CXXFLAGS
3616     if test "$HAVE_THREADSAFE_STATICS" = "TRUE"; then
3617         dnl Some C++ runtimes use a single lock for all static variables, which
3618         dnl can cause deadlock in multi-threaded applications.  This is not
3619         dnl easily tested here; for POSIX-based systems, if executing the
3620         dnl following C++ program does not terminate then the tool chain
3621         dnl apparently has this problem:
3622         dnl
3623         dnl   #include <pthread.h>
3624         dnl   int h() { return 0; }
3625         dnl   void * g(void * unused) {
3626         dnl     static int n = h();
3627         dnl     return &n;
3628         dnl   }
3629         dnl   int f() {
3630         dnl     pthread_t t;
3631         dnl     pthread_create(&t, 0, g, 0);
3632         dnl     pthread_join(t, 0);
3633         dnl     return 0;
3634         dnl   }
3635         dnl   int main() {
3636         dnl     static int n = f();
3637         dnl     return n;
3638         dnl   }
3639         dnl
3640         dnl Mac OS X up to at least 10.7.1 is known to have this problem:
3641         if test "$_os" = "Darwin"; then
3642             unset HAVE_THREADSAFE_STATICS
3643             AC_MSG_RESULT([broken (i.e., no)])
3644         else
3645             AC_MSG_RESULT([yes])
3646         fi
3647     else
3648         AC_MSG_RESULT([no])
3649     fi
3650 else
3651     AC_MSG_RESULT([unknown (assuming no)])
3653 AC_SUBST(HAVE_THREADSAFE_STATICS)
3655 dnl ===================================================================
3656 dnl visibility and c++0x features
3657 dnl ===================================================================
3658 if test "$GCC" = "yes"; then
3659     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
3660     save_CFLAGS=$CFLAGS
3661     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
3662     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
3663     CFLAGS=$save_CFLAGS
3664     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3665         AC_MSG_RESULT([yes])
3666     else
3667         AC_MSG_RESULT([no])
3668     fi
3670     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
3671     save_CFLAGS=$CFLAGS
3672     CFLAGS="$CFLAGS -Werror -Wno-long-double"
3673     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
3674     CFLAGS=$save_CFLAGS
3675     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
3676         AC_MSG_RESULT([yes])
3677     else
3678         AC_MSG_RESULT([no])
3679     fi
3681     AC_MSG_CHECKING([whether $CC supports -mno-avx])
3682     save_CFLAGS=$CFLAGS
3683     CFLAGS="$CFLAGS -Werror -mno-avx"
3684     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
3685     CFLAGS=$save_CFLAGS
3686     if test "$HAVE_GCC_AVX" = "TRUE"; then
3687         AC_MSG_RESULT([yes])
3688     else
3689         AC_MSG_RESULT([no])
3690     fi
3692     AC_MSG_CHECKING([whether $CC supports -std=c++0x without Language Defect 757])
3693     save_CXXFLAGS=$CXXFLAGS
3694     CXXFLAGS="$CXXFLAGS -std=c++0x"
3695     AC_LANG_PUSH([C++])
3697     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3698 #include <stddef.h>
3700 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
3702 namespace
3704         struct b
3705         {
3706                 int i;
3707                 int j;
3708         };
3710 ]], [[
3711 struct a
3713         int i;
3714         int j;
3716 a thinga[]={{0,0}, {1,1}};
3717 b thingb[]={{0,0}, {1,1}};
3718 size_t i = sizeof(sal_n_array_size(thinga));
3719 size_t j = sizeof(sal_n_array_size(thingb));
3720 return !(i != 0 && j != 0);
3721 ]])],[HAVE_CXX0X=TRUE],[])
3723     AC_LANG_POP([C++])
3724     CXXFLAGS=$save_CXXFLAGS
3725     if test "$HAVE_CXX0X" = "TRUE"; then
3726         AC_MSG_RESULT([yes])
3727     else
3728         AC_MSG_RESULT([no])
3729     fi
3732 AC_SUBST(HAVE_CXX0X)
3733 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
3734 AC_SUBST(HAVE_GCC_AVX)
3736 dnl ===================================================================
3737 dnl system stl sanity tests
3738 dnl ===================================================================
3739 HAVE_GCC_VISIBILITY_BROKEN=
3740 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) ; then
3742     AC_LANG_PUSH([C++])
3744     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3745         AC_MSG_CHECKING([if STL headers are visibility safe])
3746         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
3747         AC_MSG_RESULT([$stlvisok])
3748         if test "$stlvisok" = "no"; then
3749             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
3750             echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
3751             unset HAVE_GCC_VISIBILITY_FEATURE
3752         fi
3753     fi
3755     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3756         sharedlink_ldflags_save=$LDFLAGS
3757         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
3759         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
3760         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3761 #include <sstream>
3762 using namespace std;
3763             ]], [[
3764 istringstream strm( "test" ); return 0;
3765             ]])],[$EGREP -q  unresolvable conftest.err;
3766             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
3767         ])
3768         AC_MSG_RESULT([$gccvisok])
3769         if test "$gccvisok" = "no"; then
3770             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
3771             echo "Your gcc is not -fvisibility-inlines-hidden safe, disabling that." >> warn
3772             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
3773         fi
3775         LDFLAGS=$sharedlink_ldflags_save
3776     fi
3778     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3779         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
3780         cat >visibility.cxx <<_ACEOF
3781 #pragma GCC visibility push(hidden)
3782 struct __attribute__ ((visibility ("default"))) TestStruct {
3783   static void Init();
3785 __attribute__ ((visibility ("default"))) void TestFunc() {
3786   TestStruct::Init();
3788 _ACEOF
3789         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
3790             gccvisbroken=yes
3791         else
3792             case "$host_cpu" in
3793             i?86|x86_64)
3794                 if test "$_os" = "Darwin"; then
3795                     gccvisbroken=no
3796                 else
3797                     if $EGREP -q '@PLT' visibility.s; then
3798                         gccvisbroken=no
3799                     else
3800                         gccvisbroken=yes
3801                     fi
3802                 fi
3803                 ;;
3804             *)
3805                 gccvisbroken=no
3806                 ;;
3807             esac
3808         fi
3809         rm -f visibility.s visibility.cxx
3811         AC_MSG_RESULT([$gccvisbroken])
3812         if test "$gccvisbroken" = "yes"; then
3813             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
3814             echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
3815             unset HAVE_GCC_VISIBILITY_FEATURE
3816         fi
3817     fi
3819     AC_LANG_POP([C++])
3822 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3823 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
3825 dnl ===================================================================
3826 dnl allocator
3827 dnl ===================================================================
3828 AC_MSG_CHECKING([which memory allocator to use])
3829 if test "$with_alloc" = "system"; then
3830     AC_MSG_RESULT([system])
3831     ALLOC="SYS_ALLOC";
3832     AC_CHECK_FUNCS([malloc realloc calloc free])
3834 if test "$with_alloc" = "tcmalloc"; then
3835     AC_MSG_RESULT(tcmalloc)
3836     if ! echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3837         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3838     fi
3839     AC_CHECK_LIB(tcmalloc, malloc, [],
3840         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3841     ALLOC="TCMALLOC";
3843 if test "$with_alloc" = "jemalloc"; then
3844     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3845         AC_MSG_RESULT(jemalloc)
3846         save_CFLAGS=$CFLAGS
3847         CFLAGS="$CFLAGS -pthread"
3848         AC_CHECK_LIB(jemalloc, malloc, [],
3849             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3850         ALLOC="JEMALLOC";
3851         CFLAGS=$save_CFLAGS
3852     else
3853         AC_MSG_RESULT([system])
3854         ALLOC="SYS_ALLOC";
3855         AC_CHECK_FUNCS([malloc realloc calloc free])
3856     fi
3858 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3859     AC_MSG_RESULT([internal])
3861 AC_SUBST(ALLOC)
3863 dnl ===================================================================
3864 dnl Custom build version
3865 dnl ===================================================================
3867 AC_MSG_CHECKING([whether to add custom build version])
3868 if test "z$with_build_version" != "z"; then
3869     BUILD_VER_STRING=$with_build_version
3870     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3871 else
3872     BUILD_VER_STRING=
3873     AC_MSG_RESULT([no])
3875 AC_SUBST(BUILD_VER_STRING)
3877 dnl ===================================================================
3878 dnl Java support enable
3879 dnl ===================================================================
3880 AC_MSG_CHECKING([whether to build with Java support])
3881 if test "$with_java" != "no"; then
3882     AC_MSG_RESULT([yes])
3883     SOLAR_JAVA="TRUE"
3884 else
3885     AC_MSG_RESULT([no])
3886     SOLAR_JAVA=""
3889 AC_SUBST(SOLAR_JAVA)
3891 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
3892 dnl want there to be *run-time* (and build-time) support for Java extensions in the
3893 dnl built LibreOffice.
3894 dnl SOLAR_JAVA="BUILD" indicate build-time only support (no runtime support)
3895 dnl SOLAR_JAVA="" indicate no java support at all
3897 if test "$_os" = "Linux" && test "$host_cpu" = "powerpc"; then
3898     # IBMs JDK needs this...
3899     JITC_PROCESSOR_TYPE=6
3900     export JITC_PROCESSOR_TYPE
3902 AC_SUBST([JITC_PROCESSOR_TYPE])
3904 if test $_os = "WINNT"; then
3905     WITH_VC_REDIST="TRUE"
3907 AC_SUBST(WITH_VC_REDIST)
3909 dnl ===================================================================
3910 dnl Checks for Java
3911 dnl ===================================================================
3912 if test "$SOLAR_JAVA" != ""; then
3914     # Windows-specific tests
3915     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3916         if test "$CL_X64" != ""; then
3917             bitness="64-bit"
3918             otherbitness="32-bit"
3919         else
3920             bitness="32-bit"
3921             otherbitness="64-bit"
3922         fi
3924         if test -z "$with_jdk_home"; then
3926             # Unfortunately apparently no way to find, if needed, the 64-bit
3927             # JDK in the Registry from the 32-bit Perl oowintool
3929             _jdk_home=`./oowintool --jdk-home`
3930             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
3931                 with_jdk_home="$_jdk_home"
3932                 howfound="found by oowintool"
3933             else
3934                 AC_MSG_ERROR([No JDK found by oowintool, pass the --with-jdk-home option pointing to a $bitness JDK])
3935             fi
3936         else
3937             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
3938             howfound="you passed"
3939         fi
3940     fi
3942     JAVA_HOME=; export JAVA_HOME
3943     if test -z "$with_jdk_home"; then
3944         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
3945     else
3946         _java_path="$with_jdk_home/bin/$with_java"
3947         dnl Check if there is a Java interpreter at all.
3948         if test -x "$_java_path"; then
3949             JAVAINTERPRETER=$_java_path
3950         else
3951             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
3952         fi
3953     fi
3955     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3956         # Check that the JDK found is correct architecture
3957         # Why is this necessary, we don't link with any library from the JDK I think,
3959         shortjdkhome=`cygpath -d "$with_jdk_home"`
3960         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
3961             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
3962             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
3963         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
3964             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
3965             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
3966         fi
3968         if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
3969             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3970         fi
3971         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3972         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3973     elif test "$_os" = "Darwin"; then
3974         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
3975         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
3976         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
3977         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
3978         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
3979             AC_MSG_RESULT([yes])
3980             JAVAIFLAGS=-d32
3981         else
3982             AC_MSG_RESULT([no])
3983         fi
3984     fi
3987 dnl ===================================================================
3988 dnl Checks for JDK.
3989 dnl ===================================================================
3990 if test "$SOLAR_JAVA" != ""; then
3991     _gij_longver=0
3992     AC_MSG_CHECKING([the installed JDK])
3993     if test -n "$JAVAINTERPRETER"; then
3994         dnl java -version sends output to stderr!
3995         if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3996             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3997         elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
3998             JDK=gcj
3999             AC_MSG_RESULT([checked (gcj)])
4000             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
4001             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4003         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "BEA"` -gt 0; then
4004             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
4005         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "IBM"` -gt 0; then
4006             JDK=ibm
4008             dnl IBM JDK specific tests
4009             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
4010             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
4012             if test "$_jdk_ver" -lt 10500; then
4013                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
4014             fi
4016             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
4018             if test "$with_jdk_home" = ""; then
4019                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
4020 you must use the "--with-jdk-home" configure option explicitly])
4021             fi
4023            JAVA_HOME=$with_jdk_home
4025         else
4026             JDK=sun
4028             dnl Sun JDK specific tests
4029             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
4030             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
4032             if test "$_jdk_ver" -lt 10500; then
4033                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
4034             fi
4035             AC_MSG_RESULT([checked (JDK $_jdk)])
4036             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
4037             if test "$_os" = "WINNT"; then
4038                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
4039             fi
4040         fi
4041     else
4042         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
4043     fi
4044 else
4045     dnl Java disabled
4046     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
4049 _java_target_ver="1.5"
4050 dnl ===================================================================
4051 dnl Check for target Java bytecode version
4052 dnl ===================================================================
4053 if test "$SOLAR_JAVA" != ""; then
4054     AC_MSG_CHECKING([for target Java bytecode version])
4055     if test "$JDK" = "gcj" -o "$JDK" = "kaffe"; then
4056     AC_MSG_RESULT([default by $JDK])
4057     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
4058         AC_MSG_WARN([Value defined by --with-java-target-version is ignored!])
4059     fi
4060     else
4061     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
4062         _java_target_ver="$with_java_target_version"
4063         AC_MSG_RESULT([$_java_target_ver])
4064     elif test $_jdk_ver -gt 10000 ; then
4065         _java_target_ver=`echo "$_jdk_ver" | $AWK '{ maj=substr($0,1,1); min=substr($0,2,2); print int(maj)"."int(min) }'`
4066         AC_MSG_RESULT([$_java_target_ver])
4067     else
4068         AC_MSG_ERROR([Unable to guess Java bytecode version from Java version!])
4069     fi
4070     fi
4072     if ! test -z "$_java_target_ver" -o \
4073         "$_java_target_ver" = "1.1" -o \
4074             "$_java_target_ver" = "1.2" -o \
4075         "$_java_target_ver" = "1.3" -o \
4076         "$_java_target_ver" = "1.4" -o \
4077         "$_java_target_ver" = "1.5" -o \
4078         "$_java_target_ver" = "1.6" -o \
4079         "$_java_target_ver" = "5" ; then
4080         AC_MSG_ERROR([$_java_target_ver is not a supported Java bytecode version!])
4081     fi
4083     JAVA_SOURCE_VER="$_java_target_ver"
4084     JAVA_TARGET_VER="$_java_target_ver"
4087 dnl ===================================================================
4088 dnl Checks for javac
4089 dnl ===================================================================
4090 if test "$SOLAR_JAVA" != ""; then
4091     if test "$JDK" = "gcj"; then
4092         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
4093     else
4094         javacompiler="javac"
4095     fi
4096     if test -z "$with_jdk_home"; then
4097         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
4098     else
4099         _javac_path="$with_jdk_home/bin/$javacompiler"
4100         dnl Check if there is a Java compiler at all.
4101         if test -x "$_javac_path"; then
4102             JAVACOMPILER=$_javac_path
4103         fi
4104     fi
4105     if test -z "$JAVACOMPILER"; then
4106         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
4107     fi
4108     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4109         if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
4110             JAVACOMPILER="${JAVACOMPILER}.exe"
4111         fi
4112         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
4113         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
4114     fi
4116     if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
4117         AC_MSG_CHECKING([re-checking JDK])
4118         JDK=gcj
4119         AC_MSG_RESULT([checked (ecj)])
4120         #TODO: what's to do here? some switch to do 1.5 compiling?
4121         JAVAFLAGS="-source 1.5 -target 1.5"
4122         _gij_longver="40200"
4123     fi
4126 JAVACISGCJ=""
4127 dnl ===================================================================
4128 dnl Checks that javac is gcj
4129 dnl ===================================================================
4130 if test "$SOLAR_JAVA" != ""; then
4131     if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
4132         JAVACISGCJ="yes"
4133     fi
4135 AC_SUBST(JAVACISGCJ)
4137 JAVACISKAFFE=""
4138 dnl ===================================================================
4139 dnl Checks that javac is kaffe
4140 dnl ===================================================================
4141 if test "$SOLAR_JAVA" != ""; then
4142     if test `$JAVACOMPILER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
4143         JAVACISKAFFE="yes"
4144     fi
4146 AC_SUBST(JAVACISKAFFE)
4148 dnl ===================================================================
4149 dnl Checks for javadoc
4150 dnl ===================================================================
4151 if test "$SOLAR_JAVA" != ""; then
4152     if test -z "$with_jdk_home"; then
4153         AC_PATH_PROG(JAVADOC, javadoc)
4154     else
4155         _javadoc_path="$with_jdk_home/bin/javadoc"
4156         dnl Check if there is a javadoc at all.
4157         if test -x "$_javadoc_path"; then
4158             JAVADOC=$_javadoc_path
4159         else
4160             AC_PATH_PROG(JAVADOC, javadoc)
4161         fi
4162     fi
4163     if test -z "$JAVADOC"; then
4164         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
4165     fi
4166     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4167         if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
4168             JAVADOC="${JAVADOC}.exe"
4169         fi
4170         JAVADOC=`cygpath -d "$JAVADOC"`
4171         JAVADOC=`cygpath -u "$JAVADOC"`
4172     fi
4175 if test "$SOLAR_JAVA" != ""; then
4176     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
4177     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
4178         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
4179            # try to recover first by looking whether we have a alternatives
4180            # system as in Debian or newer SuSEs where following /usr/bin/javac
4181            # over /etc/alternatives/javac leads to the right bindir where we
4182            # just need to strip a bit away to get a valid JAVA_HOME
4183            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
4184         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
4185             # maybe only one level of symlink (e.g. on Mac)
4186             JAVA_HOME=$(readlink $JAVACOMPILER)
4187             if test "$(dirname $JAVA_HOME)" = "."; then
4188                 # we've got no path to trim back
4189                 JAVA_HOME=""
4190             fi
4191         else
4192             # else warn
4193             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
4194             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
4195             echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
4196             echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
4197         fi
4198         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
4199         if test "$JAVA_HOME" != "/usr"; then
4200             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
4201                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
4202                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
4203                 dnl Tiger already returns a JDK path..
4204                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
4205             else
4206                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
4207             fi
4208         fi
4209     fi
4210     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
4212     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
4213     if test -z "$JAVA_HOME"; then
4214         if test "x$with_jdk_home" = "x"; then
4215             cat > findhome.java <<_ACEOF
4216 [import java.io.File;
4218 class findhome
4220     public static void main(String args[])
4221     {
4222         String jrelocation = System.getProperty("java.home");
4223         File jre = new File(jrelocation);
4224         System.out.println(jre.getParent());
4225     }
4227 _ACEOF
4228             AC_MSG_CHECKING([if javac works])
4229             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
4230             AC_TRY_EVAL(javac_cmd)
4231             if test $? = 0 && test -f ./findhome.class ; then
4232                 AC_MSG_RESULT([javac works])
4233             else
4234                 echo "configure: javac test failed" >&5
4235                 cat findhome.java >&5
4236                 AC_MSG_ERROR([javac does not work - java projects will not build!])
4237             fi
4238             AC_MSG_CHECKING([if gij knows its java.home])
4239             JAVA_HOME=`$JAVAINTERPRETER findhome`
4240             if test $? = 0 && test "$JAVA_HOME" != "" ; then
4241                 AC_MSG_RESULT([$JAVA_HOME])
4242             else
4243                 echo "configure: java test failed" >&5
4244                 cat findhome.java >&5
4245                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
4246             fi
4247             # clean-up after ourselves
4248             rm -f ./findhome.java ./findhome.class
4249         else
4250             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
4251         fi
4252     fi
4254     dnl second sanity check JAVA_HOME if possible
4255     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
4256         # now check if $JAVA_HOME is really valid
4257         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
4258             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
4259                 JAVA_HOME_OK="NO"
4260             fi
4261         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
4262             JAVA_HOME_OK="NO"
4263         fi
4264         if test "$JAVA_HOME_OK" = "NO"; then
4265             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
4266             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
4267             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
4268             echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
4269             echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
4270             echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
4271         fi
4272     fi
4275 AWTLIB=
4277 if test "$SOLAR_JAVA" != ""; then
4278     AC_MSG_CHECKING([for jawt lib name])
4279     if test "$JDK" = "gcj"; then
4280         save_CFLAGS=$CFLAGS
4281         save_LDFLAGS=$LDFLAGS
4282         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4283         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
4284         exec 6>/dev/null # no output
4285         AC_CHECK_HEADER(jni.h, [],
4286                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
4287         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
4288         exec 6>&1 # output on again
4289         CFLAGS=$save_CFLAGS
4290         LDFLAGS=$save_LDFLAGS
4291     fi
4292     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
4293     # A workaround is to link also against libpmawt.so
4294     if test "$JDK" = "ibm" ; then
4295         save_CFLAGS=$CFLAGS
4296         save_LDFLAGS=$LDFLAGS
4297         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
4298         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4299         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
4300         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
4301         export LD_LIBRARY_PATH
4302         exec 6>/dev/null # no output
4303         AC_CHECK_HEADER(jni.h, [],
4304                     [AC_MSG_ERROR([jni.h could not be found.])], [])
4305         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
4306         if test -z "$AWTLIB"; then
4307             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
4308             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
4309         fi
4310         exec 6>&1 # output on again
4311         CFLAGS=$save_CFLAGS
4312         LDFLAGS=$save_LDFLAGS
4313         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
4314     fi
4315     if test -z "$AWTLIB"; then
4316         AWTLIB=-ljawt
4317     fi
4318     AC_MSG_RESULT([$AWTLIB])
4319     AC_SUBST(AWTLIB)
4322 AC_SUBST(JAVA_HOME)
4323 AC_SUBST(JDK)
4324 AC_SUBST(JAVAFLAGS)
4325 AC_SUBST(JAVA_SOURCE_VER)
4326 AC_SUBST(JAVA_TARGET_VER)
4327 AC_SUBST(JAVAINTERPRETER)
4328 AC_SUBST(JAVAIFLAGS)
4329 AC_SUBST(JAVACOMPILER)
4330 AC_SUBST(JAVADOC)
4332 dnl ===================================================================
4333 dnl Checks for specific files.
4334 dnl ===================================================================
4336 dnl ===================================================================
4337 dnl Checks for programs.
4338 dnl ===================================================================
4340 dnl ===================================================================
4341 dnl Check whether we already have dmake
4342 dnl ===================================================================
4343 AC_PATH_PROG(DMAKE, dmake, no)
4344 if test "$DMAKE" = "no"; then
4345     BUILD_DMAKE=YES
4346     echo "dmake will be built on ./bootstrap"
4347 else
4348     AC_MSG_CHECKING([whether the found dmake is the right dmake])
4349     # we need to find out whether that dmake we found is "our" dmake
4350     # or the dmake from Sun's SunStudio Compiler which is something
4351     # different
4352     # This test _should_ work because the one accepts -V (ours) and one
4353     # (the other) not...
4354     $DMAKE -V 2>/dev/null | grep 'dmake .* Version .*' >/dev/null
4355     if test $? -eq 0; then
4356         BUILD_DMAKE=NO
4357         AC_MSG_RESULT([yes])
4358         AC_MSG_CHECKING([the dmake version])
4359         DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
4360         if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
4361             AC_MSG_RESULT([OK, >= 4.11])
4362         elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
4363             test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
4364             AC_MSG_RESULT([OK, >= 4.11])
4365         else
4366             AC_MSG_RESULT([too old. >= 4.11 is needed])
4367             echo "A newer dmake will be built on ./bootstrap"
4368             BUILD_DMAKE=YES
4369         fi
4370     else
4371         AC_MSG_RESULT([no])
4372         echo "dmake will be built on ./bootstrap"
4373         BUILD_DMAKE=YES
4374     fi
4376 AC_SUBST(BUILD_DMAKE)
4378 AC_MSG_CHECKING([whether to enable EPM for packing])
4379 BUILD_EPM=NO
4380 if test "$enable_epm" = "yes"; then
4381     AC_MSG_RESULT([yes])
4382     dnl ===================================================================
4383     dnl Check for epm - not needed for Windows
4384     dnl ===================================================================
4385     if test "$_os" != "WINNT"; then
4386         if test -n "$with_epm"; then
4387             EPM=$with_epm
4388         else
4389             AC_PATH_PROG(EPM, epm, no)
4390         fi
4391         if test "$EPM" = "no" || test "$EPM" = "internal"; then
4392             echo "EPM will be built."
4393             BUILD_EPM=YES
4394             BUILD_TYPE="$BUILD_TYPE EPM"
4395         else
4396             # Gentoo has some epm which is something different...
4397             AC_MSG_CHECKING([whether the found epm is the right epm])
4398             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
4399                 AC_MSG_RESULT([yes])
4400             else
4401                 AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
4402             fi
4403             AC_MSG_CHECKING([epm version])
4404             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
4405             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
4406                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
4407                 AC_MSG_RESULT([OK, >= 3.7])
4408                 BUILD_EPM=NO
4409                 if test "$_os" = "Darwin"; then
4410                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
4411                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
4412                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4413                         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)])
4414                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4415                         AC_MSG_RESULT([$_pm, ok])
4416                     else # we never should get here, but go safe
4417                         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)])
4418                     fi
4419                 fi
4420             else
4421                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
4422                 echo "EPM will be built."
4423                 BUILD_EPM=YES
4424                 BUILD_TYPE="$BUILD_TYPE EPM"
4425             fi
4426         fi
4427     fi
4429     # test which package format to use
4430     AC_MSG_CHECKING([which package format to use])
4432     # defaults
4433     case "$_os" in
4434     Darwin)
4435         PKGFORMAT=dmg
4436         ;;
4437     SunOS)
4438         PKGFORMAT=pkg
4439         ;;
4440     Linux)
4441         # if building on Debian, default should be deb...
4442         if test -e /etc/debian_version; then
4443             PKGFORMAT=deb
4444         else
4445             PKGFORMAT=rpm
4446         fi
4447         ;;
4448     AIX)
4449         PKGFORMAT=rpm
4450         ;;
4451     OpenBSD|DragonFly)
4452         PKGFORMAT=portable
4453         ;;
4454     *BSD)
4455         PKGFORMAT=bsd
4456         ;;
4457     WINNT)
4458         PKGFORMAT=msi
4459         ;;
4460     # we never should get here since we check the arciecture/os at the beginning,
4461     # but go sure...
4462     *)
4463         AC_MSG_ERROR([unknown system])
4464     esac
4465     if test -n "$with_package_format"; then
4466         for i in $with_package_format; do
4467             case "$i" in
4468             aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4469                 ;;
4470             *)
4471                 AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4472 aix - AIX software distribution
4473 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4474 deb - Debian software distribution
4475 inst or tardist - IRIX software distribution
4476 osx - MacOS X software distribution
4477 pkg - Solaris software distribution
4478 rpm - RedHat software distribution
4479 setld - Tru64 (setld) software distribution
4480 native - "Native" software distribution for the platform
4481 portable - Portable software distribution
4482 LibreOffice additionally supports:
4483 archive - .tar.gz or .zip
4484 dmg - Mac OS X .dmg
4485 installed - installation tree
4486 msi - Windows .msi
4487             ])
4488                 ;;
4489             esac
4490         done
4491         PKGFORMAT="$with_package_format"
4492     fi
4493     AC_MSG_RESULT([$PKGFORMAT])
4494     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
4495         AC_MSG_CHECKING([for rpm])
4496         for a in "$RPM" rpmbuild rpm; do
4497             $a --usage >/dev/null 2> /dev/null
4498             if test $? -eq 0; then
4499                 RPM=$a
4500                 break
4501             else
4502                 $a --version >/dev/null 2> /dev/null
4503                 if test $? -eq 0; then
4504                     RPM=$a
4505                     break
4506                 fi
4507             fi
4508         done
4509         if test -z "$RPM" ; then
4510             AC_MSG_ERROR([not found])
4511         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
4512             RPM_PATH=`which $RPM`
4513             AC_MSG_RESULT([$RPM_PATH])
4514         else
4515             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
4516         fi
4517     fi
4518     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
4519         AC_PATH_PROG(DPKG, dpkg, no)
4520         if test "$DPKG" = "no"; then
4521             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
4522         fi
4523     fi
4524     if echo "PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
4525         if test "$_os" = "Darwin"; then
4526             AC_MSG_CHECKING([for PackageMaker availability])
4527             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
4528                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
4529             else
4530                 AC_MSG_RESULT([ok])
4531             fi
4532         else
4533             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
4534         fi
4535     fi
4536     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
4537        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4538         if test "$EPM" != "no" && test "$EPM" != "internal"; then
4539             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
4540                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
4541                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
4542                     AC_MSG_RESULT([yes])
4543                 else
4544                     AC_MSG_RESULT([no])
4545                     if echo "$PKGFORMAT" | grep -q rpm; then
4546                         _pt="rpm"
4547                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
4548                         echo "the rpms will need to be installed with --nodeps" >> warn
4549                     else
4550                         _pt="pkg"
4551                     fi
4552                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
4553                     echo "the ${_pt}s will not be relocateable" >> warn
4554                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
4555                                  relocation will work, you need to patch your epm with the
4556                                  patch in epm/epm-3.7.patch or build with
4557                                  --with-epm=internal which will build a suitable epm])
4558                 fi
4559             fi
4560         fi
4561     fi
4562     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4563         AC_PATH_PROG(PKGMK, pkgmk, no)
4564         if test "$PKGMK" = "no"; then
4565             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
4566         fi
4567     fi
4568     AC_SUBST(RPM)
4569     AC_SUBST(DPKG)
4570     AC_SUBST(PKGMK)
4571 else
4572     AC_MSG_RESULT([no])
4573     EPM=NO
4574     PKGFORMAT=native
4576 AC_SUBST(EPM)
4577 AC_SUBST(BUILD_EPM)
4578 AC_SUBST(PKGFORMAT)
4580 dnl ===================================================================
4581 dnl Check for gperf
4582 dnl ===================================================================
4583 AC_PATH_PROG(GPERF, gperf)
4584 if test -z "$GPERF"; then
4585     AC_MSG_ERROR([gperf not found but needed. Install it.])
4587 AC_MSG_CHECKING([gperf version])
4588 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
4589     AC_MSG_RESULT([OK])
4590 else
4591     AC_MSG_ERROR([too old, you need at least 3.0.0])
4593 AC_SUBST(GPERF)
4595 dnl ===================================================================
4596 dnl Check for building ODK
4597 dnl ===================================================================
4598 AC_MSG_CHECKING([whether to build the ODK])
4599 if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
4600     AC_MSG_RESULT([yes])
4602     if test "$with_java" != "no"; then
4603         AC_MSG_CHECKING([whether to build unowinreg.dll])
4604         if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
4605             # build on Win by default
4606             enable_build_unowinreg=yes
4607         fi
4608         if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
4609             AC_MSG_RESULT([no])
4610             BUILD_UNOWINREG=NO
4611         else
4612             AC_MSG_RESULT([yes])
4613             BUILD_UNOWINREG=YES
4614         fi
4615         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
4616             if test -z "$with_mingw_cross_compiler"; then
4617                 dnl Guess...
4618                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
4619             elif test -x "$with_mingw_cross_compiler"; then
4620                  MINGWCXX="$with_mingw_cross_compiler"
4621             else
4622                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
4623             fi
4625             if test "$MINGWCXX" = "false"; then
4626                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
4627             fi
4629             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
4630             if test -x "$mingwstrip_test"; then
4631                 MINGWSTRIP="$mingwstrip_test"
4632             else
4633                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
4634             fi
4636             if test "$MINGWSTRIP" = "false"; then
4637                 AC_MSG_ERROR(MinGW32 binutils not found.)
4638             fi
4639         fi
4640     fi
4641     BUILD_TYPE="$BUILD_TYPE ODK"
4642 else
4643     AC_MSG_RESULT([no])
4644     BUILD_UNOWINREG=NO
4646 AC_SUBST(BUILD_UNOWINREG)
4647 AC_SUBST(MINGWCXX)
4648 AC_SUBST(MINGWSTRIP)
4650 dnl ===================================================================
4651 dnl Check for system stdlibs
4652 dnl ===================================================================
4653 AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
4654 if test "$with_system_stdlibs" = "yes"; then
4655     AC_MSG_RESULT([no])
4656     SYSTEM_STDLIBS=YES
4657 else
4658     AC_MSG_RESULT([yes])
4659     SYSTEM_STDLIBS=NO
4661 AC_SUBST(SYSTEM_STDLIBS)
4663 dnl ===================================================================
4664 dnl Check for system zlib
4665 dnl ===================================================================
4666 AC_MSG_CHECKING([which zlib to use])
4667 if test "$with_system_zlib" = "yes"; then
4668     AC_MSG_RESULT([external])
4669     SYSTEM_ZLIB=YES
4670     AC_CHECK_HEADER(zlib.h, [],
4671         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
4672     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
4673         [AC_MSG_ERROR(zlib not found or functional)], [])
4674 else
4675     AC_MSG_RESULT([internal])
4676     SYSTEM_ZLIB=NO
4677     BUILD_TYPE="$BUILD_TYPE ZLIB"
4679 AC_SUBST(SYSTEM_ZLIB)
4681 dnl ===================================================================
4682 dnl Check for system jpeg
4683 dnl ===================================================================
4684 AC_MSG_CHECKING([which jpeg to use])
4685 if test "$with_system_jpeg" = "yes"; then
4686     AC_MSG_RESULT([external])
4687     SYSTEM_JPEG=YES
4688     AC_CHECK_HEADER(jpeglib.h, [],
4689         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
4690     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
4691     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
4692 else
4693     AC_MSG_RESULT([internal])
4694     SYSTEM_JPEG=NO
4695     BUILD_TYPE="$BUILD_TYPE JPEG"
4697 AC_SUBST(SYSTEM_JPEG)
4699 dnl ===================================================================
4700 dnl Check for system expat
4701 dnl ===================================================================
4702 AC_MSG_CHECKING([which expat to use])
4703 if test "$with_system_expat" = "yes"; then
4704     AC_MSG_RESULT([external])
4705     SYSTEM_EXPAT=YES
4706     AC_CHECK_HEADER(expat.h, [],
4707         [AC_MSG_ERROR(expat.h not found. install expat)], [])
4708     AC_CHECK_LIB(expat, XML_ParserCreate, [],
4709     [AC_MSG_RESULT(expat library not found or functional.)], [])
4710     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libexpat-1.dll"
4711 else
4712     AC_MSG_RESULT([internal])
4713     SYSTEM_EXPAT=NO
4714     BUILD_TYPE="$BUILD_TYPE EXPAT"
4716 AC_SUBST(SYSTEM_EXPAT)
4718 dnl ===================================================================
4719 dnl Check for system libvisio
4720 dnl ===================================================================
4721 AC_MSG_CHECKING([which libvisio to use])
4722 if test "$with_system_libvisio" = "yes"; then
4723     AC_MSG_RESULT([external])
4724     SYSTEM_LIBVISIO=YES
4725     PKG_CHECK_MODULES( VISIO, libvisio-0.0 )
4726 else
4727     AC_MSG_RESULT([internal])
4728     SYSTEM_LIBVISIO=NO
4729     BUILD_TYPE="$BUILD_TYPE LIBVISIO"
4731 AC_SUBST(SYSTEM_LIBVISIO)
4732 AC_SUBST(VISIO_CFLAGS)
4733 AC_SUBST(VISIO_LIBS)
4735 dnl ===================================================================
4736 dnl Check for system libcmis
4737 dnl ===================================================================
4738 AC_MSG_CHECKING([which libcmis to use])
4739 if test "$with_system_libcmis" = "yes"; then
4740     AC_MSG_RESULT([external])
4741     SYSTEM_LIBCMIS=YES
4742     PKG_CHECK_MODULES( LIBCMIS, libcmis-0.2 )
4743 else
4744     AC_MSG_RESULT([internal])
4745     SYSTEM_LIBCMIS=NO
4746     BUILD_TYPE="$BUILD_TYPE LIBCMIS"
4748 AC_SUBST(SYSTEM_LIBCMIS)
4749 AC_SUBST(LIBCMIS_CFLAGS)
4750 AC_SUBST(LIBCMIS_LIBS)
4753 dnl ===================================================================
4754 dnl Check for system libwpd
4755 dnl ===================================================================
4756 AC_MSG_CHECKING([which libwpd to use])
4757 if test "$with_system_libwpd" = "yes"; then
4758     AC_MSG_RESULT([external])
4759     SYSTEM_LIBWPD=YES
4760     PKG_CHECK_MODULES( WPD, libwpd-0.9 libwpd-stream-0.9 )
4761 else
4762     AC_MSG_RESULT([internal])
4763     SYSTEM_LIBWPD=NO
4764     BUILD_TYPE="$BUILD_TYPE LIBWPD"
4766 AC_SUBST(SYSTEM_LIBWPD)
4767 AC_SUBST(WPD_CFLAGS)
4768 AC_SUBST(WPD_LIBS)
4770 dnl ===================================================================
4771 dnl Check for system cppunit
4772 dnl ===================================================================
4773 AC_MSG_CHECKING([which cppunit to use])
4774 if test "$with_system_cppunit" = "yes"; then
4775     AC_MSG_RESULT([external])
4776     SYSTEM_CPPUNIT=YES
4777     # might work for earlier, too but go sure:
4778     PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
4779 else
4780     AC_MSG_RESULT([internal])
4781     SYSTEM_CPPUNIT=NO
4782     BUILD_TYPE="$BUILD_TYPE CPPUNIT"
4784 AC_SUBST(SYSTEM_CPPUNIT)
4785 AC_SUBST(CPPUNIT_CFLAGS)
4786 AC_SUBST(CPPUNIT_LIBS)
4788 dnl ===================================================================
4789 dnl Check whether freetype is available
4790 dnl ===================================================================
4791 if test  "$test_freetype" = "yes"; then
4792     AC_MSG_CHECKING([whether freetype is available])
4793     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
4795 AC_SUBST(FREETYPE_CFLAGS)
4796 AC_SUBST(FREETYPE_LIBS)
4798 dnl ===================================================================
4799 dnl Check for system libwps
4800 dnl ===================================================================
4801 AC_MSG_CHECKING([which libwps to use])
4802 if test "$with_system_libwps" = "yes"; then
4803     AC_MSG_RESULT([external])
4804     SYSTEM_LIBWPS=YES
4805     PKG_CHECK_MODULES( WPS, libwps-0.2 )
4806 else
4807     AC_MSG_RESULT([internal])
4808     SYSTEM_LIBWPS=NO
4809     BUILD_TYPE="$BUILD_TYPE LIBWPS"
4811 AC_SUBST(SYSTEM_LIBWPS)
4812 AC_SUBST(WPS_CFLAGS)
4813 AC_SUBST(WPS_LIBS)
4815 dnl ===================================================================
4816 dnl Check for system libwpg
4817 dnl ===================================================================
4818 AC_MSG_CHECKING([which libwpg to use])
4819 if test "$with_system_libwpg" = "yes"; then
4820     AC_MSG_RESULT([external])
4821     SYSTEM_LIBWPG=YES
4822     PKG_CHECK_MODULES( WPG, libwpg-0.2 )
4823 else
4824     AC_MSG_RESULT([internal])
4825     SYSTEM_LIBWPG=NO
4826     BUILD_TYPE="$BUILD_TYPE LIBWPG"
4828 AC_SUBST(SYSTEM_LIBWPG)
4829 AC_SUBST(WPG_CFLAGS)
4830 AC_SUBST(WPG_LIBS)
4832 dnl ===================================================================
4833 dnl Check whether freetype2 supports emboldening
4834 dnl ===================================================================
4835 if test  "$test_freetype" = "yes"; then
4836     save_CPPFLAGS="$CPPFLAGS"
4837     save_LDFLAGS="$LDFLAGS"
4838     save_LIBS="$LIBS"
4839     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
4840     LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
4841     AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
4842                  [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4843     LDFLAGS="$save_LDFLAGS"
4844     CPPFLAGS="$save_CPPFLAGS"
4845     LIBS="$save_LIBS"
4847 AC_SUBST(USE_FT_EMBOLDEN)
4849 # ===================================================================
4850 # Check for system libxslt
4851 # to prevent incompatibilities between internal libxml2 and external libxslt,
4852 # or vice versa, use with_system_libxml here
4853 # ===================================================================
4854 AC_MSG_CHECKING([which libxslt to use])
4855 if test "$with_system_libxml" = "yes"; then
4856     AC_MSG_RESULT([external])
4857     SYSTEM_LIBXSLT=YES
4858     if test "$_os" = "Darwin"; then
4859         dnl make sure to use SDK path
4860         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4861         dnl omit -L/usr/lib
4862         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
4863     else
4864         PKG_CHECK_MODULES(LIBXSLT, libxslt)
4865     fi
4867     dnl Check for xsltproc
4868     AC_PATH_PROG(XSLTPROC, xsltproc, no)
4869     if test "$XSLTPROC" = "no"; then
4870         AC_MSG_ERROR([xsltproc is required])
4871     fi
4873     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libxslt-1.dll"
4874 else
4875     AC_MSG_RESULT([internal])
4876     SYSTEM_LIBXSLT=NO
4877     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4879     if test "$cross_compiling" = "yes"; then
4880         AC_PATH_PROG(XSLTPROC, xsltproc, no)
4881         if test "$XSLTPROC" = "no"; then
4882             AC_MSG_ERROR([xsltproc is required])
4883         fi
4884     fi
4886 AC_SUBST(SYSTEM_LIBXSLT)
4887 AC_SUBST(LIBXSLT_CFLAGS)
4888 AC_SUBST(LIBXSLT_LIBS)
4889 AC_SUBST(XSLTPROC)
4891 # ===================================================================
4892 # Check for system libxml
4893 # ===================================================================
4894 AC_MSG_CHECKING([which libxml to use])
4895 if test "$with_system_libxml" = "yes"; then
4896     AC_MSG_RESULT([external])
4897     SYSTEM_LIBXML=YES
4898     if test "$_os" = "Darwin"; then
4899         dnl make sure to use SDK path
4900         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4901         dnl omit -L/usr/lib
4902         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
4903     elif test $_os = iOS; then
4904         dnl make sure to use SDK path
4905         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
4906         LIBXML_CFLAGS="-I$usr/include/libxml2"
4907         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
4908     else
4909         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4910     fi
4911     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS zlib1.dll libxml2-2.dll"
4912 else
4913     AC_MSG_RESULT([internal])
4914     SYSTEM_LIBXML=NO
4915     BUILD_TYPE="$BUILD_TYPE LIBXML2"
4917 AC_SUBST(SYSTEM_LIBXML)
4918 AC_SUBST(LIBXML_CFLAGS)
4919 AC_SUBST(LIBXML_LIBS)
4921 dnl ===================================================================
4922 dnl Checks for Python
4923 dnl ===================================================================
4925 AC_MSG_CHECKING([which Python to use])
4927 case "$enable_python" in
4928 no|disable)
4929     enable_python=no
4930     AC_MSG_RESULT([none])
4931     DISABLE_PYTHON=TRUE
4932     ;;
4933 ""|yes|auto)
4934     if test $build_os = cygwin; then
4935         dnl When building on Windows we don't attempt to use any installed
4936         dnl "system"  Python.
4937         dnl
4938         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
4939         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
4940         dnl MinGW cross-compilation setups.)
4941         AC_MSG_RESULT([internal])
4942         enable_python=internal
4943     elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4944         AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4945         enable_python=internal
4946     else
4947         AC_MSG_RESULT([checking below])
4948         enable_python=auto
4949     fi
4950     ;;
4951 internal)
4952     AC_MSG_RESULT([internal])
4953     ;;
4954 system)
4955     if test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4956         AC_MSG_ERROR([Cannot use "system" Python, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4957     fi
4958     AC_MSG_RESULT([system])
4959     ;;
4961     AC_MSG_ERROR([Incorrect --enable-python option])
4962     ;;
4963 esac
4965 AC_SUBST(DISABLE_PYTHON)
4967 if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then
4968     AC_MSG_ERROR([Must use internal Python when building with MSVC])
4971 if test $enable_python != no; then
4972     BUILD_TYPE="$BUILD_TYPE PYUNO"
4975 if test "$cross_compiling" = yes; then
4976     if test $enable_python = auto; then
4977         enable_python=system
4978     fi
4979 else
4980     if test $enable_python = system; then
4981         # This causes an error if no python command is found
4982         # Note that this takes the system python called just "python",
4983         # which isn't actually what we want on MacOSX when building
4984         # against the 10.6 SDK. But that shouldn't matter, we
4985         # select the correct python command manually below anyway.
4986         AM_PATH_PYTHON([2.6])
4987     elif test $enable_python = auto; then
4988         dnl This allows lack of system Python
4989         AM_PATH_PYTHON([2.6],, [:])
4991         if test "$PYTHON" = :; then
4992             enable_python=internal
4993         else
4994             enable_python=system
4995         fi
4996     fi
4999 if test $enable_python = system; then
5000     if test $_os = Darwin; then
5001         # We already have logic above to make sure the system Python
5002         # is used only when building against SDK 10.6 or newer.
5004         # Make sure we use the 2.6 Python when building against the
5005         # 10.6 SDK.
5006         case $with_macosx_sdk in
5007         10.6)
5008             python_version=2.6;;
5009         10.7)
5010             python_version=2.7;;
5011         *)
5012             # ???
5013             python_version=2.7;;
5014         esac
5015         PYTHON=python$python_version
5017         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
5018         PYTHON_LIBS="-framework Python"
5019     fi
5020     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
5021         # Fallback: Accept these in the environment, or as set above
5022         # for MacOSX.
5023         :
5024     elif test "$cross_compiling" != yes; then
5025         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
5026         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
5027         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
5028         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
5029         if $PKG_CONFIG --exists python-$python_version; then
5030             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
5031             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version`"
5032         else
5033             PYTHON_CFLAGS="-I$python_include"
5034             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
5035         fi
5036     elif test "$cross_compiling" = yes; then
5037         dnl How to find out the cross-compilation Python installation path?
5038         dnl Let's hardocode what we know for different distributions for now...
5040         for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw ; do
5041             for python_version in 2.6 ; do
5042                 if test -f ${python_sysroot}/include/python${python_version}/Python.h; then
5043                     PYTHON_CFLAGS="-I ${python_sysroot}/include/python$python_version"
5044                     PYTHON_LIBS="-L ${python_sysroot}lib -lpython$python_version $python_libs"
5045                     break
5046                 fi
5047             done
5048             test -n "$PYTHON_CFLAGS" && break
5049         done
5050     fi
5053 dnl By now enable_python should be "system", "internal" or "no"
5054 case $enable_python in
5055 system)
5056     SYSTEM_PYTHON=YES
5058     dnl Check if the headers really work
5059     save_CPPFLAGS="$CPPFLAGS"
5060     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
5061     AC_CHECK_HEADER(Python.h, [],
5062        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
5063        [])
5064     CPPFLAGS="$save_CPPFLAGS"
5066     dnl FIXME Check if the Python library can be linked with, too?
5067     ;;
5069 internal)
5070     SYSTEM_PYTHON=NO
5071     BUILD_TYPE="$BUILD_TYPE PYTHON"
5072     # Embedded Python dies without Home set
5073     if test "z$HOME" = "z"; then
5074         export HOME="";
5075     fi
5076     # bz2 tarball and bzip2 is not standard
5077     if test -z "$BZIP2"; then
5078         AC_PATH_PROG( BZIP2, bzip2)
5079         if test -z "$BZIP2"; then
5080             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
5081         fi
5082     fi
5083     ;;
5085     SYSTEM_PYTHON=NO
5086     ;;
5088     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
5089     ;;
5090 esac
5092 AC_SUBST(SYSTEM_PYTHON)
5093 AC_SUBST(PYTHON_CFLAGS)
5094 AC_SUBST(PYTHON_LIBS)
5096 dnl ===================================================================
5097 dnl Check for system Berkeley db
5098 dnl ===================================================================
5099 AC_MSG_CHECKING([which db to use])
5100 if test "$with_system_db" = "yes"; then
5101     SYSTEM_DB=YES
5102     AC_MSG_RESULT([external])
5104     db_header=
5105     for dbver in 5.1 5.0 5 4.8 4.7 4; do
5106         for dash in - ''; do
5107             AC_CHECK_HEADER([db$dash$dbver/db.h],
5108                 [ db_header="db$dash$dbver/db.h"; break 2 ])
5109         done
5110     done
5112     if test -z "$db_header"; then
5113         AC_CHECK_HEADER([db/db.h], [db_header='db/db.h'; dbver=''])
5114     fi
5116     if test -z "$db_header"; then
5117        AC_CHECK_HEADER(db.h, [ db_header='db.h'; dbver='' ])
5118     fi
5120     if test -z "$db_header"; then
5121         AC_MSG_ERROR([db.h not found. Use the correct -I flag, or install the Berkeley db development package.])
5122     fi
5124     AC_MSG_CHECKING([whether db is at least 4.1])
5125     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])])
5127     SYSTEM_DB_CFLAGS="-DSYSTEM_DB_HEADER='<$db_header>'"
5129     DB_LIB=
5130     dnl At least on OpenBSD dbver is not appended to the library
5131     if test "$_os" = "OpenBSD"; then
5132         dbver=''
5133     fi
5134     for dash in - ''; do
5135         AC_CHECK_LIB(db$dash$dbver, dbopen,
5136             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5137         AC_CHECK_LIB(db$dash$dbver, __db185_open,
5138             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5139     done
5141     if test -z "$DB_LIB" ; then
5142         AC_MSG_ERROR([db library not found. Use the correct -L flag,
5143 or install the Berkeley db development package.])
5144     fi
5146     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
5147     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libdb-4.8.dll"
5148 else
5149     AC_MSG_RESULT([internal])
5150     SYSTEM_DB=NO
5151     BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
5153 AC_SUBST(SYSTEM_DB)
5154 AC_SUBST(SYSTEM_DB_CFLAGS)
5155 AC_SUBST(DB_LIB)
5156 AC_SUBST(DB_CPPLIB)
5158 dnl ===================================================================
5159 dnl Check for system lucene
5160 dnl ===================================================================
5161 if test "$with_java" != "no"; then
5162 AC_MSG_CHECKING([which lucene to use])
5163 if test "$with_system_lucene" = "yes"; then
5164     AC_MSG_RESULT([external])
5165     SYSTEM_LUCENE=YES
5166     if test -z $LUCENE_CORE_JAR; then
5167          AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
5168             [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
5169             [
5170               AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
5171                 [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
5172                 [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
5173                    [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
5174                    [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
5175                   )
5176                 ]
5177               )
5178             ]
5179          )
5180     else
5181         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5182                [AC_MSG_ERROR(lucene-core.jar not found.)], [])
5183     fi
5185     if test -z $LUCENE_ANALYZERS_JAR; then
5186         AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
5187             [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
5188             [
5189               AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
5190                 [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
5191                 [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
5192               )
5193             ]
5194         )
5195     else
5196         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5197                [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
5198     fi
5199     AC_MSG_CHECKING([whether lucene is version 2.x])
5200     export LUCENE_CORE_JAR
5201     if $PERL -e 'use Archive::Zip;
5202             my $file = "$ENV{'LUCENE_CORE_JAR'}";
5203             my $zip = Archive::Zip->new( $file );
5204             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5205             if ( $mf =~ m/Specification-Version: 2.*/ ) {
5206                 exit 0;
5207             } else {
5208                 exit 1;
5209             }'; then
5210         AC_MSG_RESULT([yes])
5211     else
5212         AC_MSG_ERROR([no, you need lucene 2])
5213     fi
5215 else
5216     AC_MSG_RESULT([internal])
5217     SYSTEM_LUCENE=NO
5218     BUILD_TYPE="$BUILD_TYPE LUCENE"
5221 AC_SUBST(SYSTEM_LUCENE)
5222 AC_SUBST(LUCENE_CORE_JAR)
5223 AC_SUBST(LUCENE_ANALYZERS_JAR)
5225 AC_MSG_CHECKING([whether to build the MySQL Connector extension])
5226 if test "x$enable_ext_mysql_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
5227     AC_MSG_RESULT([yes])
5228     ENABLE_MYSQLC=YES
5229     BUILD_TYPE="$BUILD_TYPE MYSQLC"
5230 else
5231     AC_MSG_RESULT([no])
5232     ENABLE_MYSQLC=NO
5234 AC_SUBST(ENABLE_MYSQLC)
5236 if test "$ENABLE_MYSQLC" = "YES"; then
5238     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MYSQLC"
5240     dnl ===================================================================
5241     dnl Check for system MySQL
5242     dnl ===================================================================
5243     AC_MSG_CHECKING([for MySQL prerequisites])
5244     if test "$with_system_mysql" = "yes"; then
5245         AC_MSG_RESULT([external MySQL])
5246         SYSTEM_MYSQL=YES
5247         AC_PATH_PROG( MYSQLCONFIG, mysql_config)
5248         AC_MSG_CHECKING([MySQL version])
5249         MYSQL_VERSION=`$MYSQLCONFIG --version`
5250         MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
5251         if test "$MYSQL_MAJOR" -ge "5"; then
5252             AC_MSG_RESULT([OK])
5253         else
5254             AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
5255         fi
5256         AC_MSG_CHECKING([for MySQL Client library])
5257         MYSQL_INC=`$MYSQLCONFIG --include`
5258         MYSQL_LIB=`$MYSQLCONFIG --libs`
5259         MYSQL_DEFINES=`$MYSQLCONFIG --cflags | $SED -e s,$MYSQL_INC,,`
5260         AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
5261     else
5262         SYSTEM_MYSQL=NO
5263         if test -n "$with_libmysql_path"; then
5264             AC_MSG_RESULT([external Connector/C (libmysql)])
5265             LIBMYSQL=libmysql.so
5266             if test "$_os" = "Darwin"; then
5267                 LIBMYSQL=libmysql.dylib
5268             elif test "$_os" = "WINNT"; then
5269                 LIBMYSQL=libmysql.dll
5270             fi
5271             AC_MSG_CHECKING([for $LIBMYSQL])
5272             if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
5273                 AC_MSG_RESULT([found.])
5274                 LIBMYSQL_PATH=$with_libmysql_path
5275             else
5276                 AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
5277             fi
5278         else
5279             AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
5280         fi
5281     fi
5282     AC_SUBST(SYSTEM_MYSQL)
5283     AC_SUBST(MYSQL_INC)
5284     AC_SUBST(MYSQL_LIB)
5285     AC_SUBST(MYSQL_DEFINES)
5286     AC_SUBST(LIBMYSQL_PATH)
5288     AC_LANG_PUSH([C++])
5289     dnl ===================================================================
5290     dnl Check for system MySQL C++ Connector
5291     dnl ===================================================================
5292     # FIXME!
5293     # who thought this too-generic cppconn dir was a good idea?
5294     AC_MSG_CHECKING([MySQL Connector/C++])
5295     if test "$with_system_mysql_cppconn" = "yes"; then
5296         AC_MSG_RESULT([external])
5297         SYSTEM_MYSQL_CPPCONN=YES
5298         AC_LANG_PUSH([C++])
5299         AC_CHECK_HEADER(mysql_driver.h, [],
5300                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
5301         AC_CHECK_LIB(mysqlcppconn, main, [],
5302                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
5303         AC_MSG_CHECKING([version])
5304         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5305 #include <mysql_driver.h>
5307 int main(int argc, char **argv) {
5308     sql::Driver *driver;
5309     driver = get_driver_instance();
5310     if (driver->getMajorVersion() > 1 || \
5311        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
5312        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
5313         return 0;
5314       else
5315         return 1;
5317       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
5319         AC_LANG_POP([C++])
5321     else
5322         AC_MSG_RESULT([internal])
5323         AC_MSG_CHECKING([for mysqlcppconn module])
5324         if test -d mysqlcppconn; then
5325             AC_MSG_RESULT([OK])
5326         else
5327             AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
5328         fi
5329         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
5330         SYSTEM_MYSQL_CPPCONN=NO
5331     fi
5332     AC_LANG_POP([C++])
5333     AC_SUBST(SYSTEM_MYSQL_CPPCONN)
5336 dnl ===================================================================
5337 dnl Check for system hsqldb
5338 dnl ===================================================================
5339 if test "$with_java" != "no"; then
5340 AC_MSG_CHECKING([which hsqldb to use])
5341 if test "$with_system_hsqldb" = "yes"; then
5342     AC_MSG_RESULT([external])
5343     SYSTEM_HSQLDB=YES
5344     if test -z $HSQLDB_JAR; then
5345         HSQLDB_JAR=/usr/share/java/hsqldb.jar
5346     fi
5347     AC_CHECK_FILE($HSQLDB_JAR, [],
5348                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
5349     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
5350     export HSQLDB_JAR
5351     if $PERL -e 'use Archive::Zip;
5352             my $file = "$ENV{'HSQLDB_JAR'}";
5353             my $zip = Archive::Zip->new( $file );
5354             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5355             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
5356                push @l, split(/\n/, $mf);
5357                foreach my $line (@l) {
5358                   if ($line =~ m/Specification-Version:/) {
5359                       ($t, $version) = split (/:/,$line);
5360                       $version =~ s/^\s//;
5361                       ($a, $b, $c, $d) = split (/\./,$version);
5362                       if ($c == "0" && $d > "8")  {
5363                           exit 0;
5364                       } else {
5365                           exit 1;
5366                       }
5367                   }
5368                }
5369             } else {
5370                 exit 1;
5371             }'; then
5372         AC_MSG_RESULT([yes])
5373     else
5374         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
5375     fi
5376 else
5377     AC_MSG_RESULT([internal])
5378     SYSTEM_HSQLDB=NO
5379     BUILD_TYPE="$BUILD_TYPE HSQLDB"
5381 AC_SUBST(SYSTEM_HSQLDB)
5382 AC_SUBST(HSQLDB_JAR)
5385 dnl ===================================================================
5386 dnl Check for PostgreSQL stuff
5387 dnl ===================================================================
5389 if test "x$enable_ext_postgresql_sdbc" = "xyes"; then
5390     AC_MSG_CHECKING([for PostgreSQL prerequisites])
5391     if test "$with_system_postgresql" = "yes"; then
5392         AC_MSG_RESULT([external PostgreSQL])
5393         SYSTEM_POSTGRESQL=YES
5394         AC_PATH_PROG(PGCONFIG, pg_config)
5395         if test -z "$PGCONFIG"; then
5396            AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
5397         fi
5398         POSTGRESQL_INC=-I$(pg_config --includedir)
5399         POSTGRESQL_LIB="-L$(pg_config --libdir) -lpq"
5400     else
5401         SYSTEM_POSTGRESQL=NO
5402         if test -n "$with_libpq_path"; then
5403             AC_MSG_RESULT([external libpq])
5404             POSTGRESQL_LIB="-L${with_libpq_path}/lib/ -lpq"
5405             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
5406         else
5407             AC_MSG_ERROR([not given. Please specify either --with-system-postgresql or --with-libpq-path])
5408         fi
5409     fi
5410     AC_MSG_CHECKING([for PostgreSQL C interface])
5411     save_CFLAGS=$CFLAGS
5412     save_CPPFLAGS=$CPPFLAGS
5413     save_LIBS=$LIBS
5414     CPPFLAGS="${POSTGRESQL_INC}"
5415     LIBS="${POSTGRESQL_LIB}"
5416     AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
5417     AC_CHECK_LIB(pq, PQconnectdbParams, [],
5418         [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
5419     CFLAGS=$save_CFLAGS
5420     CPPFLAGS=$save_CPPFLAGS
5421     LIBS=$save_LIBS
5422     BUILD_POSTGRESQL_SDBC=YES
5424 AC_SUBST(BUILD_POSTGRESQL_SDBC)
5425 AC_SUBST(SYSTEM_POSTGRESQL)
5426 AC_SUBST(POSTGRESQL_INC)
5427 AC_SUBST(POSTGRESQL_LIB)
5429 dnl ===================================================================
5430 dnl Check for system beanshell
5431 dnl ===================================================================
5432 if test "$with_java" != "no"; then
5433 AC_MSG_CHECKING([which beanshell to use])
5434 if test "$with_system_beanshell" = "yes"; then
5435     AC_MSG_RESULT([external])
5436     SYSTEM_BSH=YES
5437     if test -z $BSH_JAR; then
5438         BSH_JAR=/usr/share/java/bsh.jar
5439     fi
5440     AC_CHECK_FILE($BSH_JAR, [],
5441                [AC_MSG_ERROR(bsh.jar not found.)], [])
5442 else
5443     AC_MSG_RESULT([internal])
5444     SYSTEM_BSH=NO
5445     BUILD_TYPE="$BUILD_TYPE BSH"
5448 AC_SUBST(SYSTEM_BSH)
5449 AC_SUBST(BSH_JAR)
5452 dnl ===================================================================
5453 dnl Check for system saxon
5454 dnl ===================================================================
5455 if test "$with_java" != "no"; then
5456 AC_MSG_CHECKING([which saxon to use])
5457 if test "$with_system_saxon" = "yes"; then
5458     AC_MSG_RESULT([external])
5459     SYSTEM_SAXON=YES
5460     if test -z $SAXON_JAR; then
5461         AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5462             [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5463             [
5464               AC_CHECK_FILE(/usr/share/java/saxon.jar,
5465                 [ SAXON_JAR=/usr/share/java/saxon.jar ],
5466                 [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5467                     [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5468                     [ AC_MSG_ERROR(saxon.jar replacement not found)]
5469                   )
5470                 ]
5471               )
5472             ]
5473           )
5474     else
5475         AC_CHECK_FILE($SAXON_JAR, [],
5476                [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
5477     fi
5478     if test -n "$SERIALIZER_JAR"; then
5479         AC_CHECK_FILE($SERIALIZER_JAR, [],
5480                [AC_MSG_ERROR(serializer.jar not found.)], [])
5481         AC_SUBST(SERIALIZER_JAR)
5482     fi
5484     dnl Saxon comes in two practically available versions, the out-of-date saxonb which
5485     dnl supports the Java extensions that LibreOffice uses, and the up-to-date saxon he
5486     dnl "home edition" version, which is crippled to not support those Java extensions.
5487     dnl And as an aside the he one also needs to be tweaked to include
5488     dnl a META-INF/services to broadcast that it supports the jaxp transform factory
5490     AC_MSG_CHECKING([if saxon works])
5491     cat > saxontest.java <<_ACEOF
5492 [import javax.xml.transform.TransformerFactory;
5493 import javax.xml.transform.Transformer;
5494 import javax.xml.transform.stream.StreamSource;
5495 import java.io.*;
5497 import net.sf.saxon.FeatureKeys;
5499 class saxontest {
5500     public static void main(String[] args) {
5501       System.setProperty("javax.xml.transform.TransformerFactory",
5502         "net.sf.saxon.TransformerFactoryImpl");
5503       try {
5504         TransformerFactory tfactory = TransformerFactory.newInstance();
5505     // some external saxons (Debian, Ubuntu, ...) have this disabled
5506     // per default
5507     tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
5508         System.out.println("TransformerFactory is" +
5509           tfactory.getClass().getName());
5510         Transformer transformer = tfactory.newTransformer(
5511           new StreamSource(new File(args[0])));
5512       } catch(Exception e){
5513         e.printStackTrace(System.err);
5514         System.exit(-1);
5515       }
5516       System.exit(0);
5517     }
5520 _ACEOF
5522     cat > saxontest.xsl<<_ACEOF
5523 [<?xml version="1.0" encoding="UTF-8"?>
5524 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5525  <xsl:template match="/">
5526   <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
5527  </xsl:template>
5528 </xsl:stylesheet>
5530 _ACEOF
5532     javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
5533     AC_TRY_EVAL(javac_cmd)
5534     if test $? = 0 && test -f ./saxontest.class ; then
5535         java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
5536         AC_TRY_EVAL(java_cmd)
5537         if test $? = 0; then
5538             AC_MSG_RESULT([yes])
5539         else
5540             cat saxontest.java >&5
5541             AC_MSG_RESULT([no])
5542             AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
5543         fi
5544     else
5545         AC_MSG_RESULT([no])
5546         cat saxontest.java >&5
5547         AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
5548     fi
5549 else
5550     AC_MSG_RESULT([internal])
5551     SYSTEM_SAXON=NO
5552     NEED_SAXON=TRUE
5555 AC_SUBST(SYSTEM_SAXON)
5556 AC_SUBST(SAXON_JAR)
5558 if test -n "$NEED_SAXON"; then
5559     BUILD_TYPE="$BUILD_TYPE SAXON"
5562 # ===================================================================
5563 # Check whether to build stax
5564 # ===================================================================
5565 AC_MSG_CHECKING([whether building the stax is required])
5566 BUILD_STAX=NO
5567 if test -z "$SOLAR_JAVA"; then
5568     AC_MSG_RESULT([no (java disabled)])
5569 elif test "$SYSTEM_SAXON" = "YES"; then
5570     AC_MSG_RESULT([no (already provided by system saxon)])
5571 elif test -f "./stax/download/jsr173_1.0_api.jar"; then
5572     AC_MSG_RESULT([no (will use the prebuilt stax/download/jsr173_1.0_api.jar)])
5573 else
5574     BUILD_STAX=YES
5575     AC_MSG_RESULT([yes (no system saxon and no prebuilt copy)])
5577 AC_SUBST(BUILD_STAX)
5579 dnl ===================================================================
5580 dnl Check for system curl
5581 dnl ===================================================================
5582 AC_MSG_CHECKING([which libcurl to use])
5583 if test "$with_system_curl" = "yes"; then
5584     AC_MSG_RESULT([external])
5585     SYSTEM_CURL=YES
5587     curl_version=""
5588     if test "$cross_compiling" = "yes"; then
5589         dnl At least the OBS mingw32-libcurl-devel package
5590         dnl comes with a proper .pc file
5591         PKG_CHECK_MODULES(CURL, libcurl,, [:])
5592         if test -n "$CURL_PKG_ERRORS"; then
5593             AC_MSG_RESULT([no])
5594         else
5595             curl_version=`$PKG_CONFIG --modversion libcurl`
5596         fi
5597     fi
5598     if test -z "$curl_version"; then
5599         AC_PATH_PROG(CURLCONFIG, curl-config)
5600         if test -z "$CURLCONFIG"; then
5601             AC_MSG_ERROR([install the libcurl development package])
5602         fi
5603         CURL_LIBS=`$CURLCONFIG --libs`
5604         CURL_CFLAGS=`$CURLCONFIG --cflags`
5605         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
5606     fi
5608     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
5610     case $curl_version in
5611     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
5612     dnl so they need to be doubled to end up in the configure script
5613     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
5614         AC_MSG_RESULT([yes, you have $curl_version])
5615         ;;
5616     *)
5617         AC_MSG_ERROR([no, you have $curl_version])
5618         ;;
5619     esac
5621     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"
5622 else
5623     AC_MSG_RESULT([internal])
5624     SYSTEM_CURL=NO
5625     BUILD_TYPE="$BUILD_TYPE CURL"
5627 AC_SUBST(SYSTEM_CURL)
5628 AC_SUBST(CURL_CFLAGS)
5629 AC_SUBST(CURL_LIBS)
5631 dnl ===================================================================
5632 dnl Check for system boost
5633 dnl ===================================================================
5634 AC_MSG_CHECKING([which boost to use])
5635 if test "$with_system_boost" = "yes"; then
5636     AC_MSG_RESULT([external])
5637     SYSTEM_BOOST=YES
5638     AC_LANG_PUSH([C++])
5639     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
5640        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
5641     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
5642        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
5643     AC_CHECK_HEADER(boost/function.hpp, [],
5644        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
5645     AC_CHECK_HEADER([boost/unordered_map.hpp], [HAVE_BOOST_UNORDERED_MAP=TRUE],
5646                    [AC_MSG_WARN([boost/unordered_map.hpp not found])], [])
5648     save_CXXFLAGS=$CXXFLAGS
5649     CXXFLAGS="$CXXFLAGS -fno-exceptions"
5650     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
5651     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
5652 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
5654     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
5655         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
5656     else
5657         AC_MSG_RESULT([yes])
5658     fi
5659     CXXFLAGS=$save_CXXFLAGS
5660     AC_LANG_POP([C++])
5661 else
5662     AC_MSG_RESULT([internal])
5663     BUILD_TYPE="$BUILD_TYPE BOOST"
5664     SYSTEM_BOOST=NO
5665     HAVE_BOOST_UNORDERED_MAP=TRUE
5667 AC_SUBST([HAVE_BOOST_UNORDERED_MAP])
5668 AC_SUBST(SYSTEM_BOOST)
5670 dnl ===================================================================
5671 dnl Check for system mdds
5672 dnl ===================================================================
5673 AC_MSG_CHECKING([which mdds to use])
5674 if test "$with_system_mdds" = "yes"; then
5675     AC_MSG_RESULT([external])
5676     SYSTEM_MDDS=YES
5678     dnl ===================================================================
5679     dnl Determine which hash container mdds shall use
5680     dnl ===================================================================
5681     AC_MSG_CHECKING([which hash container mdds shall use])
5682     if test "x$HAVE_CXX0X" = "xTRUE"; then
5683         MDDS_CPPFLAGS="-std=c++0x"
5684         AC_MSG_RESULT([std::unordered_map])
5685     else
5686         MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5687         AC_MSG_RESULT([boost::unordered_map])
5688     fi
5690     AC_LANG_PUSH([C++])
5691     save_CPPFLAGS="$CPPFLAGS"
5692     CPPFLAGS="$CPPFLAGS $MDDS_CPPFLAGS"
5693     AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
5694         [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
5695     AC_CHECK_HEADER(mdds/mixed_type_matrix.hpp, [],
5696         [AC_MSG_ERROR(mdds/mixed_type_matrix.hpp not found. install mdds >= 0.4.0)], [])
5697     CPPFLAGS="$save_CPPFLAGS"
5698     save_CXXFLAGS="$CXXFLAGS"
5699     CXXFLAGS="$CXXFLAGS $MDDS_CPPFLAGS"
5700     AC_MSG_CHECKING([for correct signature of ::mdds::flat_segment_tree])
5701     AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <mdds/flat_segment_tree.hpp>
5703     int main(int argc, char **argv) {
5704         ::mdds::flat_segment_tree<long, short> db(0, 100, 0);
5705         short val;
5706         if (!db.search(5, val).second)
5707             return 1;
5708         return 0;
5709     }
5710 ]])],[ac_cv_cxx_mdds_flat_segment_tree_correct=yes],[ac_cv_cxx_mdds_flat_segment_tree_correct=no],[])
5712     if test "$ac_cv_cxx_mdds_flat_segment_tree_correct" = "yes"; then
5713         AC_MSG_RESULT([yes])
5714     else
5715         AC_MSG_ERROR([no, install mdds >= 0.5.0])
5716     fi
5717     CXXFLAGS=$save_CXXFLAGS
5718     AC_LANG_POP([C++])
5719 else
5720     AC_MSG_RESULT([internal])
5721     BUILD_TYPE="$BUILD_TYPE MDDS"
5722     SYSTEM_MDDS=NO
5724     dnl ===================================================================
5725     dnl Determine which hash container mdds shall use
5726     dnl ===================================================================
5727     AC_MSG_CHECKING([which hash container mdds shall use])
5728     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5729     AC_MSG_RESULT([boost::unordered_map])
5731 AC_SUBST(SYSTEM_MDDS)
5732 AC_SUBST([MDDS_CPPFLAGS])
5734 dnl ===================================================================
5735 dnl Check for system vigra
5736 dnl ===================================================================
5737 AC_MSG_CHECKING([which vigra to use])
5738 if test "$with_system_vigra" = "yes"; then
5739     AC_MSG_RESULT([external])
5740     SYSTEM_VIGRA=YES
5741     AC_LANG_PUSH([C++])
5742     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
5743        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
5744     AC_LANG_POP([C++])
5745 else
5746     AC_MSG_RESULT([internal])
5747     BUILD_TYPE="$BUILD_TYPE VIGRA"
5748     SYSTEM_VIGRA=NO
5750 AC_SUBST(SYSTEM_VIGRA)
5752 dnl ===================================================================
5753 dnl Check for system odbc
5754 dnl ===================================================================
5755 AC_MSG_CHECKING([which odbc headers to use])
5756 if test "$with_system_odbc" = "yes"; then
5757     AC_MSG_RESULT([external])
5758     SYSTEM_ODBC_HEADERS=YES
5760     AC_CHECK_HEADER(sqlext.h, [],
5761       [AC_MSG_ERROR(odbc not found. install odbc)], [])
5762 else
5763     AC_MSG_RESULT([internal])
5764     SYSTEM_ODBC_HEADERS=NO
5765     BUILD_TYPE="$BUILD_TYPE UNIXODBC"
5767 AC_SUBST(SYSTEM_ODBC_HEADERS)
5769 AC_MSG_CHECKING([whether to enable build of Mozilla])
5770 if test "$enable_mozilla" = "no"; then
5771     AC_MSG_RESULT([no])
5772     WITH_MOZILLA=NO
5773 else
5774     AC_MSG_RESULT([yes])
5775     WITH_MOZILLA=YES
5777 AC_SUBST(WITH_MOZILLA)
5779 AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
5780 if test "$enable_mozilla" = "no"; then
5781     AC_MSG_RESULT([no])
5782 elif test "$with_system_mozilla" = "yes"; then
5783     AC_MSG_RESULT([no, not possible with system-mozilla])
5784 else
5785     AC_MSG_RESULT([yes])
5788 AC_MSG_CHECKING([whether to build XML Security support])
5789 if test "$enable_xmlsec" = "no"; then
5790     AC_MSG_RESULT([no])
5791     ENABLE_XMLSEC=
5792 else
5793     ENABLE_XMLSEC="YES"
5794     BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
5795     AC_MSG_RESULT([yes])
5797 AC_SUBST(ENABLE_XMLSEC)
5799 AC_MSG_CHECKING([whether to build LDAP configuration backend])
5800 if test "$enable_ldap" != "no"; then
5801     WITH_OPENLDAP=NO
5802     WITH_LDAP=NO
5803     if test "$with_openldap" = "yes"; then
5804         WITH_LDAP=YES
5805         AC_MSG_RESULT([OpenLDAP])
5806         WITH_OPENLDAP=YES
5807         AC_CHECK_HEADERS(ldap.h, [],
5808             [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
5809         AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
5810             [AC_MSG_ERROR(openldap lib not found or functional)], [])
5811         AC_CHECK_LIB(ldap, ldap_set_option, [],
5812             [AC_MSG_ERROR(openldap lib not found or functional)], [])
5813     elif test "$enable_mozilla" != "no"; then
5814         AC_MSG_RESULT([Mozilla])
5815         WITH_LDAP=YES
5816         WITH_OPENLDAP=NO
5817     else
5818         AC_MSG_RESULT([no. Either Mozilla or OpenLDAP required])
5819     fi
5820 else
5821     AC_MSG_RESULT([no])
5822     WITH_LDAP=NO
5824 AC_SUBST(WITH_LDAP)
5825 AC_SUBST(WITH_OPENLDAP)
5827 dnl ===================================================================
5828 dnl Check for system mozilla
5829 dnl ===================================================================
5830 AC_MSG_CHECKING([which Mozilla to use])
5831 if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
5832     AC_MSG_RESULT([external])
5833     SYSTEM_MOZILLA=YES
5834     AC_MSG_CHECKING([which Mozilla flavour to use])
5835     if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
5836         MOZ_FLAVOUR=libxul
5837     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
5838         MOZ_FLAVOUR=xulrunner
5839     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
5840         MOZ_FLAVOUR=seamonkey
5841     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "iceape"; then
5842         MOZ_FLAVOUR=iceape
5843     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
5844         MOZ_FLAVOUR=firefox
5845     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
5846         MOZ_FLAVOUR=mozilla
5847     else
5848         MOZ_FLAVOUR=libxul
5849     fi
5850     tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
5851     AC_MSG_RESULT($tmp)
5853     if test "$MOZ_FLAVOUR" != "libxul"; then
5854         PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
5855         MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
5856         MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
5857     fi
5859     if test -z "$HASXPCOM"; then
5860         PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
5861         MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
5862         MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
5863         if ! test -e "$MOZ_LIB/libxul.so"; then
5864             MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
5865             if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
5866                 MOZ_LIB="$MOZ_LIB/sdk/lib"
5867             fi
5868         fi
5869     fi
5871     MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
5872     if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
5873         AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
5874         if test -d "$MOZ_INC/ldap"; then
5875             AC_MSG_RESULT([yes])
5876             MOZ_LDAP_CFLAGS="-I$MOZ_INC"
5877         else
5878             AC_MSG_ERROR([no.
5879 Could not find LDAP header include files in $MOZ_INC/ldap.
5880 Please recompile $tmp with --enable-ldap or use --with-openldap.])
5881         fi
5882     fi
5884     #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
5885     #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
5886     if test "$MOZ_FLAVOUR" = "libxul"; then
5887         MOZ_FLAVOUR="mozilla"
5888     fi
5890 elif test "$enable_mozilla" = "no"; then
5891     AC_MSG_RESULT([none])
5892     WITH_MOZILLA=NO
5893 else
5894     AC_MSG_RESULT([internal])
5895     SYSTEM_MOZILLA=NO
5896     BUILD_TYPE="$BUILD_TYPE MOZ"
5897 if test -z "$with_mozilla_version"; then
5898     MOZILLA_VERSION=
5899 else
5900     AC_MSG_CHECKING([which Mozilla version to build])
5901     MOZILLA_VERSION=$with_mozilla_version
5902     enable_build_mozilla=1
5903     AC_MSG_RESULT([$MOZILLA_VERSION])
5906 AC_SUBST(MOZILLA_VERSION)
5908 AC_MSG_CHECKING([for toolkit Mozilla should use])
5909 if test -z "$with_mozilla_toolkit"; then
5910     if test "$_os" != "WINNT" ; then
5911         if test "$_os" = "Darwin" ; then
5912             MOZILLA_TOOLKIT=mac
5913             AC_MSG_RESULT([mac])
5914         else
5915             MOZILLA_TOOLKIT=gtk2
5916             AC_MSG_RESULT([gtk2])
5917         fi
5918     fi
5919 else
5920     MOZILLA_TOOLKIT=$with_mozilla_toolkit
5921     enable_build_mozilla=1
5922     AC_MSG_RESULT([$MOZILLA_TOOLKIT])
5925 AC_SUBST(MOZILLA_TOOLKIT)
5927 # default to enabling build mozilla
5928 if test "$enable_build_mozilla" != "no"; then
5929     enable_build_mozilla=yes
5930 else
5931     enable_build_mozilla=
5934 AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
5935 if test -n "$enable_build_mozilla"; then
5936     BUILD_MOZAB="TRUE"
5937     AC_MSG_RESULT([yes])
5938 else
5939     BUILD_MOZAB=""
5940     AC_MSG_RESULT([no])
5943 if test "$BUILD_MOZAB" = "TRUE"; then
5944     if test "$_os" = "WINNT"; then
5945         if test "$WITH_MINGW" != "yes"; then
5946             # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
5947             if test "$MSVSVER" != "2005"; then
5948                 AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio 2005 only.])
5949             fi
5950         else
5951             AC_MSG_WARN([Building SeaMonkey with MinGW is not tested, and likely to break.])
5952             echo "Building SeaMonkey with MinGW is not tested, and likely to break." >> warn
5953         fi
5954     fi
5956     if test -z "$MOZILLA_VERSION"; then
5957         MOZILLA_VERSION=1.1.14
5958     fi
5959     MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
5960     MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst.in`
5961     AC_MSG_CHECKING([for Mozilla sources])
5962     if test -z "$MOZILLA_FETCH_FILE"; then
5963         AC_MSG_RESULT([not found])
5964         HAVE_MOZILLA_TARBALL=n
5965     else
5966         AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
5967         if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
5968             if test -z "$DO_FETCH"; then
5969                 AC_MSG_RESULT([will be fetched])
5970                 HAVE_MOZILLA_TARBALL=y
5971             else
5972                 AC_MSG_RESULT([not found])
5973                 HAVE_MOZILLA_TARBALL=n
5974             fi
5975         else
5976             AC_MSG_RESULT([found])
5977             HAVE_MOZILLA_TARBALL=y
5978         fi
5979     fi
5980     if test "$HAVE_MOZILLA_TARBALL" != "y"; then
5981         AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
5982 Use "./download" to download.])
5983     fi
5984     if test "$_os" = "WINNT"; then
5985         AC_MSG_CHECKING([for moztools binaries])
5986         if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
5987             AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
5988 (from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
5989         else
5990             AC_MSG_RESULT([ok])
5991         fi
5992     elif test "$_os" = "Darwin"; then
5993         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
5994         if test -z "$MOZIDL"; then
5995             AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build Mozilla with Mac toolkit.])
5996         fi
5997     else
5998         # Generic Unix/Linux section
5999         if test "$MOZILLA_TOOLKIT" = "gtk2"; then
6000             PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
6001             if test -z "$MOZGTK"; then
6002                 AC_MSG_ERROR([GTK2 is needed to build Mozilla.])
6003             fi
6004             PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
6005             if test -z "$MOZIDL"; then
6006                 AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build Mozilla.])
6007             fi
6008         else
6009             PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
6010             if test -z "$MOZGTK"; then
6011                 AC_MSG_ERROR([GTK+ 1.2 is needed when not using GTK2 to build Mozilla.])
6012             fi
6013             PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
6014             if test -z "$MOZIDL"; then
6015                 AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build Mozilla.])
6016             fi
6017         fi
6018     fi
6021 AC_SUBST(BUILD_MOZAB)
6024 AC_SUBST(MOZILLABUILD)
6025 AC_SUBST(SYSTEM_MOZILLA)
6026 AC_SUBST(MOZ_FLAVOUR)
6027 AC_SUBST(MOZ_INC)
6028 AC_SUBST(MOZ_LIB)
6029 AC_SUBST(MOZ_LIB_XPCOM)
6030 AC_SUBST(MOZ_LDAP_CFLAGS)
6032 dnl ===================================================================
6033 dnl Check for system NSS only with xmlsec or mozilla build enabled
6034 dnl ===================================================================
6035 if test "x$enable_xmlsec" != "xno" -o "x$enable_mozilla" != "xno"; then
6036 AC_MSG_CHECKING([which NSS to use])
6037 if test "$with_system_nss" = "yes"; then
6038     AC_MSG_RESULT([external])
6039     SYSTEM_NSS="YES"
6040     PKG_CHECK_MODULES(NSS, nss >= 3.9.3 nspr >= 4.8)
6041 else
6042     SYSTEM_NSS="NO"
6043     BUILD_TYPE="$BUILD_TYPE NSS"
6044     AC_MSG_RESULT([internal])
6045     if test "$build_os" = "cygwin"; then
6046         AC_MSG_CHECKING([for Mozilla build tooling. Required for nss and/or mozilla])
6047         if test -z "$MOZILLABUILD" ; then
6048             AC_MSG_ERROR([Mozilla build tooling not found.
6049 Use the --with-mozilla-build option after installing the tools obtained
6050 from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
6051         else
6052             if test \( "$WITH_MINGW" = "yes" \) ; then
6053                 if test ! -d "$MOZILLABUILD" ; then
6054                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
6055                 else
6056                     AC_MSG_RESULT([ok])
6057                 fi
6058             else
6059                 if test ! -d "$MOZILLABUILD/moztools" \
6060                         -o ! -d "$MOZILLABUILD/msys" ; then
6061                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
6062                 else
6063                     AC_MSG_RESULT([ok])
6064                 fi
6065             fi
6066         fi
6067     fi
6068 fi # system nss
6069 fi # enable xmlsec || enable mozilla
6070 AC_SUBST(SYSTEM_NSS)
6071 AC_SUBST(NSS_CFLAGS)
6072 AC_SUBST(NSS_LIBS)
6074 dnl ===================================================================
6075 dnl Check for system mozilla headers
6076 dnl ===================================================================
6077 AC_MSG_CHECKING([which mozilla headers to use])
6078 if test "$with_system_mozilla_headers" = "yes"; then
6079     AC_MSG_RESULT([external])
6080     SYSTEM_MOZILLA_HEADERS=YES
6081     # First try npapi-sdk:
6082     PKG_CHECK_MODULES(MOZILLA_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
6083     # Then go with libxul:
6084     if test "x$LOCATED" != "xyes"; then
6085         PKG_CHECK_MODULES(MOZILLA_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
6086     fi
6087     # if still not found bail out
6088     if test "x$LOCATED" != "xyes"; then
6089         AC_MSG_ERROR([npapi.h header file not found])
6090     fi
6091 else
6092     AC_MSG_RESULT([internal])
6093     SYSTEM_MOZILLA_HEADERS=NO
6095 AC_SUBST(MOZILLA_HEADERS_CFLAGS)
6096 AC_SUBST(SYSTEM_MOZILLA_HEADERS)
6098 dnl ===================================================================
6099 dnl Check for system sane
6100 dnl ===================================================================
6101 AC_MSG_CHECKING([which sane header to use])
6102 if test "$with_system_sane" = "yes"; then
6103     AC_MSG_RESULT([external])
6104     SYSTEM_SANE_HEADER=YES
6105     AC_CHECK_HEADER(sane/sane.h, [],
6106       [AC_MSG_ERROR(sane not found. install sane)], [])
6107 else
6108     AC_MSG_RESULT([internal])
6109     SYSTEM_SANE_HEADER=NO
6110     BUILD_TYPE="$BUILD_TYPE SANE"
6112 AC_SUBST(SYSTEM_SANE_HEADER)
6114 dnl ===================================================================
6115 dnl Check for system icu
6116 dnl ===================================================================
6117 SYSTEM_GENBRK=
6118 SYSTEM_GENCCODE=
6119 SYSTEM_GENCMN=
6120 ICU_MAJOR=
6121 ICU_MINOR=
6122 ICU_MICRO=
6123 ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
6124 AC_MSG_CHECKING([which icu to use])
6125 if test "$with_system_icu" = "yes"; then
6126     AC_MSG_RESULT([external])
6127     SYSTEM_ICU=YES
6128     AC_LANG_PUSH([C++])
6129     AC_MSG_CHECKING([for unicode/rbbi.h])
6130     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
6131     AC_LANG_POP([C++])
6133     ICUPATH="$PATH"
6134     if test "$WITH_MINGW" = "yes" ; then
6135         ICUPATH="/usr/i686-w64-mingw32/sys-root/mingw/bin:$ICUPATH"
6136     fi
6137     AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
6139     AC_MSG_CHECKING([ICU version])
6140     ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
6141     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
6142     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
6143     ICU_MICRO=`echo $ICU_VERSION | cut -d"." -f3`
6145     if test "$ICU_MAJOR" -ge "4"; then
6146         AC_MSG_RESULT([OK, $ICU_VERSION])
6147     else
6148         AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
6149     fi
6151     if test "$cross_compiling" != "yes"; then
6152         # using the system icu tools can lead to version confusion, use the
6153         # ones from the build environment when cross-compiling
6154         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
6155         if test -z "$SYSTEM_GENBRK"; then
6156             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
6157         fi
6158         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6159         if test -z "$SYSTEM_GENCCODE"; then
6160             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
6161         fi
6162         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6163         if test -z "$SYSTEM_GENCMN"; then
6164             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
6165         fi
6166         if test "$ICU_MAJOR" -ge "5" -o "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4"; then
6167             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6168         fi
6169     fi
6171     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS icui18n$ICU_MAJOR$ICU_MINOR.dll icuuc$ICU_MAJOR$ICU_MINOR.dll icudata$ICU_MAJOR$ICU_MINOR.dll"
6172 else
6173     AC_MSG_RESULT([internal])
6174     SYSTEM_ICU="NO"
6175     ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6176     BUILD_TYPE="$BUILD_TYPE ICU"
6178 AC_SUBST(SYSTEM_ICU)
6179 AC_SUBST(SYSTEM_GENBRK)
6180 AC_SUBST(SYSTEM_GENCCODE)
6181 AC_SUBST(SYSTEM_GENCMN)
6182 AC_SUBST(ICU_MAJOR)
6183 AC_SUBST(ICU_MINOR)
6184 AC_SUBST(ICU_MICRO)
6185 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
6187 dnl ===================================================================
6188 dnl Graphite
6189 dnl ===================================================================
6191 AC_MSG_CHECKING([whether to enable graphite support])
6192 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
6193     AC_MSG_RESULT([yes])
6194     ENABLE_GRAPHITE="TRUE"
6195     AC_MSG_CHECKING([which graphite to use])
6196     if test "$with_system_graphite" = "yes"; then
6197         AC_MSG_RESULT([external])
6198         SYSTEM_GRAPHITE=YES
6199         PKG_CHECK_MODULES( GRAPHITE, graphite2 >= 0.9.3 )
6200         MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libgraphite2.dll"
6201     else
6202         AC_MSG_RESULT([internal])
6203         SYSTEM_GRAPHITE=NO
6204         BUILD_TYPE="$BUILD_TYPE GRAPHITE"
6205     fi
6206 else
6207     AC_MSG_RESULT([no])
6209 AC_SUBST(ENABLE_GRAPHITE)
6210 AC_SUBST(SYSTEM_GRAPHITE)
6211 AC_SUBST(GRAPHITE_LIBS)
6212 AC_SUBST(GRAPHITE_CFLAGS)
6214 dnl ===================================================================
6215 dnl SampleICC
6216 dnl ===================================================================
6217 AC_MSG_CHECKING([whether to use system SampleICC])
6218 if test "$with_system_sampleicc" = "yes"; then
6219     AC_MSG_RESULT([yes])
6220     SYSTEM_SAMPLEICC=YES
6221     PKG_CHECK_MODULES(SAMPLEICC, sampleicc)
6222 else
6223     AC_MSG_RESULT([no])
6224     SYSTEM_SAMPLEICC=NO
6226 AC_SUBST(SYSTEM_SAMPLEICC)
6227 AC_SUBST(SAMPLEICC_LIBS)
6228 AC_SUBST(SAMPLEICC_CFLAGS)
6230 dnl ===================================================================
6231 dnl Checks for libraries.
6232 dnl ===================================================================
6233 dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
6234 dnl See if we have the AppKit framework for building with Quartz graphics.
6236 if test  "$_os" = "Darwin"; then
6237     if test "x$with_x" = "xyes"; then
6238         AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
6239     else
6240         AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
6241         if test -d "/System/Library/Frameworks/AppKit.framework/"; then
6242             AC_MSG_RESULT([yes])
6243             x_includes="no_x_includes"
6244             x_libraries="no_x_libraries"
6245             dnl disable some things used on other Unix versions but not on the aqua build
6246             enable_gtk=no
6247         else
6248             AC_MSG_ERROR([No AppKit.framewrok found])
6249         fi
6250     fi
6253 if test $_os = iOS -o $_os = Android; then
6254     enable_gtk=no
6257 dnl ===================================================================
6258 dnl Check for nsplugin
6259 dnl ===================================================================
6260 AC_MSG_CHECKING([wether to build nsplugin extension])
6261 ENABLE_NSPLUGIN=NO
6262 if test "$enable_nsplugin" != "no"; then
6263     if test "$enable_gtk" != "no"; then
6264         AC_MSG_RESULT([yes])
6265         ENABLE_NSPLUGIN=YES
6266     else
6267         AC_MSG_RESULT([no, disabled gtk2])
6268     fi
6269 else
6270     AC_MSG_RESULT([no])
6272 AC_SUBST(ENABLE_NSPLUGIN)
6274 dnl ***************************************
6275 dnl testing for X libraries and includes...
6276 dnl ***************************************
6277 if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
6278     dnl Mac OS X using Aqua graphics. Don't check for X11.
6279     :
6280 elif test "$_os" != "WINNT" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6281     AC_PATH_X
6282     AC_PATH_XTRA
6283     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
6285     if test "x$x_includes" = "x"; then
6286         x_includes="default_x_includes"
6287     fi
6288     if test "x$x_libraries" = "x"; then
6289         x_libraries="default_x_libraries"
6290     fi
6291     dnl The variables $x_libraries and $x_includes are set.
6292     if test -z "$x_libraries"; then
6293         AC_MSG_ERROR([No X libraries found]) # Exit
6294     fi
6295     if test -z "$x_includes"; then
6296         AC_MSG_ERROR([No X includes found]) # Exit
6297     fi
6298     CFLAGS="$CFLAGS $X_CFLAGS"
6299     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
6300     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
6301     dnl Check if the XauDisposeAuth symbol is provided by libXau.
6302     AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
6303 else
6304     x_includes="no_x_includes"
6305     x_libraries="no_x_libraries"
6307 if test -z "$x_includes"; then
6308     x_includes="no_x_includes"
6310 if test -z "$x_libraries"; then
6311     x_libraries="no_x_libraries"
6313 if test "$x_includes" = "default_x_includes"; then
6314     XINC="/usr/include"
6315 else
6316     XINC="$x_includes"
6318 AC_SUBST(XINC)
6319 if test "$x_libraries" = "default_x_libraries"; then
6320     XLIB=`$PKG_CONFIG --variable=libdir x11`
6321     if test "x$XLIB" = x; then
6322         XLIB="/usr/lib"
6323     fi
6324 else
6325     XLIB="$x_libraries"
6327 AC_SUBST(XLIB)
6328 AC_SUBST(XAU_LIBS)
6330 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6331     dnl ===================================================================
6332     dnl Check for Composite.h for Mozilla plugin
6333     dnl ===================================================================
6334     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
6335      [#include <X11/Intrinsic.h>])
6338 AC_MSG_CHECKING([whether to use internal X11 extensions headers])
6339 if test "$with_system_xextensions_headers" != "no"; then
6340     AC_MSG_RESULT([no])
6341 else
6342     AC_MSG_RESULT([yes])
6343     BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
6346 dnl ===================================================================
6347 dnl Check for system Xrender
6348 dnl ===================================================================
6349 AC_MSG_CHECKING([whether to use Xrender])
6350 if test "$test_xrender" = "yes"; then
6351     AC_MSG_RESULT([yes])
6352     AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
6353       [AC_MSG_ERROR(libXrender not found or functional)], [])
6354     AC_MSG_CHECKING([which Xrender headers to use])
6355     if test "$with_system_xextensions_headers" != "no"; then
6356         AC_MSG_RESULT([external])
6357         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
6358           [AC_MSG_ERROR(Xrender not found. install X)], [])
6359     else
6360         AC_MSG_RESULT([internal])
6361     fi
6364 dnl ===================================================================
6365 dnl Check for XRandr
6366 dnl ===================================================================
6367 AC_MSG_CHECKING([whether to enable RandR support])
6368 if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
6369     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
6370         XRANDR_DLOPEN="TRUE"
6371         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
6372     else
6373         AC_MSG_RESULT([yes])
6374         XRANDR_DLOPEN="FALSE"
6375         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
6376         if test "$ENABLE_RANDR" != "TRUE"; then
6377             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
6378                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
6379             XRANDR_CFLAGS=" "
6380             AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
6381               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
6382             XRANDR_LIBS="-lXrandr "
6383             ENABLE_RANDR="TRUE"
6384         fi
6385     fi
6386 else
6387     ENABLE_RANDR=""
6388     AC_MSG_RESULT([no])
6390 AC_SUBST(XRANDR_DLOPEN)
6391 AC_SUBST(XRANDR_CFLAGS)
6392 AC_SUBST(XRANDR_LIBS)
6393 AC_SUBST(ENABLE_RANDR)
6395 dnl ===================================================================
6396 dnl Check for building neon
6397 dnl ===================================================================
6398 AC_MSG_CHECKING([whether to use neon])
6399 if test "$enable_neon" = "no"; then
6400     AC_MSG_RESULT([no])
6401     DISABLE_NEON=TRUE
6402     AC_SUBST(DISABLE_NEON)
6403 else
6404     AC_MSG_RESULT([yes])
6405 dnl ===================================================================
6406 dnl Check for system neon
6407 dnl ===================================================================
6408 AC_MSG_CHECKING([which neon to use])
6409 if test "$with_system_neon" = "yes"; then
6410     AC_MSG_RESULT([external])
6411     PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
6412     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
6413     NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
6414     SYSTEM_NEON=YES
6415     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libtasn1-3.dll libgnutls-26.dll libneon-27.dll"
6416 else
6417     AC_MSG_RESULT([internal])
6418     SYSTEM_NEON=NO
6419     NEON_LIBS=-lneon
6420     NEON_CFLAGS=
6421     BUILD_TYPE="$BUILD_TYPE NEON"
6423 AC_SUBST(SYSTEM_NEON)
6424 AC_SUBST(NEON_VERSION)
6425 AC_SUBST(NEON_LIBS)
6426 AC_SUBST(NEON_CFLAGS)
6429 dnl ===================================================================
6430 dnl Check for system openssl
6431 dnl ===================================================================
6432 if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6433         "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
6434     with_system_openssl=yes
6436 AC_MSG_CHECKING([which libssl to use])
6437 if test "$with_system_openssl" = "yes"; then
6438     AC_MSG_RESULT([external])
6439     # Mac OS builds should get out without extra stuff is the Mac porters'
6440     # wish. And pkg-config is although Xcode ships a .pc for openssl
6441     if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6442             "$_os" = "DragonFly"; then
6443         OPENSSL_CFLAGS=
6444         OPENSSL_LIBS="-lssl -lcrypto"
6445     else
6446         PKG_CHECK_MODULES( OPENSSL, openssl )
6447     fi
6448     SYSTEM_OPENSSL=YES
6449     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libssl-8.dll libcrypto-8.dll"
6450 else
6451     AC_MSG_RESULT([internal])
6452     SYSTEM_OPENSSL=NO
6453     BUILD_TYPE="$BUILD_TYPE OPENSSL"
6455 AC_SUBST(SYSTEM_OPENSSL)
6456 AC_SUBST(OPENSSL_CFLAGS)
6457 AC_SUBST(OPENSSL_LIBS)
6459 dnl ===================================================================
6460 dnl Check for system redland
6461 dnl ===================================================================
6462 AC_MSG_CHECKING([which redland library to use])
6463 if test "$with_system_redland" = "yes"; then
6464     AC_MSG_RESULT([external])
6465     SYSTEM_REDLAND=YES
6466     dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
6467     PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
6468     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libraptor-1.dll librasqal-2.dll libsqlite3-0.dll librdf-0.dll"
6469 else
6470     AC_MSG_RESULT([internal])
6471     BUILD_TYPE="$BUILD_TYPE REDLAND"
6472     SYSTEM_REDLAND=NO
6474 AC_SUBST(SYSTEM_REDLAND)
6475 AC_SUBST(REDLAND_CFLAGS)
6476 AC_SUBST(REDLAND_LIBS)
6478 dnl ===================================================================
6479 dnl Check for system hunspell
6480 dnl ===================================================================
6481 AC_MSG_CHECKING([which libhunspell to use])
6482 if test "$with_system_hunspell" = "yes"; then
6483     AC_MSG_RESULT([external])
6484     SYSTEM_HUNSPELL=YES
6485     AC_LANG_PUSH([C++])
6486     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
6487     if test "$HUNSPELL_PC" != "TRUE"; then
6488         AC_CHECK_HEADER(hunspell.hxx, [],
6489             [
6490             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
6491             [AC_MSG_ERROR(hunspell headers not found.)], [])
6492             ], [])
6493         AC_CHECK_LIB(hunspell, main, [],
6494            [ AC_MSG_ERROR(hunspell library not found.) ], [])
6495         HUNSPELL_LIBS=-lhunspell
6496     fi
6497     AC_LANG_POP([C++])
6498     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhunspell-1.3-0.dll"
6499 else
6500     AC_MSG_RESULT([internal])
6501     SYSTEM_HUNSPELL=NO
6502     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
6504 AC_SUBST(SYSTEM_HUNSPELL)
6505 AC_SUBST(HUNSPELL_CFLAGS)
6506 AC_SUBST(HUNSPELL_LIBS)
6508 dnl ===================================================================
6509 dnl Checking for altlinuxhyph
6510 dnl ===================================================================
6511 AC_MSG_CHECKING([which altlinuxhyph to use])
6512 if test "$with_system_altlinuxhyph" = "yes"; then
6513     AC_MSG_RESULT([external])
6514     SYSTEM_HYPH=YES
6515     AC_CHECK_HEADER(hyphen.h, [],
6516        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
6517     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
6518        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
6519        [#include <hyphen.h>])
6520     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
6521         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6522     if test -z "$HYPHEN_LIB"; then
6523         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
6524            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6525     fi
6526     if test -z "$HYPHEN_LIB"; then
6527         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
6528            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6529     fi
6530     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhyphen-0.dll"
6531 else
6532     AC_MSG_RESULT([internal])
6533     SYSTEM_HYPH=NO
6534     BUILD_TYPE="$BUILD_TYPE HYPHEN"
6536 AC_SUBST(SYSTEM_HYPH)
6537 AC_SUBST(HYPHEN_LIB)
6539 dnl ===================================================================
6540 dnl Checking for mythes
6541 dnl ===================================================================
6542 AC_MSG_CHECKING([which mythes to use])
6543 if test "$with_system_mythes" = "yes"; then
6544     AC_MSG_RESULT([external])
6545     SYSTEM_MYTHES=YES
6546     AC_LANG_PUSH([C++])
6547     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
6548     if test "$MYTHES_PKGCONFIG" = "no"; then
6549         AC_CHECK_HEADER(mythes.hxx, [],
6550             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
6551         AC_CHECK_LIB(mythes-1.2, main, [],
6552             [ MYTHES_FOUND=no], [])
6553     if test "$MYTHES_FOUND" = "no"; then
6554         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
6555                 [ MYTHES_FOUND=no], [])
6556     fi
6557     if test "$MYTHES_FOUND" = "no"; then
6558         AC_MSG_ERROR([mythes library not found!.])
6559     fi
6560     fi
6561     AC_LANG_POP([C++])
6562     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libmythes-1.2-0.dll"
6563 else
6564     AC_MSG_RESULT([internal])
6565     SYSTEM_MYTHES=NO
6566     BUILD_TYPE="$BUILD_TYPE MYTHES"
6568 AC_SUBST(SYSTEM_MYTHES)
6569 AC_SUBST(MYTHES_CFLAGS)
6570 AC_SUBST(MYTHES_LIBS)
6572 dnl ===================================================================
6573 dnl Checking for lpsolve
6574 dnl ===================================================================
6575 AC_MSG_CHECKING([which lpsolve to use])
6576 if test "$with_system_lpsolve" = "yes"; then
6577     AC_MSG_RESULT([external])
6578     SYSTEM_LPSOLVE=YES
6579     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
6580        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
6581     # some systems need this. Like Ubuntu....
6582     AC_CHECK_LIB(m, floor)
6583     AC_CHECK_LIB(dl, dlopen)
6584     AC_CHECK_LIB(lpsolve55, make_lp, ,
6585         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
6586     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS lpsolve55.dll"
6587 else
6588     AC_MSG_RESULT([internal])
6589     SYSTEM_LPSOLVE=NO
6590     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
6592 AC_SUBST(SYSTEM_LPSOLVE)
6594 dnl ===================================================================
6595 dnl Checking for libexttextcat
6596 dnl ===================================================================
6597 AC_MSG_CHECKING([which libexttextcat to use])
6598 if test "$with_system_libexttextcat" = "yes"; then
6599     AC_MSG_RESULT([external])
6600     SYSTEM_LIBEXTTEXTCAT=YES
6601     PKG_CHECK_MODULES([LIBEXTTEXTCAT], [libexttextcat >= 3.1.1])
6602     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
6603 else
6604     AC_MSG_RESULT([internal])
6605     SYSTEM_LIBEXTTEXTCAT=NO
6606     BUILD_TYPE="$BUILD_TYPE LIBEXTTEXTCAT"
6608 AC_SUBST(SYSTEM_LIBEXTTEXTCAT)
6609 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
6610 AC_SUBST(LIBEXTTEXTCAT_CFLAGS)
6611 AC_SUBST(LIBEXTTEXTCAT_LIBS)
6613 dnl ***************************************
6614 dnl testing libc version for Linux...
6615 dnl ***************************************
6616 if test "$_os" = "Linux"; then
6617     AC_MSG_CHECKING([whether libc is >= 2.1.1])
6618     exec 6>/dev/null # no output
6619     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
6620     exec 6>&1 # output on again
6621     if test "$HAVE_LIBC"; then
6622         AC_MSG_RESULT([yes])
6623     else
6624         AC_MSG_ERROR([no, upgrade libc])
6625     fi
6628 if test "$_os" != "WINNT"; then
6629     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
6630     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
6631     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
6632         SYSTEM_LIBC=YES
6633     fi
6634 else
6635     HAVE_GETOPT=NO
6636     HAVE_READDIR_R=NO
6637     SYSTEM_LIBC=YES
6639 AC_SUBST(HAVE_GETOPT)
6640 AC_SUBST(HAVE_READDIR_R)
6641 AC_SUBST(SYSTEM_LIBC)
6643 dnl =========================================
6644 dnl Check for the Windows  SDK.
6645 dnl =========================================
6646 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
6647 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
6648 if test "$_os" = "WINNT"; then
6649     AC_MSG_CHECKING([for Windows SDK])
6650     if test "$build_os" = "cygwin"; then
6651         if test -z "$with_windows_sdk_home"; then
6652             # This first line will detect a February 2003 Microsoft Platform SDK
6653             WINDOWS_SDK_HOME=`./oowintool --windows-sdk-home`
6654             # But there might be also an April 2005 PSDK, unfortunately MS changed
6655             # the registry entry. (we prefer the old version!?)
6656             if test -z "$WINDOWS_SDK_HOME"; then
6657                 WINDOWS_SDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
6658             fi
6659             # normalize if found
6660             if test -n "$WINDOWS_SDK_HOME"; then
6661                 WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6662                 WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6663             fi
6664         else
6665             WINDOWS_SDK_HOME=`cygpath -u "$with_windows_sdk_home"`
6666         fi
6667     fi
6668     if test -n "$WINDOWS_SDK_HOME"; then
6669         # Remove a possible trailing backslash
6670         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6671         # Problem with current PSDK (iz 49865)
6672         # (What "current" does that mean?)
6673         if test -f "$WINDOWS_SDK_HOME/Lib/libcp.lib"; then
6674             AC_MSG_ERROR([
6675 Some modules do not build correctly with MS Platform SDK - April 2005
6676 Edition if the library ($WINDOWS_SDK_HOME/Lib/libcp.lib) is found.
6677 Remove/rename/backup that file and restart configure. Details about this
6678 problem can be found in issue 49856.])
6679         fi
6681         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6682              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6683              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6684             HAVE_PSDK_H="yes"
6685         else
6686             HAVE_PSDK_H="no"
6687         fi
6688         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6689             HAVE_PSDK_LIB="yes"
6690         else
6691             HAVE_PSDK_LIB="no"
6692         fi
6694         if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
6695             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6696 the  Windows SDK are installed.])
6697         fi
6699         if test ! -x "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
6700              -o ! -x "$WINDOWS_SDK_HOME/bin/msidb.exe" \
6701              -o ! -x "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
6702              -o ! -x "$WINDOWS_SDK_HOME/bin/msitran.exe" ; then
6703             AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
6704         fi
6705     fi
6707     if test -z "$WINDOWS_SDK_HOME"; then
6708         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6709     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
6710         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
6711     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
6712         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
6713     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
6714         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
6715     else
6716         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6717     fi
6719 AC_SUBST(WINDOWS_SDK_HOME)
6721 dnl =========================================
6722 dnl Check for the Microsoft DirectX SDK.
6723 dnl =========================================
6724 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
6725     AC_MSG_CHECKING([for DirectX SDK])
6726     if test "$build_os" = "cygwin"; then
6727         if test -z "$with_directx_home"; then
6728             dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
6729             if test -n "$DXSDK_DIR"; then
6730                 DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
6731                 DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
6732             fi
6733             # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
6734             # the "DirectX SDK not found" error later
6735         else
6736             DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
6737         fi
6738         # Remove a possible trailing backslash
6739         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
6740     elif test -n "$with_directx_home"; then
6741         DIRECTXSDK_HOME="$with_directx_home"
6742     fi
6744     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
6745         HAVE_DIRECTXSDK_H="yes"
6746     else
6747         HAVE_DIRECTXSDK_H="no"
6748     fi
6750     # MS changed the location of the libraries with Dec 2004 DirectX SDK
6751     if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
6752         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
6753     else
6754         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
6755     fi
6757     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
6758         HAVE_DIRECTXSDK_LIB="yes"
6759     else
6760         HAVE_DIRECTXSDK_LIB="no"
6761     fi
6763     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
6764         AC_MSG_RESULT([found])
6765     else
6766         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6767     fi
6769 AC_SUBST(DIRECTXSDK_HOME)
6770 AC_SUBST(DIRECTXSDK_LIB)
6772 dnl ============================================
6773 dnl Check for Nullsoft Scriptable Install System
6774 dnl ============================================
6775 NSIS_PATH=""
6776 if test "$_os" = "WINNT" ; then
6777     if test -z "$with_nsis_path"; then
6778         AC_PATH_PROG(NSIS_PATH, makensis)
6779         if test -n "$NSIS_PATH"; then
6780             NSIS_PATH=`dirname "$NSIS_PATH"`
6781         elif test "$build_os" = "cygwin"; then
6782             AC_MSG_CHECKING([for NSIS])
6783             nsistest=`./oowintool --nsis-dir`;
6784             nsistest=`cygpath -d -m "$nsistest"`
6785             nsistest=`cygpath -u "$nsistest"`
6786             if test -x "$nsistest/nsis.exe"; then
6787                 NSIS_PATH="$nsistest"
6788                 AC_MSG_RESULT([found ($NSIS_PATH)])
6789             else
6790                 AC_MSG_RESULT([no, no self-contained installer will be built.])
6791             fi
6792         fi
6793     else
6794         AC_MSG_CHECKING([for NSIS])
6795         if test "$build_os" = "cygwin"; then
6796             with_nsis_path=`cygpath -u "$with_nsis_path"`
6797         fi
6798         if test -e "$with_nsis_path/makensis$EXEEXT_FOR_BUILD"; then
6799             NSIS_PATH="$with_nsis_path"
6800         fi
6801         if test -z "$NSIS_PATH"; then
6802             AC_MSG_RESULT([no, no self-contained installer will be built.])
6803         else
6804             if test "$build_os" = "cygwin"; then
6805                 NSIS_PATH=`cygpath -d "$NSIS_PATH"`
6806                 NSIS_PATH=`cygpath -u "$NSIS_PATH"`
6807             fi
6808             AC_MSG_RESULT([found ($NSIS_PATH)])
6809         fi
6810     fi
6812 AC_SUBST(NSIS_PATH)
6814 dnl ***************************************
6815 dnl Checking for bison and flex
6816 dnl ***************************************
6817 AC_PATH_PROG(BISON, bison)
6818 if test -z "$BISON"; then
6819     AC_MSG_ERROR([no bison found in \$PATH, install it])
6820 else
6821     AC_MSG_CHECKING([the bison version])
6822     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
6823     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
6824     # Accept newer than 1.875 or older(equal) than 1.75
6825     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
6826         if test "$_bison_version" = "1.875" ; then
6827             AC_MSG_WARN([suspect ($BISON $_bison_version)])
6828             echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
6829         else
6830             AC_MSG_RESULT([checked ($BISON $_bison_version)])
6831         fi
6832     else
6833         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
6834     fi
6836 AC_PATH_PROG(FLEX, flex)
6837 if test -z "$FLEX"; then
6838     AC_MSG_ERROR([no flex found in \$PATH, install it])
6840 dnl ***************************************
6841 dnl Checking for patch
6842 dnl ***************************************
6843 AC_PATH_PROG(PATCH, patch)
6844 if test -z "$PATCH"; then
6845     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
6848 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
6849 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
6850     if test -z "$with_gnu_patch"; then
6851         GNUPATCH=$PATCH
6852     else
6853         if test -x "$with_gnu_patch"; then
6854             GNUPATCH=$with_gnu_patch
6855         else
6856             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
6857         fi
6858     fi
6860     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
6861     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
6862         AC_MSG_RESULT([yes])
6863     else
6864         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
6865     fi
6868 dnl We also need to check for --with-gnu-cp
6870 if test -z "$with_gnu_cp"; then
6871     # check the place where the good stuff is hidden on Solaris...
6872     if test -x /usr/gnu/bin/cp; then
6873         GNUCP=/usr/gnu/bin/cp
6874     else
6875         AC_PATH_PROGS(GNUCP, gnucp cp)
6876     fi
6877     if test -z $GNUCP; then
6878         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
6879     fi
6880 else
6881     if test -x "$with_gnu_cp"; then
6882         GNUCP=$with_gnu_cp
6883     else
6884         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
6885     fi
6888 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
6889 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
6890     AC_MSG_RESULT([yes])
6891 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
6892     AC_MSG_RESULT([yes])
6893 else
6894     case "$build_os" in
6895     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
6896         GNUCP=''
6897         AC_MSG_RESULT([no gnucp found - using the system's cp command])
6898         ;;
6899     *)
6900         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
6901         ;;
6902     esac
6905 AC_SUBST(GNUPATCH)
6906 AC_SUBST(GNUCP)
6908 dnl ***************************************
6909 dnl testing assembler path
6910 dnl ***************************************
6911 ML_EXE=""
6912 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
6913     if test "$CL_X64" = ""; then
6914         assembler=ml.exe
6915         assembler_bin=bin
6916     else
6917         assembler=ml64.exe
6918         assembler_bin=bin/amd64
6919     fi
6920     if test -n "$with_asm_home"; then
6921         with_asm_home=`cygpath -u "$with_asm_home"`
6922     fi
6923     if test -x "$with_asm_home/$assembler"; then
6924         AC_MSG_CHECKING([$assembler assembler path])
6925         AC_MSG_RESULT([$with_asm_home/$assembler])
6926         ML_EXE="$with_asm_home/$assembler"
6927     else
6928         AC_PATH_PROG(ML_EXE, $assembler)
6929         if test -z "$ML_EXE"; then
6930             AC_MSG_CHECKING([$with_cl_home/$assembler_bin/$assembler])
6931             if test -x "$with_cl_home/$assembler_bin/$assembler"; then
6932                 with_asm_home=$with_cl_home/$assembler_bin
6933                 AC_MSG_RESULT([found])
6934                 ML_EXE="$with_cl_home/$assembler_bin/$assembler"
6935             else
6936                 AC_MSG_ERROR([Configure did not find $assembler assembler.])
6937             fi
6938         else
6939             with_asm_home="ASM_IN_PATH"
6940             ML_EXE="$assembler"
6941         fi
6942     fi
6943 else
6944     with_asm_home="NO_ASM_HOME"
6946 ASM_HOME="$with_asm_home"
6947 AC_SUBST(ASM_HOME)
6948 AC_SUBST(ML_EXE)
6950 dnl ===================================================================
6951 dnl We need zip and unzip
6952 dnl ===================================================================
6953 AC_PATH_PROG(ZIP, zip)
6954 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
6955 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
6956     AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
6959 AC_PATH_PROG(UNZIP, unzip)
6960 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
6962 dnl ===================================================================
6963 dnl Zip must be a specific type for different build types.
6964 dnl ===================================================================
6965 if test $build_os = cygwin; then
6966     if test -n "`$ZIP -h | grep -i WinNT`" ; then
6967         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
6968     fi
6971 dnl ===================================================================
6972 dnl Test which vclplugs have to be built.
6973 dnl ===================================================================
6974 R=""
6975 GTK3_CFLAGS=""
6976 GTK3_LIBS=""
6977 ENABLE_GTK3=""
6978 if test "x$enable_gtk3" = "xyes"; then
6979     if test "$with_system_cairo" != yes; then
6980         echo "System cairo required for gtk3 support, please use --with-system-cairo"
6981     fi
6982     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
6983     if test "x$ENABLE_GTK3" = "xTRUE"; then
6984         R="gtk3"
6985     else
6986         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
6987     fi
6989 AC_SUBST(GTK3_LIBS)
6990 AC_SUBST(GTK3_CFLAGS)
6991 AC_SUBST(ENABLE_GTK3)
6993 AC_MSG_CHECKING([which VCLplugs shall be built])
6994 ENABLE_GTK=""
6995 if test "x$enable_gtk" = "xyes"; then
6996     ENABLE_GTK="TRUE"
6997     R="gtk $R"
6999 AC_SUBST(ENABLE_GTK)
7001 ENABLE_KDE=""
7002 if test "x$enable_kde" = "xyes"; then
7003     ENABLE_KDE="TRUE"
7004     R="$R kde"
7006 AC_SUBST(ENABLE_KDE)
7008 ENABLE_KDE4=""
7009 if test "x$enable_kde4" = "xyes"; then
7010     ENABLE_KDE4="TRUE"
7011     R="$R kde4"
7013 AC_SUBST(ENABLE_KDE4)
7015 if test -z "$R"; then
7016     AC_MSG_RESULT([none])
7017 else
7018     AC_MSG_RESULT([$R])
7021 dnl ===================================================================
7022 dnl GCONF check
7023 dnl ===================================================================
7025 ENABLE_GCONF=""
7026 AC_MSG_CHECKING([whether to enable GConf support])
7027 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gconf" = "yes"; then
7028     ENABLE_GCONF="TRUE"
7029     AC_MSG_RESULT([yes])
7030     PKG_CHECK_MODULES( GCONF, gconf-2.0 ORBit-2.0 )
7031 else
7032     AC_MSG_RESULT([no])
7034 AC_SUBST(ENABLE_GCONF)
7036 dnl ===================================================================
7037 dnl Gnome VFS check
7038 dnl ===================================================================
7040 ENABLE_GNOMEVFS=""
7041 AC_MSG_CHECKING([whether to enable GNOME VFS support])
7042 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
7043     ENABLE_GNOMEVFS="TRUE"
7044     AC_MSG_RESULT([yes])
7045     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
7046 else
7047     AC_MSG_RESULT([no])
7049 AC_SUBST(ENABLE_GNOMEVFS)
7051 dnl ===================================================================
7052 dnl Check whether the gtk 2.0 libraries are available.
7053 dnl ===================================================================
7055 GTK_CFLAGS=""
7056 GTK_LIBS=""
7057 ENABLE_SYSTRAY_GTK=""
7058 ENABLE_DBUS=""
7059 DBUS_CFLAGS=""
7060 DBUS_LIBS=""
7061 if test  "$test_gtk" = "yes"; then
7063     if test "$ENABLE_GTK" = "TRUE" ; then
7064         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]))
7065         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]))
7066         BUILD_TYPE="$BUILD_TYPE GTK"
7068         if test "x$enable_systray" = "xyes"; then
7069             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
7070                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
7071                             [ ENABLE_SYSTRAY_GTK="" ])
7072         fi
7074         AC_MSG_CHECKING([whether to enable DBUS support])
7075         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
7076             ENABLE_DBUS="TRUE"
7077             AC_MSG_RESULT([yes])
7078             PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
7079         else
7080             AC_MSG_RESULT([no])
7081         fi
7083         AC_MSG_CHECKING([whether to enable GIO support])
7084         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
7085             if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
7086                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
7087             fi
7088             ENABLE_GIO="TRUE"
7089             AC_MSG_RESULT([yes])
7090             PKG_CHECK_MODULES( GIO, gio-2.0 )
7091         else
7092             AC_MSG_RESULT([no])
7093         fi
7094     fi
7096 AC_SUBST(ENABLE_GIO)
7097 AC_SUBST(ENABLE_DBUS)
7098 AC_SUBST(ENABLE_SYSTRAY_GTK)
7099 AC_SUBST(GTK_CFLAGS)
7100 AC_SUBST(GTK_LIBS)
7101 AC_SUBST(GTHREAD_CFLAGS)
7102 AC_SUBST(GTHREAD_LIBS)
7103 AC_SUBST(DBUS_CFLAGS)
7104 AC_SUBST(DBUS_LIBS)
7106 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
7107 AC_SUBST(LIBPNG_LIBS)
7108 AC_SUBST(LIBPNG_CFLAGS)
7110 AC_MSG_CHECKING([whether to enable libpng linking in quickstarter])
7111 if test "x$unix_qstart_libpng" != "xno"; then
7112     AC_MSG_RESULT([yes])
7113 else
7114     AC_MSG_RESULT([no])
7115     ENABLE_QUICKSTART_LIBPNG=""
7117 AC_SUBST(ENABLE_QUICKSTART_LIBPNG)
7119 SPLIT_APP_MODULES=""
7120 if test "$enable_split_app_modules" = "yes"; then
7121     SPLIT_APP_MODULES="YES"
7123 AC_SUBST(SPLIT_APP_MODULES)
7125 SPLIT_OPT_FEATURES=""
7126 if test "$enable_split_opt_features" = "yes"; then
7127     SPLIT_OPT_FEATURES="YES"
7129 AC_SUBST(SPLIT_OPT_FEATURES)
7131 ENABLE_CAIRO_CANVAS="FALSE"
7132 if test "$enable_cairo_canvas" = "yes" ; then
7133    ENABLE_CAIRO_CANVAS="TRUE"
7135 AC_SUBST(ENABLE_CAIRO_CANVAS)
7137 dnl ===================================================================
7138 dnl Check whether the GStreamer libraries are available.
7139 dnl ===================================================================
7141 ENABLE_GSTREAMER=""
7143 if test  "$build_gstreamer" = "yes"; then
7145     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
7146     if test "x$enable_gstreamer" != "xno" ; then
7147         ENABLE_GSTREAMER="TRUE"
7148         AC_MSG_RESULT([yes])
7149         PKG_CHECK_MODULES( GSTREAMER, gstreamer-0.10 gstreamer-plugins-base-0.10 )
7150     else
7151         AC_MSG_RESULT([no])
7152     fi
7155 AC_SUBST(ENABLE_GSTREAMER)
7157 dnl ===================================================================
7158 dnl Check whether the OpenGL libraries are available
7159 dnl ===================================================================
7161 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
7162 ENABLE_OPENGL=
7164 if test "$_os" = "Darwin" ; then
7165     # We use frameworks on Mac OS X, no need for detail checks
7166     ENABLE_OPENGL=TRUE
7167     SYSTEM_MESA_HEADERS=YES
7168     AC_MSG_RESULT([yes])
7169 else
7170     if test "x$enable_opengl" != "xno" ; then
7171         if test "$_os" != "WINNT"; then
7172             save_LDFLAGS=$LDFLAGS
7173             LDFLAGS="$LDFLAGS -lm"
7174             AC_MSG_RESULT([yes])
7175             AC_CHECK_LIB(GL, main, [],
7176                       [AC_MSG_ERROR(libGL not installed or functional)], [])
7177             AC_CHECK_LIB(GLU, main, [],
7178                       [AC_MSG_ERROR(libGLU not installed or functional)], [])
7179             ENABLE_OPENGL=TRUE
7180             LDFLAGS=$save_LDFLAGS
7182             dnl ===================================================================
7183             dnl Check for system Mesa
7184             dnl ===================================================================
7185             AC_MSG_CHECKING([which Mesa headers to use])
7186             if test "$with_system_mesa_headers" = "yes"; then
7187                 AC_MSG_RESULT([external])
7188                 SYSTEM_MESA_HEADERS=YES
7189                 AC_LANG_PUSH(C)
7190                 AC_CHECK_HEADER(GL/glxext.h, [],
7191                    [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
7192                 AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
7193                 AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
7194                 AC_LANG_POP(C)
7195             else
7196                 AC_MSG_RESULT([internal])
7197                 SYSTEM_MESA_HEADERS=NO
7198                 BUILD_TYPE="$BUILD_TYPE MESA"
7199             fi
7200         else
7201             AC_MSG_RESULT([not on Windows])
7202         fi
7203     else
7204        AC_MSG_RESULT([no])
7205     fi
7208 AC_SUBST(SYSTEM_MESA_HEADERS)
7209 AC_SUBST(ENABLE_OPENGL)
7211 # presenter minimizer extension?
7212 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
7213 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
7214    AC_MSG_RESULT([yes])
7215    ENABLE_MINIMIZER=YES
7216 else
7217    AC_MSG_RESULT([no])
7218    ENABLE_MINIMIZER=NO
7219    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
7221 AC_SUBST(ENABLE_MINIMIZER)
7223 # presenter console extension?
7224 AC_MSG_CHECKING([whether to build the Presenter Console extension])
7225 if test "x$enable_ext_presenter_console" != "xno" -a "x$enable_extension_integration" != "xno"; then
7226    AC_MSG_RESULT([yes])
7227    ENABLE_PRESENTER_SCREEN=YES
7228 else
7229    AC_MSG_RESULT([no])
7230    ENABLE_PRESENTER_SCREEN=NO
7231    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PRESENTER_SCREEN"
7233 AC_SUBST(ENABLE_PRESENTER_SCREEN)
7235 # pdf import extension?
7236 AC_MSG_CHECKING([whether to build the PDF Import extension])
7237 if test "x$enable_ext_pdfimport" != "xno" -a "x$enable_extension_integration" != "xno"; then
7238   AC_MSG_RESULT([yes])
7239   ENABLE_PDFIMPORT=YES
7241   dnl ===================================================================
7242   dnl Check for system poppler
7243   dnl ===================================================================
7244   AC_MSG_CHECKING([which pdf backend to use])
7245   if test "$with_system_poppler" = "yes"; then
7246       AC_MSG_RESULT([external])
7247       SYSTEM_POPPLER=YES
7248       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
7249       AC_LANG_PUSH([C++])
7250       save_CXXFLAGS=$CXXFLAGS
7251       save_CPPFLAGS=$CPPFLAGS
7252       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
7253       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
7254       AC_CHECK_HEADER([cpp/poppler-version.h], [],
7255                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
7256       CXXFLAGS=$save_CXXFLAGS
7257       CPPFLAGS=$save_CPPFLAGS
7258       AC_LANG_POP([C++])
7259   else
7260       AC_MSG_RESULT([internal])
7261       SYSTEM_POPPLER=NO
7262       BUILD_TYPE="$BUILD_TYPE XPDF"
7263   fi
7264 else
7265   AC_MSG_RESULT([no])
7266   ENABLE_PDFIMPORT=NO
7267   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PDFIMPORT"
7269 AC_SUBST(ENABLE_PDFIMPORT)
7270 AC_SUBST(SYSTEM_POPPLER)
7271 AC_SUBST(POPPLER_CFLAGS)
7272 AC_SUBST(POPPLER_LIBS)
7275 if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
7276    AC_MSG_CHECKING([for sdext module])
7277    BUILD_TYPE="$BUILD_TYPE SDEXT"
7280 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
7281 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7282   AC_MSG_RESULT([yes])
7283   AC_MSG_CHECKING([for swext module])
7284   ENABLE_MEDIAWIKI=YES
7285   BUILD_TYPE="$BUILD_TYPE SWEXT"
7286   if test  "x$with_java" = "xno"; then
7287     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
7288   fi
7289 else
7290   AC_MSG_RESULT([no])
7291   ENABLE_MEDIAWIKI=NO
7292   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
7294 AC_SUBST(ENABLE_MEDIAWIKI)
7296 if test "$ENABLE_MEDIAWIKI" = "YES"; then
7297     AC_MSG_CHECKING([which Servlet API Jar to use])
7298     if test "$with_system_servlet_api" = "yes"; then
7299         AC_MSG_RESULT([external])
7300         SYSTEM_SERVLETAPI=YES
7301         if test -z "$SERVLETAPI_JAR"; then
7302             SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
7303         fi
7304         AC_CHECK_FILE($SERVLETAPI_JAR, [],
7305               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
7306     else
7307         AC_MSG_RESULT([internal])
7308         SYSTEM_SERVLETAPI=NO
7309         BUILD_TYPE="$BUILD_TYPE TOMCAT"
7310     fi
7312 AC_SUBST(SYSTEM_SERVLETAPI)
7313 AC_SUBST(SERVLETAPI_JAR)
7315 AC_MSG_CHECKING([whether to build the Report Builder extension])
7316 if test "$enable_ext_report_builder" != "no" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7317     AC_MSG_RESULT([yes])
7318     ENABLE_REPORTBUILDER=YES
7319     AC_MSG_CHECKING([for reportbuilder module])
7320     AC_MSG_CHECKING([which jfreereport libs to use])
7321     if test "$with_system_jfreereport" = "yes"; then
7322         SYSTEM_JFREEREPORT=YES
7323         AC_MSG_RESULT([external])
7324         if test -z $SAC_JAR; then
7325             SAC_JAR=/usr/share/java/sac.jar
7326         fi
7327         AC_CHECK_FILE($SAC_JAR, [],
7328              [AC_MSG_ERROR(sac.jar not found.)], [])
7330         if test -z $LIBXML_JAR; then
7331             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
7332                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
7333                 [
7334                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
7335                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
7336                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
7337                     )
7338                 ]
7339             )
7340         else
7341             AC_CHECK_FILE($LIBXML_JAR, [],
7342                  [AC_MSG_ERROR(libxml.jar not found.)], [])
7343         fi
7345         if test -z $FLUTE_JAR; then
7346             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
7347                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
7348                 [
7349                     AC_CHECK_FILE(/usr/share/java/flute.jar,
7350                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
7351                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
7352                     )
7353                 ]
7354             )
7355         else
7356             AC_CHECK_FILE($FLUTE_JAR, [],
7357                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
7358         fi
7360         if test -z $JFREEREPORT_JAR; then
7361             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
7362                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
7363                 [
7364                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
7365                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
7366                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
7367                     )
7368                 ]
7369             )
7370         else
7371             AC_CHECK_FILE($JFREEREPORT_JAR, [],
7372                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
7373         fi
7375         if test -z $LIBLAYOUT_JAR; then
7376             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
7377                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
7378                 [
7379                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
7380                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
7381                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
7382                     )
7383                 ]
7384             )
7385         else
7386             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
7387                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
7388         fi
7390         if test -z $LIBLOADER_JAR; then
7391             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
7392                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
7393                 [
7394                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
7395                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
7396                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
7397                     )
7398                 ]
7399             )
7400         else
7401             AC_CHECK_FILE($LIBLOADER_JAR, [],
7402                 [AC_MSG_ERROR(libloader.jar not found.)], [])
7403         fi
7405         if test -z $LIBFORMULA_JAR; then
7406             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
7407                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
7408                  [
7409                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
7410                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
7411                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
7412                      )
7413                  ]
7414             )
7415         else
7416             AC_CHECK_FILE($LIBFORMULA_JAR, [],
7417                 [AC_MSG_ERROR(libformula.jar not found.)], [])
7418         fi
7420         if test -z $LIBREPOSITORY_JAR; then
7421             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
7422                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
7423                 [
7424                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
7425                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
7426                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
7427                     )
7428                 ]
7429             )
7430         else
7431             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
7432                 [AC_MSG_ERROR(librepository.jar not found.)], [])
7433         fi
7435         if test -z $LIBFONTS_JAR; then
7436             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
7437                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
7438                 [
7439                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
7440                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
7441                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
7442                     )
7443                 ]
7444             )
7445         else
7446             AC_CHECK_FILE($LIBFONTS_JAR, [],
7447                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
7448         fi
7450         if test -z $LIBSERIALIZER_JAR; then
7451             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
7452                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
7453                 [
7454                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
7455                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
7456                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
7457                     )
7458                 ]
7459             )
7460         else
7461             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
7462                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
7463         fi
7466         if test -z $LIBBASE_JAR; then
7467             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
7468                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
7469                 [
7470                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
7471                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
7472                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
7473                     )
7474                 ]
7475             )
7476         else
7477             AC_CHECK_FILE($LIBBASE_JAR, [],
7478                 [AC_MSG_ERROR(libbase.jar not found.)], [])
7479         fi
7481     else
7482         AC_MSG_RESULT([internal])
7483         AC_MSG_CHECKING([for jfreereport module])
7484         SYSTEM_JFREEREPORT=NO
7485         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
7486     fi
7487     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
7488 else
7489     AC_MSG_RESULT([no])
7490     ENABLE_REPORTBUILDER=NO
7491     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_REPORTDESIGN"
7492     SYSTEM_JFREEREPORT=NO
7494 AC_SUBST(ENABLE_REPORTBUILDER)
7495 AC_SUBST(SYSTEM_JFREEREPORT)
7496 AC_SUBST(SAC_JAR)
7497 AC_SUBST(LIBXML_JAR)
7498 AC_SUBST(FLUTE_JAR)
7499 AC_SUBST(JFREEREPORT_JAR)
7500 AC_SUBST(LIBBASE_JAR)
7501 AC_SUBST(LIBLAYOUT_JAR)
7502 AC_SUBST(LIBLOADER_JAR)
7503 AC_SUBST(LIBFORMULA_JAR)
7504 AC_SUBST(LIBREPOSITORY_JAR)
7505 AC_SUBST(LIBFONTS_JAR)
7506 AC_SUBST(LIBSERIALIZER_JAR)
7508 # this has to be here because both the Wiki Publisher and the SRB use
7509 # commons-logging
7510 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7511     AC_MSG_CHECKING([which Apache commons-* libs to use])
7512     if test "$with_system_apache_commons" = "yes"; then
7513         SYSTEM_APACHE_COMMONS=YES
7514         AC_MSG_RESULT([external])
7515         if test "$ENABLE_MEDIAWIKI" = "YES"; then
7516             if test -z $COMMONS_CODEC_JAR; then
7517                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
7518                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
7519                     [
7520                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
7521                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
7522                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
7523                         )
7524                     ]
7525                 )
7526             else
7527                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
7528                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
7529             fi
7531             if test -z $COMMONS_LANG_JAR; then
7532                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
7533                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
7534                     [
7535                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
7536                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
7537                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
7538                             )
7539                     ]
7540                 )
7541             else
7542                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
7543                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
7544             fi
7546             if test -z $COMMONS_HTTPCLIENT_JAR; then
7547                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
7548                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
7549                     [
7550                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
7551                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
7552                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
7553                         )
7554                     ]
7555                 )
7556             else
7557                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
7558                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
7559             fi
7560         fi
7561         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7562             if test -z $COMMONS_LOGGING_JAR; then
7563                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
7564                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
7565                    [
7566                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
7567                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
7568                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
7569                         )
7570                     ]
7571                 )
7572             else
7573                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
7574                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
7575             fi
7576         fi
7577     else
7578         AC_MSG_RESULT([internal])
7579         SYSTEM_APACHE_COMMONS=NO
7580         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
7581     fi
7583 AC_SUBST(SYSTEM_APACHE_COMMONS)
7584 AC_SUBST(COMMONS_CODEC_JAR)
7585 AC_SUBST(COMMONS_LANG_JAR)
7586 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
7587 AC_SUBST(COMMONS_LOGGING_JAR)
7589 # scripting provider for BeanShell extension?
7590 AC_MSG_CHECKING([whether to build extension for support of scripts in BeanShell])
7591 if test "x$enable_ext_scripting_beanshell" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
7592    AC_MSG_RESULT([yes])
7593    ENABLE_SCRIPTING_BEANSHELL=YES
7594 else
7595    AC_MSG_RESULT([no])
7596    ENABLE_SCRIPTING_BEANSHELL=NO
7597    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_BEANSHELL"
7599 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
7601 # scripting provider for JavaScript extension?
7602 AC_MSG_CHECKING([whether to build extension for support of scripts in JavaScript])
7603 if test "x$enable_ext_scripting_javascript" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
7604    AC_MSG_RESULT([yes])
7605    ENABLE_SCRIPTING_JAVASCRIPT=YES
7606 else
7607    AC_MSG_RESULT([no])
7608    ENABLE_SCRIPTING_JAVASCRIPT=NO
7609    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_JAVASCRIPT"
7611 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
7613 dnl Scripting provider for Python extension?
7614 dnl We always provide this unless we have disabled Python completely
7615 if test $enable_python = no; then
7616     ENABLE_SCRIPTING_PYTHON=NO
7617 else
7618     ENABLE_SCRIPTING_PYTHON=YES
7620 AC_SUBST(ENABLE_SCRIPTING_PYTHON)
7622 supports_multilib=
7623 case "$host_cpu" in
7624 x86_64 | powerpc64 | s390x)
7625     if test "$SIZEOF_LONG" = "8"; then
7626         supports_multilib="yes"
7627     fi
7628     ;;
7630     ;;
7631 esac
7633 dnl ===================================================================
7634 dnl Check whether the Qt3 and KDE3 libraries are available.
7635 dnl ===================================================================
7637 KDE_CFLAGS=""
7638 KDE_LIBS=""
7639 if test "$_os" != "OpenBSD"; then
7640     MOC="moc"
7642 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
7643     dnl Search paths for Qt3 and KDE3
7644     if test -z "$supports_multilib" ; then
7645         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"
7646         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"
7647     else
7648         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"
7649         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"
7650     fi
7651     if test -n "$QTDIR" ; then
7652         qt_incdirs="$QTDIR/include $qt_incdirs"
7653         if test -z "$supports_multilib" ; then
7654             qt_libdirs="$QTDIR/lib $qt_libdirs"
7655         else
7656             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7657         fi
7658     fi
7659     if test -z "$supports_multilib" ; then
7660         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"
7661         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"
7662     else
7663         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"
7664         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"
7665     fi
7666     if test -n "$KDEDIR" ; then
7667         kde_incdirs="$KDEDIR/include $kde_incdirs"
7668         if test -z "$supports_multilib" ; then
7669             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7670         else
7671             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7672         fi
7673     fi
7675     dnl What to test
7676     qt_test_include="qstyle.h"
7677     kde_test_include="kapp.h"
7679     if test "$_os" != "OpenBSD"; then
7680         qt_test_library="libqt-mt.so"
7681         kde_test_library="libDCOP.so"
7682     else
7683         qt_test_library="libqt-mt.so*"
7684         kde_test_library="libDCOP.so*"
7685     fi
7687     dnl Check for Qt3 headers
7688     AC_MSG_CHECKING([for Qt3 headers])
7689     qt_incdir="no"
7690     for kde_check in $qt_incdirs ; do
7691         if test -r "$kde_check/$qt_test_include" ; then
7692             qt_incdir="$kde_check"
7693             break
7694         fi
7695     done
7696     AC_MSG_RESULT([$qt_incdir])
7697     if test "x$qt_incdir" = "xno" ; then
7698         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
7699 your Qt3 installation by exporting QTDIR before running "configure".])
7700     fi
7702     dnl Check for Qt3 libraries
7703     AC_MSG_CHECKING([for Qt3 libraries])
7704     qt_libdir="no"
7705     for qt_check in $qt_libdirs ; do
7706         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`" ; then
7707             qt_libdir="$qt_check"
7708             break
7709         fi
7710     done
7711     AC_MSG_RESULT([$qt_libdir])
7712     if test "x$qt_libdir" = "xno" ; then
7713         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
7714 your Qt3 installation by exporting QTDIR before running "configure".])
7715     fi
7717     dnl Check for Meta Object Compiler
7718     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
7719     if test "$MOC" = "no" ; then
7720         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
7721 the root of your Qt3 installation by exporting QTDIR before running "configure".])
7722     fi
7724     dnl Check for KDE3 headers
7725     AC_MSG_CHECKING([for KDE3 headers])
7726     kde_incdir="no"
7727     for kde_check in $kde_incdirs ; do
7728         if test -r "$kde_check/$kde_test_include" ; then
7729             kde_incdir="$kde_check"
7730             break
7731         fi
7732     done
7733     AC_MSG_RESULT([$kde_incdir])
7734     if test "x$kde_incdir" = "xno" ; then
7735         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
7736 your KDE3 installation by exporting KDEDIR before running "configure".])
7737     fi
7739     dnl Check for KDE3 libraries
7740     AC_MSG_CHECKING([for KDE3 libraries])
7741     kde_libdir="no"
7742     for kde_check in $kde_libdirs ; do
7743         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`" ; then
7744             kde_libdir="$kde_check"
7745             break
7746         fi
7747     done
7748     AC_MSG_RESULT([$kde_libdir])
7749     if test "x$kde_libdir" = "xno" ; then
7750         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
7751 your KDE3 installation by exporting KDEDIR before running "configure".])
7752     fi
7754     dnl Set the variables
7755     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7756     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
7758 AC_SUBST(KDE_CFLAGS)
7759 AC_SUBST(KDE_LIBS)
7760 AC_SUBST(MOC)
7762 dnl ===================================================================
7763 dnl KDE4 Integration
7764 dnl ===================================================================
7766 KDE4_CFLAGS=""
7767 KDE4_LIBS=""
7768 MOC4="moc"
7769 KDE_GLIB_CFLAGS=""
7770 KDE_GLIB_LIBS=""
7771 KDE_HAVE_GLIB=""
7772 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
7773     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
7774     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
7776     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
7777     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
7779     if test -n "$supports_multilib" ; then
7780         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
7781         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
7782     fi
7784     if test -n "$QTDIR" ; then
7785         qt_incdirs="$QTDIR/include $qt_incdirs"
7786         if test -z "$supports_multilib" ; then
7787             qt_libdirs="$QTDIR/lib $qt_libdirs"
7788         else
7789             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7790         fi
7791     fi
7792     if test -n "$QT4DIR" ; then
7793         qt_incdirs="$QT4DIR/include $qt_incdirs"
7794         if test -z "$supports_multilib" ; then
7795             qt_libdirs="$QT4DIR/lib $qt_libdirs"
7796         else
7797             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
7798         fi
7799     fi
7801     if test -n "$KDEDIR" ; then
7802         kde_incdirs="$KDEDIR/include $kde_incdirs"
7803         if test -z "$supports_multilib" ; then
7804             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7805         else
7806             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7807         fi
7808     fi
7809     if test -n "$KDE4DIR" ; then
7810         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
7811         if test -z "$supports_multilib" ; then
7812             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
7813         else
7814             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
7815         fi
7816     fi
7818     qt_test_include="Qt/qobject.h"
7819     qt_test_library="libQtCore.so"
7820     kde_test_include="kwindowsystem.h"
7821     kde_test_library="libsolid.so"
7823     AC_MSG_CHECKING([for Qt4 headers])
7824     qt_header_dir="no"
7825     for inc_dir in $qt_incdirs ; do
7826         if test -r "$inc_dir/$qt_test_include" ; then
7827             qt_header_dir="$inc_dir"
7828             break
7829         fi
7830     done
7832     AC_MSG_RESULT([$qt_header_dir])
7833     if test "x$qt_header_dir" = "xno" ; then
7834         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7835     fi
7837     AC_MSG_CHECKING([for Qt4 libraries])
7838     qt_lib_dir="no"
7839     for lib_dir in $qt_libdirs ; do
7840         if test -r "$lib_dir/$qt_test_library" ; then
7841             qt_lib_dir="$lib_dir"
7842             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
7843             break
7844         fi
7845     done
7847     AC_MSG_RESULT([$qt_lib_dir])
7849     if test "x$qt_lib_dir" = "xno" ; then
7850         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7851     fi
7853     dnl Check for Meta Object Compiler
7855     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7856     MOC4="$MOCQT4"
7857     if test "$MOC4" = "no" ; then
7858         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7859         if test "$MOC4" = "no" ; then
7860             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
7861 the root of your Qt installation by exporting QT4DIR before running "configure".])
7862         fi
7863     fi
7865     dnl Check for KDE4 headers
7866     AC_MSG_CHECKING([for KDE4 headers])
7867     kde_incdir="no"
7868     for kde_check in $kde_incdirs ; do
7869         if test -r "$kde_check/$kde_test_include" ; then
7870             kde_incdir="$kde_check"
7871             break
7872         fi
7873     done
7874     AC_MSG_RESULT([$kde_incdir])
7875     if test "x$kde_incdir" = "xno" ; then
7876         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7877     fi
7879     dnl Check for KDE4 libraries
7880     AC_MSG_CHECKING([for KDE4 libraries])
7881     kde_libdir="no"
7882     for kde_check in $kde_libdirs ; do
7883         if test -r "$kde_check/$kde_test_library" ; then
7884             kde_libdir="$kde_check"
7885             break
7886         fi
7887     done
7889     AC_MSG_RESULT([$kde_libdir])
7890     if test "x$kde_libdir" = "xno" ; then
7891         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7892     fi
7894     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7895     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
7897     AC_LANG_PUSH([C++])
7898     save_CXXFLAGS=$CXXFLAGS
7899     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
7900     AC_MSG_CHECKING([whether KDE is >= 4.2])
7901        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7902 #include <kdeversion.h>
7904 int main(int argc, char **argv) {
7905        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
7906        else return 1;
7908        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
7909     CXXFLAGS=$save_CXXFLAGS
7910     AC_LANG_POP([C++])
7912    # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled
7913     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
7914         [KDE_HAVE_GLIB=1],
7915         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
7917 AC_SUBST(KDE4_CFLAGS)
7918 AC_SUBST(KDE4_LIBS)
7919 AC_SUBST(MOC4)
7920 AC_SUBST(KDE_GLIB_CFLAGS)
7921 AC_SUBST(KDE_GLIB_LIBS)
7922 AC_SUBST(KDE_HAVE_GLIB)
7924 dnl ===================================================================
7925 dnl Test for the enabling the lockdown pieces
7926 dnl ===================================================================
7927 AC_MSG_CHECKING([whether to enable the lockdown pieces])
7928 ENABLE_LOCKDOWN=""
7929 if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
7930     ENABLE_LOCKDOWN=YES
7931     AC_MSG_RESULT([yes])
7932 else
7933     AC_MSG_RESULT([no])
7935 AC_SUBST(ENABLE_LOCKDOWN)
7937 dnl ===================================================================
7938 dnl Test whether to include Evolution 2 support
7939 dnl ===================================================================
7940 AC_MSG_CHECKING([whether to enable evolution 2 support])
7941 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
7942     AC_MSG_RESULT([yes])
7943     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
7944     ENABLE_EVOAB2="TRUE"
7945 else
7946     ENABLE_EVOAB2=""
7947     AC_MSG_RESULT([no])
7949 AC_SUBST(ENABLE_EVOAB2)
7950 AC_SUBST(GOBJECT_CFLAGS)
7951 AC_SUBST(GOBJECT_LIBS)
7953 dnl ===================================================================
7954 dnl Test whether to include KDE AB support
7955 dnl ===================================================================
7956 AC_MSG_CHECKING([whether to enable KDE address book support])
7957 if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
7958     AC_MSG_RESULT([yes])
7959     AC_LANG_PUSH([C++])
7960     save_CXXFLAGS=$CXXFLAGS
7961     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
7962     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
7963        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7964 #include <kdeversion.h>
7966 int main(int argc, char **argv) {
7967        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
7968        else return 1;
7970        ]])],[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])],[])
7971     CXXFLAGS=$save_CXXFLAGS
7972     AC_LANG_POP([C++])
7973     ENABLE_KAB=TRUE
7974 else
7975     AC_MSG_RESULT([no])
7976     ENABLE_KAB=
7978 AC_SUBST(ENABLE_KAB)
7980 dnl ===================================================================
7981 dnl Test whether to include MathMLDTD
7982 dnl ===================================================================
7983 AC_MSG_CHECKING([whether to include MathMLDTD])
7984 if test -n "$enable_mathmldtd"; then
7985     if test "$enable_mathmldtd" = "no"; then
7986         AC_MSG_RESULT([no])
7987         SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7988     else
7989         AC_MSG_RESULT([yes])
7990         BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7991     fi
7992 else
7993     AC_MSG_RESULT([no])
7994     SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7997 dnl ===================================================================
7998 dnl Test which themes to include
7999 dnl ===================================================================
8000 AC_MSG_CHECKING([which themes to include])
8001 # if none given, use all available themes
8002 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
8003     with_theme="default crystal hicontrast oxygen tango"
8006 WITH_THEMES=""
8007 for theme in $with_theme; do
8008     case $theme in
8009         default|crystal|hicontrast|oxygen|tango) : ;;
8010         *) AC_MSG_ERROR([Unknown value for --with-themes: $theme]) ;;
8011     esac
8012     WITH_THEMES="$WITH_THEMES $theme"
8013     SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
8014 done
8015 AC_MSG_RESULT([$WITH_THEMES])
8016 AC_SUBST([WITH_THEMES])
8018 dnl ===================================================================
8019 dnl Test whether to integrate helppacks into the product's installer
8020 dnl ===================================================================
8021 AC_MSG_CHECKING([for helppack integration])
8022 if test "z$with_helppack_integration" = "zno" ; then
8023     WITH_HELPPACK_INTEGRATION=NO
8024     AC_MSG_RESULT([no integration])
8025 else
8026     WITH_HELPPACK_INTEGRATION=YES
8027     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
8028     AC_MSG_RESULT([integration])
8030 AC_SUBST(WITH_HELPPACK_INTEGRATION)
8032 ###############################################################################
8033 # Extensions checking
8034 ###############################################################################
8035 dnl ===================================================================
8036 dnl Test whether to integrate extensions into the product's installer
8037 dnl ===================================================================
8038 AC_MSG_CHECKING([for extensions integration])
8039 if test "x$enable_extension_integration" != "xno"; then
8040     WITH_EXTENSION_INTEGRATION=YES
8041     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
8042     AC_MSG_RESULT([yes, use integration])
8043 else
8044     WITH_EXTENSION_INTEGRATION=NO
8045     AC_MSG_RESULT([no, do not integrate])
8047 AC_SUBST(WITH_EXTENSION_INTEGRATION)
8049 dnl ===================================================================
8050 dnl Test whether to include Lightproof extensions
8051 dnl ===================================================================
8052 AC_MSG_CHECKING([for Lightproof extensions integration (only supported languages displayed)])
8053 LIGHTPROOF_LANG=
8054 LIGHTPROOF_HU_PACK=
8055 LIGHTPROOF_RU_PACK=
8056 LIGHTPROOF_EN_US_PACK=
8057 if test "x$enable_ext_lightproof" = "xno" -o "x$enable_extension_integration" = "xno"; then
8058     AC_MSG_RESULT([no integration])
8059 else
8060     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LIGHTPROOF"
8061     if test "x$enable_ext_lightproof" = "xyes" -o "x$enable_ext_lightproof" = "x"; then
8062         wanted_lightproof="en-US hu ru"
8063     else
8064         for lang in $enable_ext_lightproof ; do
8065             case $lang in
8066                 en-US|hu|ru)
8067                     wanted_lightproof="$wanted_lightproof $lang"
8068                     ;;
8069                 *)
8070                     AC_MSG_ERROR([Unknown value for --enable-ext-lightproof: $lang])
8071                     ;;
8072                 esac
8073         done
8074     fi
8075     for lang in $wanted_lightproof ; do
8076         LIGHTPROOF_LANG="$LIGHTPROOF_LANG $lang"
8077         case $lang in
8078             en-US) LIGHTPROOF_EN_US_PACK="0ab55ac8e88f04258f1d3e79e984382f-lightproof-en_US-0.1.oxt" ;;
8079             hu) LIGHTPROOF_HU_PACK="76345f925e34fef2d29bade4f29108e9-lightproof-hu_1.3.oxt" ;;
8080             ru) LIGHTPROOF_RU_PACK="673860e8649cff2ebdc68bd46f2f7f1a-lightproof-ru_0.1.oxt" ;;
8081             *) AC_MSG_ERROR([Unknown value for --enable-ext-lightproof: $lang]) ;;
8082         esac
8083     done
8084     AC_MSG_RESULT([$LIGHTPROOF_LANG])
8086 AC_SUBST(LIGHTPROOF_LANG)
8087 AC_SUBST(LIGHTPROOF_HU_PACK)
8088 AC_SUBST(LIGHTPROOF_RU_PACK)
8089 AC_SUBST(LIGHTPROOF_EN_US_PACK)
8091 dnl ===================================================================
8092 dnl Test whether to include Watch Window extension
8093 dnl ===================================================================
8094 AC_MSG_CHECKING([for Watch Window extension integration])
8095 WATCH_WINDOW_EXTENSION_PACK=
8096 if test "x$enable_ext_watch_window" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8097     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_WATCH_WINDOW"
8098     WATCH_WINDOW_EXTENSION_PACK="23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt"
8099     AC_MSG_RESULT([yes])
8100 else
8101     AC_MSG_RESULT([no])
8103 AC_SUBST(WATCH_WINDOW_EXTENSION_PACK)
8105 dnl ===================================================================
8106 dnl Test whether to include SmART Gallery (Diagram) extension
8107 dnl ===================================================================
8108 AC_MSG_CHECKING([for SmART Gallery (Diagram) extension integration])
8109 DIAGRAM_EXTENSION_PACK=
8110 if test "x$enable_ext_diagram" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8111     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_DIAGRAM"
8112     DIAGRAM_EXTENSION_PACK="4a433efb6d385264ebc1d5513782d51c-SmART_0.9.4.oxt"
8113     AC_MSG_RESULT([yes])
8114 else
8115     AC_MSG_RESULT([no])
8117 AC_SUBST(DIAGRAM_EXTENSION_PACK)
8119 dnl ===================================================================
8120 dnl Test whether to include Validator extension
8121 dnl ===================================================================
8122 AC_MSG_CHECKING([for Validator extension integration])
8123 VALIDATOR_EXTENSION_PACK=
8124 if test "x$enable_ext_validator" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8125     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_VALIDATOR"
8126     VALIDATOR_EXTENSION_PACK="bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt"
8127     AC_MSG_RESULT([yes])
8128 else
8129     AC_MSG_RESULT([no])
8131 AC_SUBST(VALIDATOR_EXTENSION_PACK)
8133 dnl ===================================================================
8134 dnl Test whether to include Barcode extension
8135 dnl ===================================================================
8136 AC_MSG_CHECKING([for Barcode extension integration])
8137 BARCODE_EXTENSION_PACK=
8138 if test "x$enable_ext_barcode" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8139     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_BARCODE"
8140     BARCODE_EXTENSION_PACK="7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt"
8141     AC_MSG_RESULT([yes])
8142 else
8143     AC_MSG_RESULT([no])
8145 AC_SUBST([BARCODE_EXTENSION_PACK])
8147 dnl ===================================================================
8148 dnl Test whether to include ConvertTextToNumber extension
8149 dnl ===================================================================
8150 AC_MSG_CHECKING([for ConvertTextToNumber extension integration])
8151 CT2N_EXTENSION_PACK=
8152 if test "x$enable_ext_ct2n" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8153     BUILD_TYPE="$BUILD_TYPE CT2N"
8154     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_CT2N"
8155     CT2N_EXTENSION_PACK="451ccf439a36a568653b024534669971-ConvertTextToNumber_1.3.2.oxt"
8156     AC_MSG_RESULT([yes])
8157 else
8158     AC_MSG_RESULT([no])
8160 AC_SUBST(CT2N_EXTENSION_PACK)
8162 dnl ===================================================================
8163 dnl Test whether to include Numbertext extension
8164 dnl ===================================================================
8165 AC_MSG_CHECKING([for Numbertext extension integration])
8166 NUMBERTEXT_EXTENSION_PACK=
8167 if test "x$enable_ext_numbertext" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8168     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NUMBERTEXT"
8169     NUMBERTEXT_EXTENSION_PACK="b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt"
8170     AC_MSG_RESULT([yes])
8171 else
8172     AC_MSG_RESULT([no])
8174 AC_SUBST(NUMBERTEXT_EXTENSION_PACK)
8176 dnl ===================================================================
8177 dnl Test whether to include Hungarian Cross-reference Toolbar extension
8178 dnl ===================================================================
8179 AC_MSG_CHECKING([for Hungarian Cross-reference Toolbar extension integration])
8180 HUNART_EXTENSION_PACK=
8181 if test "x$enable_ext_hunart" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8182     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_HUNART"
8183     HUNART_EXTENSION_PACK="b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt"
8184     AC_MSG_RESULT([yes])
8185 else
8186     AC_MSG_RESULT([no])
8188 AC_SUBST(HUNART_EXTENSION_PACK)
8190 dnl ===================================================================
8191 dnl Test whether to include Typography Toolbar extension
8192 dnl ===================================================================
8193 AC_MSG_CHECKING([for Typography Toolbar extension integration])
8194 TYPO_EXTENSION_PACK=
8195 if test "x$enable_ext_typo" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8196     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_TYPO"
8197     TYPO_EXTENSION_PACK="9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt"
8198     AC_MSG_RESULT([yes])
8199 else
8200     AC_MSG_RESULT([no])
8202 AC_SUBST(TYPO_EXTENSION_PACK)
8204 dnl ===================================================================
8205 dnl Test whether to include Google Docs extension
8206 dnl ===================================================================
8207 AC_MSG_CHECKING([for Google Docs extension integration])
8208 GOOGLE_DOCS_EXTENSION_PACK=
8209 if test "x$enable_ext_google_docs" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8210     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_GOOGLE_DOCS"
8211     GOOGLE_DOCS_EXTENSION_PACK="cea0f63d5985ba4fcbd882031df44346-gdocs_3.0.0_modified.oxt"
8212     AC_MSG_RESULT([yes])
8213 else
8214     AC_MSG_RESULT([no])
8216 AC_SUBST(GOOGLE_DOCS_EXTENSION_PACK)
8218 dnl ===================================================================
8219 dnl Test whether to include NLPSolver extension
8220 dnl ===================================================================
8221 AC_MSG_CHECKING([for NLPSolver extension integration])
8222 if test "x$enable_ext_nlpsolver" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
8223     BUILD_TYPE="$BUILD_TYPE NLPSOLVER"
8224     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NLPSOLVER"
8225     AC_MSG_RESULT([yes])
8226 else
8227     AC_MSG_RESULT([no])
8230 dnl ===================================================================
8231 dnl Test whether to include LanguageTool extension
8232 dnl ===================================================================
8233 AC_MSG_CHECKING([for LanguageTool extension integration])
8234 if test "x$enable_ext_languagetool" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8235     BUILD_TYPE="$BUILD_TYPE LANGUAGETOOL"
8236     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LANGUAGETOOL"
8237     AC_MSG_RESULT([yes])
8238 else
8239     AC_MSG_RESULT([no])
8242 dnl ===================================================================
8243 dnl Test whether to include oooblogger extension
8244 dnl ===================================================================
8245 AC_MSG_CHECKING([for oooblogger extension integration])
8246 OOOBLOGGER_EXTENSION_PACK=
8247 if test "x$enable_ext_oooblogger" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8248     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_OOOBLOGGER"
8249     OOOBLOGGER_EXTENSION_PACK="b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt"
8250     AC_MSG_RESULT([yes])
8251 else
8252     AC_MSG_RESULT([no])
8254 AC_SUBST(OOOBLOGGER_EXTENSION_PACK)
8255 ###############################################################################
8257 dnl ===================================================================
8258 dnl Test whether to include Sun Professional Template Pack
8259 dnl ===================================================================
8260 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
8261 if test "z$with_sun_templates" = "z" -o "z$with_sun_templates" = "zno" ; then
8262     SUNTEMPLATES_LANG=""
8263     AC_MSG_RESULT([no integration])
8264 else
8265     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
8266     sun_supported_langs="en-US de it fr es hu"
8267     if test "z$with_sun_templates" = "zyes" ; then
8268         wanted_sun_templates="$sun_supported_langs"
8269     else
8270         # check whether the langs are supported by Sun
8271         wanted_sun_templates=
8272         for lang in $with_sun_templates ; do
8273             if test -n "`echo $sun_supported_langs | grep "$lang"`" ; then
8274                 wanted_sun_templates="$wanted_sun_templates $lang"
8275             fi
8276         done
8277     fi
8278     SUNTEMPLATES_LANG=
8279     SUNTEMPLATES_DE_PACK=
8280     SUNTEMPLATES_EN_US_PACK=
8281     SUNTEMPLATES_ES_PACK=
8282     SUNTEMPLATES_FR_PACK=
8283     SUNTEMPLATES_HU_PACK=
8284     SUNTEMPLATES_IT_PACK=
8285     # check whether the langs are requested at all
8286     for lang in $wanted_sun_templates ; do
8287     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`" ; then
8288         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
8289         case $lang in
8290         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
8291         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
8292         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
8293         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
8294         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
8295         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
8296         esac
8297     fi
8298     done
8299     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
8301 AC_SUBST(SUNTEMPLATES_LANG)
8302 AC_SUBST(SUNTEMPLATES_DE_PACK)
8303 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
8304 AC_SUBST(SUNTEMPLATES_ES_PACK)
8305 AC_SUBST(SUNTEMPLATES_FR_PACK)
8306 AC_SUBST(SUNTEMPLATES_HU_PACK)
8307 AC_SUBST(SUNTEMPLATES_IT_PACK)
8309 dnl ===================================================================
8310 dnl Test whether to include fonts
8311 dnl ===================================================================
8312 AC_MSG_CHECKING([whether to include third-party fonts])
8313 if test "$with_fonts" != "no" ; then
8314     AC_MSG_RESULT([yes])
8315     WITH_FONTS=YES
8316     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
8317 else
8318     AC_MSG_RESULT([no])
8319     WITH_FONTS=NO
8320     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
8322 AC_SUBST(WITH_FONTS)
8324 AC_MSG_CHECKING([whether to include Agfa Monotype fonts])
8325 if test "$with_agfa_monotype_fonts" = "yes" ; then
8326     AC_MSG_RESULT([yes])
8327     WITH_AGFA_MONOTYPE_FONTS=YES
8328     SCPDEFS="$SCPDEFS -DWITH_AGFA_MONOTYPE_FONTS"
8329     BUILD_TYPE="$BUILD_TYPE AGFA_MONOTYPE_FONTS"
8330 else
8331     AC_MSG_RESULT([no])
8332     WITH_AGFA_MONOTYPE_FONTS=NO
8334 AC_SUBST(WITH_AGFA_MONOTYPE_FONTS)
8336 dnl ===================================================================
8337 dnl Test whether to include ppds
8338 dnl ===================================================================
8339 AC_MSG_CHECKING([whether to include PPDs])
8340 if test "$with_ppds" != "no"; then
8341     AC_MSG_RESULT([yes])
8342 else
8343     AC_MSG_RESULT([no])
8344     WITHOUT_PPDS=YES
8345     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
8347 AC_SUBST(WITHOUT_PPDS)
8349 dnl ===================================================================
8350 dnl Test whether to include afms
8351 dnl ===================================================================
8352 AC_MSG_CHECKING([whether to include AFMs])
8353 if test "$with_afms" != "no"; then
8354     AC_MSG_RESULT([yes])
8355     BUILD_TYPE="$BUILD_TYPE AFMS"
8356 else
8357     AC_MSG_RESULT([no])
8358     WITHOUT_AFMS=YES
8359     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
8361 AC_SUBST(WITHOUT_AFMS)
8363 dnl ===================================================================
8364 dnl Test whether to include extra galleries
8365 dnl ===================================================================
8366 AC_MSG_CHECKING([whether to include extra galleries])
8367 if test "z$enable_extra_gallery" = "z" -o "z$enable_extra_gallery" = "zno" ; then
8368     AC_MSG_RESULT([no])
8369     WITH_EXTRA_GALLERY=NO
8370     OOOP_GALLERY_PACK=""
8371 else
8372     AC_MSG_RESULT([yes])
8373     WITH_EXTRA_GALLERY=YES
8374     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
8375     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
8376     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
8378 AC_SUBST(WITH_EXTRA_GALLERY)
8379 AC_SUBST(OOOP_GALLERY_PACK)
8381 dnl ===================================================================
8382 dnl Test whether to include extra templates
8383 dnl ===================================================================
8384 AC_MSG_CHECKING([whether to include extra templates])
8385 if test "z$enable_extra_template" = "z" -o "z$enable_extra_template" = "zno" ; then
8386     AC_MSG_RESULT([no])
8387     WITH_EXTRA_TEMPLATE=NO
8388     OOOP_TEMPLATES_PACK=""
8389 else
8390     AC_MSG_RESULT([yes])
8391     WITH_EXTRA_TEMPLATE=YES
8392     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
8393     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
8394     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
8396 AC_SUBST(WITH_EXTRA_TEMPLATE)
8397 AC_SUBST(OOOP_TEMPLATES_PACK)
8399 dnl ===================================================================
8400 dnl Test whether to include extra samples
8401 dnl ===================================================================
8402 AC_MSG_CHECKING([whether to include extra samples])
8403 if test "z$enable_extra_sample" = "z" -o "z$enable_extra_sample" = "zno" ; then
8404     AC_MSG_RESULT([no])
8405     WITH_EXTRA_SAMPLE=NO
8406     OOOP_SAMPLES_PACK=""
8407 else
8408     AC_MSG_RESULT([yes])
8409     WITH_EXTRA_SAMPLE=YES
8410     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
8411     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
8412     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
8414 AC_SUBST(WITH_EXTRA_SAMPLE)
8415 AC_SUBST(OOOP_SAMPLES_PACK)
8417 dnl ===================================================================
8418 dnl Test whether to include extra fonts
8419 dnl ===================================================================
8420 AC_MSG_CHECKING([whether to include extra fonts])
8421 if test "z$enable_extra_font" = "z" -o "z$enable_extra_font" = "zno" ; then
8422     AC_MSG_RESULT([no])
8423     WITH_EXTRA_FONT=NO
8424     OOOP_FONTS_PACK=""
8425 else
8426     AC_MSG_RESULT([yes])
8427     WITH_EXTRA_FONT=YES
8428     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
8429     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
8430     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
8432 AC_SUBST(WITH_EXTRA_FONT)
8433 AC_SUBST(OOOP_FONTS_PACK)
8435 dnl ===================================================================
8436 dnl Test whether to build global menu support
8437 dnl ===================================================================
8438 AC_MSG_CHECKING([whether to build global menu support])
8439 if test "z$enable_lomenubar" = "z" -o "z$enable_lomenubar" = "zno" ; then
8440     AC_MSG_RESULT([no])
8441     ENABLE_LOMENUBAR="FALSE"
8442 else
8443     AC_MSG_RESULT([yes])
8444     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]))
8445     ENABLE_LOMENUBAR="TRUE"
8447 AC_SUBST(ENABLE_LOMENUBAR)
8449 dnl ===================================================================
8450 dnl Test whether to enable online update service
8451 dnl ===================================================================
8452 AC_MSG_CHECKING([whether to enable online update])
8453 ENABLE_ONLINE_UPDATE=
8454 if test "z$enable_online_update" = "z" ; then
8455     if test "$_os" = "WINNT" -o "$_os" = "Darwin" ; then
8456         AC_MSG_RESULT([yes])
8457         ENABLE_ONLINE_UPDATE="TRUE"
8458     else
8459         AC_MSG_RESULT([no])
8460     fi
8461 else
8462     if test "z$enable_online_update" = "zyes" ; then
8463         AC_MSG_RESULT([yes])
8464         ENABLE_ONLINE_UPDATE="TRUE"
8465     else
8466         AC_MSG_RESULT([no])
8467     fi
8469 AC_SUBST(ENABLE_ONLINE_UPDATE)
8471 dnl ===================================================================
8472 dnl Test whether build target is Release Build
8473 dnl ===================================================================
8474 AC_MSG_CHECKING([whether build target is Release Build])
8475 if test "z$enable_release_build" = "z" -o "z$enable_release_build" = "zno" ; then
8476     AC_MSG_RESULT([no])
8477     ENABLE_RELEASE_BUILD="FALSE"
8478 else
8479     AC_MSG_RESULT([yes])
8480     ENABLE_RELEASE_BUILD="TRUE"
8482 AC_SUBST(ENABLE_RELEASE_BUILD)
8484 dnl ===================================================================
8485 dnl Test whether to create MSI with LIMITUI=1 (silent install)
8486 dnl ===================================================================
8487 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
8488 if test "z$enable_silent_msi" = "z" -o "z$enable_silent_msi" = "zno" ; then
8489     AC_MSG_RESULT([no])
8490     ENABLE_SILENT_MSI="FALSE"
8491 else
8492     AC_MSG_RESULT([yes])
8493     ENABLE_SILENT_MSI="TRUE"
8494     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
8496 AC_SUBST(ENABLE_SILENT_MSI)
8498 dnl ===================================================================
8499 dnl Test whether to enable ActiveX embedding
8500 dnl ===================================================================
8501 if test "$_os" = "WINNT"; then
8502     AC_MSG_CHECKING([whether to enable ActiveX embedding of LibreOffice components])
8503     if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
8504         ENABLE_ACTIVEX_COMPONENT="TRUE"
8505         AC_MSG_RESULT([yes])
8506         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
8507     else
8508         ENABLE_ACTIVEX_COMPONENT=""
8509         AC_MSG_RESULT([no])
8510     fi
8511     AC_SUBST(ENABLE_ACTIVEX_COMPONENT)
8512     AC_SUBST(SCPDEFS)
8515 AC_MSG_CHECKING([whether and how to use Xinerama])
8516 if test "$_os" = "Darwin"; then
8517     USE_XINERAMA=YES
8518     XINERAMA_LINK=dynamic
8519     AC_MSG_RESULT([yes])
8520 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
8521     if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
8522         # we have both versions, let the user decide but use the dynamic one
8523         # per default
8524         USE_XINERAMA=YES
8525         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
8526             XINERAMA_LINK=dynamic
8527         else
8528             XINERAMA_LINK=static
8529         fi
8530     elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
8531         # we have only the dynamic version
8532         USE_XINERAMA=YES
8533         XINERAMA_LINK=dynamic
8534     elif test -e "$XLIB/libXinerama.a"; then
8535         # static version
8536         if echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
8537             USE_XINERAMA=YES
8538             XINERAMA_LINK=static
8539         else
8540             USE_XINERAMA=NO
8541             XINERAMA_LINK=none
8542         fi
8543     else
8544         # no Xinerama
8545         USE_XINERAMA=NO
8546         XINERAMA_LINK=none
8547     fi
8548     if test "$USE_XINERAMA" = "YES"; then
8549         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
8550         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
8551             [AC_MSG_ERROR(Xinerama header not found.)], [])
8552         XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
8553         if test "$_os" = "FreeBSD"; then
8554             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
8555         fi
8556         if test "$_os" = "Linux"; then
8557             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
8558         fi
8559         AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
8560             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
8561     else
8562         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
8563     fi
8564 else
8565     USE_XINERAMA=NO
8566     XINERAMA_LINK=none
8567     AC_MSG_RESULT([no])
8569 AC_SUBST(USE_XINERAMA)
8570 AC_SUBST(XINERAMA_LINK)
8572 dnl ===================================================================
8573 dnl Checks for librsvg
8574 dnl ===================================================================
8576 dnl ENABLE_LIBRSVG is set to "" (for NO), SYSTEM or INTERNAL. The
8577 dnl SYSTEM_LIBRSVG, SYSTEM_GDKPIXBUF etc are redundant.
8579 ENABLE_LIBRSVG=""
8580 LIBRSVG_CFLAGS=""
8581 LIBRSVG_LIBS=""
8583 AC_MSG_CHECKING([what librsvg to use])
8585 case "$enable_librsvg" in
8586 no|disable)
8587     AC_MSG_RESULT([none])
8588     enable_librsvg=no
8589     ;;
8591 ""|yes|auto)
8592     if test $build_os = cygwin -o \
8593            $_os = Darwin; then
8594         dnl When building on/for these OSes always use the internal one,
8595         dnl if at all. Add more OSes above as needed.
8596         AC_MSG_RESULT([internal])
8597         enable_librsvg=internal
8598     elif test  $_os = iOS -o $_os = Android; then
8599         AC_MSG_RESULT([none])
8600         enable_librsvg=no
8601     else
8602         if test "$with_system_libs" = yes; then
8603             AC_MSG_RESULT([system])
8604             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8605             enable_librsvg=system
8606         elif test "$with_system_libs" = no; then
8607             AC_MSG_RESULT([internal])
8608             enable_librsvg=internal
8609         else
8610             AC_MSG_RESULT([checking further])
8611             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14,, [:])
8612             if test -z "$LIBRSVG_PKG_ERRORS"; then
8613                 enable_librsvg=system
8614             else
8615                 enable_librsvg=internal
8616             fi
8617         fi
8618     fi
8619     ;;
8621 internal)
8622     AC_MSG_RESULT([internal])
8623     ;;
8625 system)
8626     if test $_os = WINNT -a "$WITH_MINGW" != yes; then
8627         AC_MSG_ERROR([Must use internal librsvg when building with MSVC])
8628     fi
8629     AC_MSG_RESULT([system])
8630     PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8631     ;;
8634     AC_MSG_ERROR([Incorrect --enable-librsvg option])
8635     ;;
8636 esac
8638 dnl By now enable_librsvg should be "system", "internal" or "no"
8639 case $enable_librsvg in
8640 system)
8641     ENABLE_LIBRSVG=SYSTEM
8642     SYSTEM_LIBRSVG=YES
8643     ;;
8645 internal)
8646     ENABLE_LIBRSVG=INTERNAL
8647     SYSTEM_LIBRSVG=NO
8648     BUILD_TYPE="$BUILD_TYPE LIBRSVG"
8649     ;;
8652     ENABLE_LIBRSVG=NO
8653     SYSTEM_LIBRSVG=NO
8654     ;;
8657     AC_MSG_ERROR([Internal configure script error, invalid enable_librsvg value "$enable_librsvg"])
8658     ;;
8659 esac
8661 AC_SUBST(ENABLE_LIBRSVG)
8662 AC_SUBST(LIBRSVG_CFLAGS)
8663 AC_SUBST(LIBRSVG_LIBS)
8664 AC_SUBST(SYSTEM_LIBRSVG)
8666 dnl ===================================================================
8667 dnl Test whether to build cairo or rely on the system version
8668 dnl ===================================================================
8671 SYSTEM_CAIRO=""
8673 AC_MSG_CHECKING([whether to use the system cairo])
8675 if test "$with_system_cairo" = "yes"; then
8676     SYSTEM_CAIRO=YES
8677     AC_MSG_RESULT([yes])
8679     PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
8681     if test "$test_xrender" = "yes"; then
8682         if test "$with_system_xextensions_headers" != "no"; then
8683             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
8684             AC_LANG_PUSH([C])
8685             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
8686 #ifdef PictStandardA8
8687 #else
8688       return fail;
8689 #endif
8690 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
8692             AC_LANG_POP([C])
8693         fi
8694     fi
8695     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libfontconfig-1.dll libfreetype-6.dll libpixman-1-0.dll libpng15-15.dll libcairo-2.dll"
8696 else
8697     AC_MSG_RESULT([no])
8699     if test $_os = Android; then
8700         dnl For Android cairo isn't
8701         dnl buildable yet.
8702         :
8703     elif test $_os = WINNT; then
8704         dnl We only need cairo for Windows if we
8705         dnl build librsvg or directx disabled
8706         if test "$ENABLE_LIBRSVG" != NO -o -z "$ENABLE_DIRECTX"; then
8707             BUILD_TYPE="$BUILD_TYPE CAIRO"
8708         fi
8709     else
8710         BUILD_TYPE="$BUILD_TYPE CAIRO"
8711     fi
8714 AC_SUBST(SYSTEM_CAIRO)
8715 AC_SUBST(CAIRO_CFLAGS)
8716 AC_SUBST(CAIRO_LIBS)
8719 dnl ===================================================================
8720 dnl Test whether to build gdk-pixbuf or rely on the system version
8721 dnl ===================================================================
8723 AC_MSG_CHECKING([whether to use the system gdk-pixbuf])
8725 dnl As long as the only thing we need gdk-pixbuf for is below
8726 dnl librsvg, use the same --enable-librsvg (possibly implied
8727 dnl by --with-system-libs) to override this.
8729 if test "$SYSTEM_LIBRSVG" = YES; then
8730     SYSTEM_GDKPIXBUF=YES
8731     AC_MSG_RESULT([yes])
8732 else
8733     case "$_os" in
8734     WINNT|Darwin|iOS|Android)
8735         SYSTEM_GDKPIXBUF=NO
8736         AC_MSG_RESULT([no])
8737         ;;
8738     *)
8739         SYSTEM_GDKPIXBUF=YES
8740         AC_MSG_RESULT([yes])
8741         ;;
8742     esac
8744 AC_SUBST(SYSTEM_GDKPIXBUF)
8746 dnl ===================================================================
8747 dnl Test whether to build GLib or rely on the system version
8748 dnl ===================================================================
8750 AC_MSG_CHECKING([whether to use the system GLib])
8752 dnl As long as the only thing we need GLib for is below
8753 dnl librsvg, use the same --enable-librsvg (possibly implied
8754 dnl by --with-system-libs) to override this.
8756 if test "$SYSTEM_LIBRSVG" = YES; then
8757     SYSTEM_GLIB=YES
8758     AC_MSG_RESULT([yes])
8759 else
8760     case "$_os" in
8761     WINNT|Darwin|iOS|Android)
8762         SYSTEM_GLIB=NO
8763         AC_MSG_RESULT([no])
8764         ;;
8765     *)
8766         SYSTEM_GLIB=YES
8767         AC_MSG_RESULT([yes])
8768         ;;
8769     esac
8771 AC_SUBST(SYSTEM_GLIB)
8773 dnl ===================================================================
8774 dnl Test whether to build gettext runtime (libintl) or rely on the
8775 dnl system version
8776 dnl ===================================================================
8778 AC_MSG_CHECKING([whether to use the system gettext runtime])
8780 if test "$with_system_gettext" = yes; then
8781     SYSTEM_GETTEXT=YES
8782     AC_MSG_RESULT([yes])
8783 else
8784     case "$_os" in
8785     WINNT|Darwin|iOS|Android)
8786         SYSTEM_GETTEXT=NO
8787         AC_MSG_RESULT([no])
8788         ;;
8789     *)
8790         SYSTEM_GETTEXT=YES
8791         AC_MSG_RESULT([yes])
8792         ;;
8793     esac
8795 AC_SUBST(SYSTEM_GETTEXT)
8797 dnl ===================================================================
8798 dnl Test whether to build libcroco or rely on the system version
8799 dnl ===================================================================
8801 AC_MSG_CHECKING([whether to use the system libcroco])
8803 dnl As long as the only thing we need libcroco for is below
8804 dnl librsvg, use the same --enable-librsvg (possibly implied
8805 dnl by --with-system-libs) to override this.
8807 if test "$SYSTEM_LIBRSVG" = YES; then
8808     SYSTEM_LIBCROCO=YES
8809     AC_MSG_RESULT([yes])
8810 else
8811     case "$_os" in
8812     WINNT|Darwin|iOS|Android)
8813         SYSTEM_LIBCROCO=NO
8814         AC_MSG_RESULT([no])
8815         ;;
8816     *)
8817         SYSTEM_LIBCROCO=YES
8818         AC_MSG_RESULT([yes])
8819         ;;
8820     esac
8822 AC_SUBST(SYSTEM_LIBCROCO)
8824 dnl ===================================================================
8825 dnl Test whether to build Pango or rely on the system version
8826 dnl ===================================================================
8828 AC_MSG_CHECKING([whether to use the system pango])
8830 dnl As long as the only thing we need Pango for is below
8831 dnl librsvg, use the same --enable-librsvg (possibly implied
8832 dnl by --with-system-libs) to override this.
8834 if test "$SYSTEM_LIBRSVG" = YES; then
8835     SYSTEM_PANGO=YES
8836     AC_MSG_RESULT([yes])
8837 else
8838     case "$_os" in
8839     WINNT|Darwin|iOS|Android)
8840         SYSTEM_PANGO=NO
8841         AC_MSG_RESULT([no])
8842         ;;
8843     *)
8844         SYSTEM_PANGO=YES
8845         AC_MSG_RESULT([yes])
8846         ;;
8847     esac
8849 AC_SUBST(SYSTEM_PANGO)
8851 dnl ===================================================================
8852 dnl Test whether to build libgsf or rely on the system version
8853 dnl ===================================================================
8855 AC_MSG_CHECKING([whether to use the system libgsf])
8857 dnl As long as the only thing we need libgsf for is below librsvg (is
8858 dnl it?), use the same --enable-librsvg (possibly implied by
8859 dnl --with-system-libs) to override this.
8861 if test "$SYSTEM_LIBRSVG" = YES; then
8862     SYSTEM_LIBGSF=YES
8863     AC_MSG_RESULT([yes])
8864 else
8865     case "$_os" in
8866     WINNT|Darwin|iOS|Android)
8867         SYSTEM_LIBGSF=NO
8868         AC_MSG_RESULT([no])
8869         ;;
8870     *)
8871         SYSTEM_LIBGSF=YES
8872         AC_MSG_RESULT([yes])
8873         ;;
8874     esac
8876 AC_SUBST(SYSTEM_LIBGSF)
8878 dnl ===================================================================
8879 dnl Test whether to build libpng or rely on the system version
8880 dnl ===================================================================
8882 AC_MSG_CHECKING([whether to use the system libpng])
8884 dnl How should and does this interact with the checks for libpng
8885 dnl related to use of libpng in the quickstarter above? This needs to
8886 dnl be unified.
8888 if test "$with_system_libpng" = yes; then
8889     SYSTEM_LIBPNG=YES
8890     AC_MSG_RESULT([yes])
8891 else
8892     case "$_os" in
8893     WINNT|Darwin|iOS|Android)
8894         SYSTEM_LIBPNG=NO
8895         AC_MSG_RESULT([no])
8896         ;;
8897     *)
8898         SYSTEM_LIBPNG=YES
8899         AC_MSG_RESULT([no])
8900         ;;
8901     esac
8903 AC_SUBST(SYSTEM_LIBPNG)
8905 dnl ===================================================================
8906 dnl Test whether to build libjpeg or rely on the system version
8907 dnl ===================================================================
8908 dnl FIXME: this is currently because we have jpeg-6b for our filters
8909 dnl        and jpeg-8 as dependency for librsvg
8910 dnl        this should be unified into using only one version for both
8912 AC_MSG_CHECKING([whether to use the system libjpeg])
8914 if test "$SYSTEM_JPEG" == "YES"; then
8915     SYSTEM_LIBJPEG=YES
8916     AC_MSG_RESULT([yes])
8917 else
8918     case "$_os" in
8919     WINNT|Darwin|iOS|Android)
8920         SYSTEM_LIBJPEG=NO
8921         AC_MSG_RESULT([no])
8922         ;;
8923     *)
8924         SYSTEM_LIBJPEG=YES
8925         AC_MSG_RESULT([yes])
8926         ;;
8927     esac
8929 AC_SUBST(SYSTEM_LIBJPEG)
8931 dnl ===================================================================
8932 dnl Check for runtime JVM search path
8933 dnl ===================================================================
8934 if test "$SOLAR_JAVA" != ""; then
8935     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
8936     if test -n "$with_jvm_path" && test "$with_jvm_path" != "no"; then
8937         AC_MSG_RESULT([yes])
8938         if ! test -d "$with_jvm_path"; then
8939             AC_MSG_ERROR(["$with_jvm_path" not a directory])
8940         fi
8941         if ! test -d "$with_jvm_path"jvm; then
8942             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
8943         fi
8944         JVM_ONE_PATH_CHECK="$with_jvm_path"
8945         AC_SUBST(JVM_ONE_PATH_CHECK)
8946     else
8947         AC_MSG_RESULT([no])
8948     fi
8951 dnl ===================================================================
8952 dnl Test for the presence of Ant and that it works
8953 dnl ===================================================================
8955 if test "$SOLAR_JAVA" != ""; then
8956     ANT_HOME=; export ANT_HOME
8957     WITH_ANT_HOME=; export WITH_ANT_HOME
8958     if test -z "$with_ant_home"; then
8959         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
8960     else
8961         if test "$_os" = "WINNT"; then
8962             with_ant_home=`cygpath -u "$with_ant_home"`
8963         fi
8964         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
8965         WITH_ANT_HOME=$with_ant_home
8966         ANT_HOME=$with_ant_home
8967     fi
8969     if test -z "$ANT"; then
8970         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
8971     else
8972         # resolve relative or absolute symlink
8973         while test -h "$ANT"; do
8974             a_cwd=`pwd`
8975             a_basename=`basename "$ANT"`
8976             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
8977             cd "`dirname "$ANT"`"
8978             cd "`dirname "$a_script"`"
8979             ANT="`pwd`"/"`basename "$a_script"`"
8980             cd "$a_cwd"
8981         done
8983         AC_MSG_CHECKING([if $ANT works])
8984         cat > conftest.java << EOF
8985         public class conftest {
8986             int testmethod(int a, int b) {
8987                     return a + b;
8988             }
8989         }
8992         cat > conftest.xml << EOF
8993         <project name="conftest" default="conftest">
8994         <target name="conftest">
8995             <javac srcdir="." includes="conftest.java">
8996             </javac>
8997         </target>
8998         </project>
9001         oldJAVA_HOME=$JAVA_HOME
9002         if test "$JAVACISGCJ" = "yes"; then
9003             JAVA_HOME=; export JAVA_HOME
9004             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
9005         else
9006             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
9007         fi
9008         AC_TRY_EVAL(ant_cmd)
9009         if test $? = 0 && test -f ./conftest.class ; then
9010             AC_MSG_RESULT([Ant works])
9011             if test -z "$WITH_ANT_HOME"; then
9012                 ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
9013                 if test -z "$ANT_HOME"; then
9014                     ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
9015                 fi
9016             else
9017                 ANT_HOME="$WITH_ANT_HOME"
9018             fi
9019         else
9020             echo "configure: Ant test failed" >&5
9021             cat conftest.java >&5
9022             cat conftest.xml >&5
9023             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
9024             ANT_HOME=""
9025             echo "Ant does not work - Some Java projects will not build!" >>warn
9026         fi
9027         JAVA_HOME=$oldJAVA_HOME
9028         rm -f conftest* core core.* *.core
9029     fi
9030     if test -z "$ANT_HOME"; then
9031         ANT_HOME="NO_ANT_HOME"
9032     fi
9033     AC_SUBST(ANT_HOME)
9035     dnl Checking for ant.jar
9036     if test "$ANT_HOME" != "NO_ANT_HOME"; then
9037         AC_MSG_CHECKING([Ant lib directory])
9038         if test -f $ANT_HOME/lib/ant.jar; then
9039             ANT_LIB="$ANT_HOME/lib"
9040         else
9041             if test -f $ANT_HOME/ant.jar; then
9042                 ANT_LIB="$ANT_HOME"
9043             else
9044                 if test -f /usr/share/java/ant.jar; then
9045                     ANT_LIB=/usr/share/java
9046                 else
9047                     if test -f /usr/share/ant-core/lib/ant.jar; then
9048                         ANT_LIB=/usr/share/ant-core/lib
9049                     else
9050                         if test -f $ANT_HOME/lib/ant/ant.jar; then
9051                             ANT_LIB="$ANT_HOME/lib/ant"
9052                         else
9053                             if test -f /usr/share/lib/ant/ant.jar; then
9054                                 ANT_LIB=/usr/share/lib/ant
9055                             else
9056                                 AC_MSG_ERROR([Ant libraries not found!])
9057                             fi
9058                         fi
9059                     fi
9060                 fi
9061             fi
9062         fi
9063         AC_MSG_RESULT([Ant lib directory found.])
9064     fi
9065     AC_SUBST(ANT_LIB)
9067     ant_minver=1.6.0
9068     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
9070     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
9071     ant_version=`$ANT -version | $AWK '{ print $4; }'`
9072     ant_version_major=`echo $ant_version | cut -d. -f1`
9073     ant_version_minor=`echo $ant_version | cut -d. -f2`
9074     echo "configure: ant_version $ant_version " >&5
9075     echo "configure: ant_version_major $ant_version_major " >&5
9076     echo "configure: ant_version_minor $ant_version_minor " >&5
9077     if test "$ant_version_major" -ge "2"; then
9078         AC_MSG_RESULT([yes, $ant_version])
9079     elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
9080         AC_MSG_RESULT([yes, $ant_version])
9081     else
9082         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
9083     fi
9085     if test "$ENABLE_MEDIAWIKI" = "YES"; then
9086         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
9087         rm -rf confdir
9088         mkdir confdir
9089         cat > conftest.java << EOF
9090             public class conftest {
9091                 int testmethod(int a, int b) {
9092                     return a + b;
9093                 }
9094             }
9097         cat > conftest.xml << EOF
9098             <project name="conftest" default="conftest">
9099             <target name="conftest" depends="copytest">
9100                 <javac srcdir="." includes="conftest.java">
9101                 </javac>
9102             </target>
9103             <target name="copytest">
9104                  <copy todir="confdir">
9105                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
9106                  <filterset/>
9107                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
9108                  </copy>
9109             </target>
9110             </project>
9113         if test "$JAVACISGCJ" = "yes"; then
9114             JAVA_HOME=; export JAVA_HOME
9115             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
9116         else
9117             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
9118         fi
9119         AC_TRY_EVAL(ant_cmd)
9120         if test $? = 0 && test -f ./conftest.class ; then
9121             AC_MSG_RESULT([yes])
9122             rm -rf confdir
9123         else
9124             echo "configure: Ant test failed" >&5
9125             cat conftest.java >&5
9126             cat conftest.xml >&5
9127             rm -rf confdir
9128             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
9129         fi
9130     fi
9131     rm -f conftest* core core.* *.core
9134 OOO_JUNIT_JAR=
9135 if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
9136     AC_MSG_CHECKING([for JUnit 4])
9137     if test "$with_junit" = "yes"; then
9138         if test -e /usr/share/java/junit4.jar; then
9139             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
9140         else
9141            if test -e /usr/share/lib/java/junit.jar; then
9142               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
9143            else
9144               OOO_JUNIT_JAR=/usr/share/java/junit.jar
9145            fi
9146         fi
9147     else
9148         OOO_JUNIT_JAR=$with_junit
9149     fi
9150     if test "$_os" = "WINNT"; then
9151         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
9152     fi
9153     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
9154         grep org/junit/Before.class > /dev/null 2>&5
9155     if test $? -eq 0; then
9156         # check if either class-path entry is available for hamcrest or
9157         # it's bundled
9158         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |grep -q hamcrest || \
9159             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |grep -q 'Class-Path: hamcrest'; then
9160             AC_MSG_RESULT([$OOO_JUNIT_JAR])
9161         else
9162             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
9163 provide a full junit jar or use --without-junit])
9164         fi
9165     else
9166         AC_MSG_RESULT([no])
9167         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
9168 location (/usr/share/java), specify its pathname via
9169 --with-junit=..., or disable it via --without-junit])
9170     fi
9172 AC_SUBST(OOO_JUNIT_JAR)
9174 dnl ===================================================================
9175 dnl Product version
9176 dnl ===================================================================
9177 AC_MSG_CHECKING([for product version])
9178 PRODUCTVERSION=AC_PACKAGE_VERSION
9179 AC_MSG_RESULT([$PRODUCTVERSION])
9180 AC_SUBST(PRODUCTVERSION)
9182 dnl ===================================================================
9183 dnl Dealing with l10n options
9184 dnl ===================================================================
9185 AC_MSG_CHECKING([which languages to be built])
9186 # get list of all languages
9187 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
9188 # the sed command does the following:
9189 #   + if a line ends with a backslash, append the next line to it
9190 #   + adds " on the beginning of the value (after =)
9191 #   + adds " at the end of the value
9192 #   + removes en-US; we want to put it on the beginning
9193 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
9194 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' solenv/inc/langlist.mk)]
9195 ALL_LANGS="en-US $completelangiso"
9196 # check the configured localizations
9197 WITH_LANG="$with_lang"
9198 if test -z "$WITH_LANG"; then
9199     AC_MSG_RESULT([en-US])
9200 else
9201     AC_MSG_RESULT([$WITH_LANG])
9202     GIT_REPO_NAMES="$GIT_REPO_NAMES translations"
9204 # check that the list is valid
9205 for lang in $WITH_LANG ; do
9206     test "$lang" = "ALL" && continue;
9207     # need to check for the exact string, so add space before and after the list of all languages
9208     for vl in $ALL_LANGS ; do
9209         if test "$vl" = "$lang" ; then
9210            break;
9211         fi
9212     done
9213     if test "$vl" != "$lang" ; then
9214         AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
9215     fi
9216 done
9217 # list with substituted ALL
9218 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
9219 # this variable is used only by bin/distro-install-* helper scripts
9220 # they need a real list of languages
9221 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
9222 AC_SUBST(ALL_LANGS)
9223 AC_SUBST(WITH_LANG)
9224 AC_SUBST(WITH_LANG_LIST)
9225 AC_SUBST(GIT_REPO_NAMES)
9227 dnl git-new-workdir
9228 dnl ===================================================================
9229 if test -n "${GIT_LINK_SRC}"; then
9230     for repo in ${GIT_REPO_NAMES}; do
9231         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
9232             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
9233         fi
9234     done
9236 AC_SUBST(GIT_LINK_SRC)
9238 AC_MSG_CHECKING([for another 'intro' bitmap])
9239 INTRO_BITMAP=
9240 if test -z "$with_intro_bitmap" -o "$with_intro_bitmap" = "no" ; then
9241     INTRO_BITMAP=
9242     AC_MSG_RESULT([none])
9243 else
9244     case "$with_intro_bitmap" in
9245     *.png) INTRO_BITMAP="$with_intro_bitmap" ;;
9246     *)     AC_MSG_WARN([Intro bitmap should be a .png file!]) ;;
9247     esac
9248     AC_MSG_RESULT([$INTRO_BITMAP])
9250 AC_SUBST(INTRO_BITMAP)
9252 AC_MSG_CHECKING([for custom 'intro' progress bar color])
9253 PROGRESSBARCOLOR=
9254 if test -z "$with_intro_progressbar_color" ; then
9255    PROGRESSBARCOLOR="126,170,23"
9256    AC_MSG_RESULT([none])
9257 else
9258    PROGRESSBARCOLOR="$with_intro_progressbar_color"
9259    AC_MSG_RESULT([$PROGRESSBARCOLOR])
9261 AC_SUBST(PROGRESSBARCOLOR)
9263 AC_MSG_CHECKING([for custom 'intro' progress bar size])
9264 PROGRESSSIZE=
9265 if test -z "$with_intro_progressbar_size" ; then
9266    PROGRESSSIZE="319,10"
9267    AC_MSG_RESULT([none])
9268 else
9269    PROGRESSSIZE="$with_intro_progressbar_size"
9270    AC_MSG_RESULT([$PROGRESSSIZE])
9272 AC_SUBST(PROGRESSSIZE)
9274 AC_MSG_CHECKING([for custom 'intro' progress bar position])
9275 PROGRESSPOSITION=
9276 if test -z "$with_intro_progressbar_position" ; then
9277    PROGRESSPOSITION="164,225"
9278    AC_MSG_RESULT([none])
9279 else
9280    PROGRESSPOSITION="$with_intro_progressbar_position"
9281    AC_MSG_RESULT([$PROGRESSPOSITION])
9283 AC_SUBST(PROGRESSPOSITION)
9285 AC_MSG_CHECKING([for custom 'intro' progress bar frame color])
9286 PROGRESSFRAMECOLOR=
9287 if test -z "$with_intro_progressbar_frame_color" ; then
9288    PROGRESSFRAMECOLOR="207,208,211"
9289    AC_MSG_RESULT([none])
9290 else
9291    PROGRESSFRAMECOLOR="$with_intro_progressbar_frame_color"
9292    AC_MSG_RESULT([$PROGRESSFRAMECOLOR])
9294 AC_SUBST(PROGRESSFRAMECOLOR)
9296 AC_MSG_CHECKING([for another 'about' bitmap])
9297 ABOUT_BITMAP=
9298 if test -z "$with_about_bitmap" -o "$with_about_bitmap" = "no" ; then
9299     ABOUT_BITMAP=
9300     AC_MSG_RESULT([none])
9301 else
9302    case "$with_about_bitmap" in
9303    *.png) ABOUT_BITMAP="$with_about_bitmap" ;;
9304    *)     AC_MSG_WARN([About bitmap should be a .png file!]) ;;
9305    esac
9306    AC_MSG_RESULT([$ABOUT_BITMAP])
9308 AC_SUBST(ABOUT_BITMAP)
9310 AC_MSG_CHECKING([for another 'start center left' bitmap])
9311 STARTCENTER_LEFT_BITMAP=
9312 if test -z "$with_startcenter_left_bitmap" -o "$with_startcenter_left_bitmap" = "no" ; then
9313    STARTCENTER_LEFT_BITMAP=
9314    AC_MSG_RESULT([none])
9315 else
9316    case "$with_startcenter_left_bitmap" in
9317       *.png) STARTCENTER_LEFT_BITMAP="$with_startcenter_left_bitmap" ;;
9318       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9319    esac
9320    AC_MSG_RESULT([$STARTCENTER_LEFT_BITMAP])
9322 AC_SUBST(STARTCENTER_LEFT_BITMAP)
9324 AC_MSG_CHECKING([for another 'start center right' bitmap])
9325 STARTCENTER_RIGHT_BITMAP=
9326 if test -z "$with_startcenter_right_bitmap" -o "$with_startcenter_right_bitmap" = "no" ; then
9327    STARTCENTER_RIGHT_BITMAP=
9328    AC_MSG_RESULT([none])
9329 else
9330    case "$with_startcenter_right_bitmap" in
9331       *.png) STARTCENTER_RIGHT_BITMAP="$with_startcenter_right_bitmap" ;;
9332       *)     AC_MSG_WARN([Startcenter right bitmap should be a .png file!]) ;;
9333    esac
9334    AC_MSG_RESULT([$STARTCENTER_RIGHT_BITMAP])
9336 AC_SUBST(STARTCENTER_RIGHT_BITMAP)
9338 AC_MSG_CHECKING([for another 'start center rtl left' bitmap])
9339 STARTCENTER_RTL_LEFT_BITMAP=
9340 if test -z "$with_startcenter_rtl_left_bitmap" -o "$with_startcenter_rtl_left_bitmap" = "no" ; then
9341    STARTCENTER_RTL_LEFT_BITMAP=
9342    AC_MSG_RESULT([none])
9343 else
9344    case "$with_startcenter_rtl_left_bitmap" in
9345       *.png) STARTCENTER_RTL_LEFT_BITMAP="$with_startcenter_rtl_left_bitmap" ;;
9346       *)     AC_MSG_WARN([Startcenter rtl left bitmap should be a .png file!]) ;;
9347    esac
9348    AC_MSG_RESULT([$STARTCENTER_RTL_LEFT_BITMAP])
9350 AC_SUBST(STARTCENTER_RTL_LEFT_BITMAP)
9352 AC_MSG_CHECKING([for another 'start center rtl right' bitmap])
9353 STARTCENTER_RTL_RIGHT_BITMAP=
9354 if test -z "$with_startcenter_rtl_right_bitmap" -o "$with_startcenter_rtl_right_bitmap" = "no" ; then
9355    STARTCENTER_RTL_RIGHT_BITMAP=
9356    AC_MSG_RESULT([none])
9357 else
9358    case "$with_startcenter_rtl_right_bitmap" in
9359       *.png) STARTCENTER_RTL_RIGHT_BITMAP="$with_startcenter_rtl_right_bitmap" ;;
9360       *)     AC_MSG_WARN([Startcenter rtl right bitmap should be a .png file!]) ;;
9361    esac
9362    AC_MSG_RESULT([$STARTCENTER_RTL_RIGHT_BITMAP])
9364 AC_SUBST(STARTCENTER_RTL_RIGHT_BITMAP)
9366 AC_MSG_CHECKING([for another 'start center space' bitmap])
9367 STARTCENTER_SPACE_BITMAP=
9368 if test -z "$with_startcenter_space_bitmap" -o "$with_startcenter_space_bitmap" = "no" ; then
9369    STARTCENTER_SPACE_BITMAP=
9370    AC_MSG_RESULT([none])
9371 else
9372    case "$with_startcenter_space_bitmap" in
9373       *.png) STARTCENTER_SPACE_BITMAP="$with_startcenter_space_bitmap" ;;
9374       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9375    esac
9376    AC_MSG_RESULT([$STARTCENTER_SPACE_BITMAP])
9378 AC_SUBST(STARTCENTER_SPACE_BITMAP)
9380 OOO_VENDOR=
9381 AC_MSG_CHECKING([for vendor])
9382 if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
9383     AC_MSG_RESULT([not set])
9384 else
9385     OOO_VENDOR="$with_vendor"
9386     AC_MSG_RESULT([$OOO_VENDOR])
9388 AC_SUBST(OOO_VENDOR)
9390 UNIXWRAPPERNAME=
9391 AC_MSG_CHECKING([for UNIX wrapper name])
9392 if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
9393     AC_MSG_RESULT([not set])
9394 else
9395     UNIXWRAPPERNAME="$with_unix_wrapper"
9396     AC_MSG_RESULT([$UNIXWRAPPERNAME])
9398 AC_SUBST(UNIXWRAPPERNAME)
9400 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
9401 if test "$with_compat_oowrappers" = "yes" ; then
9402     WITH_COMPAT_OOWRAPPERS=YES
9403     AC_MSG_RESULT(yes)
9404 else
9405     WITH_COMPAT_OOWRAPPERS=
9406     AC_MSG_RESULT(no)
9408 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
9410 AC_MSG_CHECKING([for product name])
9411 PRODUCTNAME=AC_PACKAGE_NAME
9412 AC_MSG_RESULT([$PRODUCTNAME])
9413 AC_SUBST(PRODUCTNAME)
9415 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
9416 AC_MSG_CHECKING([for install dirname])
9417 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes" ; then
9418    INSTALLDIRNAME="$with_install_dirname"
9420 AC_MSG_RESULT([$INSTALLDIRNAME])
9421 AC_SUBST(INSTALLDIRNAME)
9423 AC_MSG_CHECKING([for prefix])
9424 test "x$prefix" = xNONE && prefix=$ac_default_prefix
9425 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
9426 PREFIXDIR="$prefix"
9427 AC_MSG_RESULT([$PREFIXDIR])
9428 AC_SUBST(PREFIXDIR)
9430 AC_MSG_CHECKING([for libdir])
9431 LIBDIR=[$(eval echo $(eval echo $libdir))]
9432 AC_MSG_RESULT([$LIBDIR])
9433 AC_SUBST(LIBDIR)
9435 AC_MSG_CHECKING([for data dir])
9436 DATADIR=[$(eval echo $(eval echo $datadir))]
9437 AC_MSG_RESULT([$DATADIR])
9438 AC_SUBST(DATADIR)
9440 AC_MSG_CHECKING([for man dir])
9441 MANDIR=[$(eval echo $(eval echo $mandir))]
9442 AC_MSG_RESULT([$MANDIR])
9443 AC_SUBST(MANDIR)
9445 AC_MSG_CHECKING([for doc dir])
9446 DOCDIR=[$(eval echo $(eval echo $docdir))]
9447 AC_MSG_RESULT([$DOCDIR])
9448 AC_SUBST(DOCDIR)
9450 AC_MSG_CHECKING([for install dir])
9451 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
9452 AC_MSG_RESULT([$INSTALLDIR])
9453 AC_SUBST(INSTALLDIR)
9455 AC_MSG_CHECKING([whether to statically link to Gtk])
9456 if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
9457     ENABLE_STATIC_GTK="TRUE"
9458     AC_MSG_RESULT([yes])
9459 else
9460     ENABLE_STATIC_GTK="FALSE"
9461     AC_MSG_RESULT([no])
9463 AC_SUBST(ENABLE_STATIC_GTK)
9465 # ===================================================================
9466 # De- or increase default verbosity of build process
9467 # ===================================================================
9468 AC_MSG_CHECKING([build verbosity])
9469 if test -n "$enable_verbose"; then
9470     if test "$enable_verbose" = "yes"; then
9471         VERBOSE="TRUE"
9472         AC_MSG_RESULT([high])
9473     fi
9474     if test "$enable_verbose" = "no"; then
9475         VERBOSE="FALSE"
9476         AC_MSG_RESULT([low])
9477     fi
9478 else
9479     AC_MSG_RESULT([not set])
9481 AC_SUBST(VERBOSE)
9483 dnl ===================================================================
9484 dnl Use zenity during build
9485 dnl ===================================================================
9486 AC_MSG_CHECKING([whether to use zenity during build])
9487 if test "$enable_zenity" = "yes"; then
9488     AC_MSG_RESULT([yes])
9489     AC_PATH_PROGS( ZNTY, zenity )
9490     if test -z "$ZNTY"; then
9491         ENABLE_ZENITY=FALSE
9492     else
9493         ENABLE_ZENITY=TRUE
9494     fi
9495 else
9496     ENABLE_ZENITY=FALSE
9497     AC_MSG_RESULT([no])
9499 AC_SUBST(ENABLE_ZENITY)
9502 dnl ===================================================================
9503 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
9504 dnl --enable-dependency-tracking configure option
9505 dnl ===================================================================
9506 AC_MSG_CHECKING([whether to enable dependency tracking])
9507 if test "$enable_dependency_tracking" = "no"; then
9508     nodep=TRUE
9509     AC_MSG_RESULT([no])
9510 else
9511     AC_MSG_RESULT([yes])
9513 AC_SUBST(nodep)
9515 dnl ===================================================================
9516 dnl Number of CPUs to use during the build
9517 dnl ===================================================================
9518 AC_MSG_CHECKING([for number of processors to use])
9519 if test -n "$with_num_cpus"; then
9520     BUILD_NCPUS=$with_num_cpus
9521 else
9522     case `uname -s` in
9524     Darwin|FreeBSD|NetBSD|OpenBSD)
9525         BUILD_NCPUS=`sysctl -n hw.ncpu`
9526         ;;
9528     Linux)
9529         BUILD_NCPUS=`getconf _NPROCESSORS_ONLN`
9530         ;;
9531     # what else than above does profit here *and* has /proc?
9532     *)
9533         BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
9534         ;;
9535     esac
9537     # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
9538     # unexpected format, 'wc -l' will have returned 0.
9539     if test "$BUILD_NCPUS" -eq 0; then
9540         BUILD_NCPUS=1
9541     fi
9543 AC_MSG_RESULT([$BUILD_NCPUS])
9544 AC_SUBST(BUILD_NCPUS)
9546 # ===================================================================
9547 # Creating bigger shared library to link against
9548 # ===================================================================
9549 AC_MSG_CHECKING([whether to create a big library for better performance])
9550 MERGELIBS=
9551 if test "$enable_mergelibs" = "yes"; then
9552     MERGELIBS="TRUE"
9553     AC_MSG_RESULT([yes])
9554 else
9555     AC_MSG_RESULT([no])
9557 AC_SUBST(MERGELIBS)
9559 dnl ===================================================================
9560 dnl Number of parallel jobs to be executed by dmake
9561 dnl ===================================================================
9562 AC_MSG_CHECKING([for maximum of jobs per processor])
9563 BUILD_MAX_JOBS="1"
9564 if test "z$with_max_jobs" != "z"; then
9565     BUILD_MAX_JOBS="$with_max_jobs"
9566 else
9567     if test "$enable_icecream" = "yes" ; then
9568         BUILD_MAX_JOBS="10"
9569     fi
9571 AC_MSG_RESULT([$BUILD_MAX_JOBS])
9572 AC_SUBST(BUILD_MAX_JOBS)
9574 # =====================================================================
9575 # determine the parallelism for gnu make
9576 # =====================================================================
9577 AC_MSG_CHECKING([for maximum parallelism for gmake])
9578 if test $BUILD_MAX_JOBS -gt $BUILD_NCPUS ; then
9579     GMAKE_PARALLELISM="$BUILD_MAX_JOBS"
9580 else
9581     GMAKE_PARALLELISM="$BUILD_NCPUS"
9583 GMAKE_MODULE_PARALLELISM="$BUILD_MAX_JOBS"
9584 if test "$no_parallelism_make" = "YES" ; then
9585     if test -z "$with_num_cpus"; then
9586         GMAKE_PARALLELISM="1";
9587         if test $GMAKE_MODULE_PARALLELISM -gt 1 ; then
9588             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
9589             if test -z "$with_num_cpus"; then
9590                 echo "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this." >> warn
9591             fi
9592             GMAKE_MODULE_PARALLELISM="1"
9593         fi
9594     else
9595         GMAKE_PARALLELISM="$BUILD_NCPUS";
9596         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
9597     fi
9600 # GMAKE_PARALLELISM is used in tail_build
9601 # GMAKE_MODULE_PARALLELISM is used when building individual gbuildified module
9602 AC_MSG_RESULT([per module:$GMAKE_MODULE_PARALLELISM, for tail_build:$GMAKE_PARALLELISM])
9603 AC_SUBST(GMAKE_PARALLELISM)
9604 AC_SUBST(GMAKE_MODULE_PARALLELISM)
9606 dnl ===================================================================
9607 dnl Setting up the environment.
9608 dnl ===================================================================
9609 echo "setting up the build environment variables..."
9611 if test -z "$COMPATH"; then
9612     AC_MSG_ERROR([No compiler found.])
9614 AC_SUBST(COMPATH)
9616 AC_MSG_CHECKING([solver path])
9617 if test -z "$with_local_solver"; then
9618     LOCAL_SOLVER="DEFAULT"
9619     AC_MSG_RESULT([default])
9620 else
9621     LOCAL_SOLVER=$with_local_solver
9622     AC_MSG_RESULT([$with_local_solver])
9624 AC_SUBST(LOCAL_SOLVER)
9626 AC_SUBST(BUILD_TYPE)
9628 if test "$WITH_MINGW" != "yes" ; then
9629     MINGW_EXTERNAL_DLLS=
9630 else
9631     mingw_dlldir=`$CC -print-sysroot`/mingw/bin
9632     for DLL in $MINGW_EXTERNAL_DLLS ; do
9633         AC_MSG_CHECKING([for $DLL])
9634         if ! test -f "$mingw_dlldir/$DLL" ; then
9635             AC_MSG_ERROR([Could not find $DLL, install the appropriate mingw32-<package>, not only mingw32-<package>-devel.])
9636         fi
9637         AC_MSG_RESULT([$mingw_dlldir/$DLL])
9638     done
9640 AC_SUBST(MINGW_EXTERNAL_DLLS)
9642 # make sure config.guess is +x; we execute config.guess, so it has to be so;
9643 chmod +x ./config.guess
9645 dnl Setting up the post_download check script
9646 dnl Using autoconf here, so that the migration from the previous state
9647 dnl (checks for the additional Windows downloads were directly in
9648 dnl configure.in) is as easy as possible
9649 echo "setting up the post_download check script"
9650 autoconf post_download.in > post_download
9651 chmod +x post_download
9653 # Generate a configuration timestamp we can use for deps
9654 if test -f set_soenv; then
9655     mv -f set_soenv set_soenv.last
9656 else
9657     echo > set_soenv.last
9660 AC_CONFIG_FILES([ooo.lst set_soenv Makefile bin/repo-list desktop/scripts/soffice.sh build_env])
9661 AC_OUTPUT
9663 # make sure this is executable
9664 chmod +x desktop/scripts/soffice.sh
9666 # touch the config timestamp file set_soenv.stamp
9667 if test ! -f set_soenv.stamp; then
9668     echo > set_soenv.stamp
9669 elif diff set_soenv set_soenv.last >/dev/null 2>&1; then
9670     echo "Configuration unchanged - avoiding scp2 stamp update"
9671 else
9672     echo > set_soenv.stamp
9675 dnl Run the set_soenv script to setup the Env.Host.sh script that sets
9676 dnl environment variables for the build.
9677 chmod +x set_soenv
9679 ./set_soenv
9681 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: