default to -r on gbuild for performance (assumed esp. on make 3.82)
[LibreOffice.git] / configure.in
blob4d5ceedbfcf452b1bfd786def6687240d9f90018
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.50)
7 echo "$@" >config.parms
9 dnl ===================================================================
10 dnl Optional Features (--enable/disable-)
11 dnl ===================================================================
13 dnl ---------- Extensions ----------
15 AC_ARG_ENABLE(ext-barcode,
16     AS_HELP_STRING([--enable-ext-barcode],
17         [Enables the Barcode extension.]),
20 AC_ARG_ENABLE(ext-diagram,
21     AS_HELP_STRING([--enable-ext-diagram],
22         [Enables the SmART Gallery (Diagram) extension.]),
25 AC_ARG_ENABLE(ext-google-docs,
26     AS_HELP_STRING([--enable-ext-google-docs],
27         [Download and enables the Google Documents extension.]),
30 AC_ARG_ENABLE(ext-hunart,
31     AS_HELP_STRING([--enable-ext-hunart],
32         [Enables the Hungarian Cross-reference Toolbar extension.]),
35 AC_ARG_ENABLE(ext-languagetool,
36     AS_HELP_STRING([--enable-ext-languagetool],
37         [Enables the LanguageTool extension.]),
40 AC_ARG_ENABLE(ext-lightproof,
41     AS_HELP_STRING([--enable-ext-lightproof],
42         [Enables the Lightproof extension.]),
45 AC_ARG_ENABLE(ext-mysql-connector,
46     AS_HELP_STRING([--enable-ext-mysql-connector],
47         [Enables the build of the MySQL Connector/LibreOffice extension. This requires
48          access to the MySQL Connector/C (aka libmysql) to be given, too, with
49          either the --with-system-mysql or --with-libmysql-path option.]),
52 AC_ARG_ENABLE(ext-nlpsolver,
53     AS_HELP_STRING([--enable-ext-nlpsolver],
54         [Download and enables the NLPSolver extension.]),
57 AC_ARG_ENABLE(ext-ct2n,
58     AS_HELP_STRING([--enable-ext-ct2n],
59         [Enables the ConvertTextToNumber extension.]),
62 AC_ARG_ENABLE(ext-numbertext,
63     AS_HELP_STRING([--enable-ext-numbertext],
64         [Enables the Numbertext extension.]),
67 AC_ARG_ENABLE(ext-oooblogger,
68     AS_HELP_STRING([--enable-ext-oooblogger],
69         [Download and enables the OOo Blogger extension.]),
72 AC_ARG_ENABLE(ext-pdfimport,
73     AS_HELP_STRING([--enable-ext-pdfimport],
74         [Enables the PDF Import extension and xpdf.]),
77 AC_ARG_ENABLE(ext-presenter-console,
78     AS_HELP_STRING([--enable-ext-presenter-console],
79         [Enables the Presenter Console extension.]),
82 AC_ARG_ENABLE(ext-presenter-minimizer,
83     AS_HELP_STRING([--enable-ext-presenter-minimizer],
84         [Enables the Presentation Minimizer extension.]),
87 AC_ARG_ENABLE(ext-report-builder,
88     AS_HELP_STRING([--enable-ext-report-builder],
89         [Enables the build of the Report Builder extension.]),
92 AC_ARG_ENABLE(ext-scripting-beanshell,
93     AS_HELP_STRING([--enable-ext-scripting-beanshell],
94         [Enables support for scripts in BeanShell.]),
97 AC_ARG_ENABLE(ext-scripting-javascript,
98     AS_HELP_STRING([--enable-ext-scripting-javascript],
99         [Enables support for scripts in JavaScript.]),
102 AC_ARG_ENABLE(ext-typo,
103     AS_HELP_STRING([--enable-ext-typo],
104         [Enables the Typography Toolbar extension.]),
107 AC_ARG_ENABLE(ext-validator,
108     AS_HELP_STRING([--enable-ext-validator],
109         [Enables the Validator extension.]),
112 AC_ARG_ENABLE(ext-watch-window,
113     AS_HELP_STRING([--enable-ext-watch-window],
114         [Enables the Watch Window extension to Calc.]),
117 AC_ARG_ENABLE(ext-wiki-publisher,
118     AS_HELP_STRING([--enable-ext-wiki-publisher],
119         [Enables the Wiki Publisher extension.]),
122 dnl ---------- *** ----------
124 AC_ARG_ENABLE(mergelibs,
125     AS_HELP_STRING([--enable-mergelibs],
126         [Enables linking of big merged library used for better performance.]),
129 AC_ARG_ENABLE(graphite,
130     AS_HELP_STRING([--enable-graphite],
131         [Enables the compilation of Graphite smart font rendering.]),
134 AC_ARG_ENABLE(ldap,
135     AS_HELP_STRING([--disable-ldap],
136         [Disables the use of LDAP backend via Netscape/Mozilla or OpenLDAP LDAP SDK]),
139 AC_ARG_ENABLE(fetch-external,
140     AS_HELP_STRING([--disable-fetch-external],
141         [Disables fetching external tarballs from web sources.]),
144 AC_ARG_ENABLE(lockdown,
145     AS_HELP_STRING([--disable-lockdown],
146         [Disables the gconf integration work in LibreOffice.]),
147 ,enable_lockdown=yes)
149 AC_ARG_ENABLE(vba,
150     AS_HELP_STRING([--disable-vba],
151         [Disables the vba compatibility feature.]),
154 AC_ARG_ENABLE(pch,
155     AS_HELP_STRING([--enable-pch],
156         [EXPERIMENTAL: Enables precompiled header support for C++.]),
159 AC_ARG_ENABLE(mozilla,
160     AS_HELP_STRING([--disable-mozilla],
161         [LibreOffice usually includes a strangely hacked up Mozilla binary for your
162          platform, to build without this version, use this option.]),
163 ,enable_mozilla=yes)
165 AC_ARG_ENABLE(epm,
166     AS_HELP_STRING([--enable-epm],
167         [LibreOffice includes self-packaging code, that requires epm, however epm is
168          useless for large scale package building.]),
169 ,enable_epm=no)
171 AC_ARG_ENABLE(activex_component,
172     AS_HELP_STRING([--disable-activex-component],
173         [Remove support for ActiveX embedding of LibreOffice.]),
174 ,enable_activex_component=yes)
176 AC_ARG_ENABLE(odk,
177     AS_HELP_STRING([--disable-odk],
178         [LibreOffice includes an ODK, office development kit which some packagers may
179          wish to build without.]),
180 ,enable_odk=yes)
182 AC_ARG_ENABLE(mathmldtd,
183     AS_HELP_STRING([--disable-mathmldtd],
184         [Disable mathmldtd (useful for distributions that want to avoid
185          packaging it).]),
186 ,enable_mathmldtd=yes)
188 AC_ARG_ENABLE(evolution2,
189     AS_HELP_STRING([--enable-evolution2],
190         [Allows the built-in evolution 2 addressbook connectivity build to be
191          enabled.]))
193 AC_ARG_ENABLE(directx,
194     AS_HELP_STRING([--disable-directx],
195         [Remove DirectX implementation for the new XCanvas interface.
196          The DirectX support requires more stuff installed on Windows to
197          compile. (DirectX SDK, GDI+ libs)]),
198 ,enable_directx=yes)
200 AC_ARG_ENABLE(activex,
201     AS_HELP_STRING([--disable-activex],
202         [Disable the use of ActiveX for a Windows build.])
203     [
204                           This switch is mandatory when using VC++ 2008 Express.
205     ],
208 AC_ARG_ENABLE(atl,
209     AS_HELP_STRING([--disable-atl],
210         [Disable the use of ATL for a Windows build.])
211     [
212                           This switch is mandatory when using VC++ 2008 Express.
213     ],
216 AC_ARG_ENABLE(symbols,
217     AS_HELP_STRING([--enable-symbols],
218         [Include debugging symbols in output. WARNING - a complete build needs
219          8 Gb of space and takes much longer (enables -g compiler flag).])
220     [
221                           Enabling symbols disables the stripping of the solver
222                           (--disable-strip-solver).
223     ],
226 AC_ARG_ENABLE(strip-solver,
227     AS_HELP_STRING([--disable-strip-solver],
228         [Disable the stripping of the solver. By default the solver is stripped
229          unless a build with debugging symbols (--enable-symbols) is requested.])
230     [
231                           This switch allows to override this setting.
232     ],
235 AC_ARG_ENABLE(werror,
236     AS_HELP_STRING([--enable-werror],
237         [Turn warnings to errors. (Has no effect in modules where the treating
238          of warnings as errors is disabled explicitly.)]),
241 AC_ARG_ENABLE(debug,
242     AS_HELP_STRING([--enable-debug],
243         [Include debugging symbols from --enable-symbols plus extra debugging
244          code. Extra large build! (enables -g compiler flag and dmake debug=true)
245          If you need even more verbose output, build a module with
246          "build -- debug=true dbglevel=2".]))
248 AC_ARG_ENABLE(dbgutil,
249     AS_HELP_STRING([--enable-dbgutil],
250         [Include additional debugging utilities, such as assertions, object
251          counting, etc. Larger build. Independent from --enable-debug]))
253 AC_ARG_ENABLE(lto,
254     AS_HELP_STRING([--enable-lto],
255         [Enable link-time optimization. Suitable for product builds.
256          Building takes longer but libraries are optimized for speed.
257          (possible only with gcc-4.5 or later,
258           better to use gcc-4.6 and 'gold' as linker)]))
260 AC_ARG_ENABLE(crashdump,
261     AS_HELP_STRING([--enable-crashdump],
262         [Enable the crashdump feature.]))
264 AC_ARG_ENABLE(python,
265     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
266         [Enables or disables Python support at run-time and build-time.
267          Also specifies what Python to use. 'auto' is the
268          default. Note that Python can be disabled with
269          --disable-python or --enable-python=no only if no
270          translations are required.]))
272 AC_ARG_ENABLE(gtk,
273     AS_HELP_STRING([--disable-gtk],
274         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
275 ,enable_gtk=yes)
277 AC_ARG_ENABLE(gtk3,
278     AS_HELP_STRING([--disable-gtk3],
279         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
280 ,enable_gtk3=no)
282 AC_ARG_ENABLE(systray,
283     AS_HELP_STRING([--disable-systray],
284         [Determines whether to build the systray quickstarter.]),
285 ,enable_systray=yes)
287 AC_ARG_ENABLE(split-app-modules,
288     AS_HELP_STRING([--enable-split-app-modules],
289         [Split file lists for app modules, e.g. base, calc.
290          Has effect only with make distro-pack-install]),
293 AC_ARG_ENABLE(split-opt-features,
294     AS_HELP_STRING([--enable-split-opt-features],
295         [Split file lists for some optional features, .e.g. pyuno, testtool.
296          Has effect only with make distro-pack-install]),
299 AC_ARG_ENABLE(cairo-canvas,
300 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
301                           platforms where Cairo is available.
302 ],,enable_cairo_canvas=yes)
304 AC_ARG_ENABLE(librsvg,
305     AS_HELP_STRING([--enable-librsvg=<no/auto/system/internal>],
306         [Enables or disables use of librsvg to render SVG at run-time.
307          Also specificed what librsvg to use. 'auto' is the default.]))
309 AC_ARG_ENABLE(opengl,
310     AS_HELP_STRING([--disable-opengl],
311         [Determines whether to build the OpenGL 3D slide transitions component.]),
312 ,enable_opengl=yes)
314 AC_ARG_ENABLE(dbus,
315     AS_HELP_STRING([--enable-dbus],
316         [Determines whether to enable presentation mode screensaver control
317          under GNOME via DBUS.]),
318 ,enable_dbus=no)
320 AC_ARG_ENABLE(gconf,
321     AS_HELP_STRING([--disable-gconf],
322         [Determines whether to use the GConf support.]),
323 ,enable_gconf=yes)
325 AC_ARG_ENABLE(gnome-vfs,
326     AS_HELP_STRING([--disable-gnome-vfs],
327         [Determines whether to use the Gnome Virtual Filing System on platforms
328          where that VFS is available.]),
329 ,enable_gnome_vfs=yes)
331 AC_ARG_ENABLE(gio,
332     AS_HELP_STRING([--enable-gio],
333         [Determines whether to use the GIO support.]),
334 ,enable_gio=no)
336 AC_ARG_ENABLE(static-gtk,
337     AS_HELP_STRING([--enable-static-gtk],
338         [Modules that are linked against GTK+ libraries use the static libraries
339          instead of the dynamic ones. (Enables -Bstatic linker flag for GTK+ libraries.)]),
342 AC_ARG_ENABLE(layout,
343     AS_HELP_STRING([--enable-layout],
344         [Enable the compilation and use of layout dialogs.]),
347 AC_ARG_ENABLE(build-mozilla,
348     AS_HELP_STRING([--disable-build-mozilla],
349         [Use this option if you do not want to build the Mozilla components from
350          the Mozilla source code but take precompiled zips.]),
353 AC_ARG_ENABLE(nss-module,
354     AS_HELP_STRING([--disable-nss-module],
355         [Whether to use provided NSS module.]),
356 ,enable_nss_module=yes)
358 AC_ARG_ENABLE(kde,
359     AS_HELP_STRING([--enable-kde],
360         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
361          KDE3 are available.]),
364 AC_ARG_ENABLE(kdeab,
365     AS_HELP_STRING([--disable-kdeab],
366         [Disable the KDE3 address book support.]),
368     if test "$enable_kde" = "yes"; then
369         enable_kdeab=yes;
370     fi
373 AC_ARG_ENABLE(kde4,
374     AS_HELP_STRING([--enable-kde4],
375         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
376          KDE4 are available. May be used with --enable-kde if you want to support
377          both KDE3 and KDE4.]),
380 AC_ARG_ENABLE(unix-qstart-libpng,
381     AS_HELP_STRING([--disable-unix-qstart-libpng],
382         [On UNIX systems, we have a faster splash app, that can use libpng to
383          render its splash, if we can safely link to the system libpng then
384          enabling this is a good idea (ie. for Linux Distro packaging).]),
385 ,enable_unix_libpng=yes)
387 AC_ARG_ENABLE(binfilter,
388     AS_HELP_STRING([--enable-binfilter],
389         [Enable legacy binary file formats filters build.]),
390 ,enable_binfilter=no
393 AC_ARG_ENABLE(ugly,
394     AS_HELP_STRING([--enable-ugly],
395         [Enables ugly pieces of functionality.]),
396 ,enable_ugly=no
399 AC_ARG_ENABLE(rpath,
400     AS_HELP_STRING([--disable-rpath],
401         [Disable the use of relative paths in shared libraries.]),
404 AC_ARG_ENABLE(xrender-link,
405     AS_HELP_STRING([--enable-xrender-link],
406         [Link with libXrender instead of dynamically open it.]),
409 AC_ARG_ENABLE(randr,
410     AS_HELP_STRING([--disable-randr],
411         [Disable RandR support in the vcl project.]),
412 ,enable_randr=yes)
414 AC_ARG_ENABLE(randr-link,
415     AS_HELP_STRING([--disable-randr-link],
416         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
417 ,enable_randr_link=yes)
419 AC_ARG_ENABLE(gstreamer,
420     AS_HELP_STRING([--disable-gstreamer],
421         [Disable building the gstreamer avmedia backend.]),
422 ,enable_gstreamer=yes)
424 AC_ARG_ENABLE(neon,
425     AS_HELP_STRING([--disable-neon],
426         [Disable neon and the compilation of webdav binding.]),
429 AC_ARG_ENABLE(build-unowinreg,
430     AS_HELP_STRING([--enable-build-unowinreg],
431         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
432          compiler is needed on Linux.])
433     [
434                           Usage:     --enable-build-unowinreg
435     ],
438 AC_ARG_ENABLE(verbose,
439     AS_HELP_STRING([--enable-verbose],
440         [Increase build verbosity.])[
441   --disable-verbose       Decrease build verbosity.],
444 AC_ARG_ENABLE(dependency-tracking,
445     AS_HELP_STRING([--enable-dependency-tracking],
446         [Do not reject slow dependency extractors.])[
447   --disable-dependency-tracking
448                           Disables generation of dependency information.
449                           Speed up one-time builds.],
452 AC_ARG_ENABLE(icecream,
453     AS_HELP_STRING([--enable-icecream],
454         [Use the 'icecream' distributed compiling tool to speedup the compilation.
455          It defaults to /opt/icecream for the location of the icecream gcc/g++
456          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
459 AC_ARG_ENABLE(zenity,
460     AS_HELP_STRING([--disable-zenity],
461         [Do not display a build icon in the notification area (on unix) during build.]),
462 ,enable_zenity=yes)
464 AC_ARG_ENABLE(ccache,
465     AS_HELP_STRING([--disable-ccache],
466         [Do not try to use ccache automatically.
467          By default, we will try to detect if ccache is available; in that case if
468          CC/CXX are not yet set, and --enable-icecream is not given, we
469          attempt to use ccache. --disable-ccache disables ccache completely.
473 AC_ARG_ENABLE(cl-x64,
474     AS_HELP_STRING([--enable-cl-x64],
475         [Build a 64-bit LibreOffice using the Microsoft C/C++ x64 compiler.]),
478 AC_ARG_ENABLE(extra-gallery,
479     AS_HELP_STRING([--enable-extra-gallery],
480         [Add extra gallery content.]),
483 AC_ARG_ENABLE(extra-template,
484     AS_HELP_STRING([--enable-extra-template],
485         [Add extra template content.]),
488 AC_ARG_ENABLE(extra-sample,
489     AS_HELP_STRING([--enable-extra-sample],
490         [Add extra sample content.]),
493 AC_ARG_ENABLE(extra-font,
494     AS_HELP_STRING([--enable-extra-font],
495         [Add extra font content.]),
498 AC_ARG_ENABLE(lomenubar,
499     AS_HELP_STRING([--enable-lomenubar],
500         [Enable global menu support.]),
503 AC_ARG_ENABLE(online-update,
504     AS_HELP_STRING([--enable-online-update],
505         [Enable the online update service that will check for new versions of
506          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
509 AC_ARG_ENABLE(release-build,
510     AS_HELP_STRING([--enable-release-build],
511         [Enable release build.
512          See http://wiki.documentfoundation.org/DevBuild]),
515 dnl ===================================================================
516 dnl Optional Packages (--with/without-)
517 dnl ===================================================================
518 AC_ARG_WITH(gnu-patch,
519     AS_HELP_STRING([--with-gnu-patch],
520         [Specify location of GNU patch on Solaris or FreeBSD.]),
523 AC_ARG_WITH(gnu-cp,
524     AS_HELP_STRING([--with-gnu-cp],
525         [Specify location of GNU cp on Solaris or FreeBSD.]),
528 AC_ARG_WITH(system-graphite,
529     AS_HELP_STRING([--with-system-graphite],
530         [Use graphite library already installed on system.]),
533 AC_ARG_WITH(external-tar,
534     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
535         [Specify path to tarfiles manually.]),
536     TARFILE_LOCATION=$withval ,
539 AC_ARG_WITH(linked-git,
540     AS_HELP_STRING([--with-linked-git=<OTHER_CLONE_DIR>],
541         [Specify another checkout's clonedir to re-use. This makes use of
542                  git-new-workdir, and saves a lot of diskspace when having multiple
543                  trees side-by-side.]),
544     GIT_LINK_SRC=$withval ,
547 AC_ARG_WITH(openldap,
548     AS_HELP_STRING([--with-openldap],
549         [Enables the use of the OpenLDAP LDAP SDK instead of the Netscape/Mozilla one.]),
552 AC_ARG_WITH(vba-package-format,
553     AS_HELP_STRING([--with-vba-package-format],
554         [Specify package format for vba compatibility api. Specifying  "builtin"
555          means the api component and associated type library are  part of the
556          installation set. Specifying "extn" creates an uno extension that is
557          part of the installation set (located in the program directory) that
558          MUST be optionly registered using either the unopkg executeable or the
559          extension manager gui.])
560     [
561                           Note: "builtin" is the default, "extn" can cause
562                           problems.
564                           Usage:     --with-vba-package-format="builtin" or
565                                      --with-vba-package-format="extn"
566     ],
569 AC_ARG_WITH(theme,
570     AS_HELP_STRING([--with-theme="theme1 theme2..."],
571         [Choose which themes to include. By default those themes with an '*' are included.
572          Possible choices: *default, *crystal, *hicontrast, *oxygen, *tango, classic, industrial.]),
575 AC_ARG_WITH(extension-integration,
576     AS_HELP_STRING([--with-extension-integration],
577         [It will integrate the builded extensions to the installer of the product.
578          Please use this switch to include any extension.]),
581 AC_ARG_WITH(helppack-integration,
583   --without-helppack-integration      It will not integrate the helppacks to the installer
584                           of the product.
585                           Please use this switch to use the online help or separate help packages.],
588 AC_ARG_WITH(fonts,
589     AS_HELP_STRING([--without-fonts],
590         [LibreOffice includes some third-party fonts to provide a reliable basis for
591          help content, templates, samples, etc. When these fonts are already
592          known to be available on the system then you should use this option.]),
595 AC_ARG_WITH(ppds,
596     AS_HELP_STRING([--without-ppds],
597         [Removes Postscript Printer definition files from LibreOffice
598          installation set, for people building for specific distributions where
599          PPDs are known to be already available (every recent distro with CUPS backend).]),
602 AC_ARG_WITH(afms,
603     AS_HELP_STRING([--without-afms],
604         [Removes bitmap font files from LibreOffice installation set, for people
605          building for specific distributions where AFM files or TrueType Fonts
606          are known to be available.]),
609 AC_ARG_WITH(agfa-monotype-fonts,
610      AS_HELP_STRING([--with-agfa-monotype-fonts],
611           [This switch should only be enabled for those who have the right
612            to use or distribute the proprietary Agfa Monotype
613            fonts.])
616 AC_ARG_WITH(epm,
617     AS_HELP_STRING([--with-epm],
618         [Decides which epm to use. Default is to use the one from the system if
619          one is built. When either this is not there or you say =internal epm
620          will be built.]),
623 AC_ARG_WITH(package-format,
624     AS_HELP_STRING([--with-package-format],
625         [Specify package format(s) for LibreOffice installsets. Default is the
626          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
627          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
628           installed, msi. Example: --with-package-format="deb dmg"]),
631 AC_ARG_WITH(system-stdlibs,
632     AS_HELP_STRING([--with-system-stdlibs],
633         [Use libstdc++/libgcc_s already on system.]),
636 AC_ARG_WITH(system-cairo,
637     AS_HELP_STRING([--with-system-cairo],
638         [Use Cairo libraries already on system.]),
641 AC_ARG_WITH(mozilla-version,
642     AS_HELP_STRING([--with-mozilla-version],
643         [Choose which version of Mozilla to use while building Mozilla.
644          (default=1.7.5) Note that not all versions are supported.]),
647 AC_ARG_WITH(mozilla-toolkit,
648     AS_HELP_STRING([--with-mozilla-toolkit],
649         [Choose which GUI toolkit to use while building Mozilla components. (default=gtk2)]),
652 AC_ARG_WITH(myspell-dicts,
653     AS_HELP_STRING([--without-myspell-dicts],
654         [Removes myspell dictionaries from LibreOffice installation set, for
655          people building for specific distributions where the myspell dictionaries
656          are installed from other sources.]),
659 AC_ARG_WITH(system-dicts,
660     AS_HELP_STRING([--with-system-dicts],
661         [Use dictionaries from system paths- Specify them via
662          --with-{dict,hyph,thes}-path=/path if you want to override the default ones.]),
665 AC_ARG_WITH(external-dict-dir,
666     AS_HELP_STRING([--with-external-dict-dir],
667         [Specify external dictionary dir.]),
670 AC_ARG_WITH(external-hyph-dir,
671     AS_HELP_STRING([--with-external-hyph-dir],
672         [Specify external hyphenation pattern dir.]),
675 AC_ARG_WITH(external-thes-dir,
676     AS_HELP_STRING([--with-external-thes-dir],
677         [Specify external thesaurus dir.]),
680 AC_ARG_WITH(system-libs,
681     AS_HELP_STRING([--with-system-libs],
682         [Use libs already on system -- enables all --with-system-* flags except
683          mozilla and odbc/sane/xrender-header(s).]),
686 AC_ARG_WITH(system-headers,
687     AS_HELP_STRING([--with-system-headers],
688         [Use headers already on system -- enables all --with-system-* flags for
689          external packages whose headers are the only entities used i.e.
690          boost/vigra/odbc/sane/xrender-header(s).]),
693 AC_ARG_WITH(system-jars,
694     AS_HELP_STRING([--without-system-jars],
695         [When building with --with-system-libs, also the needed jars are expected
696          on the system. Use this to disable that (except for the db case where
697          --with-system-db *has to* imply using the db.jar from there, too).]),
700 AC_ARG_WITH(system-zlib,
701     AS_HELP_STRING([--with-system-zlib],
702         [Use zlib already on system.]),
705 AC_ARG_WITH(system-openssl,
706     AS_HELP_STRING([--with-system-openssl],
707         [Use OpenSSL already on system.]),
710 AC_ARG_WITH(system-jpeg,
711     AS_HELP_STRING([--with-system-jpeg],
712         [Use jpeg already on system.]),
715 AC_ARG_WITH(system-expat,
716     AS_HELP_STRING([--with-system-expat],
717         [Use expat already on system.]),
720 AC_ARG_WITH(system-libvisio,
721     AS_HELP_STRING([--with-system-libvisio],
722         [Use libvisio already on system.]),
725 AC_ARG_WITH(system-libwpd,
726     AS_HELP_STRING([--with-system-libwpd],
727         [Use libwpd already on system.]),
730 AC_ARG_WITH(system-libwps,
731     AS_HELP_STRING([--with-system-libwps],
732         [Use libwps already on system.]),
735 AC_ARG_WITH(system-libwpg,
736     AS_HELP_STRING([--with-system-libwpg],
737         [Use libwpg already on system.]),
740 AC_ARG_WITH(system-libxml,
741     AS_HELP_STRING([--with-system-libxml],
742         [Use libxml already on system.]),
745 AC_ARG_WITH(system-translate-toolkit,
746     AS_HELP_STRING([--with-system-translate-toolkit],
747         [Use translate-toolkit already on system.]))
749 AC_ARG_WITH(system-icu,
750     AS_HELP_STRING([--with-system-icu],
751         [Use icu already on system.]))
753 AC_ARG_WITH(system-poppler,
754     AS_HELP_STRING([--with-system-poppler],
755         [Use system poppler. (only needed for pdfimport extension)]))
757 AC_ARG_WITH(system-db,
758     AS_HELP_STRING([--with-system-db],
759         [Use Berkeley db already on system.]))
761 AC_ARG_WITH(system-lucene,
762     AS_HELP_STRING([--with-system-lucene],
763         [Use Lucene already on system.]))
765 AC_ARG_WITH(system-apache-commons,
766     AS_HELP_STRING([--with-system-apache-commons],
767         [Use Apache commons libraries already on system.]))
769 AC_ARG_WITH(lucene-core-jar,
770     AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
771         [Specify path to jarfile manually.]),
772     LUCENE_CORE_JAR=$withval)
774 AC_ARG_WITH(lucene-analyzers-jar,
775     AS_HELP_STRING([--with-lucene-analyzers-jar=JARFILE],
776         [Specify path to jarfile manually.]),
777     LUCENE_ANALYZERS_JAR=$withval ,)
779 AC_ARG_WITH(system-mysql,
780     AS_HELP_STRING([--with-system-mysql],
781         [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice
782          extension. Requires MYSQLCONFIG to point to the mysql_config executable.]))
784 AC_ARG_WITH(libmysql-path,
785     AS_HELP_STRING([--with-libmysql-path],
786         [Use Connector/C (libmysql) installation for building the MySQL
787          Connector/LibreOffice extension.])
788     [
789                           Usage:     --with-libmysql-path=<absolute path to
790                                                   your Connector/C installation>
791     ],
794 AC_ARG_WITH(system-mysql-cppconn,
795     AS_HELP_STRING([--with-system-mysql-cppconn],
796         [Use MySQL C++ Connector libraries already on system.]))
798 AC_ARG_WITH(system-hsqldb,
799     AS_HELP_STRING([--with-system-hsqldb],
800         [Use hsqldb already on system.]))
802 AC_ARG_WITH(hsqldb-jar,
803     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
804         [Specify path to jarfile manually.]),
805     HSQLDB_JAR=$withval)
807 AC_ARG_WITH(system-beanshell,
808     AS_HELP_STRING([--with-system-beanshell],
809         [Use beanshell already on system.]))
811 AC_ARG_WITH(beanshell-jar,
812     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
813         [Specify path to jarfile manually.]),
814     BSH_JAR=$withval)
816 AC_ARG_WITH(commons-codec-jar,
817     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
818         [Specify path to jarfile manually.]),
819     COMMONS_CODEC_JAR=$withval)
821 AC_ARG_WITH(commons-lang-jar,
822     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
823         [Specify path to jarfile manually.]),
824     COMMONS_LANG_JAR=$withval)
826 AC_ARG_WITH(commons-httpclient-jar,
827     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
828         [Specify path to jarfile manually.]),
829     COMMONS_HTTPCLIENT_JAR=$withval)
831 AC_ARG_WITH(commons-logging-jar,
832     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
833         [Specify path to jarfile manually.]),
834     COMMONS_LOGGING_JAR=$withval)
836 AC_ARG_WITH(servlet-api-jar,
837     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
838         [Specify path to jarfile manually.]),
839     SERVLETAPI_JAR=$withval)
841 AC_ARG_WITH(system-jfreereport,
842     AS_HELP_STRING([--with-system-jfreereport],
843         [Use JFreeReport already on system.]))
845 AC_ARG_WITH(sac-jar,
846     AS_HELP_STRING([--with-sac-jar=JARFILE],
847         [Specify path to jarfile manually.]),
848     SAC_JAR=$withval)
850 AC_ARG_WITH(libxml-jar,
851     AS_HELP_STRING([--with-libxml-jar=JARFILE],
852         [Specify path to jarfile manually.]),
853     LIBXML_JAR=$withval)
855 AC_ARG_WITH(flute-jar,
856     AS_HELP_STRING([--with-flute-jar=JARFILE],
857         [Specify path to jarfile manually.]),
858     FLUTE_JAR=$withval)
860 AC_ARG_WITH(jfreereport-jar,
861     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
862         [Specify path to jarfile manually.]),
863     JFREEREPORT_JAR=$withval)
865 AC_ARG_WITH(liblayout-jar,
866     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
867         [Specify path to jarfile manually.]),
868     LIBLAYOUT_JAR=$withval)
870 AC_ARG_WITH(libloader-jar,
871     AS_HELP_STRING([--with-libloader-jar=JARFILE],
872         [Specify path to jarfile manually.]),
873     LIBLOADER_JAR=$withval)
875 AC_ARG_WITH(libloader-jar,
876     AS_HELP_STRING([--with-libloader-jar=JARFILE],
877         [Specify path to jarfile manually.]),
878     LIBLOADER_JAR=$withval)
880 AC_ARG_WITH(libformula-jar,
881     AS_HELP_STRING([--with-libformula-jar=JARFILE],
882         [Specify path to jarfile manually.]),
883     LIBFORMULA_JAR=$withval)
885 AC_ARG_WITH(librepository-jar,
886     AS_HELP_STRING([--with-librepository-jar=JARFILE],
887         [Specify path to jarfile manually.]),
888     LIBREPOSITORY_JAR=$withval)
890 AC_ARG_WITH(libfonts-jar,
891     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
892         [Specify path to jarfile manually.]),
893     LIBFONTS_JAR=$withval)
895 AC_ARG_WITH(libserializer-jar,
896     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
897         [Specify path to jarfile manually.]),
898     LIBSERIALIZER_JAR=$withval)
900 AC_ARG_WITH(libbase-jar,
901     AS_HELP_STRING([--with-libbase-jar=JARFILE],
902         [Specify path to jarfile manually.]),
903     LIBBASE_JAR=$withval)
905 AC_ARG_WITH(system-saxon,
906     AS_HELP_STRING([--with-system-saxon],
907         [Use saxon already on system.]))
909 AC_ARG_WITH(saxon-jar,
910     AS_HELP_STRING([--with-saxon-jar=JARFILE],
911         [Specify path to jarfile manually.]),
912     SAXON_JAR=$withval)
914 AC_ARG_WITH(system-libxslt,
915     AS_HELP_STRING([--with-system-libxslt],
916         [Use libxslt already on system.]))
918 AC_ARG_WITH(system-odbc,
919     AS_HELP_STRING([--with-system-odbc],
920         [Use the odbc headers already on system.]))
922 AC_ARG_WITH(system-sane,
923     AS_HELP_STRING([--with-system-sane],
924         [Use sane.h already on system.]))
926 AC_ARG_WITH(system-xrender-headers,
927     AS_HELP_STRING([--with-system-xrender-headers],
928         [Use XRender headers already on system.]))
930 AC_ARG_WITH(system-mesa-headers,
931     AS_HELP_STRING([--with-system-mesa-headers],
932         [Use Mesa headers already on system.]))
934 AC_ARG_WITH(system-curl,
935     AS_HELP_STRING([--with-system-curl],
936         [Use curl already on system.]))
938 AC_ARG_WITH(system-boost,
939     AS_HELP_STRING([--with-system-boost],
940         [Use boost already on system.]))
942 AC_ARG_WITH(system-mdds,
943     AS_HELP_STRING([--with-system-mdds],
944         [Use mdds already on system.]))
946 AC_ARG_WITH(system-vigra,
947     AS_HELP_STRING([--with-system-vigra],
948         [Use vigra already on system.]))
950 AC_ARG_WITH(system-neon,
951     AS_HELP_STRING([--with-system-neon],
952         [Use neon already on system.]))
954 AC_ARG_WITH(system-hunspell,
955     AS_HELP_STRING([--with-system-hunspell],
956         [Use libhunspell already on system.]))
958 AC_ARG_WITH(system-mythes,
959     AS_HELP_STRING([--with-system-mythes],
960         [Use mythes already on system.]))
962 AC_ARG_WITH(system-altlinuxhyph,
963     AS_HELP_STRING([--with-system-altlinuxhyph],
964         [Use ALTLinuxhyph already on system.]))
966 AC_ARG_WITH(system-lpsolve,
967     AS_HELP_STRING([--with-system-lpsolve],
968         [Use lpsolve already on system.]))
970 AC_ARG_WITH(system-libtextcat,
971     AS_HELP_STRING([--with-system-libtextcat],
972         [Use libtextcat already on system.]))
974 AC_ARG_WITH(external-libtextcat-data,
975     AS_HELP_STRING([--with-external-libtextcat-data],
976         [Use libtextcat data already on system.]))
978 AC_ARG_WITH(system-cppunit,
979     AS_HELP_STRING([--with-system-cppunit],
980         [Use cppunit already on system.]))
982 AC_ARG_WITH(system-redland,
983     AS_HELP_STRING([--with-system-redland],
984         [Use redland library already on system.]))
986 AC_ARG_WITH(system-mozilla,
987     AS_HELP_STRING([--with-system-mozilla],
988         [Use Mozilla already on system. Note that some components cannot be built
989          against a contemporary Mozilla. The flavour used can be specified by
990          --with-system-mozilla=<flavour>. Supported are: libxul (default),
991          xulrunner, firefox, seamonkey, mozilla.]),
992     WITH_SYSTEM_MOZILLA=$withval ,
993 WITH_SYSTEM_MOZILLA=no)
995 AC_ARG_WITH(system-gettext,
996     AS_HELP_STRING([--with-system-gettext],
997         [Use gettext runtime library already on system.]))
999 AC_ARG_WITH(system-libpng,
1000     AS_HELP_STRING([--with-system-libpng],
1001         [Use libpng already on system.]))
1003 AC_ARG_WITH(linker-hash-style,
1004     AS_HELP_STRING([--with-linker-hash-style],
1005         [Use linker with --hash-style=<style> when linking shared objects.
1006          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1007          if supported on the build system, and "sysv" otherwise.]))
1009 AC_ARG_WITH(stlport,
1010     AS_HELP_STRING([--with-stlport],
1011         [Build the STLPort library for compatibility with old extensions for
1012          architectures where STLPort used to be used.]),
1013     with_stlport=$withval ,
1014 with_stlport=auto)
1016 AC_ARG_WITH(jdk-home,
1017     AS_HELP_STRING([--with-jdk-home],
1018         [If you have installed JDK 1.3 or later on your system please supply the
1019          path here. Note that this is not the location of the java command but the
1020          location of the entire distribution.])
1021     [
1022                           Usage:     --with-jdk-home=<absolute path to JDK home>
1023     ],
1026 AC_ARG_WITH(gxx_include_path,
1027     AS_HELP_STRING([--with-gxx-include-path],
1028         [If you want to override the autodetected g++ include path.])
1029     [
1030                           Usage:     --with-gxx-include-path=<absolute path to
1031                                                                 g++ include dir>
1032     ],
1035 AC_ARG_WITH(help,
1036     AS_HELP_STRING([--with-help],
1037         [Enable the build of help.
1039          To build without help, use --without-help.]))
1041 AC_ARG_WITH(java,
1042     AS_HELP_STRING([--with-java],
1043         [Specify the name of the Java interpreter command. Typically "java"
1044          which is the default.
1046          To build without support for Java components, applets, accessibility
1047          or the XML filters written in Java, use --without-java or --with-java=no.])
1048     [
1049                           Usage:     --with-java==<java command>
1050                                      --without-java
1051     ],
1052     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1053     [ with_java=java ]
1056 AC_ARG_WITH(java_target_version,
1057     AS_HELP_STRING([--with-java-target-version],
1058         [Generate class files that will work on JVMs with the specified version.
1059          For example, use --with-java-target-version=1.4 to make sure that the
1060          application will work with JVM 1.4 even when compiled with JDK 1.5.])
1061     [
1062                           This option is ignored when you compile with gcj/gij.
1064                           Usage:     --with-java-target-version=<jvm version>
1065     ],
1068 AC_ARG_WITH(jvm-path,
1069     AS_HELP_STRING([--with-jvm-path],
1070         [Use a specific JVM search path at runtime.])
1071     [
1072                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1074                           e. g.: --with-jvm-path=/usr/lib/
1075                                  to find JRE/JDK in /usr/lib/jvm/
1076     ],
1079 AC_ARG_WITH(ant-home,
1080     AS_HELP_STRING([--with-ant-home],
1081         [If you have installed Jakarta Ant on your system, please supply the path here.
1082          Note that this is not the location of the Ant binary but the location
1083          of the entire distribution.])
1084     [
1085                           Usage:     --with-ant-home=<absolute path to Ant home>
1086     ],
1089 AC_ARG_WITH(junit,
1090     AS_HELP_STRING([--with-junit],
1091         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1092          --without-junit disables those tests. Not relevant in the --without-java case.])
1093     [
1094                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1095     ],
1096 ,with_junit=yes)
1098 AC_ARG_WITH(perl-home,
1099     AS_HELP_STRING([--with-perl-home],
1100         [If you have installed Perl 5 Distribution, on your system, please
1101          supply the path here. Note that this is not the location of the Perl
1102          binary but the location of the entire distribution.])
1103     [
1104                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1105     ],
1108 AC_ARG_WITH(cl-home,
1109     AS_HELP_STRING([--with-cl-home],
1110         [For Windows NT users, please supply the path for the Microsoft C/C++
1111          compiler. Note that this is not the location of the compiler binary but
1112          the location of the entire distribution.])
1113     [
1114                           Usage:     --with-cl-home=<absolute path to Microsoft
1115                                                             C/C++ compiler home>
1116     ],
1119 AC_ARG_WITH(mspdb-path,
1120     AS_HELP_STRING([--with-mspdb-path],
1121         [For Microsoft C/C++ compiler users, please supply the path pointing to
1122          the mspdb80.dll (if using Visual Studio 2008) or mspdb100.dl (if using
1123          Visual Studio 2010).])
1124     [
1125                           Usage:     --with-mspdb-path=<path to
1126                                                        mspdb80.dll/mspdb100.dll>
1127     ],
1130 AC_ARG_WITH(midl-path,
1131     AS_HELP_STRING([--with-midl-path],
1132         [For Microsoft compiler users, please supply the path pointing to the midl.exe.])
1133     [
1134                           Usage:     --with-midl-path=<abs. path to midl.exe>
1135     ],
1138 AC_ARG_WITH(csc-path,
1139     AS_HELP_STRING([--with-csc-path],
1140         [For Windows builds, please supply the path pointing to the csc.exe.
1141          Usually found automatically when building on Windows.])
1142     [
1143                           Usage:     --with-csc-path=<abs. path to csc.exe>
1144     ],
1147 AC_ARG_WITH(nsis-path,
1148     AS_HELP_STRING([--with-nsis-path],
1149         [For Windows builds, please supply the directory where makensis
1150          is located. If makensis is found in PATH or this option is
1151          properly supplied a self-contained executable installer for
1152          LibreOffice will be created.])
1153     [
1154                           Usage:     --with-nsis-path=<path to directory containing makensis>
1155     ],
1158 AC_ARG_WITH(dotnet-framework-home,
1159     AS_HELP_STRING([--with-dotnet-framework-home],
1160         [For Microsoft compiler users, please supply the path pointing to
1161          lib/mscoree.lib, usually something like:
1162          "/cygdrive/c/Program Files/Windows SDKs/Windows/v7.0"])
1163     [
1164                           Note that in most cases it will be automatically
1165                           found, though.
1167                           Usage:     --with-dotnet-framework-home=<absolute path to .NET
1168                                                           Framework>
1169     ],
1172 AC_ARG_WITH(windows-sdk-home,
1173     AS_HELP_STRING([--with-windows-sdk-home],
1174         [For Windows builds, please supply the path to the Windows SDK.
1175          Usually found automatically when building on Windows.])
1176     [
1177                           Usage:     --with-windows-sdk-home=<absolute path to Windows SDK>
1178     ],
1181 AC_ARG_WITH(directx-home,
1182     AS_HELP_STRING([--with-directx-home],
1183         [For Windows users, please supply the path to the Microsoft DirectX SDK.])
1184     [
1185                           Usage:     --with-directx-home=<absolute path to
1186                                                           Microsoft DirectX SDK>
1187     ],
1190 AC_ARG_WITH(mozilla-build,
1191     AS_HELP_STRING([--with-mozilla-build],
1192         [For Windows users, please supply the path to the Mozilla build tools.])
1193     [
1194                           Usage:     --with-mozilla-build=<absolute path to
1195                                                           Mozilla build tools>
1197                           At the moment of this writing, an installer for the
1198                           mozilla build tools can be obtained from http://ftp.
1199                           mozilla.org/pub/mozilla.org/mozilla/libraries/win32.
1200     ],
1201     MOZILLABUILD=$withval ,
1204 AC_ARG_WITH(local-solver,
1205     AS_HELP_STRING([--with-local-solver],
1206         [If you have solver in a location other than ./solver, please supply the path here.])
1207     [
1208                           Usage:     --with-local-solver=<abs. path to solver>
1209     ],
1212 AC_ARG_WITH(lang,
1213     AS_HELP_STRING([--with-lang],
1214         [Use this option to build LibreOffice with additional language support.
1215          English (US) is always included by default.
1216          Separate multiple languages with space.
1217          For all languages, use --with-lang=ALL.])
1218     [
1219                           Usage:     --with-lang="es sw tu cs sk"
1220     ],
1223 dnl ===================================================================
1224 dnl Branding
1225 dnl ===================================================================
1227 AC_ARG_WITH(intro-bitmap,
1228 [  --with-intro-bitmap    Prefer the specified intro bitmap over the
1229                           the default one.
1231                           Usage:     --with-intro-bitmap=/path/my_ooo_intro.png
1232 ],,)
1234 AC_ARG_WITH(intro-progressbar-color,
1235 [  --with-intro-progressbar-color    Set color of progress bar on intro screen.
1236                                      Comma separated RGB values in decimal format.
1238                           Usage: --with-intro-progressbar-color=126,170,23
1239 ],,)
1241 AC_ARG_WITH(intro-progressbar-size,
1242 [  --with-intro-progressbar-size     Set size of progress bar on intro screen.
1243                                      Comma separated values in decimal format.
1245                           Usage: --with-intro-progressbar-size=319,10
1246 ],,)
1248 AC_ARG_WITH(intro-progressbar-position,
1249 [  --with-intro-progressbar-position Set position of progress bar on intro screen.
1250                                      Comma separated values in decimal format.
1252                           Usage: --with-intro-progressbar-position=164,225
1253 ],,)
1255 AC_ARG_WITH(intro-progressbar-frame-color,
1256 [  --with-intro-progressbar-frame-color    Set color of progress bar frame on intro screen.
1257                                            Comma separated RGB values in decimal format.
1259                           Usage: --with-intro-progressbar-frame-color=207,208,211
1260 ],,)
1262 AC_ARG_WITH(about-bitmap,
1263 [  --with-about-bitmap    Similarly to --with-intro-bitmap, this allows
1264                           specification of bitmap for the About box.
1266                           Usage:     --with-about-bitmap=/path/my_ooo_about.png
1267 ],,)
1269 AC_ARG_WITH(startcenter-left-bitmap,
1270 [  --with-startcenter-left-bitmap    Similarly to --with-intro-bitmap, this allows
1271                                      specification of bitmap for the Start center.
1273                           Usage: --with-startcenter-left-bitmap=/path/my_backing_left.png
1274 ],,)
1276 AC_ARG_WITH(startcenter-right-bitmap,
1277 [  --with-startcenter-right-bitmap    Similarly to --with-intro-bitmap, this allows
1278                                       specification of bitmap for the Start center.
1280                           Usage: --with-startcenter-right-bitmap=/path/my_backing_right.png
1281 ],,)
1283 AC_ARG_WITH(startcenter-rtl-left-bitmap,
1284 [  --with-startcenter-rtl-left-bitmap    Similarly to --with-intro-bitmap, this allows
1285                                          specification of bitmap for the Start center.
1287                           Usage: --with-startcenter-rtl-left-bitmap=/path/my_backing_rtl_left.png
1288 ],,)
1290 AC_ARG_WITH(startcenter-rtl-right-bitmap,
1291 [  --with-startcenter-rtl-right-bitmap    Similarly to --with-intro-bitmap, this allows
1292                                           specification of bitmap for the Start center.
1294                           Usage: --with-startcenter-rtl-right-bitmap=/path/my_backing_rtl_right.png
1295 ],,)
1297 AC_ARG_WITH(startcenter-space-bitmap,
1298 [  --with-startcenter-space-bitmap    Similarly to --with-intro-bitmap, this allows
1299                                       specification of bitmap for the Start center.
1301                           Usage: --with-startcenter-space-bitmap=/path/my_backing_space.png
1302 ],,)
1304 AC_ARG_WITH(vendor,
1305     AS_HELP_STRING([--with-vendor],
1306         [Set vendor of the build.])
1307     [
1308                           Usage:     --with-vendor="John the Builder"
1309     ],
1312 AC_ARG_WITH(unix-wrapper,
1313     AS_HELP_STRING([--with-unix-wrapper],
1314         [Redefines the name of the UNIX wrapper that will be used in the desktop
1315          files and in the desktop-integration RPMs.])
1316     [
1317                           Usage:     --with-unix-wrapper=ooffice
1318     ],
1321 AC_ARG_WITH(compat-oowrappers,
1322     AS_HELP_STRING([--with-compat-oowrappers],
1323         [Install oo* wrappers in parallel with
1324          lo* ones to keep backward compatibility.
1325          Has effect only with make distro-pack-install]),
1328 AC_ARG_WITH(asm-home,
1329     AS_HELP_STRING([--with-asm-home],
1330         [For Windows, please supply the path for the ml.exe or ml64.exe assembler.])
1331     [
1332                           Usage:     --with-asm-home=<path to assembler directory>
1333     ],
1336 AC_ARG_WITH(os-version,
1337     AS_HELP_STRING([--with-os-version],
1338         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1339     [
1340                           Usage:     --with-os-version=<OSVERSION>
1341     ],
1344 AC_ARG_WITH(mingw-cross-compiler,
1345     AS_HELP_STRING([--with-mingw-cross-compiler],
1346         [Specify the MinGW cross-compiler to use.])
1347     [
1348                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1350                           When building on the ODK on Unix and building unowinreg.dll,
1351                           specify the MinGW C++ cross-compiler.
1352     ],
1355 AC_ARG_WITH(build-version,
1356     AS_HELP_STRING([--with-build-version],
1357         [Allows the builder to add a custom version tag that will appear in the
1358          Help/About box for QA purposes.])
1359     [
1360                           Usage:     --with-build-version="Built by Jim"
1361     ],
1362     with_build_version=$withval ,
1365 AC_ARG_WITH(alloc,
1366     AS_HELP_STRING([--with-alloc],
1367         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1368          Note that on FreeBSD/NetBSD system==jemalloc]),
1371 AC_ARG_WITH(sun-templates,
1372     AS_HELP_STRING([--with-sun-templates],
1373         [Integrate Sun template packages.]),
1376 AC_ARG_WITH(num-cpus,
1377     AS_HELP_STRING([--with-num-cpus],
1378         [Number of build processes/cpus to use (number of projects that will build at the same time).
1379          Multi-process/multi-cpu builds can save a lot of time on multi-cpu machines.
1380          Defaults to the number of CPUs on the machine.]),
1383 AC_ARG_WITH(max-jobs,
1384     AS_HELP_STRING([--with-max-jobs],
1385         [Maximum number of jobs per one CPU that will be issued at the same time by dmake.
1386          The real number of the jobs is affected by the --with-num-cpus too, it can get up to CPUS*max_jobs.
1387          Defaults to 1, unless you configure --enable-icecream - then to 10.]),
1390 dnl ===================================================================
1391 dnl MacOSX build and runtime environment options
1392 dnl ===================================================================
1394 AC_ARG_WITH(macosx-sdk,
1395     AS_HELP_STRING([--with-macosx-sdk],
1396         [Use a specific SDK for building.])
1397     [
1398                           Usage:     --with-macosx-sdk=<version>
1400                           e. g.: --with-macosx-sdk=10.4
1402                           there are 3 options to controle the MacOSX build:
1403                           --with-macosx-sdk (refered as 'sdl' below)
1404                           --with-macosx-version-min-required (refered as 'min' below)
1405                           --with-macosx-version-max-allowed (refered as 'max' below)
1407                           the connection between these value and the default they take is as follow:
1408                           ( ? means not specified on the command line, constraint: x <= y <= z)
1410                           ==========================================
1411                            command line      || config result
1412                           ==========================================
1413                           min  | max  | sdk  || min  | max  | sdk  |
1414                           ?    | ?    | ?    || 10.4 | 10.4 | 10.4 |
1415                           ?    | ?    | 10.x || 10.4 | 10.4 | 10.x |
1416                           ?    | 10.x | ?    || 10.4 | 10.x | 10.x |
1417                           ?    | 10.x | 10.y || 10.4 | 10.x | 10.y |
1418                           10.x | ?    | ?    || 10.x | 10.x | 10.x |
1419                           10.x | ?    | 10.y || 10.x | 10.x | 10.y |
1420                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1421                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1424                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1425                           for a detailled technical explanation of these variables
1427                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1429     ],
1432 AC_ARG_WITH(macosx-version-min-required,
1433     AS_HELP_STRING([--with-macosx-version-min-required],
1434         [set the minimum version needed to run])
1435     [
1436                           Usage:     --with-macosx-version-min-required=<version>
1438                           e. g.: --with-macos-version-min-required=10.4
1439                           see --with-macosx-sdk for more info
1440     ],
1443 AC_ARG_WITH(macosx-version-max-allowed,
1444     AS_HELP_STRING([--with-macosx-version-max-allowed],
1445         [set the minimum version needed to run])
1446     [
1447                           Usage:     --with-macosx-version-max-allowed=<version>
1449                           e. g.: --with-macos-version-max-allowed=10.6
1450                           see --with-macosx-sdk for more info
1451     ],
1455 BUILD_TYPE="LibO"
1456 SCPDEFS=""
1457 GIT_REPO_NAMES=""
1459 echo "********************************************************************"
1460 echo "*"
1461 echo "*   Running ${PACKAGE_NAME} build configuration."
1462 echo "*"
1463 echo "********************************************************************"
1464 echo ""
1466 dnl ===================================================================
1467 dnl checks build and host OSes
1468 dnl ===================================================================
1469 AC_CANONICAL_SYSTEM
1471 if test "$cross_compiling" = "yes"; then
1472     CROSS_COMPILING=YES
1473 else
1474     CROSS_COMPILING=
1475     BUILD_TYPE="$BUILD_TYPE NATIVE"
1477 AC_SUBST(CROSS_COMPILING)
1479 if test "$build_os" = "cygwin"; then
1480     EXEEXT_FOR_BUILD=.exe
1481 else
1482     EXEEXT_FOR_BUILD=
1484 AC_SUBST(EXEEXT_FOR_BUILD)
1486 dnl ===================================================================
1487 dnl check for required programs (grep, awk, sed, bash)
1488 dnl ===================================================================
1489 cat /dev/null > warn
1491 if test "z$EUID" = "z0" -a "z`uname -o 2>/dev/null`" = "zCygwin"; then
1492     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
1495 save_CC=$CC
1496 save_CXX=$CXX
1498 AC_PROG_EGREP
1499 AC_PROG_AWK
1500 AC_PATH_PROG( AWK, $AWK)
1501 if test -z "$AWK"; then
1502     AC_MSG_ERROR([install awk to run this script])
1505 AC_PATH_PROGS(SED, sed )
1506 if test -z "$SED"; then
1507     AC_MSG_ERROR([install sed to run this script])
1510 AC_PATH_PROG(BASH, bash)
1511 if test -z "$BASH"; then
1512     AC_MSG_ERROR([bash not found in \$PATH])
1514 AC_SUBST(BASH)
1516 AC_MSG_CHECKING([for GNU or BSD tar])
1517 for a in $GNUTAR gtar gnutar tar; do
1518     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
1519     if test $? -eq 0;  then
1520         GNUTAR=$a
1521         break
1522     fi
1523 done
1524 AC_MSG_RESULT($GNUTAR)
1525 if test -z "$GNUTAR"; then
1526     AC_MSG_ERROR([not found. install GNU or BSD tar.])
1528 AC_SUBST(GNUTAR)
1530 dnl ===================================================================
1531 dnl The following is a list of supported systems.
1532 dnl Sequential to keep the logic very simple
1533 dnl These values may be checked and reset later.
1534 dnl ===================================================================
1535 #defaults unless the os test overrides this:
1536 test_randr=yes
1537 test_cups=yes
1538 test_fontconfig=yes
1540 case "$host_os" in
1542 solaris*)
1543     test_gtk=yes
1544     build_gstreamer=yes
1545     test_kde=yes
1546     test_freetype=yes
1547     test_gstreamer=yes
1548     _os=SunOS
1549     AC_PATH_PROG( GNUTAR, gtar,,$PATH:/usr/sfw/bin)
1550     if test -z "$GNUTAR"; then
1551         AC_MSG_ERROR([gtar (GNU tar) not found but needed. Install it (Sun Freeware package).])
1552     fi
1553     AC_SUBST(GNUTAR)
1555     dnl ===========================================================
1556     dnl Check whether we're using Solaris 6,7,8 - SPARC or Intel.
1557     dnl ===========================================================
1558     AC_MSG_CHECKING([the Solaris operating system release])
1559     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
1560     if test "$_os_release" -lt "6"; then
1561         AC_MSG_ERROR([use Solaris >= 6 to build LibreOffice])
1562     else
1563         AC_MSG_RESULT([ok ($_os_release)])
1564     fi
1566     dnl Check whether we're using a SPARC or i386 processor
1567     AC_MSG_CHECKING([the processor type])
1568     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
1569         AC_MSG_RESULT([ok ($host_cpu)])
1570     else
1571         AC_MSG_ERROR([only SPARC and i386 processors are supported])
1572     fi
1573     ;;
1575 linux-gnu*|k*bsd*-gnu*)
1576     test_gtk=yes
1577     build_gstreamer=yes
1578     test_kde=yes
1579     test_kde4=yes
1580     test_freetype=yes
1581     test_unix_quickstarter=yes
1582     _os=Linux
1583     ;;
1585 gnu)
1586     test_randr=no
1587     _os=GNU
1588      ;;
1590 cygwin*|interix*|mingw32*)
1592     # When building on Windows normally with MSVC under Cygwin,
1593     # configure thinks that the host platform (the platform the
1594     # built code will run on) is Cygwin, even if it obviously is
1595     # Windows, which in Autoconf terminology is called
1596     # "mingw32". (Which is misleading as MinGW is the name of the
1597     # tool-chain, not an operating system.)
1599     # Somewhat confusing, yes. But this configure script doesn't
1600     # look at $host etc that much, it mostly uses its own $_os
1601     # variable, set here in this case statement.
1603     # When cross-compiling to Windows from Unix, the host platform
1604     # is "mingw32" (because in that case it is the MinGW
1605     # tool-chain that is used).
1607     test_cups=no
1608     test_randr=no
1609     test_freetype=no
1610     test_fontconfig=no
1611     _os=WINNT
1613     # If the host OS matches "mingw32*", that means we are using the
1614     # MinGW cross-compiler, because we don't see the point in building
1615     # LibreOffice using MinGW on Windows. If you want to build on
1616     # Windows, use MSVC. If you want to use MinGW, surely you want to
1617     # cross-compile (from Linux or some other Unix).
1619     case "$host_os" in
1620     mingw32*)
1621         WITH_MINGW=yes
1622         if test -z "$CC" ; then
1623             CC="$host_cpu-$host_vendor-$host_os-gcc"
1624         fi
1625         if test -z "$CXX" ; then
1626             CXX="$host_cpu-$host_vendor-$host_os-g++"
1627         fi
1628         ;;
1629     esac
1630     ;;
1632 darwin*) # Mac OS X or iOS
1633     test_gtk=yes
1634     test_randr=no
1635     test_freetype=no
1636     test_fontconfig=no
1637     if test "$host_cpu" = "arm"; then
1638         _os=iOS
1639         test_gtk=no
1640         test_cups=no
1641     else
1642         _os=Darwin
1643     fi
1644     enable_systray=no
1647 freebsd*)
1648     test_gtk=yes
1649     build_gstreamer=yes
1650     test_kde=yes
1651     test_kde4=yes
1652     test_freetype=yes
1653     AC_MSG_CHECKING([the FreeBSD operating system release])
1654     if test -n "$with_os_version"; then
1655         OSVERSION="$with_os_version"
1656     else
1657         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1658     fi
1659     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1660     AC_MSG_CHECKING([which thread library to use])
1661     if test "$OSVERSION" -lt "500016"; then
1662         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1663         PTHREAD_LIBS="-pthread"
1664     elif test "$OSVERSION" -lt "502102"; then
1665         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1666         PTHREAD_LIBS="-lc_r"
1667     else
1668         PTHREAD_CFLAGS=""
1669         PTHREAD_LIBS="-pthread"
1670     fi
1671     AC_MSG_RESULT([$PTHREAD_LIBS])
1672     _os=FreeBSD
1673     ;;
1675 *netbsd*)
1676     test_gtk=yes
1677     build_gstreamer=yes
1678     test_kde=no
1679     test_kde4=yes
1680     test_freetype=yes
1681     PTHREAD_LIBS="-pthread -lpthread"
1682     _os=NetBSD
1683     ;;
1685 aix*)
1686     test_randr=no
1687     test_freetype=yes
1688     PTHREAD_LIBS=-pthread
1689     _os=AIX
1690     ;;
1692 openbsd*)
1693     test_gtk=yes
1694     test_kde=yes
1695     test_freetype=yes
1696     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1697     PTHREAD_LIBS="-pthread"
1698     _os=OpenBSD
1699     ;;
1701 dragonfly*)
1702     test_gtk=yes
1703     build_gstreamer=yes
1704     test_kde=yes
1705     test_kde4=yes
1706     test_freetype=yes
1707     PTHREAD_LIBS="-pthread"
1708     _os=DragonFly
1709     ;;
1711 androideabi*)
1712     build_gstreamer=no
1713     test_cups=no
1714     test_fontconfig=no
1715     test_freetype=no
1716     test_gtk=no
1717     test_kde=no
1718     test_kde4=no
1719     test_randr=no
1720     test_unix_quickstarter=no
1721     _os=Android
1722     ;;
1725     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice!])
1726     ;;
1727 esac
1729 if test "$_os" = "AIX"; then
1730     AC_PATH_PROG(GAWK, gawk)
1731     if test -z "$GAWK"; then
1732         AC_MSG_ERROR([gawk not found in \$PATH])
1733     fi
1736 AC_SUBST(WITH_MINGW)
1737 AC_SUBST(OSVERSION)
1738 AC_SUBST(PTHREAD_CFLAGS)
1739 AC_SUBST(PTHREAD_LIBS)
1741 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
1742 dnl desktop OSes from "mobile" ones.
1744 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
1745 dnl In other words, that when building for an OS that is not a
1746 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
1748 dnl Note the direction of the implication; there is no assumption that
1749 dnl cross-compiling would imply a non-desktop OS.
1751 if test $_os != iOS -a $_os != Android; then
1752     BUILD_TYPE="$BUILD_TYPE DESKTOP"
1755 dnl ===================================================================
1756 dnl Extra check for Windows. Cygwin builds need gcc to build dmake
1757 dnl although MSVC is used to build other build-time tools and 
1758 dnl LibreOffice itself.
1759 dnl ===================================================================
1760 if test "$build_os" = "cygwin" ; then
1761     AC_MSG_CHECKING([for Cygwin gcc/g++])
1762     if which gcc > /dev/null && which g++ > /dev/null ; then
1763         AC_MSG_RESULT([found])
1764     else
1765         AC_MSG_ERROR([Cygwin gcc and g++ are needed, please install them.])
1766     fi
1771 dnl ===================================================================
1772 dnl  Checks if ccache is available
1773 dnl ===================================================================
1774 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \) ; then
1775     if test -z "$CC" ; then
1776         if test -z "$CXX" ; then
1777             AC_PATH_PROG([CCACHE],[ccache],[not found])
1778             if test "$CCACHE" = "not found" ; then
1779                 CCACHE=""
1780             else
1781                 CCACHE="ccache"
1782                 # need to check for ccache version: otherwise prevents
1783                 # caching of the results (like "-x objective-c++" for Mac)
1784                 if test $_os = Darwin -o $_os = iOS; then
1785                     # check ccache version
1786                     AC_MSG_CHECKING([whether version of ccache is suitable])
1787                     CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
1788                     CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1789                     if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
1790                         AC_MSG_RESULT([yes])
1791                     else
1792                         AC_MSG_RESULT([no])
1793                         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. ccache will not be used.])
1794                         CCACHE=""
1795                     fi
1796                 fi
1797             fi
1798         else
1799             AC_MSG_NOTICE([Automatic ccache detection ingored: CXX is pre-defined])
1800             CCACHE=""
1801         fi
1802     else
1803         AC_MSG_NOTICE([Automatic ccache detection ingored: CC is pre-defined])
1804         CCACHE=""
1805     fi
1806 else
1807     CCACHE=""
1810 if test "$CCACHE" != "" ; then
1811     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
1812     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
1813     if test "$ccache_size" = "" ; then
1814         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
1815         if test "$ccache_size" = "" ; then
1816             ccache_size=0
1817         fi
1818         # we could not determine the size or it was less than 1GB -> disable auto-ccache
1819         if test $ccache_size -lt 1024 ; then
1820             CCACHE=""
1821             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
1822             echo "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled" >> warn
1823         else
1824             # warn that ccache may be too small for debug build
1825             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1826             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1827         fi
1828     else
1829         if test $ccache_size -lt 5  ; then
1830             #warn that ccache may be too small for debug build
1831             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1832             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1833         fi
1834     fi
1837 dnl ===================================================================
1838 dnl  Checks for C compiler,
1839 dnl  The check for the C++ compiler is later on.
1840 dnl ===================================================================
1841 GCC_HOME_SET="true"
1842 AC_MSG_CHECKING([gcc home])
1843 if test -z "$with_gcc_home"; then
1844     if test "$enable_icecream" = "yes" ; then
1845         GCC_HOME="/opt/icecream"
1846     else
1847         GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1848         GCC_HOME_SET="false"
1849     fi
1850 else
1851     GCC_HOME="$with_gcc_home"
1853 AC_MSG_RESULT($GCC_HOME)
1854 AC_SUBST(GCC_HOME)
1856 if test "$GCC_HOME_SET" = "true" ; then
1857     if test -z "$CC"; then
1858         CC="$GCC_HOME/bin/gcc"
1859     fi
1860     if test -z "$CXX"; then
1861         CXX="$GCC_HOME/bin/g++"
1862     fi
1865 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1866 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
1867     AC_PROG_CC
1870 COMPATH=`dirname "$CC"`
1871 if test "$COMPATH" = "." ; then
1872     AC_PATH_PROGS(COMPATH, $CC)
1873     dnl double square bracket to get single because of M4 quote...
1874     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1876 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1881 dnl ===================================================================
1882 dnl  Test MacOSX sdk and version requirement
1883 dnl ===================================================================
1884 if test "$_os" = "Darwin" ; then
1886     if test "$with_macosx_version_min_required" = "" ; then
1887         with_macosx_version_min_required="10.4"
1888     fi
1890     if test "$with_macosx_version_max_allowed" = "" ; then
1891         with_macosx_version_max_allowed="$with_macosx_version_min_required"
1892     fi
1894     if test "$with_macosx_sdk" = "" ; then
1895         with_macosx_sdk="$with_macosx_version_max_allowed"
1896     fi
1898     case "$with_macosx_sdk" in
1900     10.4)
1901         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.4u.sdk"
1902         if test ! -d "$MACOSX_SDK_PATH"; then
1903           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.4u.sdk"
1904         fi
1905         macosx_sdk_value="1040"
1906         ;;
1907     10.5)
1908         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"
1909         if test ! -d "$MACOSX_SDK_PATH"; then
1910           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.5.sdk"
1911         fi
1912         macosx_sdk_value="1050"
1913         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
1914         echo "Building with a SDK > 10.4 is experimental" >> warn
1915         ;;
1916     10.6)
1917         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk"
1918         macosx_sdk_value="1060"
1919         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
1920         echo "Building with a SDK > 10.4 is experimental" >> warn
1921         ;;
1922     10.7)
1923         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.7.sdk"
1924         macosx_sdk_value="1070"
1925         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
1926         echo "Building with a SDK > 10.4 is experimental" >> warn
1927         ;;
1928     *)
1929         AC_MSG_ERROR([$with_macosx_sdk is not a supported SDK value, supported value are 10.4, 10.5, 10.6 and 10.7])
1930         ;;
1931     esac
1932     AC_MSG_CHECKING([the presence of the SDK $with_macosx_sdk])
1933     if test -d "$MACOSX_SDK_PATH" ; then
1934         AC_MSG_RESULT([$MACOSX_SDK_PATH ok])
1935     else
1936         AC_MSG_ERROR([$MACOSX_SDK_PATH not found])
1937     fi
1938     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
1940     case "$with_macosx_version_min_required" in
1942     10.4)
1943         MAC_OS_X_VERSION_MIN_REQUIRED="1040"
1944         ;;
1945     10.5)
1946         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
1947         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
1948         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
1949         ;;
1950     10.6)
1951         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
1952         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
1953         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
1954         ;;
1955     10.7)
1956         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
1957         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
1958         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
1959         ;;
1960     *)
1961         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])
1962         ;;
1963     esac
1965     case "$with_macosx_version_max_allowed" in
1967     10.4)
1968         MAC_OS_X_VERSION_MAX_ALLOWED="1040"
1969         ;;
1970     10.5)
1971         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
1972         ;;
1973     10.6)
1974         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
1975         ;;
1976     10.7)
1977         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
1978         ;;
1979     *)
1980         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])
1981         ;;
1982     esac
1984     AC_MSG_CHECKING([that macosx-verion-min-required is coherent with macosx-version-max-allowed])
1985     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED ; then
1986         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
1987     else
1988         AC_MSG_RESULT([ok])
1989     fi
1991     AC_MSG_CHECKING([that macosx-verion-max-allowed is coherent macos-with-sdk])
1992     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $macosx_sdk_value ; then
1993         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
1994     else
1995         AC_MSG_RESULT([ok])
1996     fi
1997     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
1998     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2000 AC_SUBST(MACOSX_SDK_PATH)
2001 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2002 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2003 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2005 dnl ===================================================================
2006 dnl  Test the gcc version,  3 is OK
2007 dnl ===================================================================
2008 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) -a "$GCC" = "yes"; then
2009     AC_MSG_CHECKING([the GNU C compiler version])
2010     _gcc_version=`$CC -dumpversion`
2011     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2012     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2014     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$GCCVER" -ge "040100" ; then
2015         if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
2016             export CC="$GCC_HOME/bin/gcc-4.0"
2017             #  export CC to have it available in set_soenv -> config.guess
2018             GCCVER2=`$CC -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2019             if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
2020                 GCCVER=$GCCVER2
2021             fi
2022         fi
2023         if test "$GCCVER" -ge "040100" ; then
2024             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])
2025         else
2026             AC_MSG_RESULT([implicitly using CC=$CC])
2027         fi
2028     else
2029         AC_MSG_RESULT([checked (gcc $_gcc_version)])
2030     fi
2035 # prefix C with ccache if needed
2037 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" ; then
2038     if test "$CCACHE" != "" ; then
2039         AC_MSG_CHECKING([whether $CC is already ccached])
2042         AC_LANG_PUSH([C])
2043         save_CFLAGS=$CFLAGS
2044         CFLAGS="$CFLAGS --ccache-skip -O2"
2045         dnl an empty program will do, we're checking the compiler flags
2046         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2047                           [use_ccache=yes], [use_ccache=no])
2048         if test $use_ccache = yes ; then
2049             AC_MSG_RESULT([yes])
2050         else
2051             CC="$CCACHE $CC"
2052             AC_MSG_RESULT([no])
2053         fi
2054         CFLAGS=$save_CFLAGS
2055         AC_LANG_POP([C])
2056     fi
2060 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2061 if test "$GCC" = "yes"; then
2062     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2063     bsymbolic_functions_ldflags_save=$LDFLAGS
2064     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2065     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2066 #include <stdio.h>
2067         ],[
2068 printf ("hello world\n");
2069         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2070     if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
2071         AC_MSG_RESULT( found )
2072     else
2073         AC_MSG_RESULT( not found )
2074     fi
2075     LDFLAGS=$bsymbolic_functions_ldflags_save
2077 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2079 dnl ===================================================================
2080 dnl Set up a different compiler to produce tools to run on the build
2081 dnl machine when doing cross-compilation
2082 dnl ===================================================================
2084 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
2085 if test "$cross_compiling" = "yes"; then
2086     AC_MSG_CHECKING([for BUILD platform configuration])
2087     echo
2088     rm -rf CONF-FOR-BUILD Env.Build.sh
2089     mkdir CONF-FOR-BUILD
2090     tar cf - \
2091         Makefile.in \
2092         bin/repo-list.in \
2093         bootstrap.1 \
2094         config.guess \
2095         configure \
2096         ooo.lst.in \
2097         oowintool \
2098         post_download.in \
2099         set_soenv.in \
2100         solenv/inc/langlist.mk \
2101         solenv/inc/minor.mk \
2102         solenv/inc/postset.mk \
2103         solenv/inc/productversion.mk \
2104     | (cd CONF-FOR-BUILD && tar xf -)
2105     (
2106     unset COM GUI GUIBASE OS CPU CPUNAME
2107     unset CC CXX SYSBASE CFLAGS
2108     unset PYTHON_CFLAGS PYTHON_LIBS
2109     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
2110     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
2111     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
2112     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
2113     cd CONF-FOR-BUILD
2114     sub_conf_opts=""
2115     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
2116     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
2117     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
2118     ./configure \
2119         --disable-mozilla \
2120         --disable-build-mozilla \
2121         --disable-zenity \
2122         $sub_conf_opts \
2123         2>&1 | sed -e 's/^/    /'
2124     test -f ./Env.Host.sh 2>/dev/null || exit
2125     cp Env.Host.sh ../Env.Build.sh
2126     . ./Env.Host.sh
2127     for V in COM GUI GUIBASE OS CPU CPUNAME CC CXX GXX_INCLUDE_PATH MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
2128              SYSTEM_LIBXSLT; do
2129         VV='$'$V
2130         VV=`eval "echo $VV"`
2131         if test -n "$VV"; then
2132             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
2133             echo "$line" >>build-config
2134         fi
2135     done
2137     for V in OUTDIR PATH SOLARINC SOLARLIB WORKDIR; do
2138         VV='$'$V
2139         VV=`eval "echo $VV"`
2140         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
2141         if test -n "$VV"; then
2142             line="${V}_FOR_BUILD='$VV'"
2143             echo "$line" >>build-config
2144         fi
2145     done
2146     )
2147     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
2148     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])
2149     perl -pi -e 's,/CONF-FOR-BUILD,,g' Env.Build.sh
2150     eval `cat CONF-FOR-BUILD/build-config`
2151     AC_MSG_RESULT([checking for BUILD platform configuration... done])
2152     rm -rf CONF-FOR-BUILD
2153 else
2154     CC_FOR_BUILD="$CC"
2155     CXX_FOR_BUILD="$CXX"
2157 AC_SUBST(COM_FOR_BUILD)
2158 AC_SUBST(GUI_FOR_BUILD)
2159 AC_SUBST(GUIBASE_FOR_BUILD)
2160 AC_SUBST(OS_FOR_BUILD)
2161 AC_SUBST(CPU_FOR_BUILD)
2162 AC_SUBST(CPUNAME_FOR_BUILD)
2163 AC_SUBST(CC_FOR_BUILD)
2164 AC_SUBST(CXX_FOR_BUILD)
2165 AC_SUBST(GXX_INCLUDE_PATH_FOR_BUILD)
2166 AC_SUBST(INPATH_FOR_BUILD)
2167 AC_SUBST(OUTPATH_FOR_BUILD)
2168 AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD)
2169 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
2171 AC_SUBST(OUTDIR_FOR_BUILD)
2172 AC_SUBST(PATH_FOR_BUILD)
2173 AC_SUBST(SOLARINC_FOR_BUILD)
2174 AC_SUBST(SOLARLIB_FOR_BUILD)
2175 AC_SUBST(WORKDIR_FOR_BUILD)
2177 if test -e solenv/inc/minor.mk; then
2178     # Get UPD number from ./solenv/inc/minor.mk
2179     UPD="`grep RSCVERSION= solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'`"
2180     AC_SUBST(UPD)
2181     SOURCEVERSION="`grep SOURCEVERSION= solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'`"
2182     AC_SUBST(SOURCEVERSION)
2183 else
2184     AC_MSG_ERROR([solenv/inc/minor.mk missing but needed for architecture/os detecion and proper environment script generation...])
2187 dnl ===================================================================
2188 dnl Set the ENABLE_CRASHDUMP variable.
2189 dnl ===================================================================
2190 AC_MSG_CHECKING([whether to enable crashdump feature])
2191 if test "$enable_crashdump" = "yes"; then
2192     ENABLE_CRASHDUMP="TRUE"
2193     BUILD_TYPE="$BUILD_TYPE CRASHREP"
2194     AC_MSG_RESULT([yes])
2195 else
2196     ENABLE_CRASHDUMP=""
2197     AC_MSG_RESULT([no])
2199 AC_SUBST(ENABLE_CRASHDUMP)
2202 dnl ===================================================================
2203 dnl Windows specific tests and stuff
2204 dnl ===================================================================
2205 if test "$_os" = "WINNT"; then
2207     dnl Include twain scanners
2208     BUILD_TYPE="$BUILD_TYPE TWAIN"
2210     dnl Set the CL_X64 variable if we are building a 64-bit LibreOffice.
2211     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2212     if test "z$enable_cl_x64" = "z" -o "$enable_cl_x64" = "no"; then
2213         CL_X64=""
2214         AC_MSG_RESULT([no])
2215     else
2216         CL_X64="TRUE"
2217         AC_MSG_RESULT([yes])
2218     fi
2219     AC_SUBST(CL_X64)
2221     AC_MSG_CHECKING([whether to use DirectX])
2222     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2223         ENABLE_DIRECTX="TRUE"
2224         AC_MSG_RESULT([yes])
2225     else
2226         ENABLE_DIRECTX=""
2227         AC_MSG_RESULT([no])
2228     fi
2229     AC_SUBST(ENABLE_DIRECTX)
2231     AC_MSG_CHECKING([whether to use ActiveX])
2232     if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
2233         DISABLE_ACTIVEX=""
2234         AC_MSG_RESULT([yes])
2235     else
2236         DISABLE_ACTIVEX="TRUE"
2237         AC_MSG_RESULT([no])
2238     fi
2239     AC_SUBST(DISABLE_ACTIVEX)
2241     AC_MSG_CHECKING([whether to use ATL])
2242     if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE"; then
2243         DISABLE_ATL=""
2244         AC_MSG_RESULT([yes])
2245     elif test "$enable_atl" = ""; then
2246         if test "$WITH_MINGW" = "yes"; then
2247             DISABLE_ATL="TRUE"
2248             AC_MSG_RESULT([no])
2249         else
2250             DISABLE_ATL=""
2251             AC_MSG_RESULT([yes])
2252         fi
2253     else
2254         DISABLE_ATL="TRUE"
2255         AC_MSG_RESULT([no])
2256     fi
2257     AC_SUBST(DISABLE_ATL)
2260 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
2261 dnl ===================================================================
2262 AC_MSG_CHECKING([whether to turn warnings to errors])
2263 if test -n "$enable_werror" && test "$enable_werror" != "no"; then
2264     ENABLE_WERROR="TRUE"
2265     AC_MSG_RESULT([yes])
2266     AC_MSG_WARN([Turning warnings to errors has no effect in modules or])
2267     AC_MSG_WARN([on platforms where it has been disabled explicitly])
2268     echo "Turning warnings to errors has no effect in modules or on platforms where it has been disabled explicitly" >> warn
2269 else
2270     ENABLE_WERROR="FALSE"
2271     AC_MSG_RESULT([no])
2273 AC_SUBST(ENABLE_WERROR)
2275 dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
2276 dnl ===================================================================
2277 AC_MSG_CHECKING([whether to do a debug build])
2278 if test -n "$enable_debug" && test "$enable_debug" != "no"; then
2279     ENABLE_DEBUG="TRUE"
2280     enable_symbols="yes"
2281     AC_MSG_RESULT([yes])
2282 else
2283     ENABLE_DEBUG="FALSE"
2284     AC_MSG_RESULT([no])
2286 AC_SUBST(ENABLE_DEBUG)
2288 dnl Set the ENABLE_DBGUTIL variable
2289 dnl ===================================================================
2290 AC_MSG_CHECKING([whether to build with additional debug utilities])
2291 if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2292     PROEXT=""
2293     PRODUCT=""
2294     PROFULLSWITCH=""
2295     AC_MSG_RESULT([yes])
2296     if test $_os = WINNT -a \( "$enable_mozilla" = yes -o "$enable_build_mozilla" = yes \); then
2297         # We can't build against the Mozilla stuff if using _DEBUG, will get linking errors
2298         # See connectivity/drivers/mozab
2299         AC_MSG_WARN([Also disabling Mozilla then])
2300         enable_mozilla=no
2301         enable_build_mozilla=no
2302     fi
2303 else
2304     PRODUCT="full"
2305     PROFULLSWITCH="product=full"
2306     PROEXT=".pro"
2307     AC_MSG_RESULT([no, full product build])
2309 AC_SUBST(PRODUCT)
2310 AC_SUBST(PROFULLSWITCH)
2311 AC_SUBST(PROEXT)
2313 # Set the ENABLE_LTO variable
2314 # ===================================================================
2315 AC_MSG_CHECKING([whether to use link-time optimization])
2316 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2317     ENABLE_LTO="TRUE"
2318     AC_MSG_RESULT([yes])
2319 else
2320     ENABLE_LTO=""
2321     AC_MSG_RESULT([no])
2323 AC_SUBST(ENABLE_LTO)
2325 dnl whether to include symbols into final build.
2326 dnl ===================================================================
2327 AC_MSG_CHECKING([whether to include symbols])
2328 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
2329     ENABLE_SYMBOLS="TRUE"
2330     AC_MSG_RESULT([yes])
2331 else
2332     ENABLE_SYMBOLS=
2333     AC_MSG_RESULT([no])
2335 AC_SUBST(ENABLE_SYMBOLS)
2337 dnl Determine if the solver is to be stripped or not.
2338 dnl ===================================================================
2339 AC_MSG_CHECKING([whether to strip the solver or not.])
2340 if test "z$enable_strip_solver" = "zno"; then
2341     DISABLE_STRIP="TRUE"
2342     AC_MSG_RESULT([no])
2343 else
2344     if test -n "$ENABLE_SYMBOLS"; then
2345         DISABLE_STRIP="TRUE"
2346         AC_MSG_RESULT([no])
2347     else
2348         DISABLE_STRIP=
2349         AC_MSG_RESULT([yes])
2350     fi
2352 AC_SUBST(DISABLE_STRIP)
2354 dnl check for cups support
2355 dnl ===================================================================
2356 AC_MSG_CHECKING([whether cups support is present])
2357 if test "$test_cups" = "yes"; then
2358     AC_CHECK_LIB(cups, cupsPrintFiles)
2359     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
2360     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
2361         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
2362     fi
2366 # check for fontconfig support
2367 AC_MSG_CHECKING([whether we need fontconfig])
2368 if test "z$test_fontconfig" = "zyes"; then
2369     ENABLE_FONTCONFIG="TRUE"
2370     AC_MSG_RESULT([yes])
2371     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
2372 else
2373     ENABLE_FONTCONFIG=""
2374     AC_MSG_RESULT([no])
2376 AC_SUBST(ENABLE_FONTCONFIG)
2377 AC_SUBST(FONTCONFIG_CFLAGS)
2378 AC_SUBST(FONTCONFIG_LIBS)
2380 dnl whether to find & fetch external tarballs?
2381 dnl ===================================================================
2382 if test -z "$TARFILE_LOCATION"; then
2383     TARFILE_LOCATION="DEFAULT"
2385 AC_SUBST(TARFILE_LOCATION)
2387 if test "z$enable_fetch_external" != "zno" ; then
2388     DO_FETCH_TARBALLS="YES"
2390 AC_SUBST(DO_FETCH_TARBALLS)
2393 dnl git-new-workdir
2394 dnl ===================================================================
2395 AC_SUBST(GIT_LINK_SRC)
2397 dnl Disable legacy binary file formats filters
2398 dnl ===================================================================
2399 AC_MSG_CHECKING([whether to enable filters for legacy binary file formats (StarOffice 5.2)])
2400 if test "$enable_binfilter" = "no"; then
2401     WITH_BINFILTER="NO"
2402     AC_MSG_RESULT([no])
2403 else
2404     WITH_BINFILTER="YES"
2405     BUILD_TYPE="$BUILD_TYPE BINFILTER"
2406     GIT_REPO_NAMES="$GIT_REPO_NAMES binfilter"
2407     AC_MSG_RESULT([yes])
2409 AC_SUBST(WITH_BINFILTER)
2411 AC_MSG_CHECKING([whether to build help])
2412 if test "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
2413     AC_MSG_RESULT([yes])
2414     BUILD_TYPE="$BUILD_TYPE HELP"
2415     SCPDEFS="$SCPDEFS -DWITH_HELP"
2416     GIT_REPO_NAMES="$GIT_REPO_NAMES help"
2417 else
2418     AC_MSG_RESULT([no])
2421 dnl Enable ugly pieces of code we're better off without
2422 dnl ===================================================================
2423 if test "$enable_ugly" = "yes"; then
2424     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2425     SCPDEFS="$SCPDEFS -DWITH_UGLY"
2426     ENABLE_UGLY=YES
2427 else
2428     ENABLE_UGLY=NO
2430 AC_SUBST(ENABLE_UGLY)
2432 dnl ===================================================================
2433 dnl Disable rpath in shared libraries?
2434 dnl ===================================================================
2435 AC_MSG_CHECKING([whether to use RPATH in shared libraries])
2436 if test "$enable_rpath" = "no"; then
2437     ENABLE_RPATH="no"
2438 else
2439     ENABLE_RPATH="yes"
2441 AC_MSG_RESULT([$ENABLE_RPATH])
2442 AC_SUBST(ENABLE_RPATH)
2444 dnl Test whether to include MySpell dictionaries
2445 dnl ===================================================================
2446 AC_MSG_CHECKING([whether to include MySpell dictionaries])
2447 if test -z "$with_myspell_dicts" || test "$with_myspell_dicts" = "yes"; then
2448     AC_MSG_RESULT([yes])
2449     WITH_MYSPELL_DICTS=YES
2450     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2451     GIT_REPO_NAMES="$GIT_REPO_NAMES dictionaries"
2452 else
2453     AC_MSG_RESULT([no])
2454     WITH_MYSPELL_DICTS=NO
2456 AC_SUBST(WITH_MYSPELL_DICTS)
2458 AC_MSG_CHECKING([whether to use dicts from external paths])
2459 if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
2460     AC_MSG_RESULT([yes])
2461     SYSTEM_DICTS=YES
2462     AC_MSG_CHECKING([for spelling dictionary directory])
2463     if test -n "$with_external_dict_dir"; then
2464         DICT_SYSTEM_DIR=file://$with_external_dict_dir
2465     else
2466         DICT_SYSTEM_DIR=file:///usr/share/hunspell
2467     fi
2468     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
2469     AC_MSG_CHECKING([for hyphenation patterns directory])
2470     if test -n "$with_external_hyph_dir"; then
2471         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
2472     else
2473         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
2474     fi
2475     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
2476     AC_MSG_CHECKING([for thesaurus directory])
2477     if test -n "$with_external_thes_dir"; then
2478         THES_SYSTEM_DIR=file://$with_external_thes_dir
2479     else
2480         THES_SYSTEM_DIR=file:///usr/share/mythes
2481     fi
2482     AC_MSG_RESULT([$THES_SYSTEM_DIR])
2483 else
2484     AC_MSG_RESULT([no])
2485     SYSTEM_DICTS=NO
2487 AC_SUBST(SYSTEM_DICTS)
2488 AC_SUBST(DICT_SYSTEM_DIR)
2489 AC_SUBST(HYPH_SYSTEM_DIR)
2490 AC_SUBST(THES_SYSTEM_DIR)
2492 dnl ===================================================================
2493 dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
2494 dnl ===================================================================
2495 AC_MSG_CHECKING([whether to enable pch feature])
2496 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
2497     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2498         ENABLE_PCH="TRUE"
2499         AC_MSG_RESULT([yes])
2500 dnl There is no PCH support in GCC versions prior to this
2501     elif test "$GCC" = "yes"; then
2502         ENABLE_PCH="TRUE"
2503         AC_MSG_RESULT([yes])
2504     else
2505         ENABLE_PCH=""
2506         AC_MSG_WARN([Precompiled header not yet supported for your platform/compiler])
2507     fi
2508 else
2509     ENABLE_PCH=""
2510     AC_MSG_RESULT([no])
2512 AC_SUBST(ENABLE_PCH)
2514 dnl ===================================================================
2515 dnl Search all the common names for GNU make
2516 dnl ===================================================================
2517 AC_MSG_CHECKING([for GNU make])
2519 # try to use our own make if it is available and GNUMAKE was not already defined
2520 if test -z "$GNUMAKE"; then
2521     if test -x "/opt/lo/bin/make"; then
2522         GNUMAKE="/opt/lo/bin/make"
2523     fi
2526 for a in "$MAKE" $GNUMAKE make gmake gnumake; do
2527     $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
2528     if test $? -eq 0;  then
2529         GNUMAKE=$a
2530         break
2531     fi
2532 done
2533 AC_MSG_RESULT($GNUMAKE)
2534 if test -z "$GNUMAKE"; then
2535     AC_MSG_ERROR([not found. install GNU make.])
2538 AC_MSG_CHECKING([the GNU make version])
2539 _make_version=`$GNUMAKE --version | grep GNU | grep -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
2540 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2541 if test "$_make_longver" -ge "038200" ; then
2542     AC_MSG_RESULT([$GNUMAKE $_make_version])
2544 elif test "$_make_longver" -ge "038100" ; then
2545     AC_MSG_RESULT([$GNUMAKE $_make_version])
2546     no_parallelism_make="YES"
2547 else
2548     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
2550 AC_SUBST(GNUMAKE)
2552 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`;
2553 STALE_MAKE=
2554 make_warning=
2555 if test "z$_make_ver_check" = "z"; then
2556    STALE_MAKE=TRUE
2558 AC_SUBST(STALE_MAKE)
2560 dnl ===================================================================
2561 dnl  Test the Solaris compiler version
2562 dnl ===================================================================
2563 if test "$_os" = "SunOS"; then
2564     if test "$CC" = "cc"; then
2565         AC_PATH_PROGS(_cc, cc)
2566         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2567         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2568         dnl cc -V outputs to standard error!!!!
2569         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2570         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2571         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2572         if test "$_sunstudio_major" != "5"; then
2573             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2574         else
2575             _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" }'`
2576             if test "$_sunstudio_minor" = "false"; then
2577                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2578             else
2579                 dnl compiler will do
2580                 AC_MSG_RESULT([checked])
2581             fi
2582         fi
2583     fi
2586 HAVE_LD_HASH_STYLE=FALSE
2587 WITH_LINKER_HASH_STYLE=
2588 AC_MSG_CHECKING( for --hash-style gcc linker support )
2589 if test "$GCC" = "yes" ; then
2590     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes" ; then
2591         hash_styles="gnu sysv"
2592     elif test "$with_linker_hash_style" = "no" ; then
2593         hash_styles=
2594     else
2595         hash_styles="$with_linker_hash_style"
2596     fi
2598     for hash_style in $hash_styles ; do
2599         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
2600         hash_style_ldflags_save=$LDFLAGS
2601         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
2603         AC_LINK_IFELSE([AC_LANG_PROGRAM(
2604             [
2605 #include <stdio.h>
2606             ],[
2607 printf ("");
2608             ])],
2609             [ if ./conftest$EXEEXT; then
2610                   HAVE_LD_HASH_STYLE=TRUE
2611                   WITH_LINKER_HASH_STYLE=$hash_style
2612               fi],
2613             [HAVE_LD_HASH_STYLE=FALSE])
2614         LDFLAGS=$hash_style_ldflags_save
2615     done
2617     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
2618         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
2619     else
2620         AC_MSG_RESULT( no )
2621     fi
2622     LDFLAGS=$hash_style_ldflags_save
2623 else
2624     AC_MSG_RESULT( no )
2626 AC_SUBST(HAVE_LD_HASH_STYLE)
2627 AC_SUBST(WITH_LINKER_HASH_STYLE)
2629 dnl ===================================================================
2630 dnl Check whether there's a Perl version available.
2631 dnl ===================================================================
2632 if test -z "$with_perl_home"; then
2633     AC_PATH_PROG(PERL, perl)
2634 else
2635     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
2636     _perl_path="$with_perl_home/bin/perl"
2637     if test -x "$_perl_path"; then
2638         PERL=$_perl_path
2639     else
2640         AC_MSG_ERROR([$_perl_path not found])
2641     fi
2644 dnl ===================================================================
2645 dnl Testing for Perl version 5 or greater.
2646 dnl $] is the Perl version variable, it is returned as an integer
2647 dnl ===================================================================
2648 if test "$PERL"; then
2649     AC_MSG_CHECKING([the Perl version])
2650     ${PERL} -e "exit($]);"
2651     _perl_version=$?
2652     if test "$_perl_version" -lt 5; then
2653         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2654     fi
2655     AC_MSG_RESULT([checked (perl $_perl_version)])
2656 else
2657     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2659 AC_SUBST(PERL)
2661 dnl ===================================================================
2662 dnl Testing for required Perl modules
2663 dnl ===================================================================
2665 AC_MSG_CHECKING([for required Perl modules])
2666 if `$PERL -e 'use Archive::Zip; use Cwd;'`; then
2667     AC_MSG_RESULT([all modules found])
2668 else
2669     AC_MSG_ERROR([Failed to find some modules])
2672 dnl ===================================================================
2673 dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2674 dnl ===================================================================
2675 SHOWINCLUDES_PREFIX=
2676 if test "$_os" = "WINNT"; then
2677     if test "$WITH_MINGW" != "yes"; then
2678         AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
2679         if test -z "$with_cl_home"; then
2680             vctest=`./oowintool --msvc-productdir`;
2681             if test "$CL_X64" = ""; then
2682                 if test -x "$vctest/bin/cl.exe"; then
2683                     with_cl_home=$vctest;
2684                 fi
2685             else
2686                 if test -x "$vctest/bin/amd64/cl.exe"; then
2687                     with_cl_home=$vctest;
2688                 fi
2689             fi
2690         else
2691             with_cl_home=`cygpath -u "$with_cl_home"`
2692         fi
2693         with_cl_home=`cygpath -d "$with_cl_home"`
2694         with_cl_home=`cygpath -u "$with_cl_home"`
2695         AC_MSG_RESULT([$with_cl_home])
2697         dnl ===========================================================
2698         dnl  Check for mspdb80.dll/mspdb100.dll
2699         dnl ===========================================================
2700         dnl MSVS 2008/10 Compiler
2701         if test -n "$with_mspdb_path";then
2702             with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2703         fi
2704         if test -e "$with_mspdb_path/mspdb80.dll" -o -e "$with_mspdb_path/mspdb100.dll"; then
2705             MSPDB_PATH="$with_mspdb_path"
2706         fi
2707         dnl MSVS 2008 case
2708         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2709             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2710         fi
2711         dnl Windows SDK 6.0 case
2712         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2713             MSPDB_PATH="$with_cl_home/bin"
2714         fi
2715         dnl MSVS 2010 case
2716         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb100.dll"; then
2717             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2718         fi
2720         if test -z "$MSPDB_PATH";then
2721             dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2722             AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2723             AC_PATH_PROG(MSPDB_PATH, mspdb100.dll)
2724             MSPDB_PATH=`dirname "$MSPDB_PATH"`
2725         fi
2727         if test -z "$MSPDB_PATH"; then
2728             AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
2729         fi
2730         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2731         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2732         dnl The path needs to be added before cl is called
2733         PATH="$MSPDB_PATH:$PATH"
2735         AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2736         if test -z "$CC"; then
2737             if test "$CL_X64" = ""; then
2738                 if test -x "$with_cl_home/bin/cl.exe"; then
2739                     CC="$with_cl_home/bin/cl.exe"
2740                 fi
2741             else
2742                 if test -x "$with_cl_home/bin/amd64/cl.exe"; then
2743                     CC="$with_cl_home/bin/amd64/cl.exe"
2744                 fi
2745             fi
2746             if test -z "$CC"; then
2747                 AC_PATH_PROG(CC, cl.exe)
2748             fi
2749             # This gives us a posix path with 8.3 filename restrictions
2750             CC=`cygpath -d "$CC"`
2751             CC=`cygpath -u "$CC"`
2752         fi
2754         if test -n "$CC"; then
2755             # Remove /cl.exe from CC case insensitive
2756             AC_MSG_RESULT([found ($CC)])
2757             if test "$CL_X64" = ""; then
2758                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
2759             else
2760                 if test -n "$with_cl_home"; then
2761                     COMPATH=`echo $with_cl_home`
2762                 fi
2763             fi
2764             export INCLUDE=`cygpath -d "$COMPATH/Include"`
2765             dnl  Check which Microsoft C/C++ compiler is found
2766             AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2767             # The following finds Microsoft, matches nn.nn.nnnn then pulls numbers out.
2768             CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft/ && /..\\...\\...../ {
2769                             x = match( \\\$0, /..\\...\\...../ )
2770                             CCversion = substr( \\\$0, RSTART, RLENGTH)
2771                             tokencount = split (CCversion,vertoken,\".\")
2772                             for ( i = 1 ; i <= tokencount ; i++ ) {
2773                                 printf (\"%04d\",vertoken[[i]] )
2774                             }
2775                             }"`
2776             if test "$CCNUMVER" -ge "001600000000"; then
2777                 COMEX=13
2778                 MSVSVER=2010
2779             elif test "$CCNUMVER" -ge "001500000000"; then
2780                 COMEX=12
2781                 MSVSVER=2008
2782             else
2783                 AC_MSG_ERROR([Compiler too old. Use Microsoft Visual Studio 2008 or 2010.])
2784             fi
2785             AC_MSG_RESULT([found compiler version $CCNUMVER (MSVS $MSVSVER).])
2786         else
2787             AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
2788         fi
2790         dnl We need to guess the prefix of the -showIncludes output, it can be
2791         dnl localized
2792         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
2793         echo "#include <stdlib.h>" > conftest.c
2794         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
2795             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
2796         rm -f conftest.c conftest.obj
2797         if test -z "$SHOWINCLUDES_PREFIX" ; then
2798             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
2799         else
2800             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
2801         fi
2803         # Check for 64-bit (cross-)compiler to use to build the 64-bit
2804         # version of the Explorer extension (and maybe other small
2805         # bits, too) needed when installing a 32-bit LibreOffice on a
2806         # 64-bit OS. The 64-bit Explorer extension is a feature that
2807         # has been present since long in OOo. Don't confuse it with
2808         # building LibreOffice itself as 64-bit code, which is
2809         # unfished work and highly experimental.
2811         BUILD_X64=
2812         CC_X64_BINARY=
2813         LINK_X64_BINARY=
2814         LIBMGR_X64_BINARY=
2816         AC_MSG_CHECKING([for a x64 compiler and libraries for 64bit ActiveX component])
2817         if test "$CL_X64" = "" -a -f "$with_cl_home/atlmfc/lib/amd64/atls.lib"; then
2818             # Prefer native x64 compiler to cross-compiler, in case we are running
2819             # the build on a 64-bit OS.
2820             if "$with_cl_home/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2821                 BUILD_X64=TRUE
2822                 CC_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
2823                 CXX_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
2824                 LINK_X64_BINARY="$with_cl_home/bin/amd64/link.exe"
2825                 LIBMGR_X64_BINARY="$with_cl_home/bin/amd64/lib.exe"
2826             elif "$with_cl_home/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2827                 BUILD_X64=TRUE
2828                 CC_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
2829                 CXX_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
2830                 LINK_X64_BINARY="$with_cl_home/bin/x86_amd64/link.exe"
2831                 LIBMGR_X64_BINARY="$with_cl_home/bin/x86_amd64/lib.exe"
2832             fi
2833         fi
2834         if test "$BUILD_X64" = TRUE; then
2835             AC_MSG_RESULT([found])
2836         else
2837             AC_MSG_RESULT([not found])
2838             AC_MSG_WARN([Installation set will not contain the 64-bit Explorer extension])
2839         fi
2840         AC_SUBST(BUILD_X64)
2842         # These are passed to the environment through set_soenv.in as usual, and then
2843         # used in set_wntx64.mk
2844         AC_SUBST(CC_X64_BINARY)
2845         AC_SUBST(CXX_X64_BINARY)
2846         AC_SUBST(LINK_X64_BINARY)
2847         AC_SUBST(LIBMGR_X64_BINARY)
2849     else
2850         AC_MSG_CHECKING([the compiler is MinGW])
2851         MACHINE_PREFIX=`$CC -dumpmachine`
2852         if echo $MACHINE_PREFIX | grep -q mingw32; then
2853             AC_MSG_RESULT([yes])
2854         else
2855             AC_MSG_ERROR([Compiler is not MinGW.])
2856         fi
2857     fi
2859 AC_SUBST(COMEX)
2860 AC_SUBST(MSPDB_PATH)
2861 AC_SUBST(SHOWINCLUDES_PREFIX)
2863 dnl ===================================================================
2864 dnl Check for pkg-config
2865 dnl ===================================================================
2866 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2867     PKG_PROG_PKG_CONFIG
2870 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2872     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
2873     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
2874     # explicitly. Or put /path/to/compiler in PATH yourself.
2876     AC_CHECK_TOOL(AR,ar)
2877     AC_CHECK_TOOL(NM,nm)
2878     AC_CHECK_TOOL(OBJDUMP,objdump)
2879     AC_CHECK_TOOL(RANLIB,ranlib)
2880     AC_CHECK_TOOL(STRIP,strip)
2881     if test "$_os" = "WINNT"; then
2882         AC_CHECK_TOOL(DLLTOOL,dlltool)
2883         AC_CHECK_TOOL(WINDRES,windres)
2884     fi
2886 AC_SUBST(AR)
2887 AC_SUBST(DLLTOOL)
2888 AC_SUBST(NM)
2889 AC_SUBST(OBJDUMP)
2890 AC_SUBST(PKG_CONFIG)
2891 AC_SUBST(RANLIB)
2892 AC_SUBST(STRIP)
2893 AC_SUBST(WINDRES)
2895 dnl ===================================================================
2896 dnl pkg-config checks on Mac OS X
2897 dnl ===================================================================
2899 if test $_os = Darwin; then
2900     AC_MSG_CHECKING([for bogus pkg-config])
2901     if test -n "$PKG_CONFIG"; then
2902         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | grep -q Mono.framework; then
2903             AC_MSG_RESULT([yes, from Mono])
2904         else
2905             AC_MSG_RESULT([yes, from unknown origin])
2906         fi
2907         AC_MSG_WARN([This might have unexpected consequences, please consider hiding $PKG_CONFIG])
2908         echo "Having a $PKG_CONFIG might have unexpected consequences, please consider hiding it" >>warn
2909     else
2910         AC_MSG_RESULT([no])
2911     fi
2914 dnl ===================================================================
2915 dnl  .NET needs special treatment
2916 dnl (does the above comment really mean .NET, or is it misusing
2917 dnl that to mean Visual Studio .NET 2003 ? And does this also
2918 dnl in fact apply equally to what we actually support, i.e.
2919 dnl Visual Studio 2008 and 2010?)
2920 dnl ===================================================================
2921 if test "$build_os" = "cygwin"; then
2922     dnl Check midl.exe
2923     AC_PATH_PROG(MIDL_PATH, midl.exe)
2924     if test -n "$MIDL_PATH";then
2925         MIDL_PATH=`dirname "$MIDL_PATH"`
2926     fi
2927     if test -n "$with_midl_path";then
2928         with_midl_path=`cygpath -u "$with_midl_path"`
2929     fi
2930     if test -x "$with_midl_path/midl.exe"; then
2931         MIDL_PATH="$with_midl_path"
2932     fi
2933     if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
2934         MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
2935     fi
2936     if test -z "$MIDL_PATH" ; then
2937         vstest=`./oowintool --msvs-productdir`;
2938         if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
2939             MIDL_PATH="$vstest/Common7/Tools/Bin"
2940         fi
2941     fi
2942     if test -z "$MIDL_PATH" ; then
2943         winsdktest=`./oowintool --windows-sdk-home`
2944         if test -x "$winsdktest/Bin/midl.exe" ; then
2945             MIDL_PATH="$winsdktest/Bin"
2946         fi
2947     fi
2948     if test ! -x "$MIDL_PATH/midl.exe"; then
2949         AC_MSG_ERROR([midl.exe not found. Make sure it's in PATH or use --with-midl-path])
2950     fi
2951     # Convert to posix path with 8.3 filename restrictions ( No spaces )
2952     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
2953     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
2955     dnl Check csc.exe
2956     AC_PATH_PROG(CSC_PATH, csc.exe)
2957     if test -n "$CSC_PATH";then
2958         CSC_PATH=`dirname "$CSC_PATH"`
2959     fi
2960     if test -n "$with_csc_path";then
2961         with_csc_path=`cygpath -u "$with_csc_path"`
2962     fi
2963     if test -x "$with_csc_path/csc.exe"; then
2964         CSC_PATH="$with_csc_path"
2965     else
2966        csctest=`./oowintool --csc-compilerdir`;
2967        if test -x "$csctest/csc.exe"; then
2968            CSC_PATH="$csctest"
2969        fi
2970     fi
2971     if test ! -x "$CSC_PATH/csc.exe"; then
2972         AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
2973     fi
2974     # Convert to posix path with 8.3 filename restrictions ( No spaces )
2975     CSC_PATH=`cygpath -d "$CSC_PATH"`
2976     CSC_PATH=`cygpath -u "$CSC_PATH"`
2978     dnl Check mscoree.lib / .NET Framework dir
2979     AC_MSG_CHECKING(.NET Framework)
2980     if test -n "$with_dotnet_framework_home"; then
2981         with_dotnet_framework_home=`cygpath -u "$with_dotnet_framework_home"`
2982     fi
2983     if test -f "$with_dotnet_framework_home/lib/mscoree.lib"; then
2984         DOTNET_FRAMEWORK_HOME="$with_dotnet_framework_home"
2985     fi
2986     if test -z "$DOTNET_FRAMEWORK_HOME" ; then
2987         frametest=`./oowintool --dotnetsdk-dir`
2988         if test -f "$frametest/lib/mscoree.lib"; then
2989             DOTNET_FRAMEWORK_HOME="$frametest"
2990         else
2991             frametest=`./oowintool --windows-sdk-home`
2992             if test -f "$frametest/lib/mscoree.lib"; then
2993                 DOTNET_FRAMEWORK_HOME="$frametest"
2994             fi
2995         fi
2996     fi
2997     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
2998         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-dotnet-framework-home])
2999     fi
3000     AC_MSG_RESULT(found)
3001     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3002     DOTNET_FRAMEWORK_HOME=`cygpath -d "$DOTNET_FRAMEWORK_HOME"`
3003     DOTNET_FRAMEWORK_HOME=`cygpath -u "$DOTNET_FRAMEWORK_HOME"`
3004     AC_SUBST(MIDL_PATH)
3005     AC_SUBST(CSC_PATH)
3006     AC_SUBST(DOTNET_FRAMEWORK_HOME)
3009 dnl ===================================================================
3010 dnl Check if stdc headers are available excluding MSVC.
3011 dnl ===================================================================
3012 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3013     AC_HEADER_STDC
3016 dnl ===================================================================
3017 dnl Testing for C++ compiler and version...
3018 dnl ===================================================================
3020 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3021     AC_PROG_CXX
3022 else
3023     if test -n "$CC" -a -z "$CXX"; then
3024         CXX="$CC"
3025     fi
3028 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
3029 if test "$GXX" = "yes"; then
3030     AC_MSG_CHECKING([the GNU C++ compiler version])
3032     _gpp_version=`$CXX -dumpversion`
3033     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
3035     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$_gpp_majmin" -ge "401" ; then
3036         if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
3037             export CXX="$GCC_HOME/bin/g++-4.0"
3038             _gpp_majmin_2=`$CXX -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
3039             if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
3040                 _gpp_majmin=$_gpp_majmin_2
3041             fi
3042         fi
3043         if test "$_gpp_majmin" -ge "401" ; then
3044             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])
3045         else
3046             AC_MSG_RESULT([implicitly using CXX=$CXX])
3047         fi
3048     else
3049         AC_MSG_RESULT([checked (g++ $_gpp_version)])
3050     fi
3052     if test "$_gpp_majmin" = "304"; then
3053         AC_MSG_CHECKING([whether $CXX has the enum bug])
3054         AC_TRY_RUN([
3055             extern "C" void abort (void);
3056             extern "C" void exit (int status);
3058             enum E { E0, E1, E2, E3, E4, E5 };
3060             void test (enum E e)
3061             {
3062                 if (e == E2 || e == E3 || e == E1)
3063                     exit (1);
3064             }
3066             int main (void)
3067             {
3068                 test (E4);
3069                 test (E5);
3070                 test (E0);
3071                 return 0;
3072             }
3073             ],
3074             [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])])
3075     fi
3079 # prefx CXX with ccache if needed
3081 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3082     if test "$CCACHE" != "" ; then
3083         AC_MSG_CHECKING([whether $CXX is already ccached])
3084         AC_LANG_PUSH([C++])
3085         save_CXXFLAGS=$CXXFLAGS
3086         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
3087         dnl an empty program will do, we're checking the compiler flags
3088         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3089                           [use_ccache=yes], [use_ccache=no])
3090         if test $use_ccache = yes ; then
3091             AC_MSG_RESULT([yes])
3092         else
3093             CXX="$CCACHE $CXX"
3094             AC_MSG_RESULT([no])
3095         fi
3096         CXXFLAGS=$save_CXXFLAGS
3097         AC_LANG_POP([C++])
3098     fi
3101 dnl ===================================================================
3102 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
3103 dnl ===================================================================
3105 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3106     AC_PROG_CXXCPP
3108     dnl Check whether there's a C pre-processor.
3109     dnl ===================================================================
3110     dnl When using SunStudio compiler, there is a bug with the cc
3111     dnl preprocessor, so use CC preprocessor as the cc preprocessor
3112     dnl See Issuezilla #445.
3113     dnl ===================================================================
3114     if test "$_os" = "SunOS"; then
3115         CPP=$CXXCPP
3116     else
3117         AC_PROG_CPP
3118     fi
3122 dnl ===================================================================
3123 dnl Find integral type sizes and alignments
3124 dnl ===================================================================
3126 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3128     AC_CHECK_SIZEOF(long)
3129     AC_CHECK_SIZEOF(short)
3130     AC_CHECK_SIZEOF(int)
3131     AC_CHECK_SIZEOF(long long)
3132     AC_CHECK_SIZEOF(double)
3133     AC_CHECK_SIZEOF(void*)
3135     SIZEOF_SHORT=$ac_cv_sizeof_short
3136     SIZEOF_INT=$ac_cv_sizeof_int
3137     SIZEOF_LONG=$ac_cv_sizeof_long
3138     SIZEOF_LONGLONG=$ac_cv_sizeof_long_long
3139     SIZEOF_DOUBLE=$ac_cv_sizeof_double
3140     SIZEOF_POINTER=$ac_cv_sizeof_voidp
3142     dnl Allow build without AC_CHECK_ALIGNOF, grrr
3143     m4_pattern_allow([AC_CHECK_ALIGNOF])
3144     m4_ifdef([AC_CHECK_ALIGNOF],
3145       ,
3146       [
3147          dnl We know that the ALIGNOF_ variables are used only when cross-compiling
3148          dnl in sal/typesconfig/makefile.mk...
3149          if test "$cross_compiling" = "yes"; then
3150             AC_MSG_ERROR([When cross-compiling you must use a recent Autoconf with [AC_][CHECK_ALIGNOF]])
3151          fi
3152          m4_define([AC_CHECK_ALIGNOF],
3153             [
3154                AC_MSG_WARN([Cannot determine alignment of $1])
3155                AS_TR_SH([ac_cv_alignof_$3])=unknown
3156             ])
3157       ])
3159     AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
3160     AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
3161     AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
3162     AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
3164     ALIGNOF_SHORT=$ac_cv_alignof_short
3165     ALIGNOF_INT=$ac_cv_alignof_int
3166     ALIGNOF_LONG=$ac_cv_alignof_long
3167     ALIGNOF_DOUBLE=$ac_cv_alignof_double
3169     AC_C_BIGENDIAN
3170     WORDS_BIGENDIAN=$ac_cv_c_bigendian
3172     dnl Check for large file support
3173     AC_SYS_LARGEFILE
3174     if test -n "$ac_cv_sys_file_offset_bits"; then
3175         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
3176     fi
3177     if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
3178         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
3179     fi
3180 else
3181     # Hardcode for MSVC
3182     SIZEOF_SHORT=2
3183     SIZEOF_INT=4
3184     SIZEOF_LONG=4
3185     SIZEOF_LONGLONG=8
3186     if test "$CL_X64" = ""; then
3187         SIZEOF_POINTER=4
3188     else
3189         SIZEOF_POINTER=8
3190     fi
3191     ALIGNOF_SHORT=2
3192     ALIGNOF_INT=4
3193     ALIGNOF_LONG=4
3194     ALIGNOF_DOUBLE=8
3195     WORDS_BIGENDIAN=no
3196     LFS_CFLAGS=''
3198 AC_SUBST(WORDS_BIGENDIAN)
3199 AC_SUBST(LFS_CFLAGS)
3201 AC_SUBST(SIZEOF_SHORT)
3202 AC_SUBST(SIZEOF_INT)
3203 AC_SUBST(SIZEOF_LONG)
3204 AC_SUBST(SIZEOF_LONGLONG)
3205 AC_SUBST(SIZEOF_DOUBLE)
3206 AC_SUBST(SIZEOF_POINTER)
3207 AC_SUBST(ALIGNOF_SHORT)
3208 AC_SUBST(ALIGNOF_INT)
3209 AC_SUBST(ALIGNOF_LONG)
3210 AC_SUBST(ALIGNOF_DOUBLE)
3212 dnl ===================================================================
3213 dnl Check if valgrind.h is available
3214 dnl ===================================================================
3215 if test "$cross_compiling" != "yes" -a "$enable_dbgutil" != "no"; then
3216     dnl Test $prefix (currently only testing for /usr and /usr/local)
3217     dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
3218     VALGRIND_CFLAGS=""
3219     prev_cppflags=$CPPFLAGS
3220     if test -z "$VALGRIND_CFLAGS"; then
3221         CPPFLAGS="-I/usr/include/valgrind"
3222         AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
3223     fi
3224     if test -z "$VALGRIND_CFLAGS"; then
3225         CPPFLAGS="-I/usr/local/include/valgrind"
3226         AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
3227     fi
3228     if test -n "$VALGRIND_CFLAGS"; then
3229         CPPFLAGS=$VALGRIND_CFLAGS
3230         AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
3231     fi
3232     CPPFLAGS=$prev_cppflags
3234 AC_SUBST([VALGRIND_CFLAGS])
3236 dnl ===================================================================
3237 dnl Set the gcc/gxx include directories
3238 dnl ===================================================================
3239 # Removed the special FreeBSD treatment. The problem was that with_gxx_include_path
3240 # often contains an i386 which is expanded as a macro.
3241 if test "$GXX" = "yes"; then
3242     AC_MSG_CHECKING([for g++ include path])
3243     if test -z "$with_gxx_include_path"; then
3244         with_gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
3245         if test "$with_gxx_include_path" = "/usr/libexec/(null)/include"; then
3246             with_gxx_include_path="/usr/include"
3247         fi
3248         if echo $with_gxx_include_path | grep -q linux; then
3249             # workaround for Mandriva - issue 100049
3250             with_gxx_include_path=`cd $with_gxx_include_path && pwd`
3251         fi
3252     fi
3253     dnl This is the original code...
3254     dnl with_gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include
3255     if test -z "$with_gxx_include_path"; then
3256         with_gxx_include_path="NO_GXX_INCLUDE"
3257         AC_MSG_RESULT([none])
3258     else
3259         AC_MSG_RESULT([$with_gxx_include_path])
3260     fi
3261 else
3262     with_gxx_include_path="NO_GXX_INCLUDE"
3264 GXX_INCLUDE_PATH="$with_gxx_include_path"
3265 AC_SUBST(GXX_INCLUDE_PATH)
3267 dnl ===================================================================
3268 dnl Set the MinGW include directories
3269 dnl ===================================================================
3270 if test "$WITH_MINGW" = "yes"; then
3271     AC_MSG_CHECKING([for MinGW include path])
3272     cat >conftest.$ac_ext <<_ACEOF
3273 #include <stddef.h>
3274 #include <bits/c++config.h>
3275 _ACEOF
3276     _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`
3277     rm conftest.$ac_ext
3278     if test -z "$_mingw_lib_include_path"; then
3279         _mingw_lib_include_path="NO_LIB_INCLUDE"
3280         AC_MSG_RESULT([no MinGW include path])
3281     else
3282         AC_MSG_RESULT([$_mingw_lib_include_path])
3283     fi
3284     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
3285     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
3287     mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
3288     MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
3290     AC_LANG_PUSH([C++])
3292     AC_MSG_CHECKING([for dynamic libgcc])
3293     AC_TRY_LINK([
3294 #include <iostream>
3295 using namespace std;
3296 ],  
3297         [ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ],
3298         [   
3299             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
3300             if test -n "$MINGW_GCCDLL"; then
3301                 MINGW_SHARED_GCCLIB=YES
3302                 AC_MSG_RESULT([ $MINGW_GCCDLL])
3303             else
3304                 MINGW_SHARED_GCCLIB=NO
3305                 AC_MSG_RESULT([no])
3306             fi
3307        ],
3308        [ AC_MSG_RESULT([no])
3309        ]
3310     )
3312     AC_MSG_CHECKING([for dynamic libstdc++])
3313     AC_TRY_LINK([
3314 #include <iostream>
3315 using namespace std;
3316 ],  
3317         [ cout << "Hello there." << endl; ],
3318         [   
3319             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
3320             if test -n "$MINGW_GXXDLL"; then
3321                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
3322                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
3323                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
3324                 MINGW_SHARED_GXXLIB=YES
3325                 AC_MSG_RESULT([$MINGW_GXXDLL])
3326             else
3327                 MINGW_SHARED_GXXLIB=NO
3328                 AC_MSG_RESULT([no])
3329             fi
3330        ],
3331        [ AC_MSG_RESULT([no])
3332        ]
3333     )
3335     AC_LANG_POP([C++])
3337     AC_SUBST(MINGW_CLIB_DIR)
3338     AC_SUBST(MINGW_SHARED_GCCLIB)
3339     AC_SUBST(MINGW_SHARED_GXXLIB)
3340     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
3341     AC_SUBST(MINGW_GCCDLL)
3342     AC_SUBST(MINGW_GXXDLL)
3345 dnl ===================================================================
3346 dnl Extra checking for the SunOS compiler
3347 dnl ===================================================================
3348 if test "$_os" = "SunOS"; then
3349     dnl SunStudio C++ compiler packaged with SunStudio C compiler
3350     if test "$CC" = "cc"; then
3351     AC_MSG_CHECKING([SunStudio C++ Compiler])
3352         if test "$CXX" != "CC"; then
3353             AC_MSG_WARN([SunStudio C++ was not found])
3354             echo "SunStudio C++ was not found" >> warn
3355         else
3356             AC_MSG_RESULT([checked])
3357         fi
3358     fi
3361 dnl *************************************************************
3362 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
3363 dnl *************************************************************
3364 if test "$WITH_MINGW" = "yes"; then
3365     AC_MSG_CHECKING([exception type])
3366     AC_LANG_PUSH([C++])
3367     AC_TRY_LINK(
3368         [#include <iostream>
3370         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
3372         ],
3373         [_Unwind_SjLj_RaiseException() ],
3374         [exceptions_type="sjlj"],
3375         [exceptions_type="dwarf2"]
3376     )
3377     AC_MSG_RESULT($exceptions_type)
3378     AC_LANG_POP([C++])
3381 EXCEPTIONS="$exceptions_type"
3382 AC_SUBST(EXCEPTIONS)
3384 dnl ===================================================================
3385 dnl Checks for what the default STL should be
3386 dnl ===================================================================
3387 AC_MSG_CHECKING([Whether building STLPort library makes sense])
3388 BUILD_STLPORT="no"
3389 if test "$_os" = "Linux"; then
3390     case "$host_cpu" in
3391     i?86)
3392         case "$host_os" in
3393         k*bsd*-gnu*)
3394             BUILD_STLPORT="no"
3395             ;;
3396         *)
3397             BUILD_STLPORT="yes"
3398             ;;
3399         esac
3400         ;;
3401     *)
3402         BUILD_STLPORT="no"
3403         ;;
3404     esac
3405 elif test "$_os" = "SunOS"; then
3406     BUILD_STLPORT="yes"
3407 elif test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
3408     BUILD_STLPORT="yes"
3409 elif test "$_os" = "FreeBSD"; then
3410     BUILD_STLPORT="yes"
3412 if test "$BUILD_STLPORT" = "yes" ; then
3413     AC_MSG_RESULT([yes])
3414 else
3415     AC_MSG_RESULT([no])
3418 AC_MSG_CHECKING([Whether STLPort library will be actually built])
3419 if test "$with_stlport" = "auto" -o "$BUILD_STLPORT" = "no"; then
3420     with_stlport=$BUILD_STLPORT
3422 if test "$with_stlport" = "yes" ; then
3423     AC_MSG_RESULT([yes])
3424     WITH_STLPORT=YES
3425     SCPDEFS="$SCPDEFS -DWITH_STLPORT"
3426     BUILD_TYPE="$BUILD_TYPE STLPORT"
3427 else
3428     WITH_STLPORT=NO
3429     AC_MSG_RESULT([no])
3432 AC_SUBST(WITH_STLPORT)
3434 dnl ===================================================================
3435 dnl visibility and c++0x features
3436 dnl ===================================================================
3437 if test "$GCC" = "yes"; then
3438     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
3439     save_CFLAGS=$CFLAGS
3440     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
3441     AC_TRY_LINK([], [ return 0; ], [ HAVE_GCC_VISIBILITY_FEATURE=TRUE ], [])
3442     CFLAGS=$save_CFLAGS
3443     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3444         AC_MSG_RESULT([yes])
3445     else
3446         AC_MSG_RESULT([no])
3447     fi
3449     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
3450     save_CFLAGS=$CFLAGS
3451     CFLAGS="$CFLAGS -Werror -Wno-long-double"
3452     AC_TRY_LINK([], [ return 0; ], [ HAVE_GCC_NO_LONG_DOUBLE=TRUE ], [])
3453     CFLAGS=$save_CFLAGS
3454     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
3455         AC_MSG_RESULT([yes])
3456     else
3457         AC_MSG_RESULT([no])
3458     fi
3460     AC_MSG_CHECKING([whether $CC supports -mno-avx])
3461     save_CFLAGS=$CFLAGS
3462     CFLAGS="$CFLAGS -Werror -mno-avx"
3463     AC_TRY_LINK([], [ return 0; ], [ HAVE_GCC_AVX=TRUE ], [])
3464     CFLAGS=$save_CFLAGS
3465     if test "$HAVE_GCC_AVX" = "TRUE"; then
3466         AC_MSG_RESULT([yes])
3467     else
3468         AC_MSG_RESULT([no])
3469     fi
3471     AC_MSG_CHECKING([whether $CC supports -std=c++0x without Language Defect 757])
3472     save_CXXFLAGS=$CFLAGS
3473     CXXFLAGS="$CXXFLAGS -std=c++0x"
3474     AC_LANG_PUSH([C++])
3476     AC_TRY_COMPILE([
3477 #include <stddef.h>
3479 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
3481 namespace
3483         struct b
3484         {
3485                 int i;
3486                 int j;
3487         };
3490 struct a
3492         int i;
3493         int j;
3495 a thinga[]={{0,0}, {1,1}};
3496 b thingb[]={{0,0}, {1,1}};
3497 size_t i = sizeof(sal_n_array_size(thinga));
3498 size_t j = sizeof(sal_n_array_size(thingb));
3499 return !(i != 0 && j != 0);
3500 ], HAVE_CXX0X=TRUE,)
3502     AC_LANG_POP([C++])
3503     CXXFLAGS=$save_CXXFLAGS
3504     if test "$HAVE_CXX0X" = "TRUE"; then
3505         AC_MSG_RESULT([yes])
3506     else
3507         AC_MSG_RESULT([no])
3508     fi
3511 AC_SUBST(HAVE_CXX0X)
3512 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
3513 AC_SUBST(HAVE_GCC_AVX)
3515 dnl ===================================================================
3516 dnl system stl sanity tests
3517 dnl ===================================================================
3518 HAVE_GCC_VISIBILITY_BROKEN=
3519 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) ; then
3521     AC_LANG_PUSH([C++])
3523     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3524         AC_MSG_CHECKING([if STL headers are visibility safe])
3525         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
3526         AC_MSG_RESULT([$stlvisok])
3527         if test "$stlvisok" = "no"; then
3528             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
3529             echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
3530             unset HAVE_GCC_VISIBILITY_FEATURE
3531         fi
3532     fi
3534     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3535         sharedlink_ldflags_save=$LDFLAGS
3536         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
3538         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
3539         AC_TRY_LINK(
3540             [
3541 #include <sstream>
3542 using namespace std;
3543             ],[
3544 istringstream strm( "test" ); return 0;
3545             ],
3546             $EGREP -q  unresolvable conftest.err;
3547             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi,
3548             gccvisok=no
3549         )
3550         AC_MSG_RESULT([$gccvisok])
3551         if test "$gccvisok" = "no"; then
3552             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
3553             echo "Your gcc is not -fvisibility-inlines-hidden safe, disabling that." >> warn
3554             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
3555         fi
3557         LDFLAGS=$sharedlink_ldflags_save
3558     fi
3560     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3561         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
3562         cat >visibility.cxx <<_ACEOF
3563 #pragma GCC visibility push(hidden)
3564 struct __attribute__ ((visibility ("default"))) TestStruct {
3565   static void Init();
3567 __attribute__ ((visibility ("default"))) void TestFunc() {
3568   TestStruct::Init();
3570 _ACEOF
3571         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
3572             gccvisbroken=yes
3573         else
3574             case "$host_cpu" in
3575             i?86|x86_64)
3576                 if test "$_os" = "Darwin"; then
3577                     gccvisbroken=no
3578                 else
3579                     if $EGREP -q '@PLT' visibility.s; then
3580                         gccvisbroken=no
3581                     else
3582                         gccvisbroken=yes
3583                     fi
3584                 fi
3585                 ;;
3586             *)
3587                 gccvisbroken=no
3588                 ;;
3589             esac
3590         fi
3591         rm -f visibility.s visibility.cxx
3593         AC_MSG_RESULT([$gccvisbroken])
3594         if test "$gccvisbroken" = "yes"; then
3595             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
3596             echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
3597             unset HAVE_GCC_VISIBILITY_FEATURE
3598         fi
3599     fi
3601     AC_LANG_POP([C++])
3604 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3605 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
3607 dnl ===================================================================
3608 dnl allocator
3609 dnl ===================================================================
3610 AC_MSG_CHECKING([which memory allocator to use])
3611 if test "$with_alloc" = "system"; then
3612     AC_MSG_RESULT([system])
3613     ALLOC="SYS_ALLOC";
3614     AC_CHECK_FUNCS([malloc realloc calloc free])
3616 if test "$with_alloc" = "tcmalloc"; then
3617     AC_MSG_RESULT(tcmalloc)
3618     if ! echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3619         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3620     fi
3621     AC_CHECK_LIB(tcmalloc, malloc, [],
3622         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3623     ALLOC="TCMALLOC";
3625 if test "$with_alloc" = "jemalloc"; then
3626     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3627         AC_MSG_RESULT(jemalloc)
3628         save_CFLAGS=$CFLAGS
3629         CFLAGS="$CFLAGS -pthread"
3630         AC_CHECK_LIB(jemalloc, malloc, [],
3631             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3632         ALLOC="JEMALLOC";
3633         CFLAGS=$save_CFLAGS
3634     else
3635         AC_MSG_RESULT([system])
3636         ALLOC="SYS_ALLOC";
3637         AC_CHECK_FUNCS([malloc realloc calloc free])
3638     fi
3640 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3641     AC_MSG_RESULT([internal])
3643 AC_SUBST(ALLOC)
3645 dnl ===================================================================
3646 dnl Custom build version
3647 dnl ===================================================================
3649 AC_MSG_CHECKING([whether to add custom build version])
3650 if test "z$with_build_version" != "z"; then
3651     BUILD_VER_STRING=$with_build_version
3652     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3653 else
3654     BUILD_VER_STRING=
3655     AC_MSG_RESULT([no])
3657 AC_SUBST(BUILD_VER_STRING)
3659 dnl ===================================================================
3660 dnl Java support enable
3661 dnl ===================================================================
3662 AC_MSG_CHECKING([whether to build with Java support])
3663 if test "$with_java" != "no"; then
3664     AC_MSG_RESULT([yes])
3665     SOLAR_JAVA="TRUE"
3666 else
3667     AC_MSG_RESULT([no])
3668     SOLAR_JAVA=""
3671 AC_SUBST(SOLAR_JAVA)
3673 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
3674 dnl want there to be *run-time* (and build-time) support for Java extensions in the
3675 dnl built LibreOffice.
3676 dnl SOLAR_JAVA="BUILD" indicate build-time only support (no runtime support)
3677 dnl SOLAR_JAVA="" indicate no java support at all
3679 if test "$_os" = "Linux" && test "$host_cpu" = "powerpc"; then
3680     # IBMs JDK needs this...
3681     JITC_PROCESSOR_TYPE=6
3682     export JITC_PROCESSOR_TYPE
3685 if test $_os = "WINNT"; then
3686     WITH_VC_REDIST="TRUE"
3688 AC_SUBST(WITH_VC_REDIST)
3690 dnl ===================================================================
3691 dnl Checks for Java
3692 dnl ===================================================================
3693 if test "$SOLAR_JAVA" != ""; then
3695     # Windows-specific tests
3696     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3697         if test "$CL_X64" != ""; then
3698             bitness="64-bit"
3699             otherbitness="32-bit"
3700         else
3701             bitness="32-bit"
3702             otherbitness="64-bit"
3703         fi
3705         if test -z "$with_jdk_home"; then
3707             # Unfortunately apparently no way to find, if needed, the 64-bit
3708             # JDK in the Registry from the 32-bit Perl oowintool
3710             _jdk_home=`./oowintool --jdk-home`
3711             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
3712                 with_jdk_home="$_jdk_home"
3713                 howfound="found by oowintool"
3714             else
3715                 AC_MSG_ERROR([No JDK found by oowintool, pass the --with-jdk-home option pointing to a $bitness JDK])
3716             fi
3717         else
3718             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
3719             howfound="you passed"
3720         fi
3721     fi
3723     JAVA_HOME=; export JAVA_HOME
3724     if test -z "$with_jdk_home"; then
3725         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
3726     else
3727         _java_path="$with_jdk_home/bin/$with_java"
3728         dnl Check if there is a Java interpreter at all.
3729         if test -x "$_java_path"; then
3730             JAVAINTERPRETER=$_java_path
3731         else
3732             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
3733         fi
3734     fi
3736     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3737         # Check that the JDK found is correct architecture
3738         # Why is this necessary, we don't link with any library from the JDK I think,
3740         shortjdkhome=`cygpath -d "$with_jdk_home"`
3741         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
3742             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
3743             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
3744         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
3745             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
3746             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
3747         fi
3749         if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
3750             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3751         fi
3752         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3753         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3754     elif test "$_os" = "Darwin"; then
3755         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
3756         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
3757         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
3758         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
3759         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
3760             AC_MSG_RESULT([yes])
3761             JAVAIFLAGS=-d32
3762         else
3763             AC_MSG_RESULT([no])
3764         fi
3765     fi
3768 dnl ===================================================================
3769 dnl Checks for JDK.
3770 dnl ===================================================================
3771 if test "$SOLAR_JAVA" != ""; then
3772     _gij_longver=0
3773     AC_MSG_CHECKING([the installed JDK])
3774     if test -n "$JAVAINTERPRETER"; then
3775         dnl java -version sends output to stderr!
3776         if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3777             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3778         elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
3779             JDK=gcj
3780             AC_MSG_RESULT([checked (gcj)])
3781             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
3782             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3784         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "BEA"` -gt 0; then
3785             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3786         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "IBM"` -gt 0; then
3787             JDK=ibm
3789             dnl IBM JDK specific tests
3790             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3791             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3793             if test "$_jdk_ver" -lt 10500; then
3794                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
3795             fi
3797             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
3799             if test "$with_jdk_home" = ""; then
3800                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
3801 you must use the "--with-jdk-home" configure option explicitly])
3802             fi
3804            JAVA_HOME=$with_jdk_home
3806         else
3807             JDK=sun
3809             dnl Sun JDK specific tests
3810             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3811             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3813             if test "$_jdk_ver" -lt 10500; then
3814                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
3815             fi
3816             AC_MSG_RESULT([checked (JDK $_jdk)])
3817             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3818             if test "$_os" = "WINNT"; then
3819                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3820             fi
3821         fi
3822     else
3823         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
3824     fi
3825 else
3826     dnl Java disabled
3827     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
3830 _java_target_ver="1.5"
3831 dnl ===================================================================
3832 dnl Check for target Java bytecode version
3833 dnl ===================================================================
3834 if test "$SOLAR_JAVA" != ""; then
3835     AC_MSG_CHECKING([for target Java bytecode version])
3836     if test "$JDK" = "gcj" -o "$JDK" = "kaffe"; then
3837     AC_MSG_RESULT([default by $JDK])
3838     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
3839         AC_MSG_WARN([Value defined by --with-java-target-version is ignored!])
3840     fi
3841     else
3842     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
3843         _java_target_ver="$with_java_target_version"
3844         AC_MSG_RESULT([$_java_target_ver])
3845     elif test $_jdk_ver -gt 10000 ; then
3846         _java_target_ver=`echo "$_jdk_ver" | $AWK '{ maj=substr($0,1,1); min=substr($0,2,2); print int(maj)"."int(min) }'`
3847         AC_MSG_RESULT([$_java_target_ver])
3848     else
3849         AC_MSG_ERROR([Unable to guess Java bytecode version from Java version!])
3850     fi
3851     fi
3853     if ! test -z "$_java_target_ver" -o \
3854         "$_java_target_ver" = "1.1" -o \
3855             "$_java_target_ver" = "1.2" -o \
3856         "$_java_target_ver" = "1.3" -o \
3857         "$_java_target_ver" = "1.4" -o \
3858         "$_java_target_ver" = "1.5" -o \
3859         "$_java_target_ver" = "1.6" -o \
3860         "$_java_target_ver" = "5" ; then
3861         AC_MSG_ERROR([$_java_target_ver is not a supported Java bytecode version!])
3862     fi
3864     JAVA_SOURCE_VER="$_java_target_ver"
3865     JAVA_TARGET_VER="$_java_target_ver"
3868 dnl ===================================================================
3869 dnl Checks for javac
3870 dnl ===================================================================
3871 if test "$SOLAR_JAVA" != ""; then
3872     if test "$JDK" = "gcj"; then
3873         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
3874     else
3875         javacompiler="javac"
3876     fi
3877     if test -z "$with_jdk_home"; then
3878         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
3879     else
3880         _javac_path="$with_jdk_home/bin/$javacompiler"
3881         dnl Check if there is a Java compiler at all.
3882         if test -x "$_javac_path"; then
3883             JAVACOMPILER=$_javac_path
3884         fi
3885     fi
3886     if test -z "$JAVACOMPILER"; then
3887         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
3888     fi
3889     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3890         if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
3891             JAVACOMPILER="${JAVACOMPILER}.exe"
3892         fi
3893         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
3894         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
3895     fi
3897     if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
3898         AC_MSG_CHECKING([re-checking JDK])
3899         JDK=gcj
3900         AC_MSG_RESULT([checked (ecj)])
3901         #TODO: what's to do here? some switch to do 1.5 compiling?
3902         JAVAFLAGS="-source 1.5 -target 1.5"
3903         _gij_longver="40200"
3904     fi
3907 JAVACISGCJ=""
3908 dnl ===================================================================
3909 dnl Checks that javac is gcj
3910 dnl ===================================================================
3911 if test "$SOLAR_JAVA" != ""; then
3912     if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
3913         JAVACISGCJ="yes"
3914     fi
3916 AC_SUBST(JAVACISGCJ)
3918 JAVACISKAFFE=""
3919 dnl ===================================================================
3920 dnl Checks that javac is kaffe
3921 dnl ===================================================================
3922 if test "$SOLAR_JAVA" != ""; then
3923     if test `$JAVACOMPILER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3924         JAVACISKAFFE="yes"
3925     fi
3927 AC_SUBST(JAVACISKAFFE)
3929 dnl ===================================================================
3930 dnl Checks for javadoc
3931 dnl ===================================================================
3932 if test "$SOLAR_JAVA" != ""; then
3933     if test -z "$with_jdk_home"; then
3934         AC_PATH_PROG(JAVADOC, javadoc)
3935     else
3936         _javadoc_path="$with_jdk_home/bin/javadoc"
3937         dnl Check if there is a javadoc at all.
3938         if test -x "$_javadoc_path"; then
3939             JAVADOC=$_javadoc_path
3940         else
3941             AC_PATH_PROG(JAVADOC, javadoc)
3942         fi
3943     fi
3944     if test -z "$JAVADOC"; then
3945         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
3946     fi
3947     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3948         if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3949             JAVADOC="${JAVADOC}.exe"
3950         fi
3951         JAVADOC=`cygpath -d "$JAVADOC"`
3952         JAVADOC=`cygpath -u "$JAVADOC"`
3953     fi
3956 if test "$SOLAR_JAVA" != ""; then
3957     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
3958     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
3959         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
3960            # try to recover first by looking whether we have a alternatives
3961            # system as in Debian or newer SuSEs where following /usr/bin/javac
3962            # over /etc/alternatives/javac leads to the right bindir where we
3963            # just need to strip a bit away to get a valid JAVA_HOME
3964            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
3965         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
3966             # maybe only one level of symlink (e.g. on Mac)
3967             JAVA_HOME=$(readlink $JAVACOMPILER)
3968             if test "$(dirname $JAVA_HOME)" = "."; then
3969                 # we've got no path to trim back
3970                 JAVA_HOME=""
3971             fi
3972         else
3973             # else warn
3974             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
3975             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
3976             echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
3977             echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
3978         fi
3979         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
3980         if test "$JAVA_HOME" != "/usr"; then
3981             if test "$_os" = "Darwin"; then
3982                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
3983                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
3984                 dnl Tiger already returns a JDK path..
3985                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
3986             else
3987                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
3988             fi
3989         fi
3990     fi
3991     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
3993     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
3994     if test -z "$JAVA_HOME"; then
3995         if test "x$with_jdk_home" = "x"; then
3996             cat > findhome.java <<_ACEOF
3997 [import java.io.File;
3999 class findhome
4001     public static void main(String args[])
4002     {
4003         String jrelocation = System.getProperty("java.home");
4004         File jre = new File(jrelocation);
4005         System.out.println(jre.getParent());
4006     }
4008 _ACEOF
4009             AC_MSG_CHECKING([if javac works])
4010             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
4011             AC_TRY_EVAL(javac_cmd)
4012             if test $? = 0 && test -f ./findhome.class ; then
4013                 AC_MSG_RESULT([javac works])
4014             else
4015                 echo "configure: javac test failed" >&5
4016                 cat findhome.java >&5
4017                 AC_MSG_ERROR([javac does not work - java projects will not build!])
4018             fi
4019             AC_MSG_CHECKING([if gij knows its java.home])
4020             JAVA_HOME=`$JAVAINTERPRETER findhome`
4021             if test $? = 0 && test "$JAVA_HOME" != "" ; then
4022                 AC_MSG_RESULT([$JAVA_HOME])
4023             else
4024                 echo "configure: java test failed" >&5
4025                 cat findhome.java >&5
4026                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
4027             fi
4028             # clean-up after ourselves
4029             rm -f ./findhome.java ./findhome.class
4030         else
4031             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
4032         fi
4033     fi
4035     dnl second sanity check JAVA_HOME if possible
4036     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
4037         # now check if $JAVA_HOME is really valid
4038         if test "$_os" = "Darwin"; then
4039             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
4040                 JAVA_HOME_OK="NO"
4041             fi
4042         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
4043             JAVA_HOME_OK="NO"
4044         fi
4045         if test "$JAVA_HOME_OK" = "NO"; then
4046             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
4047             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
4048             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
4049             echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
4050             echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
4051             echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
4052         fi
4053     fi
4054     AC_MSG_NOTICE([JAVA_HOME=$JAVA_HOME])
4057 AWTLIB=
4059 if test "$SOLAR_JAVA" != ""; then
4060     AC_MSG_CHECKING([for jawt lib name])
4061     if test "$JDK" = "gcj"; then
4062         save_CFLAGS=$CFLAGS
4063         save_LDFLAGS=$LDFLAGS
4064         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4065         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
4066         exec 6>/dev/null # no output
4067         AC_CHECK_HEADER(jni.h, [],
4068                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
4069         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
4070         exec 6>&1 # output on again
4071         CFLAGS=$save_CFLAGS
4072         LDFLAGS=$save_LDFLAGS
4073     fi
4074     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
4075     # A workaround is to link also against libpmawt.so
4076     if test "$JDK" = "ibm" ; then
4077         save_CFLAGS=$CFLAGS
4078         save_LDFLAGS=$LDFLAGS
4079         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
4080         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4081         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
4082         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
4083         export LD_LIBRARY_PATH
4084         exec 6>/dev/null # no output
4085         AC_CHECK_HEADER(jni.h, [],
4086                     [AC_MSG_ERROR([jni.h could not be found.])], [])
4087         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
4088         if test -z "$AWTLIB"; then
4089             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
4090             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
4091         fi
4092         exec 6>&1 # output on again
4093         CFLAGS=$save_CFLAGS
4094         LDFLAGS=$save_LDFLAGS
4095         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
4096     fi
4097     if test -z "$AWTLIB"; then
4098         AWTLIB=-ljawt
4099     fi
4100     AC_MSG_RESULT([$AWTLIB])
4101     AC_SUBST(AWTLIB)
4104 AC_SUBST(JAVA_HOME)
4105 AC_SUBST(JDK)
4106 AC_SUBST(JAVAFLAGS)
4107 AC_SUBST(JAVA_SOURCE_VER)
4108 AC_SUBST(JAVA_TARGET_VER)
4109 AC_SUBST(JAVAINTERPRETER)
4110 AC_SUBST(JAVAIFLAGS)
4111 AC_SUBST(JAVACOMPILER)
4112 AC_SUBST(JAVADOC)
4114 dnl ===================================================================
4115 dnl Checks for specific files.
4116 dnl ===================================================================
4118 dnl ===================================================================
4119 dnl Checks for programs.
4120 dnl ===================================================================
4122 dnl ===================================================================
4123 dnl Check whether we already have dmake
4124 dnl ===================================================================
4125 AC_PATH_PROG(DMAKE, dmake, no)
4126 if test "$DMAKE" = "no"; then
4127     BUILD_DMAKE=YES
4128     echo "dmake will be built on ./bootstrap"
4129 else
4130     AC_MSG_CHECKING([whether the found dmake is the right dmake])
4131     # we need to find out whether that dmake we found is "our" dmake
4132     # or the dmake from Sun's SunStudio Compiler which is something
4133     # different
4134     # This test _should_ work because the one accepts -V (ours) and one
4135     # (the other) not...
4136     $DMAKE -V 2>/dev/null | grep 'dmake .* Version .*' >/dev/null
4137     if test $? -eq 0; then
4138         BUILD_DMAKE=NO
4139         AC_MSG_RESULT([yes])
4140         AC_MSG_CHECKING([the dmake version])
4141         DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
4142         if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
4143             AC_MSG_RESULT([OK, >= 4.11])
4144         elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
4145             test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
4146             AC_MSG_RESULT([OK, >= 4.11])
4147         else
4148             AC_MSG_RESULT([too old. >= 4.11 is needed])
4149             echo "A newer dmake will be built on ./bootstrap"
4150             BUILD_DMAKE=YES
4151         fi
4152     else
4153         AC_MSG_RESULT([no])
4154         echo "dmake will be built on ./bootstrap"
4155         BUILD_DMAKE=YES
4156     fi
4158 AC_SUBST(BUILD_DMAKE)
4160 AC_MSG_CHECKING([whether to enable EPM for packing])
4161 BUILD_EPM=NO
4162 if test "$enable_epm" = "yes"; then
4163     AC_MSG_RESULT([yes])
4164     dnl ===================================================================
4165     dnl Check for epm - not needed for Windows
4166     dnl ===================================================================
4167     if test "$_os" != "WINNT"; then
4168         if test -n "$with_epm"; then
4169             EPM=$with_epm
4170         else
4171             AC_PATH_PROG(EPM, epm, no)
4172         fi
4173         if test "$EPM" = "no" || test "$EPM" = "internal"; then
4174             echo "EPM will be built."
4175             BUILD_EPM=YES
4176             BUILD_TYPE="$BUILD_TYPE EPM"
4177         else
4178             # Gentoo has some epm which is something different...
4179             AC_MSG_CHECKING([whether the found epm is the right epm])
4180             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
4181                 AC_MSG_RESULT([yes])
4182             else
4183                 AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
4184             fi
4185             AC_MSG_CHECKING([epm version])
4186             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
4187             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
4188                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
4189                 AC_MSG_RESULT([OK, >= 3.7])
4190                 BUILD_EPM=NO
4191                 if test "$_os" = "Darwin"; then
4192                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
4193                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
4194                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4195                         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)])
4196                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4197                         AC_MSG_RESULT([$_pm, ok])
4198                     else # we never should get here, but go safe
4199                         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)])
4200                     fi
4201                 fi
4202             else
4203                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
4204                 echo "EPM will be built."
4205                 BUILD_EPM=YES
4206                 BUILD_TYPE="$BUILD_TYPE EPM"
4207             fi
4208         fi
4209     fi
4211     # test which package format to use
4212     AC_MSG_CHECKING([which package format to use])
4214     # defaults
4215     case "$_os" in
4216     Darwin)
4217         PKGFORMAT=dmg
4218         ;;
4219     SunOS)
4220         PKGFORMAT=pkg
4221         ;;
4222     Linux)
4223         # if building on Debian, default should be deb...
4224         if test -e /etc/debian_version; then
4225             PKGFORMAT=deb
4226         else
4227             PKGFORMAT=rpm
4228         fi
4229         ;;
4230     AIX)
4231         PKGFORMAT=rpm
4232         ;;
4233     OpenBSD|DragonFly)
4234         PKGFORMAT=portable
4235         ;;
4236     *BSD)
4237         PKGFORMAT=bsd
4238         ;;
4239     WINNT)
4240         PKGFORMAT=msi
4241         ;;
4242     # we never should get here since we check the arciecture/os at the beginning,
4243     # but go sure...
4244     *)
4245         AC_MSG_ERROR([unknown system])
4246     esac
4247     if test -n "$with_package_format"; then
4248         for i in $with_package_format; do
4249             case "$i" in
4250             aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4251                 ;;
4252             *)
4253                 AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4254 aix - AIX software distribution
4255 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4256 depot or swinstall - HP-UX software distribution
4257 deb - Debian software distribution
4258 inst or tardist - IRIX software distribution
4259 osx - MacOS X software distribution
4260 pkg - Solaris software distribution
4261 rpm - RedHat software distribution
4262 setld - Tru64 (setld) software distribution
4263 native - "Native" software distribution for the platform
4264 portable - Portable software distribution
4265 LibreOffice additionally supports:
4266 archive - .tar.gz or .zip
4267 dmg - Mac OS X .dmg
4268 installed - installation tree
4269 msi - Windows .msi
4270             ])
4271                 ;;
4272             esac
4273         done
4274         PKGFORMAT="$with_package_format"
4275     fi
4276     AC_MSG_RESULT([$PKGFORMAT])
4277     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
4278         AC_MSG_CHECKING([for rpm])
4279         for a in "$RPM" rpmbuild rpm; do
4280             $a --usage >/dev/null 2> /dev/null
4281             if test $? -eq 0; then
4282                 RPM=$a
4283                 break
4284             else
4285                 $a --version >/dev/null 2> /dev/null
4286                 if test $? -eq 0; then
4287                     RPM=$a
4288                     break
4289                 fi
4290             fi
4291         done
4292         if test -z "$RPM" ; then
4293             AC_MSG_ERROR([not found])
4294         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
4295             RPM_PATH=`which $RPM`
4296             AC_MSG_RESULT([$RPM_PATH])
4297         else
4298             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
4299         fi
4300     fi
4301     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
4302         AC_PATH_PROG(DPKG, dpkg, no)
4303         if test "$DPKG" = "no"; then
4304             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
4305         fi
4306     fi
4307     if echo "PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
4308         if test "$_os" = "Darwin"; then
4309             AC_MSG_CHECKING([for PackageMaker availability])
4310             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
4311                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
4312             else
4313                 AC_MSG_RESULT([ok])
4314             fi
4315         else
4316             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
4317         fi
4318     fi
4319     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
4320        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4321         if test "$EPM" != "no" && test "$EPM" != "internal"; then
4322             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
4323                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
4324                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
4325                     AC_MSG_RESULT([yes])
4326                 else
4327                     AC_MSG_RESULT([no])
4328                     if echo "$PKGFORMAT" | grep -q rpm; then
4329                         _pt="rpm"
4330                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
4331                         echo "the rpms will need to be installed with --nodeps" >> warn
4332                     else
4333                         _pt="pkg"
4334                     fi
4335                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
4336                     echo "the ${_pt}s will not be relocateable" >> warn
4337                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
4338                                  relocation will work, you need to patch your epm with the
4339                                  patch in epm/epm-3.7.patch or build with
4340                                  --with-epm=internal which will build a suitable epm])
4341                 fi
4342             fi
4343         fi
4344     fi
4345     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4346         AC_PATH_PROG(PKGMK, pkgmk, no)
4347         if test "$PKGMK" = "no"; then
4348             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
4349         fi
4350     fi
4351     AC_SUBST(RPM)
4352     AC_SUBST(DPKG)
4353     AC_SUBST(PKGMK)
4354 else
4355     AC_MSG_RESULT([no])
4356     EPM=NO
4357     PKGFORMAT=native
4359 AC_SUBST(EPM)
4360 AC_SUBST(BUILD_EPM)
4361 AC_SUBST(PKGFORMAT)
4363 dnl ===================================================================
4364 dnl Check for gperf
4365 dnl ===================================================================
4366 AC_PATH_PROG(GPERF, gperf)
4367 if test -z "$GPERF"; then
4368     AC_MSG_ERROR([gperf not found but needed. Install it.])
4370 AC_MSG_CHECKING([gperf version])
4371 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
4372     AC_MSG_RESULT([OK])
4373 else
4374     AC_MSG_ERROR([too old, you need at least 3.0.0])
4376 AC_SUBST(GPERF)
4378 dnl ===================================================================
4379 dnl Check for building stax
4380 dnl ===================================================================
4381 AC_MSG_CHECKING([whether to build the stax])
4382 if test -f "./stax/download/jsr173_1.0_api.jar"; then
4383     BUILD_STAX=NO
4384     AC_MSG_RESULT([no, will use the prebuilt stax/download/jsr173_1.0_api.jar])
4385 else
4386     BUILD_STAX=YES
4387     AC_MSG_RESULT([yes])
4389 AC_SUBST(BUILD_STAX)
4391 dnl ===================================================================
4392 dnl Check for building ODK
4393 dnl ===================================================================
4394 AC_MSG_CHECKING([whether to build the ODK])
4395 if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
4396     AC_MSG_RESULT([yes])
4398     if test "$with_java" != "no"; then
4399         AC_MSG_CHECKING([whether to build unowinreg.dll])
4400         if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
4401             # build on Win by default
4402             enable_build_unowinreg=yes
4403         fi
4404         if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
4405             AC_MSG_RESULT([no])
4406             BUILD_UNOWINREG=NO
4407         else
4408             AC_MSG_RESULT([yes])
4409             BUILD_UNOWINREG=YES
4410         fi
4411         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
4412             if test -z "$with_mingw_cross_compiler"; then
4413                 dnl Guess...
4414                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
4415             elif test -x "$with_mingw_cross_compiler"; then
4416                  MINGWCXX="$with_mingw_cross_compiler"
4417             else
4418                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
4419             fi
4421             if test "$MINGWCXX" = "false"; then
4422                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
4423             fi
4425             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
4426             if test -x "$mingwstrip_test"; then
4427                 MINGWSTRIP="$mingwstrip_test"
4428             else
4429                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
4430             fi
4432             if test "$MINGWSTRIP" = "false"; then
4433                 AC_MSG_ERROR(MinGW32 binutils not found.)
4434             fi
4435         fi
4436     fi
4437     BUILD_TYPE="$BUILD_TYPE ODK"
4438 else
4439     AC_MSG_RESULT([no])
4440     BUILD_UNOWINREG=NO
4442 AC_SUBST(BUILD_UNOWINREG)
4443 AC_SUBST(MINGWCXX)
4444 AC_SUBST(MINGWSTRIP)
4446 dnl ===================================================================
4447 dnl Check for system stdlibs
4448 dnl ===================================================================
4449 AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
4450 if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
4451     test "$with_system_stdlibs" != "no"; then
4452     AC_MSG_RESULT([no])
4453     SYSTEM_STDLIBS=YES
4454 else
4455     AC_MSG_RESULT([yes])
4456     SYSTEM_STDLIBS=NO
4458 AC_SUBST(SYSTEM_STDLIBS)
4460 dnl ===================================================================
4461 dnl Check for system zlib
4462 dnl ===================================================================
4463 AC_MSG_CHECKING([which zlib to use])
4464 if test -n "$with_system_zlib" -o -n "$with_system_libs" -o \
4465         "$_os" != "WINNT" && \
4466     test "$with_system_zlib" != "no"; then
4467     AC_MSG_RESULT([external])
4468     SYSTEM_ZLIB=YES
4469     AC_CHECK_HEADER(zlib.h, [],
4470         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
4471     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
4472         [AC_MSG_ERROR(zlib not found or functional)], [])
4473 else
4474     AC_MSG_RESULT([internal])
4475     SYSTEM_ZLIB=NO
4476     BUILD_TYPE="$BUILD_TYPE ZLIB"
4478 AC_SUBST(SYSTEM_ZLIB)
4480 dnl ===================================================================
4481 dnl Check for system jpeg
4482 dnl ===================================================================
4483 AC_MSG_CHECKING([which jpeg to use])
4484 if test -n "$with_system_jpeg" -o -n "$with_system_libs" -o \
4485         "$_os" = "Linux" && \
4486     test "$with_system_jpeg" != "no"; then
4487     AC_MSG_RESULT([external])
4488     SYSTEM_JPEG=YES
4489     AC_CHECK_HEADER(jpeglib.h, [],
4490         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
4491     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
4492     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
4493 else
4494     AC_MSG_RESULT([internal])
4495     SYSTEM_JPEG=NO
4496     BUILD_TYPE="$BUILD_TYPE JPEG"
4498 AC_SUBST(SYSTEM_JPEG)
4500 dnl ===================================================================
4501 dnl Check for system expat
4502 dnl ===================================================================
4503 AC_MSG_CHECKING([which expat to use])
4504 if test -n "$with_system_expat" -o -n "$with_system_libs" && \
4505     test "$with_system_expat" != "no"; then
4506     AC_MSG_RESULT([external])
4507     SYSTEM_EXPAT=YES
4508     AC_CHECK_HEADER(expat.h, [],
4509         [AC_MSG_ERROR(expat.h not found. install expat)], [])
4510     AC_CHECK_LIB(expat, XML_ParserCreate, [],
4511     [AC_MSG_RESULT(expat library not found or functional.)], [])
4512 else
4513     AC_MSG_RESULT([internal])
4514     SYSTEM_EXPAT=NO
4515     BUILD_TYPE="$BUILD_TYPE EXPAT"
4517 AC_SUBST(SYSTEM_EXPAT)
4519 dnl ===================================================================
4520 dnl Check for system libvisio
4521 dnl ===================================================================
4522 AC_MSG_CHECKING([which libvisio to use])
4523 if test -n "$with_system_libvisio" -a "$with_system_libvisio" = "yes"; then
4524     AC_MSG_RESULT([external])
4525     SYSTEM_LIBVISIO=YES
4526     PKG_CHECK_MODULES( LIBVISIO, libvisio-0.0 )
4527 else
4528     AC_MSG_RESULT([internal])
4529     SYSTEM_LIBVISIO=NO
4530     BUILD_TYPE="$BUILD_TYPE LIBVISIO"
4532 AC_SUBST(SYSTEM_LIBVISIO)
4533 AC_SUBST(LIBVISIO_CFLAGS)
4534 AC_SUBST(LIBVISIO_LIBS)
4537 dnl ===================================================================
4538 dnl Check for system libwpd
4539 dnl ===================================================================
4540 AC_MSG_CHECKING([which libwpd to use])
4541 if test -n "$with_system_libwpd" -o -n "$with_system_libs" && \
4542         test "$with_system_libwpd" != "no"; then
4543     AC_MSG_RESULT([external])
4544     SYSTEM_LIBWPD=YES
4545     PKG_CHECK_MODULES( LIBWPD, libwpd-0.9 libwpd-stream-0.9 )
4546 else
4547     AC_MSG_RESULT([internal])
4548     SYSTEM_LIBWPD=NO
4549     BUILD_TYPE="$BUILD_TYPE LIBWPD"
4551 AC_SUBST(SYSTEM_LIBWPD)
4552 AC_SUBST(LIBWPD_CFLAGS)
4553 AC_SUBST(LIBWPD_LIBS)
4555 dnl ===================================================================
4556 dnl Check for system cppunit
4557 dnl ===================================================================
4558 AC_MSG_CHECKING([which cppunit to use])
4559 if test -n "$with_system_cppunit" -o -n "$with_system_libs" && \
4560         test "$with_system_cppunit" != "no"; then
4561     AC_MSG_RESULT([external])
4562     SYSTEM_CPPUNIT=YES
4563     # might work for earlier, too but go sure:
4564     PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
4565 else
4566     AC_MSG_RESULT([internal])
4567     SYSTEM_CPPUNIT=NO
4568     BUILD_TYPE="$BUILD_TYPE CPPUNIT"
4570 AC_SUBST(SYSTEM_CPPUNIT)
4571 AC_SUBST(CPPUNIT_CFLAGS)
4572 AC_SUBST(CPPUNIT_LIBS)
4574 dnl ===================================================================
4575 dnl Check whether freetype is available
4576 dnl ===================================================================
4577 if test  "$test_freetype" = "yes"; then
4578     AC_MSG_CHECKING([whether freetype is available])
4579     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
4581 AC_SUBST(FREETYPE_CFLAGS)
4582 AC_SUBST(FREETYPE_LIBS)
4584 dnl ===================================================================
4585 dnl Check for system libwps
4586 dnl ===================================================================
4587 AC_MSG_CHECKING([which libwps to use])
4588 if test -n "$with_system_libwps" -o -n "$with_system_libs" && \
4589         test "$with_system_libwps" != "no"; then
4590     AC_MSG_RESULT([external])
4591     SYSTEM_LIBWPS=YES
4592     PKG_CHECK_MODULES( LIBWPS, libwps-0.2 )
4593 else
4594     AC_MSG_RESULT([internal])
4595     SYSTEM_LIBWPS=NO
4596     BUILD_TYPE="$BUILD_TYPE LIBWPS"
4598 AC_SUBST(SYSTEM_LIBWPS)
4599 AC_SUBST(LIBWPS_CFLAGS)
4600 AC_SUBST(LIBWPS_LIBS)
4602 dnl ===================================================================
4603 dnl Check for system libwpg
4604 dnl ===================================================================
4605 AC_MSG_CHECKING([which libwpg to use])
4606 if test -n "$with_system_libwpg" -o -n "$with_system_libs" && \
4607         test "$with_system_libwpg" != "no"; then
4608     AC_MSG_RESULT([external])
4609     SYSTEM_LIBWPG=YES
4610     PKG_CHECK_MODULES( LIBWPG, libwpg-0.2 )
4611 else
4612     AC_MSG_RESULT([internal])
4613     SYSTEM_LIBWPG=NO
4614     BUILD_TYPE="$BUILD_TYPE LIBWPG"
4616 AC_SUBST(SYSTEM_LIBWPG)
4617 AC_SUBST(LIBWPG_CFLAGS)
4618 AC_SUBST(LIBWPG_LIBS)
4620 dnl ===================================================================
4621 dnl Check whether freetype2 supports emboldening
4622 dnl ===================================================================
4623 if test  "$test_freetype" = "yes"; then
4624     save_CPPFLAGS="$CPPFLAGS"
4625     save_LDFLAGS="$LDFLAGS"
4626     save_LIBS="$LIBS"
4627     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
4628     LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
4629     AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
4630                  [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4631     LDFLAGS="$save_LDFLAGS"
4632     CPPFLAGS="$save_CPPFLAGS"
4633     LIBS="$save_LIBS"
4635 AC_SUBST(USE_FT_EMBOLDEN)
4637 if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
4638        test "$with_system_libxslt" != "no"; then
4639     if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
4640            test "$with_system_libxml" = "no"; then
4641         # somehow AC_MSG_WARN won't work...
4642         echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
4643         echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
4644         with_system_libxml=yes
4645     fi
4647 if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
4648        test "$with_system_libxml" != "no"; then
4649     if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
4650            test "$with_system_libxslt" = "no"; then
4651         # somehow AC_MSG_WARN won't work...
4652         echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
4653         echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
4654         with_system_libxslt=yes
4655     fi
4658 # ===================================================================
4659 # Check for system libxslt
4660 # ===================================================================
4661 AC_MSG_CHECKING([which libxslt to use])
4662 if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
4663        "$_os" = "Darwin" && \
4664        test "$with_system_libxslt" != "no"; then
4665     AC_MSG_RESULT([external])
4666     SYSTEM_LIBXSLT=YES
4667     if test "$_os" = "Darwin"; then
4668         dnl make sure to use SDK path
4669         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4670         dnl omit -L/usr/lib
4671         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
4672     else
4673         PKG_CHECK_MODULES(LIBXSLT, libxslt)
4674     fi
4676     dnl Check for xsltproc
4677     AC_PATH_PROG(XSLTPROC, xsltproc, no)
4678     if test "$XSLTPROC" = "no"; then
4679         AC_MSG_ERROR([xsltproc is required])
4680     fi
4681 else
4682     AC_MSG_RESULT([internal])
4683     SYSTEM_LIBXSLT=NO
4684     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4686     if test "$cross_compiling" = "yes"; then
4687         AC_PATH_PROG(XSLTPROC, xsltproc, no)
4688         if test "$XSLTPROC" = "no"; then
4689             AC_MSG_ERROR([xsltproc is required])
4690         fi
4691     fi
4693 AC_SUBST(SYSTEM_LIBXSLT)
4694 AC_SUBST(LIBXSLT_CFLAGS)
4695 AC_SUBST(LIBXSLT_LIBS)
4696 AC_SUBST(XSLTPROC)
4698 # ===================================================================
4699 # Check for system libxml
4700 # ===================================================================
4701 AC_MSG_CHECKING([which libxml to use])
4702 if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
4703             "$_os" = "Darwin" -o $_os = iOS && \
4704         test "$with_system_libxml" != "no"; then
4705     AC_MSG_RESULT([external])
4706     SYSTEM_LIBXML=YES
4707     if test "$_os" = "Darwin"; then
4708         dnl make sure to use SDK path
4709         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4710         dnl omit -L/usr/lib
4711         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
4712     elif test $_os = iOS; then
4713         dnl make sure to use SDK path
4714         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
4715         LIBXML_CFLAGS="-I$usr/include/libxml2"
4716         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
4717     else
4718         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4719     fi
4720     BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
4721 else
4722     AC_MSG_RESULT([internal])
4723     SYSTEM_LIBXML=NO
4724     BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
4726 AC_SUBST(SYSTEM_LIBXML)
4727 AC_SUBST(LIBXML_CFLAGS)
4728 AC_SUBST(LIBXML_LIBS)
4730 dnl ===================================================================
4731 dnl Checks for Python
4732 dnl ===================================================================
4734 AC_MSG_CHECKING([which Python to use])
4736 case "$enable_python" in
4737 no|disable)
4738     enable_python=no
4739     AC_MSG_RESULT([none])
4740     DISABLE_PYTHON=TRUE
4741     ;;
4742 ""|yes|auto)
4743     if test $build_os = cygwin; then
4744         dnl When building on Windows we don't attempt to use any installed
4745         dnl "system"  Python.
4746         dnl
4747         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
4748         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
4749         dnl MinGW cross-compilation setups.)
4750         AC_MSG_RESULT([internal])
4751         enable_python=internal
4752     elif test $_os = Darwin; then
4753         AC_MSG_RESULT([internal, neither 10.4's nor 10.5's Python is compatible with Python3-ified pyuno])
4754         enable_python=internal
4755     else
4756         AC_MSG_RESULT([checking below])
4757         enable_python=auto
4758     fi
4759     ;;
4760 internal)
4761     AC_MSG_RESULT([internal])
4762     ;;
4763 system)
4764     AC_MSG_RESULT([system])
4765     ;;
4767     AC_MSG_ERROR([Incorrect --enable-python option])
4768     ;;
4769 esac
4771 AC_SUBST(DISABLE_PYTHON)
4773 if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then
4774     AC_MSG_ERROR([Must use internal Python when building with MSVC])
4777 if test $enable_python != no; then
4778     BUILD_TYPE="$BUILD_TYPE PYUNO"
4781 if test "$cross_compiling" = yes; then
4782     if test $enable_python = auto; then
4783         enable_python=system
4784     fi
4785 else
4786     if test $enable_python = system; then
4787         dnl This causes an error if no Python found
4788         AM_PATH_PYTHON([2.6])
4789     elif test $enable_python = auto; then
4790         dnl This allows lack of system Python
4791         AM_PATH_PYTHON([2.6],, [:])
4793         if test "$PYTHON" = :; then
4794             enable_python=internal
4795         else
4796             enable_python=system
4797         fi
4798     fi
4801 if test $enable_python = system; then
4802     if test $_os = Darwin; then
4803         #TODO: conditionalize for chosen Mac-SDK (configure switch not yet available)
4804         AC_MSG_ERROR([system python is not compatible with pyuno anymore, you need to compile against Mac OSX 10.6 or later (needs Python 2.6 or newer)])
4805         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX10.6/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6"
4806         PYTHON_LIBS="-framework Python"
4807     fi
4808     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
4809         dnl Fallback: Accept these in the environment.
4810       :
4811     elif test "$cross_compiling" != yes; then
4812         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
4813         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4814         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
4815         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
4816         if $PKG_CONFIG --exists python-$python_version; then
4817                 PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
4818                 PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version`"
4819         else
4820                 PYTHON_CFLAGS="-I$python_include"
4821                 PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
4822         fi
4823     elif test "$cross_compiling" = yes; then
4824         dnl How to find out the cross-compilation Python installation path?
4825         dnl Let's hardocode what we know for different distributions for now...
4827         for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw ; do
4828             for python_version in 2.6 ; do
4829                 if test -f ${python_sysroot}/include/python${python_version}/Python.h; then
4830                     PYTHON_CFLAGS="-I ${python_sysroot}/include/python$python_version"
4831                     PYTHON_LIBS="-L ${python_sysroot}lib -lpython$python_version $python_libs"
4832                     break
4833                 fi
4834             done
4835             test -n "$PYTHON_CFLAGS" && break
4836         done
4837     fi
4840 dnl By now enable_python should be "system", "internal" or "no"
4841 case $enable_python in
4842 system)
4843     SYSTEM_PYTHON=YES
4845     dnl Check if the headers really work
4846     save_CPPFLAGS="$CPPFLAGS"
4847     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4848     AC_CHECK_HEADER(Python.h, [],
4849        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
4850        [])
4851     CPPFLAGS="$save_CPPFLAGS"
4853     dnl FIXME Check if the Python library can be linked with, too?
4854     ;;
4856 internal)
4857     SYSTEM_PYTHON=NO
4858     BUILD_TYPE="$BUILD_TYPE PYTHON"
4859     # Embedded Python dies without Home set
4860     if test "z$HOME" = "z"; then
4861         export HOME="";
4862     fi
4863     # bz2 tarball and bzip2 is not standard
4864     if test -z "$BZIP2"; then
4865         AC_PATH_PROG( BZIP2, bzip2)
4866         if test -z "$BZIP2"; then
4867             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
4868         fi
4869     fi
4870     ;;
4872     SYSTEM_PYTHON=NO
4873     ;;
4875     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
4876     ;;
4877 esac
4879 AC_SUBST(SYSTEM_PYTHON)
4880 AC_SUBST(PYTHON_CFLAGS)
4881 AC_SUBST(PYTHON_LIBS)
4883 dnl ===================================================================
4884 dnl Check for system translate-toolkit
4885 dnl ===================================================================
4886 AC_MSG_CHECKING([which translate-toolkit to use])
4887 if test "$with_system_translate_toolkit" = "yes" ; then
4888     AC_MSG_RESULT([system])
4889     SYSTEM_TRANSLATE_TOOLKIT=YES
4891     AC_PATH_PROGS(OO2PO, oo2po)
4892     if test -z "$OO2PO"; then
4893         AC_MSG_ERROR([install translate-toolkit or use --without-system-translate-toolkit])
4894     fi
4896     AC_PATH_PROGS(PO2OO, po2oo)
4897     if test -z "$PO2OO"; then
4898         AC_MSG_ERROR([install translate-toolkit or use --without-system-translate-toolkit])
4899     fi
4901     $PO2OO --help | grep -q '\-\-skipsource'
4902     if test $? -ne 0 ;  then
4903         AC_MSG_ERROR([$PO2OO does not support --skipsource; use translate-toolkit >= 1.9 or use --without-system-translate-toolkit])
4904     fi
4905 else
4906     AC_MSG_RESULT([internal])
4907     SYSTEM_TRANSLATE_TOOLKIT=NO
4908     BUILD_TYPE="$BUILD_TYPE TRANSLATE_TOOLKIT"
4910 AC_SUBST(SYSTEM_TRANSLATE_TOOLKIT)
4912 dnl ===================================================================
4913 dnl Check for system Berkeley db
4914 dnl ===================================================================
4915 AC_MSG_CHECKING([which db to use])
4916 if test -n "$with_system_db" -o -n "$with_system_libs" && \
4917     test "$with_system_db" != "no"; then
4918     SYSTEM_DB=YES
4919     AC_MSG_RESULT([external])
4921     db_header=
4922     for dbver in 5.1 5.0 5 4.8 4.7 4; do
4923         for dash in - ''; do
4924             AC_CHECK_HEADER([db$dash$dbver/db.h],
4925                 [ db_header="db$dash$dbver/db.h"; break 2 ])
4926         done
4927     done
4929     if test -z "$db_header"; then
4930         AC_CHECK_HEADER([db/db.h], [db_header='db/db.h'; dbver=''])
4931     fi
4933     if test -z "$db_header"; then
4934        AC_CHECK_HEADER(db.h, [ db_header='db.h'; dbver='' ])
4935     fi
4937     if test -z "$db_header"; then
4938         AC_MSG_ERROR([db.h not found. Use the correct -I flag, or install the Berkeley db development package.])
4939     fi
4941     AC_MSG_CHECKING([whether db is at least 4.1])
4942     AC_TRY_COMPILE([#include <$db_header>],
4943         [int array[(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1))-1];],
4944         [AC_MSG_RESULT([yes])],
4945         [AC_MSG_ERROR([no. you need at least db 4.1])])
4947     SYSTEM_DB_CFLAGS="-DSYSTEM_DB_HEADER='<$db_header>'"
4949     DB_LIB=
4950     dnl At least on OpenBSD dbver is not appended to the library
4951     if test "$_os" = "OpenBSD"; then
4952         dbver=''
4953     fi
4954     for dash in - ''; do
4955         AC_CHECK_LIB(db$dash$dbver, dbopen,
4956             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
4957         AC_CHECK_LIB(db$dash$dbver, __db185_open,
4958             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
4959     done
4961     if test -z "$DB_LIB" ; then
4962         AC_MSG_ERROR([db library not found. Use the correct -L flag,
4963 or install the Berkeley db development package.])
4964     fi
4966     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
4967 else
4968     AC_MSG_RESULT([internal])
4969     SYSTEM_DB=NO
4970     BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
4972 AC_SUBST(SYSTEM_DB)
4973 AC_SUBST(SYSTEM_DB_CFLAGS)
4974 AC_SUBST(DB_LIB)
4975 AC_SUBST(DB_CPPLIB)
4977 dnl ===================================================================
4978 dnl Check for system lucene
4979 dnl ===================================================================
4980 if test "$with_java" != "no"; then
4981 AC_MSG_CHECKING([which lucene to use])
4982 if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4983         test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4984     AC_MSG_RESULT([external])
4985     SYSTEM_LUCENE=YES
4986     if test -z $LUCENE_CORE_JAR; then
4987          AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
4988             [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
4989             [
4990               AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4991                 [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4992                 [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4993                    [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4994                    [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4995                   )
4996                 ]
4997               )
4998             ]
4999          )
5000     else
5001         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5002                [AC_MSG_ERROR(lucene-core.jar not found.)], [])
5003     fi
5005     if test -z $LUCENE_ANALYZERS_JAR; then
5006         AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
5007             [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
5008             [
5009               AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
5010                 [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
5011                 [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
5012               )
5013             ]
5014         )
5015     else
5016         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5017                [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
5018     fi
5019     AC_MSG_CHECKING([whether lucene is version 2.x])
5020     export LUCENE_CORE_JAR
5021     if $PERL -e 'use Archive::Zip;
5022             my $file = "$ENV{'LUCENE_CORE_JAR'}";
5023             my $zip = Archive::Zip->new( $file );
5024             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5025             if ( $mf =~ m/Specification-Version: 2.*/ ) {
5026                 exit 0;
5027             } else {
5028                 exit 1;
5029             }'; then
5030         AC_MSG_RESULT([yes])
5031     else
5032         AC_MSG_ERROR([no, you need lucene 2])
5033     fi
5035 else
5036     AC_MSG_RESULT([internal])
5037     SYSTEM_LUCENE=NO
5038     BUILD_TYPE="$BUILD_TYPE LUCENE"
5041 AC_SUBST(SYSTEM_LUCENE)
5042 AC_SUBST(LUCENE_CORE_JAR)
5043 AC_SUBST(LUCENE_ANALYZERS_JAR)
5045 AC_MSG_CHECKING([whether to build the MySQL Connector extension])
5046 if test -n "$enable_ext_mysql_connector" -a "$enable_ext_mysql_connector" != "no"; then
5047     AC_MSG_RESULT([yes])
5048     ENABLE_MYSQLC=YES
5049     BUILD_TYPE="$BUILD_TYPE MYSQLC"
5050 else
5051     AC_MSG_RESULT([no])
5052     ENABLE_MYSQLC=NO
5054 AC_SUBST(ENABLE_MYSQLC)
5056 if test "$ENABLE_MYSQLC" = "YES"; then
5058     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MYSQLC"
5060     dnl ===================================================================
5061     dnl Check for system MySQL
5062     dnl ===================================================================
5063     AC_MSG_CHECKING([for mysql pre-requisites])
5064     if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
5065            test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
5066         AC_MSG_RESULT([external MySQL])
5067         SYSTEM_MYSQL=YES
5068         AC_PATH_PROG( MYSQLCONFIG, mysql_config)
5069         AC_MSG_CHECKING([MySQL version])
5070         MYSQL_VERSION=`$MYSQLCONFIG --version`
5071         MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
5072         if test "$MYSQL_MAJOR" -ge "5"; then
5073             AC_MSG_RESULT([OK])
5074         else
5075             AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
5076         fi
5077         AC_MSG_CHECKING([for MySQL Client library])
5078         MYSQL_INC=`$MYSQLCONFIG --include`
5079         MYSQL_LIB=`$MYSQLCONFIG --libs`
5080         MYSQL_DEFINES=`$MYSQLCONFIG --cflags | $SED -e s,$MYSQL_INC,,`
5081         AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
5082     else
5083         SYSTEM_MYSQL=NO
5084         if test -n "$with_libmysql_path"; then
5085             AC_MSG_RESULT([external Connector/C (libmysql)])
5086             LIBMYSQL=libmysql.so
5087             if test "$_os" = "Darwin"; then
5088                 LIBMYSQL=libmysql.dylib
5089             elif test "$_os" = "WINNT"; then
5090                 LIBMYSQL=libmysql.dll
5091             fi
5092             AC_MSG_CHECKING([for $LIBMYSQL])
5093             if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
5094                 AC_MSG_RESULT([found.])
5095                 LIBMYSQL_PATH=$with_libmysql_path
5096             else
5097                 AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
5098             fi
5099         else
5100             AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
5101         fi
5102     fi
5103     AC_SUBST(SYSTEM_MYSQL)
5104     AC_SUBST(MYSQL_INC)
5105     AC_SUBST(MYSQL_LIB)
5106     AC_SUBST(MYSQL_DEFINES)
5107     AC_SUBST(LIBMYSQL_PATH)
5109     AC_LANG_PUSH([C++])
5110     dnl ===================================================================
5111     dnl Check for system MySQL C++ Connector
5112     dnl ===================================================================
5113     # FIXME!
5114     # who thought this too-generic cppconn dir was a good idea?
5115     AC_MSG_CHECKING([MySQL Connector/C++])
5116     if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
5117             test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
5118         AC_MSG_RESULT([external])
5119         SYSTEM_MYSQL_CPPCONN=YES
5120         AC_LANG_PUSH([C++])
5121         AC_CHECK_HEADER(mysql_driver.h, [],
5122                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
5123         AC_CHECK_LIB(mysqlcppconn, main, [],
5124                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
5125         AC_MSG_CHECKING([version])
5126         AC_TRY_RUN([
5127 #include <mysql_driver.h>
5129 int main(int argc, char **argv) {
5130     sql::Driver *driver;
5131     driver = get_driver_instance();
5132     if (driver->getMajorVersion() > 1 || \
5133        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
5134        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
5135         return 0;
5136       else
5137         return 1;
5139       ], [AC_MSG_RESULT(OK)], [AC_MSG_ERROR([not suitable, we need >= 1.0.6])])
5141         AC_LANG_POP([C++])
5143     else
5144         AC_MSG_RESULT([internal])
5145         AC_MSG_CHECKING([for mysqlcppconn module])
5146         if test -d mysqlcppconn; then
5147             AC_MSG_RESULT([OK])
5148         else
5149             AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
5150         fi
5151         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
5152         SYSTEM_MYSQL_CPPCONN=NO
5153     fi
5154     AC_LANG_POP([C++])
5155     AC_SUBST(SYSTEM_MYSQL_CPPCONN)
5158 dnl ===================================================================
5159 dnl Check for system hsqldb
5160 dnl ===================================================================
5161 AC_MSG_CHECKING([which hsqldb to use])
5162 if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
5163        test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
5164     AC_MSG_RESULT([external])
5165     SYSTEM_HSQLDB=YES
5166     if test -z $HSQLDB_JAR; then
5167         HSQLDB_JAR=/usr/share/java/hsqldb.jar
5168     fi
5169     AC_CHECK_FILE($HSQLDB_JAR, [],
5170                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
5171     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
5172     export HSQLDB_JAR
5173     if $PERL -e 'use Archive::Zip;
5174             my $file = "$ENV{'HSQLDB_JAR'}";
5175             my $zip = Archive::Zip->new( $file );
5176             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5177             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
5178                push @l, split(/\n/, $mf);
5179                foreach my $line (@l) {
5180                   if ($line =~ m/Specification-Version:/) {
5181                       ($t, $version) = split (/:/,$line);
5182                       $version =~ s/^\s//;
5183                       ($a, $b, $c, $d) = split (/\./,$version);
5184                       if ($c == "0" && $d > "8")  {
5185                           exit 0;
5186                       } else {
5187                           exit 1;
5188                       }
5189                   }
5190                }
5191             } else {
5192                 exit 1;
5193             }'; then
5194         AC_MSG_RESULT([yes])
5195     else
5196         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
5197     fi
5198 else
5199     AC_MSG_RESULT([internal])
5200     SYSTEM_HSQLDB=NO
5201     BUILD_TYPE="$BUILD_TYPE HSQLDB"
5203 AC_SUBST(SYSTEM_HSQLDB)
5204 AC_SUBST(HSQLDB_JAR)
5206 dnl ===================================================================
5207 dnl Check for system beanshell
5208 dnl ===================================================================
5209 if test "$with_java" != "no"; then
5210 AC_MSG_CHECKING([which beanshell to use])
5211 if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
5212        test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
5213     AC_MSG_RESULT([external])
5214     SYSTEM_BSH=YES
5215     if test -z $BSH_JAR; then
5216         BSH_JAR=/usr/share/java/bsh.jar
5217     fi
5218     AC_CHECK_FILE($BSH_JAR, [],
5219                [AC_MSG_ERROR(bsh.jar not found.)], [])
5220 else
5221     AC_MSG_RESULT([internal])
5222     SYSTEM_BSH=NO
5223     BUILD_TYPE="$BUILD_TYPE BSH"
5226 AC_SUBST(SYSTEM_BSH)
5227 AC_SUBST(BSH_JAR)
5230 dnl ===================================================================
5231 dnl Check for system saxon
5232 dnl ===================================================================
5233 if test "$with_java" != "no"; then
5234 AC_MSG_CHECKING([which saxon to use])
5235 if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
5236        test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
5237     AC_MSG_RESULT([external])
5238     SYSTEM_SAXON=YES
5239     if test -z $SAXON_JAR; then
5240         AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5241             [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5242             [
5243               AC_CHECK_FILE(/usr/share/java/saxon.jar,
5244                 [ SAXON_JAR=/usr/share/java/saxon.jar ],
5245                 [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5246                     [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5247                     [ AC_MSG_ERROR(saxon.jar replacement not found)]
5248                   )
5249                 ]
5250               )
5251             ]
5252           )
5253     else
5254         AC_CHECK_FILE($SAXON_JAR, [],
5255                [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
5256     fi
5257     if test -n "$SERIALIZER_JAR"; then
5258         AC_CHECK_FILE($SERIALIZER_JAR, [],
5259                [AC_MSG_ERROR(serializer.jar not found.)], [])
5260         AC_SUBST(SERIALIZER_JAR)
5261     fi
5263     dnl Saxon comes in two practically available versions, the out-of-date saxonb which
5264     dnl supports the Java extensions that LibreOffice uses, and the up-to-date saxon he
5265     dnl "home edition" version, which is crippled to not support those Java extensions.
5266     dnl And as an aside the he one also needs to be tweaked to include
5267     dnl a META-INF/services to broadcast that it supports the jaxp transform factory
5269     AC_MSG_CHECKING([if saxon works])
5270     cat > saxontest.java <<_ACEOF
5271 [import javax.xml.transform.TransformerFactory;
5272 import javax.xml.transform.Transformer;
5273 import javax.xml.transform.stream.StreamSource;
5274 import java.io.*;
5276 import net.sf.saxon.FeatureKeys;
5278 class saxontest {
5279     public static void main(String[] args) {
5280       System.setProperty("javax.xml.transform.TransformerFactory",
5281         "net.sf.saxon.TransformerFactoryImpl");
5282       try {
5283         TransformerFactory tfactory = TransformerFactory.newInstance();
5284     // some external saxons (Debian, Ubuntu, ...) have this disabled
5285     // per default
5286     tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
5287         System.out.println("TransformerFactory is" +
5288           tfactory.getClass().getName());
5289         Transformer transformer = tfactory.newTransformer(
5290           new StreamSource(new File(args[0])));
5291       } catch(Exception e){
5292         e.printStackTrace(System.err);
5293         System.exit(-1);
5294       }
5295       System.exit(0);
5296     }
5299 _ACEOF
5301     cat > saxontest.xsl<<_ACEOF
5302 [<?xml version="1.0" encoding="UTF-8"?>
5303 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5304  <xsl:template match="/">
5305   <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
5306  </xsl:template>
5307 </xsl:stylesheet>
5309 _ACEOF
5311     javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
5312     AC_TRY_EVAL(javac_cmd)
5313     if test $? = 0 && test -f ./saxontest.class ; then
5314         java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
5315         AC_TRY_EVAL(java_cmd)
5316         if test $? = 0; then
5317             AC_MSG_RESULT([yes])
5318         else
5319             cat saxontest.java >&5
5320             AC_MSG_RESULT([no])
5321             AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
5322         fi
5323     else
5324         AC_MSG_RESULT([no])
5325         cat saxontest.java >&5
5326         AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
5327     fi
5328 else
5329     AC_MSG_RESULT([internal])
5330     SYSTEM_SAXON=NO
5331     NEED_SAXON=TRUE
5334 AC_SUBST(SYSTEM_SAXON)
5335 AC_SUBST(SAXON_JAR)
5337 if test -n "$NEED_SAXON"; then
5338     BUILD_TYPE="$BUILD_TYPE SAXON"
5341 dnl ===================================================================
5342 dnl Check for system curl
5343 dnl ===================================================================
5344 if test "$_os" = "Darwin" -a "$with_system_curl" != "no"; then
5345     with_system_curl=yes
5347 AC_MSG_CHECKING([which libcurl to use])
5348 if test -n "$with_system_curl" -o -n "$with_system_libs" && \
5349     test "$with_system_curl" != "no"; then
5350     AC_MSG_RESULT([external])
5351     SYSTEM_CURL=YES
5353     curl_version=""
5354     if test "$cross_compiling" = "yes"; then
5355         dnl At least the OBS mingw32-libcurl-devel package
5356         dnl comes with a proper .pc file
5357         PKG_CHECK_MODULES(CURL, libcurl,, [:])
5358         if test -n "$CURL_PKG_ERRORS"; then
5359             AC_MSG_RESULT([no])
5360         else
5361             curl_version=`$PKG_CONFIG --modversion libcurl`
5362         fi
5363     fi
5364     if test -z "$curl_version"; then
5365         AC_PATH_PROG(CURLCONFIG, curl-config)
5366         if test -z "$CURLCONFIG"; then
5367             AC_MSG_ERROR([install the libcurl development package])
5368         fi
5369         CURL_LIBS=`$CURLCONFIG --libs`
5370         CURL_CFLAGS=`$CURLCONFIG --cflags`
5371         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
5372     fi
5374     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
5376     case $curl_version in
5377     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
5378     dnl so they need to be doubled to end up in the configure script
5379     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
5380         AC_MSG_RESULT([yes, you have $curl_version])
5381         ;;
5382     *)
5383         AC_MSG_ERROR([no, you have $curl_version])
5384         ;;
5385     esac
5386 else
5387     AC_MSG_RESULT([internal])
5388     SYSTEM_CURL=NO
5389     BUILD_TYPE="$BUILD_TYPE CURL"
5391 AC_SUBST(SYSTEM_CURL)
5392 AC_SUBST(CURL_CFLAGS)
5393 AC_SUBST(CURL_LIBS)
5395 dnl ===================================================================
5396 dnl Check for system boost
5397 dnl ===================================================================
5398 AC_MSG_CHECKING([which boost to use])
5399 if test -n "$with_system_boost" -o -n "$with_system_headers" && \
5400         test "$with_system_boost" != "no"; then
5401     AC_MSG_RESULT([external])
5402     SYSTEM_BOOST=YES
5403     AC_LANG_PUSH([C++])
5404     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
5405        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
5406     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
5407        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
5408     AC_CHECK_HEADER(boost/function.hpp, [],
5409        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
5410     AC_CHECK_HEADER([boost/unordered_map.hpp], [HAVE_BOOST_UNORDERED_MAP=TRUE],
5411                    [AC_MSG_WARN([boost/unordered_map.hpp not found])], [])
5413     save_CXXFLAGS=$CXXFLAGS
5414     CXXFLAGS="$CXXFLAGS -fno-exceptions"
5415     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
5416     AC_TRY_COMPILE([#include <boost/function.hpp>
5417 ], [], ac_cv_cxx_boost_no_exceptions_broken=no, ac_cv_cxx_boost_no_exceptions_broken=yes)
5419     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
5420         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
5421     else
5422         AC_MSG_RESULT([yes])
5423     fi
5424     CXXFLAGS=$save_CXXFLAGS
5425     AC_LANG_POP([C++])
5426 else
5427     AC_MSG_RESULT([internal])
5428     BUILD_TYPE="$BUILD_TYPE BOOST"
5429     SYSTEM_BOOST=NO
5430     HAVE_BOOST_UNORDERED_MAP=TRUE
5432 AC_SUBST([HAVE_BOOST_UNORDERED_MAP])
5433 AC_SUBST(SYSTEM_BOOST)
5435 dnl ===================================================================
5436 dnl Check for system mdds
5437 dnl ===================================================================
5438 AC_MSG_CHECKING([which mdds to use])
5439 if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
5440         test "$with_system_mdds" != "no"; then
5441     AC_MSG_RESULT([external])
5442     SYSTEM_MDDS=YES
5444     dnl ===================================================================
5445     dnl Determine which hash container mdds shall use
5446     dnl ===================================================================
5447     AC_MSG_CHECKING([which hash container mdds shall use])
5448     if test "x$HAVE_CXX0X" = "xTRUE"; then
5449         MDDS_CPPFLAGS="-std=c++0x"
5450         AC_MSG_RESULT([std::unordered_map])
5451     else
5452         MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5453         AC_MSG_RESULT([boost::unordered_map])
5454     fi
5456     AC_LANG_PUSH([C++])
5457     save_CPPFLAGS="$CPPFLAGS"
5458     CPPFLAGS="$CPPFLAGS $MDDS_CPPFLAGS"
5459     AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
5460         [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
5461     AC_CHECK_HEADER(mdds/mixed_type_matrix.hpp, [],
5462         [AC_MSG_ERROR(mdds/mixed_type_matrix.hpp not found. install mdds >= 0.4.0)], [])
5463     CPPFLAGS="$save_CPPFLAGS"
5464     save_CXXFLAGS="$CXXFLAGS"
5465     CXXFLAGS="$CXXFLAGS $MDDS_CPPFLAGS"
5466     AC_MSG_CHECKING([for correct signature of ::mdds::flat_segment_tree])
5467     AC_TRY_RUN([#include <mdds/flat_segment_tree.hpp>
5469     int main(int argc, char **argv) {
5470         ::mdds::flat_segment_tree<long, short> db(0, 100, 0);
5471         short val;
5472         if (!db.search(5, val).second)
5473             return 1;
5474         return 0;
5475     }
5476 ], ac_cv_cxx_mdds_flat_segment_tree_correct=yes, ac_cv_cxx_mdds_flat_segment_tree_correct=no)
5478     if test "$ac_cv_cxx_mdds_flat_segment_tree_correct" = "yes"; then
5479         AC_MSG_RESULT([yes])
5480     else
5481         AC_MSG_ERROR([no, install mdds >= 0.5.0])
5482     fi
5483     CXXFLAGS=$save_CXXFLAGS
5484     AC_LANG_POP([C++])
5485 else
5486     AC_MSG_RESULT([internal])
5487     BUILD_TYPE="$BUILD_TYPE MDDS"
5488     SYSTEM_MDDS=NO
5490     dnl ===================================================================
5491     dnl Determine which hash container mdds shall use
5492     dnl ===================================================================
5493     AC_MSG_CHECKING([which hash container mdds shall use])
5494     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5495     AC_MSG_RESULT([boost::unordered_map])
5497 AC_SUBST(SYSTEM_MDDS)
5498 AC_SUBST([MDDS_CPPFLAGS])
5500 dnl ===================================================================
5501 dnl Check for system vigra
5502 dnl ===================================================================
5503 AC_MSG_CHECKING([which vigra to use])
5504 if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
5505         test "$with_system_vigra" != "no"; then
5506     AC_MSG_RESULT([external])
5507     SYSTEM_VIGRA=YES
5508     AC_LANG_PUSH([C++])
5509     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
5510        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
5511     AC_LANG_POP([C++])
5512 else
5513     AC_MSG_RESULT([internal])
5514     BUILD_TYPE="$BUILD_TYPE VIGRA"
5515     SYSTEM_VIGRA=NO
5517 AC_SUBST(SYSTEM_VIGRA)
5519 dnl ===================================================================
5520 dnl Check for system odbc
5521 dnl ===================================================================
5522 AC_MSG_CHECKING([which odbc headers to use])
5523 if test -n "$with_system_odbc" -o -n "$with_system_headers" && \
5524         test "$with_system_odbc" != "no"; then
5525     AC_MSG_RESULT([external])
5526     SYSTEM_ODBC_HEADERS=YES
5528     AC_CHECK_HEADER(sqlext.h, [],
5529       [AC_MSG_ERROR(odbc not found. install odbc)], [])
5530 else
5531     AC_MSG_RESULT([internal])
5532     SYSTEM_ODBC_HEADERS=NO
5533     BUILD_TYPE="$BUILD_TYPE UNIXODBC"
5535 AC_SUBST(SYSTEM_ODBC_HEADERS)
5537 AC_MSG_CHECKING([whether to enable build of Mozilla/Mozilla NSS-using components])
5538 if test "$enable_mozilla" = "no"; then
5539     AC_MSG_RESULT([no])
5540     WITH_MOZILLA=NO
5541     ENABLE_NSS_MODULE=NO
5542 else
5543     AC_MSG_RESULT([yes])
5544     WITH_MOZILLA=YES
5546 AC_SUBST(WITH_MOZILLA)
5548 AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
5549 if test "$enable_mozilla" = "no"; then
5550     AC_MSG_RESULT([no])
5551 elif test "$with_system_mozilla" = "yes"; then
5552     AC_MSG_RESULT([no, not possible with system-mozilla])
5553 else
5554     AC_MSG_RESULT([yes])
5557 AC_MSG_CHECKING([whether to build XML Security support])
5558 if test "$enable_mozilla" = "no"; then
5559     AC_MSG_RESULT([no, since Mozilla (NSS) disabled but needed])
5560 else
5561     AC_MSG_RESULT([yes])
5564 AC_MSG_CHECKING([whether to build LDAP configuration backend])
5565 if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
5566     if test "$enable_mozilla" = "yes" || test "$with_openldap" = "yes"; then
5567         AC_MSG_RESULT([yes])
5568         WITH_LDAP=YES
5569     else
5570         AC_MSG_RESULT([no. Either Mozilla or OpenLDAP needed])
5571         WITH_LDAP=NO
5572     fi
5573 else
5574     AC_MSG_RESULT([no])
5575     WITH_LDAP=NO
5578 if test "$WITH_LDAP" = "YES"; then
5579     dnl ===================================================================
5580     dnl Test whether we want to use the Mozilla or the OpenLDAP LDAP SDK
5581     dnl ===================================================================
5582     AC_MSG_CHECKING([which LDAP SDK to use])
5583     if test -n "$with_openldap" && test "$with_openldap" != "no"; then
5584         AC_MSG_RESULT([OpenLDAP])
5585         WITH_OPENLDAP=YES
5586         AC_CHECK_HEADERS(ldap.h, [],
5587            [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
5588         AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
5589            [AC_MSG_ERROR(openldap lib not found or functional)], [])
5590         # rumours say that OpenLDAP doesn't have that function. I looked and
5591         # it has it. Test for it to be sure
5592         AC_CHECK_LIB(ldap, ldap_set_option, [],
5593                 [AC_MSG_ERROR(openldap lib not found or functional)], [])
5594     else
5595         AC_MSG_RESULT([Netscape/Mozilla])
5596         # TODO. Actually do a sanity check and check for
5597         # LDAP_OPT_SIZELIMIT and LDAP_X_OPT_CONNECT_TIMEOUT
5598         WITH_OPENLDAP=NO
5599     fi
5601 AC_SUBST(WITH_LDAP)
5602 AC_SUBST(WITH_OPENLDAP)
5604 AC_OUTPUT([ooo.lst])
5606 dnl ===================================================================
5607 dnl Check for system mozilla
5608 dnl ===================================================================
5609 AC_MSG_CHECKING([which Mozilla to use])
5610 if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
5611     AC_MSG_RESULT([external])
5612     SYSTEM_MOZILLA=YES
5613     ENABLE_NSS_MODULE=NO
5614     enable_nss_module=no
5615     AC_MSG_CHECKING([which Mozilla flavour to use])
5616     if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
5617         MOZ_FLAVOUR=libxul
5618     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
5619         MOZ_FLAVOUR=xulrunner
5620     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
5621         MOZ_FLAVOUR=seamonkey
5622     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
5623         MOZ_FLAVOUR=firefox
5624     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
5625         MOZ_FLAVOUR=mozilla
5626     else
5627         MOZ_FLAVOUR=libxul
5628     fi
5629     tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
5630     AC_MSG_RESULT($tmp)
5632     PKG_CHECK_MODULES( MOZ_NSS, nss, STANDALONENSS="TRUE", STANDALONENSS="" )
5633     if test -z "$STANDALONENSS"; then
5634         PKG_CHECK_MODULES( MOZ_NSS, $MOZ_FLAVOUR-nss )
5635     else
5636         NSS_LIB="-L`$PKG_CONFIG --variable=libdir nss`"
5637         AC_SUBST(NSS_LIB)
5638     fi
5640     if $PKG_CONFIG --exists nspr ; then
5641         PKG_CHECK_MODULES( MOZ_NSPR, nspr )
5642         NSPR_LIB="-L`$PKG_CONFIG --variable=libdir nspr`"
5643         AC_SUBST(NSPR_LIB)
5644     else
5645         PKG_CHECK_MODULES( MOZ_NSPR, $MOZ_FLAVOUR-nspr )
5646     fi
5648     if test "$MOZ_FLAVOUR" != "libxul"; then
5649         PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
5650         MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
5651         MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
5652     fi
5654     if test -z "$HASXPCOM"; then
5655         PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
5656         MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
5657         MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
5658         if ! test -e "$MOZ_LIB/libxul.so"; then
5659             MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
5660             if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
5661                 MOZ_LIB="$MOZ_LIB/sdk/lib"
5662             fi
5663         fi
5664     fi
5666     save_CPPFLAGS="$CPPFLAGS"
5667     save_LDFLAGS="$LDFLAGS"
5668     save_LIBS="$LIBS"
5669     CPPFLAGS="$CPPFLAGS $MOZ_NSS_CFLAGS"
5670     LDFLAGS="$LDFLAGS $MOZ_NSS_LIBS"
5671     AC_CHECK_LIB(nss3, PK11_GetCertFromPrivateKey, [],
5672       [AC_MSG_ERROR(PK11_GetCertFromPrivateKey missing but needed.
5673 See https://bugzilla.mozilla.org/show_bug.cgi?id=262274.
5674 Fixed since nss 3.9.3 (contained by e.g. mozilla >= 1.7.5))], [])
5675     LDFLAGS="$save_LDFLAGS"
5676     CPPFLAGS="$save_CPPFLAGS"
5677     LIBS="$save_LIBS"
5679     MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
5680     if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
5681         AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
5682         if test -d "$MOZ_INC/ldap"; then
5683             AC_MSG_RESULT([yes])
5684             MOZ_LDAP_CFLAGS="-I$MOZ_INC"
5685         else
5686             AC_MSG_ERROR([no.
5687 Could not find LDAP header include files in $MOZ_INC/ldap.
5688 Please recompile $tmp with --enable-ldap or use --with-openldap.])
5689         fi
5690     fi
5692     #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
5693     #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
5694     if test "$MOZ_FLAVOUR" = "libxul"; then
5695         MOZ_FLAVOUR="mozilla"
5696     fi
5698 elif test "$enable_mozilla" = "no"; then
5699     AC_MSG_RESULT([none])
5700     WITH_MOZILLA=NO
5701     ENABLE_NSS_MODULE=NO
5702     enable_nss_module=no
5703 else
5704     AC_MSG_RESULT([internal])
5705     SYSTEM_MOZILLA=NO
5706     BUILD_TYPE="$BUILD_TYPE MOZ"
5707 if test -z "$with_mozilla_version"; then
5708     MOZILLA_VERSION=
5709 else
5710     AC_MSG_CHECKING([which Mozilla version to build])
5711     MOZILLA_VERSION=$with_mozilla_version
5712     enable_build_mozilla=1
5713     AC_MSG_RESULT([$MOZILLA_VERSION])
5716 AC_SUBST(MOZILLA_VERSION)
5718 AC_MSG_CHECKING([for toolkit Mozilla should use])
5719 if test -z "$with_mozilla_toolkit"; then
5720     if test "$_os" != "WINNT" ; then
5721         if test "$_os" = "Darwin" ; then
5722             MOZILLA_TOOLKIT=mac
5723             AC_MSG_RESULT([mac])
5724         else
5725             MOZILLA_TOOLKIT=gtk2
5726             AC_MSG_RESULT([gtk2])
5727         fi
5728     fi
5729 else
5730     MOZILLA_TOOLKIT=$with_mozilla_toolkit
5731     enable_build_mozilla=1
5732     AC_MSG_RESULT([$MOZILLA_TOOLKIT])
5734 #if test "$_os" = "Darwin" && test "$MOZILLA_TOOLKIT" != "gtk2"; then
5735 #   #only gtk2 toolkit supported - xlib or cocoa nees glib1 and libIDL1 - the latter is not
5736 #   #available using fink, mac (carbon) doesn't work because xcode installs conflicting headers
5737 #   AC_MSG_ERROR([Only gtk2 toolkit supported on Mac, sorry.])
5740 AC_SUBST(MOZILLA_TOOLKIT)
5742 # default to enabling build mozilla
5743 if test "$enable_build_mozilla" != "no"; then
5744     enable_build_mozilla=yes
5745 else
5746     enable_build_mozilla=
5749 AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
5750 if test -n "$enable_build_mozilla"; then
5751     BUILD_MOZAB="TRUE"
5752     AC_MSG_RESULT([yes])
5753 else
5754     BUILD_MOZAB=""
5755     AC_MSG_RESULT([no])
5758 AC_MSG_CHECKING([whether to build provided NSS module])
5759 if test "$enable_nss_module" != "no"; then
5760     ENABLE_NSS_MODULE="YES"
5761     BUILD_TYPE="$BUILD_TYPE NSS"
5762     AC_MSG_RESULT([yes])
5763     if test "$build_os" = "cygwin"; then
5764         AC_MSG_CHECKING([for Mozilla build tooling])
5765         if test -z "$MOZILLABUILD" ; then
5766             AC_MSG_ERROR([Mozilla build tooling not found.
5767 Use the --with-mozilla-build option after installing the tools obtained
5768 from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
5769         else
5770             if test \( "$WITH_MINGW" = "yes" \) ; then
5771                 if test ! -d "$MOZILLABUILD" ; then
5772                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
5773                 else
5774                     AC_MSG_RESULT([ok])
5775                 fi
5776             else
5777                 if test ! -d "$MOZILLABUILD/moztools" \
5778                         -o ! -d "$MOZILLABUILD/msys" ; then
5779                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
5780                 else
5781                     AC_MSG_RESULT([ok])
5782                 fi
5783             fi
5784         fi
5785     fi
5786 else
5787     ENABLE_NSS_MODULE="NO"
5788     AC_MSG_RESULT([no])
5792 if test "$BUILD_MOZAB" = "TRUE"; then
5793     if test "$_os" = "WINNT"; then
5794         if test "$WITH_MINGW" != "yes"; then
5795             # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
5796             if test "$MSVSVER" != "2005"; then
5797                 AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio 2005 only.])
5798             fi
5799         else
5800             AC_MSG_WARN([Building SeaMonkey with MinGW is not tested, and likely to break.])
5801             echo "Building SeaMonkey with MinGW is not tested, and likely to break." >> warn
5802         fi
5803     fi
5805     if test -z "$MOZILLA_VERSION"; then
5806         MOZILLA_VERSION=1.1.14
5807     fi
5808     MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
5809     MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst`
5810     AC_MSG_CHECKING([for Mozilla sources])
5811     if test -z "$MOZILLA_FETCH_FILE"; then
5812         AC_MSG_RESULT([not found])
5813         HAVE_MOZILLA_TARBALL=n
5814     else
5815         AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
5816         if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
5817             if test -z "$DO_FETCH"; then
5818                 AC_MSG_RESULT([will be fetched])
5819                 HAVE_MOZILLA_TARBALL=y
5820             else
5821                 AC_MSG_RESULT([not found])
5822                 HAVE_MOZILLA_TARBALL=n
5823             fi
5824         else
5825             AC_MSG_RESULT([found])
5826             HAVE_MOZILLA_TARBALL=y
5827         fi
5828     fi
5829     if test "$HAVE_MOZILLA_TARBALL" != "y"; then
5830         AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
5831 Use "./download" to download.])
5832     fi
5833     if test "$_os" = "WINNT"; then
5834         AC_MSG_CHECKING([for moztools binaries])
5835         if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
5836             AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
5837 (from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
5838         else
5839             AC_MSG_RESULT([ok])
5840         fi
5841     elif test "$_os" = "Darwin"; then
5842         if test "$MOZILLA_TOOLKIT" = "gtk2"; then
5843             AC_MSG_NOTICE([checking whether Mozilla can be built...])
5844             PKG_CHECK_MODULES(MOZGTK2, gtk+-2.0 >= 2.4 libIDL-2.0 >= 0.8, AC_MSG_NOTICE([OK - can build Mozilla]), AC_MSG_ERROR([Prerequisites to build Mozilla not met. Either use the precompiled Mozilla binaries or install the missing packages]))
5845         else
5846             PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
5847             if test -z "$MOZIDL"; then
5848                 AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build Mozilla with Mac toolkit.])
5849             fi
5850         fi
5851     else
5852         # Generic Unix/Linux section
5853         if test "$MOZILLA_TOOLKIT" = "gtk2"; then
5854             PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
5855             if test -z "$MOZGTK"; then
5856                 AC_MSG_ERROR([GTK2 is needed to build Mozilla.])
5857             fi
5858             PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
5859             if test -z "$MOZIDL"; then
5860                 AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build Mozilla.])
5861             fi
5862         else
5863             PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
5864             if test -z "$MOZGTK"; then
5865                 AC_MSG_ERROR([GTK+ 1.2 is needed when not using GTK2 to build Mozilla.])
5866             fi
5867             PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
5868             if test -z "$MOZIDL"; then
5869                 AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build Mozilla.])
5870             fi
5871         fi
5872     fi
5875 AC_SUBST(BUILD_MOZAB)
5878 AC_SUBST(ENABLE_NSS_MODULE)
5879 AC_SUBST(MOZILLABUILD)
5880 AC_SUBST(SYSTEM_MOZILLA)
5881 AC_SUBST(MOZ_FLAVOUR)
5882 AC_SUBST(MOZ_INC)
5883 AC_SUBST(MOZ_LIB)
5884 AC_SUBST(MOZ_LIB_XPCOM)
5885 AC_SUBST(MOZ_NSPR_CFLAGS)
5886 AC_SUBST(MOZ_NSS_CFLAGS)
5887 AC_SUBST(MOZ_LDAP_CFLAGS)
5889 dnl ===================================================================
5890 dnl Check for system sane
5891 dnl ===================================================================
5892 AC_MSG_CHECKING([which sane header to use])
5893 if test -n "$with_system_sane" -o -n "$with_system_headers" && \
5894         test "$with_system_sane" != "no"; then
5895     AC_MSG_RESULT([external])
5896     SYSTEM_SANE_HEADER=YES
5897     AC_CHECK_HEADER(sane/sane.h, [],
5898       [AC_MSG_ERROR(sane not found. install sane)], [])
5899 else
5900     AC_MSG_RESULT([internal])
5901     SYSTEM_SANE_HEADER=NO
5902     BUILD_TYPE="$BUILD_TYPE SANE"
5904 AC_SUBST(SYSTEM_SANE_HEADER)
5906 dnl ===================================================================
5907 dnl Check for system icu
5908 dnl ===================================================================
5909 ICU_MAJOR=
5910 ICU_MINOR=
5911 ICU_MICRO=
5912 AC_MSG_CHECKING([which icu to use])
5913 if test -n "$with_system_icu" -o -n "$with_system_libs" && \
5914         test "$with_system_icu" != "no"; then
5915     AC_MSG_RESULT([external])
5916     SYSTEM_ICU=YES
5917     AC_LANG_PUSH([C++])
5918     AC_MSG_CHECKING([for unicode/rbbi.h])
5919     AC_TRY_CPP(unicode/rbbi.h, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([icu headers not found.]))
5920     AC_LANG_POP([C++])
5921     AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
5922     if test -z "$SYSTEM_GENBRK"; then
5923         AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk\"])
5924     fi
5925     AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
5926     if test -z "$SYSTEM_GENCCODE"; then
5927         AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode\"])
5928     fi
5929     AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
5930     if test -z "$SYSTEM_GENCMN"; then
5931         AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn\"])
5932     fi
5934     AC_PATH_PROG( ICUCONFIG, icu-config)
5935     AC_MSG_CHECKING([ICU version])
5936     ICU_VERSION=`$ICUCONFIG --version`
5937     ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
5938     ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
5939     ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
5941     if test "$ICU_MAJOR" -ge "4"; then
5942         AC_MSG_RESULT([OK])
5943     else
5944         AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
5945     fi
5947 else
5948     AC_MSG_RESULT([internal])
5949     SYSTEM_ICU=NO
5950     BUILD_TYPE="$BUILD_TYPE ICU"
5952 AC_SUBST(SYSTEM_ICU)
5953 AC_SUBST(SYSTEM_GENBRK)
5954 AC_SUBST(SYSTEM_GENCCODE)
5955 AC_SUBST(SYSTEM_GENCMN)
5956 AC_SUBST(ICU_MAJOR)
5957 AC_SUBST(ICU_MINOR)
5958 AC_SUBST(ICU_MICRO)
5960 dnl ===================================================================
5961 dnl Graphite
5962 dnl ===================================================================
5964 AC_MSG_CHECKING([whether to enable graphite support])
5965 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
5966     AC_MSG_RESULT([yes])
5967     ENABLE_GRAPHITE="TRUE"
5968     AC_MSG_CHECKING([which graphite to use])
5969     if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
5970         test "$with_system_graphite" != "no"; then
5971         AC_MSG_RESULT([external])
5972         SYSTEM_GRAPHITE=YES
5973         PKG_CHECK_MODULES( GRAPHITE, graphite2 >= 0.9.3 )
5974     else
5975         AC_MSG_RESULT([internal])
5976         SYSTEM_GRAPHITE=NO
5977         BUILD_TYPE="$BUILD_TYPE GRAPHITE"
5978     fi
5979 else
5980     AC_MSG_RESULT([no])
5982 AC_SUBST(ENABLE_GRAPHITE)
5983 AC_SUBST(SYSTEM_GRAPHITE)
5984 AC_SUBST(GRAPHITE_LIBS)
5985 AC_SUBST(GRAPHITE_CFLAGS)
5987 dnl ===================================================================
5988 dnl Checks for libraries.
5989 dnl ===================================================================
5990 dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
5991 dnl See if we have the AppKit framework for building with Quartz graphics.
5993 if test  "$_os" = "Darwin"; then
5994     if test "x$with_x" = "xyes"; then
5995         AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
5996     else
5997         AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
5998         if test -d "/System/Library/Frameworks/AppKit.framework/"; then
5999             AC_MSG_RESULT([yes])
6000             x_includes="no_x_includes"
6001             x_libraries="no_x_libraries"
6002             dnl disable some things used on other Unix versions but not on the aqua build
6003             enable_gtk=no
6004         else
6005             AC_MSG_ERROR([No AppKit.framewrok found])
6006         fi
6007     fi
6010 if test $_os = iOS -o $_os = Android; then
6011     enable_gtk=no
6014 dnl ***************************************
6015 dnl testing for X libraries and includes...
6016 dnl ***************************************
6017 if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
6018     dnl Mac OS X using Aqua graphics. Don't check for X11.
6019     :
6020 elif test "$_os" != "WINNT" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6021     AC_PATH_X
6022     AC_PATH_XTRA
6023     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
6025     if test "x$x_includes" = "x"; then
6026         x_includes="default_x_includes"
6027     fi
6028     if test "x$x_libraries" = "x"; then
6029         x_libraries="default_x_libraries"
6030     fi
6031     dnl The variables $x_libraries and $x_includes are set.
6032     if test -z "$x_libraries"; then
6033         AC_MSG_ERROR([No X libraries found]) # Exit
6034     fi
6035     if test -z "$x_includes"; then
6036         AC_MSG_ERROR([No X includes found]) # Exit
6037     fi
6038     CFLAGS="$CFLAGS $X_CFLAGS"
6039     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
6040     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
6041     dnl Check if the XauDisposeAuth symbol is provided by libXau.
6042     AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
6043 else
6044     x_includes="no_x_includes"
6045     x_libraries="no_x_libraries"
6047 if test -z "$x_includes"; then
6048     x_includes="no_x_includes"
6050 if test -z "$x_libraries"; then
6051     x_libraries="no_x_libraries"
6053 if test "$x_includes" = "default_x_includes"; then
6054     XINC="/usr/include"
6055 else
6056     XINC="$x_includes"
6058 AC_SUBST(XINC)
6059 if test "$x_libraries" = "default_x_libraries"; then
6060     XLIB=`$PKG_CONFIG --variable=libdir x11`
6061     if test "x$XLIB" = x; then
6062         XLIB="/usr/lib"
6063     fi
6064 else
6065     XLIB="$x_libraries"
6067 AC_SUBST(XLIB)
6068 AC_SUBST(XAU_LIBS)
6070 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6071     dnl ===================================================================
6072     dnl Check for Composite.h for Mozilla plugin
6073     dnl ===================================================================
6074     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
6075      [#include <X11/Intrinsic.h>])
6079 dnl ===================================================================
6080 dnl Check for system Xrender
6081 dnl ===================================================================
6082 AC_MSG_CHECKING([whether to link to Xrender])
6083 if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
6084     AC_MSG_RESULT([yes])
6085     XRENDER_LINK=YES
6086     with_system_xrender_headers=yes
6087 else
6088     AC_MSG_RESULT([no, dynamically open it])
6089     XRENDER_LINK=NO
6091 AC_MSG_CHECKING([which Xrender headers to use])
6092 if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
6093         test "$with_system_xrender_headers" != "no"; then
6094     AC_MSG_RESULT([external])
6095     SYSTEM_XRENDER_HEADERS=YES
6096     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
6097       [AC_MSG_ERROR(Xrender not found. install X)], [])
6098 else
6099     AC_MSG_RESULT([internal])
6100     SYSTEM_XRENDER_HEADERS=NO
6101     BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
6103 if test "$XRENDER_LINK" = "YES"; then
6104     AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
6105       [AC_MSG_ERROR(libXrender not found or functional)], [])
6107 AC_SUBST(SYSTEM_XRENDER_HEADERS)
6108 AC_SUBST(XRENDER_LINK)
6110 dnl ===================================================================
6111 dnl Check for XRandr
6112 dnl ===================================================================
6113 AC_MSG_CHECKING([whether to enable RandR support])
6114 if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
6115     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
6116         XRANDR_DLOPEN="TRUE"
6117         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
6118     else
6119         AC_MSG_RESULT([yes])
6120         XRANDR_DLOPEN="FALSE"
6121         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
6122         if test "$ENABLE_RANDR" != "TRUE"; then
6123             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
6124                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
6125             XRANDR_CFLAGS=" "
6126             AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
6127               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
6128             XRANDR_LIBS="-lXrandr "
6129             ENABLE_RANDR="TRUE"
6130         fi
6131     fi
6132 else
6133     ENABLE_RANDR=""
6134     AC_MSG_RESULT([no])
6136 AC_SUBST(XRANDR_DLOPEN)
6137 AC_SUBST(XRANDR_CFLAGS)
6138 AC_SUBST(XRANDR_LIBS)
6139 AC_SUBST(ENABLE_RANDR)
6141 dnl ===================================================================
6142 dnl Check for building neon
6143 dnl ===================================================================
6144 AC_MSG_CHECKING([whether to use neon])
6145 if test "$enable_neon" = "no"; then
6146     AC_MSG_RESULT([no])
6147     DISABLE_NEON=TRUE
6148     AC_SUBST(DISABLE_NEON)
6149 else
6150     AC_MSG_RESULT([yes])
6151 dnl ===================================================================
6152 dnl Check for system neon
6153 dnl ===================================================================
6154 AC_MSG_CHECKING([which neon to use])
6155 if test -n "$with_system_neon" -o -n "$with_system_libs" && \
6156         test "$with_system_neon" != "no"; then
6157     AC_MSG_RESULT([external])
6158     PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
6159     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
6160     NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
6161     SYSTEM_NEON=YES
6162 else
6163     AC_MSG_RESULT([internal])
6164     SYSTEM_NEON=NO
6165     NEON_LIBS=-lneon
6166     NEON_CFLAGS=
6167     BUILD_TYPE="$BUILD_TYPE NEON"
6169 AC_SUBST(SYSTEM_NEON)
6170 AC_SUBST(NEON_VERSION)
6171 AC_SUBST(NEON_LIBS)
6172 AC_SUBST(NEON_CFLAGS)
6175 dnl ===================================================================
6176 dnl Check for system openssl
6177 dnl ===================================================================
6178 if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6179         "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
6180     with_system_openssl=yes
6182 AC_MSG_CHECKING([which libssl to use])
6183 if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
6184         test "$with_system_openssl" != "no"; then
6185     AC_MSG_RESULT([external])
6186     # Mac OS builds should get out without extra stuff is the Mac porters'
6187     # wish. And pkg-config is although Xcode ships a .pc for openssl
6188     if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6189             "$_os" = "DragonFly"; then
6190         OPENSSL_CFLAGS=
6191         OPENSSL_LIBS="-lssl -lcrypto"
6192     else
6193         PKG_CHECK_MODULES( OPENSSL, openssl )
6194     fi
6195     SYSTEM_OPENSSL=YES
6196 else
6197     AC_MSG_RESULT([internal])
6198     SYSTEM_OPENSSL=NO
6199     BUILD_TYPE="$BUILD_TYPE OPENSSL"
6201 AC_SUBST(SYSTEM_OPENSSL)
6202 AC_SUBST(OPENSSL_CFLAGS)
6203 AC_SUBST(OPENSSL_LIBS)
6205 dnl ===================================================================
6206 dnl Check for system redland
6207 dnl ===================================================================
6208 AC_MSG_CHECKING([which redland library to use])
6209 if test -n "$with_system_redland" -o -n "$with_system_libs" && \
6210         test "$with_system_redland" != "no"; then
6211     AC_MSG_RESULT([external])
6212     SYSTEM_REDLAND=YES
6213     dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
6214     PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
6215 else
6216     AC_MSG_RESULT([internal])
6217     BUILD_TYPE="$BUILD_TYPE REDLAND"
6218     SYSTEM_REDLAND=NO
6220 AC_SUBST(SYSTEM_REDLAND)
6221 AC_SUBST(REDLAND_CFLAGS)
6222 AC_SUBST(REDLAND_LIBS)
6224 dnl ===================================================================
6225 dnl Check for system hunspell
6226 dnl ===================================================================
6227 AC_MSG_CHECKING([which libhunspell to use])
6228 if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
6229         test "$with_system_hunspell" != "no"; then
6230     AC_MSG_RESULT([external])
6231     SYSTEM_HUNSPELL=YES
6232     AC_LANG_PUSH([C++])
6233     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
6234     if test "$HUNSPELL_PC" != "TRUE"; then
6235         AC_CHECK_HEADER(hunspell.hxx, [],
6236             [
6237             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
6238             [AC_MSG_ERROR(hunspell headers not found.)], [])
6239             ], [])
6240         AC_CHECK_LIB(hunspell, main, [],
6241            [ AC_MSG_ERROR(hunspell library not found.) ], [])
6242         HUNSPELL_LIBS=-lhunspell
6243     fi
6244     AC_LANG_POP([C++])
6245 else
6246     AC_MSG_RESULT([internal])
6247     SYSTEM_HUNSPELL=NO
6248     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
6250 AC_SUBST(SYSTEM_HUNSPELL)
6251 AC_SUBST(HUNSPELL_CFLAGS)
6252 AC_SUBST(HUNSPELL_LIBS)
6254 dnl ===================================================================
6255 dnl Checking for altlinuxhyph
6256 dnl ===================================================================
6257 AC_MSG_CHECKING([which altlinuxhyph to use])
6258 if test -n "$with_system_altlinuxhyph" -o -n "$with_system_libs" && \
6259         test "$with_system_altlinuxhyph" != "no"; then
6260     AC_MSG_RESULT([external])
6261     SYSTEM_HYPH=YES
6262     AC_CHECK_HEADER(hyphen.h, [],
6263        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
6264     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
6265        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
6266        [#include <hyphen.h>])
6267     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
6268         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6269     if test -z "$HYPHEN_LIB"; then
6270         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
6271            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6272     fi
6273     if test -z "$HYPHEN_LIB"; then
6274         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
6275            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6276     fi
6277 else
6278     AC_MSG_RESULT([internal])
6279     SYSTEM_HYPH=NO
6280     BUILD_TYPE="$BUILD_TYPE HYPHEN"
6282 AC_SUBST(SYSTEM_HYPH)
6283 AC_SUBST(HYPHEN_LIB)
6285 dnl ===================================================================
6286 dnl Checking for mythes
6287 dnl ===================================================================
6288 AC_MSG_CHECKING([which mythes to use])
6289 if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
6290        test "$with_system_mythes" != "no"; then
6291     AC_MSG_RESULT([external])
6292     SYSTEM_MYTHES=YES
6293     AC_LANG_PUSH([C++])
6294     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
6295     if test "$MYTHES_PKGCONFIG" = "no"; then
6296         AC_CHECK_HEADER(mythes.hxx, [],
6297             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
6298         AC_CHECK_LIB(mythes-1.2, main, [],
6299             [ MYTHES_FOUND=no], [])
6300     if test "$MYTHES_FOUND" = "no"; then
6301         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
6302                 [ MYTHES_FOUND=no], [])
6303     fi
6304     if test "$MYTHES_FOUND" = "no"; then
6305         AC_MSG_ERROR([mythes library not found!.])
6306     fi
6307     fi
6308     AC_LANG_POP([C++])
6309 else
6310     AC_MSG_RESULT([internal])
6311     SYSTEM_MYTHES=NO
6312     BUILD_TYPE="$BUILD_TYPE MYTHES"
6314 AC_SUBST(SYSTEM_MYTHES)
6315 AC_SUBST(MYTHES_CFLAGS)
6316 AC_SUBST(MYTHES_LIBS)
6318 dnl ===================================================================
6319 dnl Checking for lpsolve
6320 dnl ===================================================================
6321 AC_MSG_CHECKING([which lpsolve to use])
6322 if test -n "$with_system_lpsolve" -o -n "$with_system_libs" && \
6323         test "$with_system_lpsolve" != "no"; then
6324     AC_MSG_RESULT([external])
6325     SYSTEM_LPSOLVE=YES
6326     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
6327        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
6328     # some systems need this. Like Ubuntu....
6329     AC_CHECK_LIB(m, floor)
6330     AC_CHECK_LIB(dl, dlopen)
6331     AC_CHECK_LIB(lpsolve55, make_lp, ,
6332         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
6333 else
6334     AC_MSG_RESULT([internal])
6335     SYSTEM_LPSOLVE=NO
6336     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
6338 AC_SUBST(SYSTEM_LPSOLVE)
6340 dnl ===================================================================
6341 dnl Checking for libtextcat
6342 dnl ===================================================================
6343 AC_MSG_CHECKING([which libtextcat to use])
6344 if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
6345     AC_MSG_RESULT([external])
6346     SYSTEM_LIBTEXTCAT=YES
6347     AC_CHECK_HEADER(libtextcat/textcat.h, [],
6348        [ AC_MSG_ERROR(libtextcat headers not found.)], [])
6349     AC_CHECK_LIB(textcat, special_textcat_Init, ,
6350         [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
6351 else
6352     AC_MSG_RESULT([internal])
6353     SYSTEM_LIBTEXTCAT=NO
6354     BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
6356 AC_SUBST(SYSTEM_LIBTEXTCAT)
6358 AC_MSG_CHECKING([which libtextcat data directory to use])
6359 if test -n "$with_external_libtextcat_data" && test "$with_external_libtextcat_data" != "no"; then
6360     if test "$with_external_libtextcat_data" = "yes"; then
6361         SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
6362     else
6363         SYSTEM_LIBTEXTCAT_DATA=file://$with_external_libtextcat_data
6364     fi
6365     AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
6366 else
6367     AC_MSG_RESULT([internal])
6368     BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
6370 AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
6372 dnl ***************************************
6373 dnl testing libc version for Linux...
6374 dnl ***************************************
6375 if test "$_os" = "Linux"; then
6376     AC_MSG_CHECKING([whether libc is >= 2.1.1])
6377     exec 6>/dev/null # no output
6378     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
6379     exec 6>&1 # output on again
6380     if test "$HAVE_LIBC"; then
6381         AC_MSG_RESULT([yes])
6382     else
6383         AC_MSG_ERROR([no, upgrade libc])
6384     fi
6387 if test "$_os" != "WINNT"; then
6388     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
6389     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
6390     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
6391         SYSTEM_LIBC=YES
6392     fi
6393 else
6394     HAVE_GETOPT=NO
6395     HAVE_READDIR_R=NO
6396     SYSTEM_LIBC=YES
6398 AC_SUBST(HAVE_GETOPT)
6399 AC_SUBST(HAVE_READDIR_R)
6400 AC_SUBST(SYSTEM_LIBC)
6402 dnl =========================================
6403 dnl Check for the Windows  SDK.
6404 dnl =========================================
6405 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
6406 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
6407 if test "$_os" = "WINNT"; then
6408     AC_MSG_CHECKING([for Windows SDK])
6409     if test "$build_os" = "cygwin"; then
6410         if test -z "$with_windows_sdk_home"; then
6411             # This first line will detect a February 2003 Microsoft Platform SDK
6412             WINDOWS_SDK_HOME=`./oowintool --windows-sdk-home`
6413             # But there might be also an April 2005 PSDK, unfortunately MS changed
6414             # the registry entry. (we prefer the old version!?)
6415             if test -z "$WINDOWS_SDK_HOME"; then
6416                 WINDOWS_SDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
6417             fi
6418             # normalize if found
6419             if test -n "$WINDOWS_SDK_HOME"; then
6420                 WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6421                 WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6422             fi
6423         else
6424             WINDOWS_SDK_HOME=`cygpath -u "$with_windows_sdk_home"`
6425         fi
6426     fi
6427     if test -n "$WINDOWS_SDK_HOME"; then
6428         # Remove a possible trailing backslash
6429         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6430         # Problem with current PSDK (iz 49865)
6431         # (What "current" does that mean?)
6432         if test -f "$WINDOWS_SDK_HOME/Lib/libcp.lib"; then
6433             AC_MSG_ERROR([
6434 Some modules do not build correctly with MS Platform SDK - April 2005
6435 Edition if the library ($WINDOWS_SDK_HOME/Lib/libcp.lib) is found.
6436 Remove/rename/backup that file and restart configure. Details about this
6437 problem can be found in issue 49856.])
6438         fi
6440         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6441              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6442              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6443             HAVE_PSDK_H="yes"
6444         else
6445             HAVE_PSDK_H="no"
6446         fi
6447         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6448             HAVE_PSDK_LIB="yes"
6449         else
6450             HAVE_PSDK_LIB="no"
6451         fi
6453         if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
6454             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6455 the  Windows SDK are installed.])
6456         fi
6458         if test ! -x "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
6459              -o ! -x "$WINDOWS_SDK_HOME/bin/msidb.exe" \
6460              -o ! -x "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
6461              -o ! -x "$WINDOWS_SDK_HOME/bin/msitran.exe" ; then
6462             AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
6463         fi
6464     fi
6466     if test -z "$WINDOWS_SDK_HOME"; then
6467         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6468     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
6469         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
6470     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
6471         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
6472     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
6473         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
6474     else
6475         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6476     fi
6478 AC_SUBST(WINDOWS_SDK_HOME)
6480 dnl =========================================
6481 dnl Check for the Microsoft DirectX SDK.
6482 dnl =========================================
6483 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
6484     AC_MSG_CHECKING([for DirectX SDK])
6485     if test "$build_os" = "cygwin"; then
6486         if test -z "$with_directx_home"; then
6487             dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
6488             if test -n "$DXSDK_DIR"; then
6489                 DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
6490                 DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
6491             fi
6492             # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
6493             # the "DirectX SDK not found" error later
6494         else
6495             DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
6496         fi
6497         # Remove a possible trailing backslash
6498         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
6499     elif test -n "$with_directx_home"; then
6500         DIRECTXSDK_HOME="$with_directx_home"
6501     fi
6503     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
6504         HAVE_DIRECTXSDK_H="yes"
6505     else
6506         HAVE_DIRECTXSDK_H="no"
6507     fi
6509     # MS changed the location of the libraries with Dec 2004 DirectX SDK
6510     if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
6511         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
6512     else
6513         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
6514     fi
6516     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
6517         HAVE_DIRECTXSDK_LIB="yes"
6518     else
6519         HAVE_DIRECTXSDK_LIB="no"
6520     fi
6522     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
6523         AC_MSG_RESULT([found])
6524     else
6525         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6526     fi
6528 AC_SUBST(DIRECTXSDK_HOME)
6529 AC_SUBST(DIRECTXSDK_LIB)
6531 dnl ============================================
6532 dnl Check for Nullsoft Scriptable Install System
6533 dnl ============================================
6534 NSIS_PATH=""
6535 if test "$_os" = "WINNT" ; then
6536     if test -z "$with_nsis_path"; then
6537         AC_PATH_PROG(NSIS_PATH, makensis)
6538         if test -n "$NSIS_PATH"; then
6539             NSIS_PATH=`dirname "$NSIS_PATH"`
6540         elif test "$build_os" = "cygwin"; then
6541             AC_MSG_CHECKING([for NSIS])
6542             nsistest=`./oowintool --nsis-dir`;
6543             nsistest=`cygpath -d -m "$nsistest"`
6544             nsistest=`cygpath -u "$nsistest"`
6545             if test -x "$nsistest/nsis.exe"; then
6546                 NSIS_PATH="$nsistest"
6547                 AC_MSG_RESULT([found ($NSIS_PATH)])
6548             else
6549                 AC_MSG_RESULT([no, no self-contained installer will be built.])
6550             fi
6551         fi
6552     else
6553         AC_MSG_CHECKING([for NSIS])
6554         if test "$build_os" = "cygwin"; then
6555             with_nsis_path=`cygpath -u "$with_nsis_path"`
6556         fi
6557         if test -e "$with_nsis_path/makensis$EXEEXT_FOR_BUILD"; then
6558             NSIS_PATH="$with_nsis_path"
6559         fi
6560         if test -z "$NSIS_PATH"; then
6561             AC_MSG_RESULT([no, no self-contained installer will be built.])
6562         else
6563             if test "$build_os" = "cygwin"; then
6564                 NSIS_PATH=`cygpath -d "$NSIS_PATH"`
6565                 NSIS_PATH=`cygpath -u "$NSIS_PATH"`
6566             fi
6567             AC_MSG_RESULT([found ($NSIS_PATH)])
6568         fi
6569     fi
6571 AC_SUBST(NSIS_PATH)
6573 dnl ***************************************
6574 dnl Checking for bison and flex
6575 dnl ***************************************
6576 AC_PATH_PROG(BISON, bison)
6577 if test -z "$BISON"; then
6578     AC_MSG_ERROR([no bison found in \$PATH, install it])
6579 else
6580     AC_MSG_CHECKING([the bison version])
6581     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
6582     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
6583     # Accept newer than 1.875 or older(equal) than 1.75
6584     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
6585         if test "$_bison_version" = "1.875" ; then
6586             AC_MSG_WARN([suspect ($BISON $_bison_version)])
6587             echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
6588         else
6589             AC_MSG_RESULT([checked ($BISON $_bison_version)])
6590         fi
6591     else
6592         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
6593     fi
6595 AC_PATH_PROG(FLEX, flex)
6596 if test -z "$FLEX"; then
6597     AC_MSG_ERROR([no flex found in \$PATH, install it])
6599 dnl ***************************************
6600 dnl Checking for patch
6601 dnl ***************************************
6602 AC_PATH_PROG(PATCH, patch)
6603 if test -z "$PATCH"; then
6604     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
6607 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
6608 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
6609     if test -z "$with_gnu_patch"; then
6610         GNUPATCH=$PATCH
6611     else
6612         if test -x "$with_gnu_patch"; then
6613             GNUPATCH=$with_gnu_patch
6614         else
6615             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
6616         fi
6617     fi
6619     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
6620     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
6621         AC_MSG_RESULT([yes])
6622     else
6623         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
6624     fi
6627 dnl We also need to check for --with-gnu-cp
6629 if test -z "$with_gnu_cp"; then
6630     # check the place where the good stuff is hidden on Solaris...
6631     if test -x /usr/gnu/bin/cp; then
6632         GNUCP=/usr/gnu/bin/cp
6633     else
6634         AC_PATH_PROGS(GNUCP, gnucp cp)
6635     fi
6636     if test -z $GNUCP; then
6637         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
6638     fi
6639 else
6640     if test -x "$with_gnu_cp"; then
6641         GNUCP=$with_gnu_cp
6642     else
6643         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
6644     fi
6647 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
6648 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
6649     AC_MSG_RESULT([yes])
6650 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
6651     AC_MSG_RESULT([yes])
6652 else
6653     case "$build_os" in
6654     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
6655         GNUCP=''
6656         AC_MSG_RESULT([no gnucp found - using the system's cp command])
6657         ;;
6658     *)
6659         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
6660         ;;
6661     esac
6664 AC_SUBST(GNUPATCH)
6665 AC_SUBST(GNUCP)
6667 dnl ***************************************
6668 dnl testing assembler path
6669 dnl ***************************************
6670 ML_EXE=""
6671 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
6672     if test "$CL_X64" = ""; then
6673         assembler=ml.exe
6674         assembler_bin=bin
6675     else
6676         assembler=ml64.exe
6677         assembler_bin=bin/amd64
6678     fi
6679     if test -n "$with_asm_home"; then
6680         with_asm_home=`cygpath -u "$with_asm_home"`
6681     fi
6682     if test -x "$with_asm_home/$assembler"; then
6683         AC_MSG_CHECKING([$assembler assembler path])
6684         AC_MSG_RESULT([$with_asm_home/$assembler])
6685         ML_EXE="$with_asm_home/$assembler"
6686     else
6687         AC_PATH_PROG(ML_EXE, $assembler)
6688         if test -z "$ML_EXE"; then
6689             AC_MSG_CHECKING([$with_cl_home/$assembler_bin/$assembler])
6690             if test -x "$with_cl_home/$assembler_bin/$assembler"; then
6691                 with_asm_home=$with_cl_home/$assembler_bin
6692                 AC_MSG_RESULT([found])
6693                 ML_EXE="$with_cl_home/$assembler_bin/$assembler"
6694             else
6695                 AC_MSG_ERROR([Configure did not find $assembler assembler.])
6696             fi
6697         else
6698             with_asm_home="ASM_IN_PATH"
6699             ML_EXE="$assembler"
6700         fi
6701     fi
6702 else
6703     with_asm_home="NO_ASM_HOME"
6705 ASM_HOME="$with_asm_home"
6706 AC_SUBST(ASM_HOME)
6707 AC_SUBST(ML_EXE)
6709 dnl ===================================================================
6710 dnl We need zip and unzip
6711 dnl ===================================================================
6712 AC_PATH_PROG(ZIP, zip)
6713 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
6714 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
6715     AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
6718 AC_PATH_PROG(UNZIP, unzip)
6719 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
6721 dnl ===================================================================
6722 dnl Zip must be a specific type for different build types.
6723 dnl ===================================================================
6724 if test $build_os = cygwin; then
6725     if test -n "`$ZIP -h | grep -i WinNT`" ; then
6726         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
6727     fi
6730 dnl ===================================================================
6731 dnl Test which vclplugs have to be built.
6732 dnl ===================================================================
6733 R=""
6734 GTK3_CFLAGS=""
6735 GTK3_LIBS=""
6736 ENABLE_GTK3=""
6737 if test "x$enable_gtk3" = "xyes"; then
6738     if test "$with_system_cairo" != yes; then
6739         echo "System cairo required for gtk3 support, please use --system-cairo"
6740     fi
6741     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
6742     if test "x$ENABLE_GTK3" = "xTRUE"; then
6743         R="gtk3"
6744     fi
6746 AC_SUBST(GTK3_LIBS)
6747 AC_SUBST(GTK3_CFLAGS)
6748 AC_SUBST(ENABLE_GTK3)
6750 AC_MSG_CHECKING([which VCLplugs shall be built])
6751 ENABLE_GTK=""
6752 if test "x$enable_gtk" = "xyes"; then
6753     ENABLE_GTK="TRUE"
6754     R="gtk $R"
6756 AC_SUBST(ENABLE_GTK)
6758 ENABLE_KDE=""
6759 if test "x$enable_kde" = "xyes"; then
6760     ENABLE_KDE="TRUE"
6761     R="$R kde"
6763 AC_SUBST(ENABLE_KDE)
6765 ENABLE_KDE4=""
6766 if test "x$enable_kde4" = "xyes"; then
6767     ENABLE_KDE4="TRUE"
6768     R="$R kde4"
6770 AC_SUBST(ENABLE_KDE4)
6772 if test -z "$R"; then
6773     AC_MSG_RESULT([none])
6774 else
6775     AC_MSG_RESULT([$R])
6778 dnl ===================================================================
6779 dnl GCONF check
6780 dnl ===================================================================
6782 ENABLE_GCONF=""
6783 AC_MSG_CHECKING([whether to enable GConf support])
6784 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gconf" = "yes"; then
6785     ENABLE_GCONF="TRUE"
6786     AC_MSG_RESULT([yes])
6787     PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6788 else
6789     AC_MSG_RESULT([no])
6791 AC_SUBST(ENABLE_GCONF)
6793 dnl ===================================================================
6794 dnl Gnome VFS check
6795 dnl ===================================================================
6797 ENABLE_GNOMEVFS=""
6798 AC_MSG_CHECKING([whether to enable GNOME VFS support])
6799 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
6800     ENABLE_GNOMEVFS="TRUE"
6801     AC_MSG_RESULT([yes])
6802     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
6803     if test "$ENABLE_GCONF" != "TRUE"; then
6804         PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6805     fi
6806 else
6807     AC_MSG_RESULT([no])
6809 AC_SUBST(ENABLE_GNOMEVFS)
6811 dnl ===================================================================
6812 dnl Check whether the gtk 2.0 libraries are available.
6813 dnl ===================================================================
6815 GTK_CFLAGS=""
6816 GTK_LIBS=""
6817 ENABLE_SYSTRAY_GTK=""
6818 ENABLE_DBUS=""
6819 if test  "$test_gtk" = "yes"; then
6821     if test "$ENABLE_GTK" = "TRUE" ; then
6822         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]))
6823         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]))
6824         BUILD_TYPE="$BUILD_TYPE GTK"
6826         if test "x$enable_systray" = "xyes"; then
6827             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
6828                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
6829                             [ ENABLE_SYSTRAY_GTK="" ])
6830         fi
6832         AC_MSG_CHECKING([whether to enable DBUS support])
6833         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
6834             ENABLE_DBUS="TRUE"
6835             AC_MSG_RESULT([yes])
6836             PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
6837         else
6838             AC_MSG_RESULT([no])
6839         fi
6841         AC_MSG_CHECKING([whether to enable GIO support])
6842         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
6843             if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
6844                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
6845             fi
6846             ENABLE_GIO="TRUE"
6847             AC_MSG_RESULT([yes])
6848             PKG_CHECK_MODULES( GIO, gio-2.0 )
6849         else
6850             AC_MSG_RESULT([no])
6851         fi
6852     fi
6854 AC_SUBST(ENABLE_GIO)
6855 AC_SUBST(ENABLE_DBUS)
6856 AC_SUBST(ENABLE_SYSTRAY_GTK)
6857 AC_SUBST(GTK_CFLAGS)
6858 AC_SUBST(GTK_LIBS)
6859 AC_SUBST(GTHREAD_CFLAGS)
6860 AC_SUBST(GTHREAD_LIBS)
6862 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
6863 AC_SUBST(LIBPNG_LIBS)
6864 AC_SUBST(LIBPNG_CFLAGS)
6866 AC_MSG_CHECKING([whether to enable libpng linking in quickstarter])
6867 if test "x$enable_unix_libpng" = "xyes"; then
6868     AC_MSG_RESULT([yes])
6869 else
6870     AC_MSG_RESULT([no])
6871     ENABLE_QUICKSTART_LIBPNG=""
6873 AC_SUBST(ENABLE_QUICKSTART_LIBPNG)
6875 SPLIT_APP_MODULES=""
6876 if test "$enable_split_app_modules" = "yes"; then
6877     SPLIT_APP_MODULES="YES"
6879 AC_SUBST(SPLIT_APP_MODULES)
6881 SPLIT_OPT_FEATURES=""
6882 if test "$enable_split_opt_features" = "yes"; then
6883     SPLIT_OPT_FEATURES="YES"
6885 AC_SUBST(SPLIT_OPT_FEATURES)
6887 ENABLE_CAIRO_CANVAS="FALSE"
6888 if test "$enable_cairo_canvas" = "yes" ; then
6889    ENABLE_CAIRO_CANVAS="TRUE"
6891 AC_SUBST(ENABLE_CAIRO_CANVAS)
6893 dnl ===================================================================
6894 dnl Check whether the GStreamer libraries are available.
6895 dnl ===================================================================
6897 ENABLE_GSTREAMER=""
6899 if test  "$build_gstreamer" = "yes"; then
6901     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
6902     if test "x$enable_gstreamer" != "xno" ; then
6903         ENABLE_GSTREAMER="TRUE"
6904         AC_MSG_RESULT([yes])
6905         PKG_CHECK_MODULES( GSTREAMER, gstreamer-0.10 gstreamer-plugins-base-0.10 )
6906     else
6907         AC_MSG_RESULT([no])
6908     fi
6911 AC_SUBST(ENABLE_GSTREAMER)
6913 dnl ===================================================================
6914 dnl Check whether the OpenGL libraries are available
6915 dnl ===================================================================
6917 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6918 ENABLE_OPENGL=
6920 if test "$_os" = "Darwin" ; then
6921     # We use frameworks on Mac OS X, no need for detail checks
6922     ENABLE_OPENGL=TRUE
6923     SYSTEM_MESA_HEADERS=YES
6924     AC_MSG_RESULT([yes])
6925 else
6926     if test "x$enable_opengl" != "xno" ; then
6927         if test "$_os" != "WINNT"; then
6928             save_LDFLAGS=$LDFLAGS
6929             LDFLAGS="$LDFLAGS -lm"
6930             AC_MSG_RESULT([yes])
6931             AC_CHECK_LIB(GL, main, [],
6932                       [AC_MSG_ERROR(libGL not installed or functional)], [])
6933             AC_CHECK_LIB(GLU, main, [],
6934                       [AC_MSG_ERROR(libGLU not installed or functional)], [])
6935             ENABLE_OPENGL=TRUE
6936             LDFLAGS=$save_LDFLAGS
6938             dnl ===================================================================
6939             dnl Check for system Mesa
6940             dnl ===================================================================
6941             AC_MSG_CHECKING([which Mesa headers to use])
6942             if test -n "$with_system_mesa_headers" -o -n "$with_system_headers" && \
6943                     test "$with_system_mesa_headers" != "no"; then
6944                 AC_MSG_RESULT([external])
6945                 SYSTEM_MESA_HEADERS=YES
6946                 AC_LANG_PUSH(C)
6947                 AC_CHECK_HEADER(GL/glxext.h, [],
6948                    [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
6949                 AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
6950                 AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
6951                 AC_LANG_POP(C)
6952             else
6953                 AC_MSG_RESULT([internal])
6954                 SYSTEM_MESA_HEADERS=NO
6955                 BUILD_TYPE="$BUILD_TYPE MESA"
6956             fi
6957         else
6958             AC_MSG_RESULT([not on Windows])
6959         fi
6960     else
6961        AC_MSG_RESULT([no])
6962     fi
6965 AC_SUBST(SYSTEM_MESA_HEADERS)
6966 AC_SUBST(ENABLE_OPENGL)
6968 # presenter minimizer extension?
6969 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
6970 AS_IF([test "x$enable_ext_presenter_minimizer" = "xyes"], [
6971    AC_MSG_RESULT([yes])
6972    ENABLE_MINIMIZER=YES
6974    AC_MSG_RESULT([no])
6975    ENABLE_MINIMIZER=NO
6976    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
6978 AC_SUBST(ENABLE_MINIMIZER)
6980 # presenter console extension?
6981 AC_MSG_CHECKING([whether to build the Presenter Console extension])
6982 AS_IF([test "x$enable_ext_presenter_console" = "xyes"], [
6983    AC_MSG_RESULT([yes])
6984    ENABLE_PRESENTER_SCREEN=YES
6986    AC_MSG_RESULT([no])
6987    ENABLE_PRESENTER_SCREEN=NO
6988    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PRESENTER_SCREEN"
6990 AC_SUBST(ENABLE_PRESENTER_SCREEN)
6992 # pdf import extension?
6993 AC_MSG_CHECKING([whether to build the PDF Import extension])
6994 AS_IF([test "x$enable_ext_pdfimport" = "xyes"], [
6995   AC_MSG_RESULT([yes])
6996   ENABLE_PDFIMPORT=YES
6998   dnl ===================================================================
6999   dnl Check for system poppler
7000   dnl ===================================================================
7001   AC_MSG_CHECKING([which pdf backend to use])
7002   if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
7003        test "$with_system_poppler" != "no"; then
7004       AC_MSG_RESULT([external])
7005       SYSTEM_POPPLER=YES
7006       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
7007   else
7008       AC_MSG_RESULT([internal])
7009       SYSTEM_POPPLER=NO
7010       BUILD_TYPE="$BUILD_TYPE XPDF"
7011   fi
7013   AC_MSG_RESULT([no])
7014   ENABLE_PDFIMPORT=NO
7015   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PDFIMPORT"
7017 AC_SUBST(ENABLE_PDFIMPORT)
7018 AC_SUBST(SYSTEM_POPPLER)
7019 AC_SUBST(POPPLER_CFLAGS)
7020 AC_SUBST(POPPLER_LIBS)
7023 if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
7024    AC_MSG_CHECKING([for sdext module])
7025    BUILD_TYPE="$BUILD_TYPE SDEXT"
7028 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
7029 AS_IF([test "x$enable_ext_wiki_publisher" = "xyes"], [
7030   AC_MSG_RESULT([yes])
7031   AC_MSG_CHECKING([for swext module])
7032   ENABLE_MEDIAWIKI=YES
7033   BUILD_TYPE="$BUILD_TYPE SWEXT"
7034   if test  "x$with_java" = "xno"; then
7035     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
7036   fi
7038   AC_MSG_RESULT([no])
7039   ENABLE_MEDIAWIKI=NO
7040   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
7042 AC_SUBST(ENABLE_MEDIAWIKI)
7044 if test "$ENABLE_MEDIAWIKI" = "YES"; then
7045     AC_MSG_CHECKING([which Servlet API Jar to use])
7046     if test -n "$with_system_servlet_api"; then
7047         AC_MSG_RESULT([external])
7048         SYSTEM_SERVLETAPI=YES
7049         if test -z "$SERVLETAPI_JAR"; then
7050             SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
7051         fi
7052         AC_CHECK_FILE($SERVLETAPI_JAR, [],
7053               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
7054     else
7055         AC_MSG_RESULT([internal])
7056         SYSTEM_SERVLETAPI=NO
7057         BUILD_TYPE="$BUILD_TYPE TOMCAT"
7058     fi
7060 AC_SUBST(SYSTEM_SERVLETAPI)
7061 AC_SUBST(SERVLETAPI_JAR)
7063 AC_MSG_CHECKING([whether to build the Report Builder extension])
7064 if test -n "$enable_ext_report_builder" -a "$enable_ext_report_builder" != "no" && test "$with_java" != "no"; then
7065     AC_MSG_RESULT([yes])
7066     ENABLE_REPORTBUILDER=YES
7067     AC_MSG_CHECKING([for reportbuilder module])
7068     AC_MSG_CHECKING([which jfreereport libs to use])
7069     if test "$with_system_jfreereport" = "yes"; then
7070         SYSTEM_JFREEREPORT=YES
7071         AC_MSG_RESULT([external])
7072         if test -z $SAC_JAR; then
7073             SAC_JAR=/usr/share/java/sac.jar
7074         fi
7075         AC_CHECK_FILE($SAC_JAR, [],
7076              [AC_MSG_ERROR(sac.jar not found.)], [])
7078         if test -z $LIBXML_JAR; then
7079             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
7080                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
7081                 [
7082                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
7083                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
7084                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
7085                     )
7086                 ]
7087             )
7088         else
7089             AC_CHECK_FILE($LIBXML_JAR, [],
7090                  [AC_MSG_ERROR(libxml.jar not found.)], [])
7091         fi
7093         if test -z $FLUTE_JAR; then
7094             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
7095                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
7096                 [
7097                     AC_CHECK_FILE(/usr/share/java/flute.jar,
7098                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
7099                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
7100                     )
7101                 ]
7102             )
7103         else
7104             AC_CHECK_FILE($FLUTE_JAR, [],
7105                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
7106         fi
7108         if test -z $JFREEREPORT_JAR; then
7109             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
7110                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
7111                 [
7112                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
7113                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
7114                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
7115                     )
7116                 ]
7117             )
7118         else
7119             AC_CHECK_FILE($JFREEREPORT_JAR, [],
7120                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
7121         fi
7123         if test -z $LIBLAYOUT_JAR; then
7124             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
7125                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
7126                 [
7127                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
7128                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
7129                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
7130                     )
7131                 ]
7132             )
7133         else
7134             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
7135                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
7136         fi
7138         if test -z $LIBLOADER_JAR; then
7139             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
7140                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
7141                 [
7142                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
7143                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
7144                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
7145                     )
7146                 ]
7147             )
7148         else
7149             AC_CHECK_FILE($LIBLOADER_JAR, [],
7150                 [AC_MSG_ERROR(libloader.jar not found.)], [])
7151         fi
7153         if test -z $LIBFORMULA_JAR; then
7154             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
7155                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
7156                  [
7157                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
7158                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
7159                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
7160                      )
7161                  ]
7162             )
7163         else
7164             AC_CHECK_FILE($LIBFORMULA_JAR, [],
7165                 [AC_MSG_ERROR(libformula.jar not found.)], [])
7166         fi
7168         if test -z $LIBREPOSITORY_JAR; then
7169             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
7170                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
7171                 [
7172                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
7173                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
7174                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
7175                     )
7176                 ]
7177             )
7178         else
7179             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
7180                 [AC_MSG_ERROR(librepository.jar not found.)], [])
7181         fi
7183         if test -z $LIBFONTS_JAR; then
7184             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
7185                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
7186                 [
7187                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
7188                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
7189                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
7190                     )
7191                 ]
7192             )
7193         else
7194             AC_CHECK_FILE($LIBFONTS_JAR, [],
7195                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
7196         fi
7198         if test -z $LIBSERIALIZER_JAR; then
7199             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
7200                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
7201                 [
7202                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
7203                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
7204                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
7205                     )
7206                 ]
7207             )
7208         else
7209             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
7210                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
7211         fi
7214         if test -z $LIBBASE_JAR; then
7215             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
7216                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
7217                 [
7218                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
7219                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
7220                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
7221                     )
7222                 ]
7223             )
7224         else
7225             AC_CHECK_FILE($LIBBASE_JAR, [],
7226                 [AC_MSG_ERROR(libbase.jar not found.)], [])
7227         fi
7229     else
7230         AC_MSG_RESULT([internal])
7231         AC_MSG_CHECKING([for jfreereport module])
7232         SYSTEM_JFREEREPORT=NO
7233         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
7234     fi
7235     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
7236 else
7237     AC_MSG_RESULT([no])
7238     ENABLE_REPORTBUILDER=NO
7239     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_REPORTDESIGN"
7240     SYSTEM_JFREEREPORT=NO
7242 AC_SUBST(ENABLE_REPORTBUILDER)
7243 AC_SUBST(SYSTEM_JFREEREPORT)
7244 AC_SUBST(SAC_JAR)
7245 AC_SUBST(LIBXML_JAR)
7246 AC_SUBST(FLUTE_JAR)
7247 AC_SUBST(JFREEREPORT_JAR)
7248 AC_SUBST(LIBBASE_JAR)
7249 AC_SUBST(LIBLAYOUT_JAR)
7250 AC_SUBST(LIBLOADER_JAR)
7251 AC_SUBST(LIBFORMULA_JAR)
7252 AC_SUBST(LIBREPOSITORY_JAR)
7253 AC_SUBST(LIBFONTS_JAR)
7254 AC_SUBST(LIBSERIALIZER_JAR)
7256 # this has to be here because both the Wiki Publisher and the SRB use
7257 # commons-logging
7258 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7259     AC_MSG_CHECKING([which Apache commons-* libs to use])
7260     if test "$with_system_apache_commons" = "yes"; then
7261         SYSTEM_APACHE_COMMONS=YES
7262         AC_MSG_RESULT([external])
7263         if test "$ENABLE_MEDIAWIKI" = "YES"; then
7264             if test -z $COMMONS_CODEC_JAR; then
7265                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
7266                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
7267                     [
7268                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
7269                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
7270                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
7271                         )
7272                     ]
7273                 )
7274             else
7275                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
7276                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
7277             fi
7279             if test -z $COMMONS_LANG_JAR; then
7280                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
7281                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
7282                     [
7283                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
7284                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
7285                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
7286                             )
7287                     ]
7288                 )
7289             else
7290                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
7291                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
7292             fi
7294             if test -z $COMMONS_HTTPCLIENT_JAR; then
7295                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
7296                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
7297                     [
7298                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
7299                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
7300                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
7301                         )
7302                     ]
7303                 )
7304             else
7305                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
7306                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
7307             fi
7308         fi
7309         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7310             if test -z $COMMONS_LOGGING_JAR; then
7311                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
7312                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
7313                    [
7314                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
7315                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
7316                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
7317                         )
7318                     ]
7319                 )
7320             else
7321                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
7322                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
7323             fi
7324         fi
7325     else
7326         AC_MSG_RESULT([internal])
7327         SYSTEM_APACHE_COMMONS=NO
7328         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
7329     fi
7331 AC_SUBST(SYSTEM_APACHE_COMMONS)
7332 AC_SUBST(COMMONS_CODEC_JAR)
7333 AC_SUBST(COMMONS_LANG_JAR)
7334 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
7335 AC_SUBST(COMMONS_LOGGING_JAR)
7337 # scripting provider for BeanShell extension?
7338 AC_MSG_CHECKING([whether to build extension for support of scripts in BeanShell])
7339 AS_IF([test "x$enable_ext_scripting_beanshell" = "xyes"], [
7340    AC_MSG_RESULT([yes])
7341    ENABLE_SCRIPTING_BEANSHELL=YES
7343    AC_MSG_RESULT([no])
7344    ENABLE_SCRIPTING_BEANSHELL=NO
7345    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_BEANSHELL"
7347 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
7349 # scripting provider for JavaScript extension?
7350 AC_MSG_CHECKING([whether to build extension for support of scripts in JavaScript])
7351 AS_IF([test "x$enable_ext_scripting_javascript" = "xyes"], [
7352    AC_MSG_RESULT([yes])
7353    ENABLE_SCRIPTING_JAVASCRIPT=YES
7355    AC_MSG_RESULT([no])
7356    ENABLE_SCRIPTING_JAVASCRIPT=NO
7357    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_JAVASCRIPT"
7359 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
7361 dnl Scripting provider for Python extension?
7362 dnl We always provide this unless we have disabled Python completely
7363 if test $enable_python = no; then
7364     ENABLE_SCRIPTING_PYTHON=NO
7365 else
7366     ENABLE_SCRIPTING_PYTHON=YES
7368 AC_SUBST(ENABLE_SCRIPTING_PYTHON)
7370 supports_multilib=
7371 case "$host_cpu" in
7372 x86_64 | powerpc64 | s390x)
7373     if test "$SIZEOF_LONG" = "8"; then
7374         supports_multilib="yes"
7375     fi
7376     ;;
7378     ;;
7379 esac
7381 dnl ===================================================================
7382 dnl Check whether the Qt3 and KDE3 libraries are available.
7383 dnl ===================================================================
7385 KDE_CFLAGS=""
7386 KDE_LIBS=""
7387 if test "$_os" != "OpenBSD"; then
7388     MOC="moc"
7390 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
7391     dnl Search paths for Qt3 and KDE3
7392     if test -z "$supports_multilib" ; then
7393         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"
7394         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"
7395     else
7396         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"
7397         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"
7398     fi
7399     if test -n "$QTDIR" ; then
7400         qt_incdirs="$QTDIR/include $qt_incdirs"
7401         if test -z "$supports_multilib" ; then
7402             qt_libdirs="$QTDIR/lib $qt_libdirs"
7403         else
7404             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7405         fi
7406     fi
7407     if test -z "$supports_multilib" ; then
7408         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"
7409         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"
7410     else
7411         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"
7412         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"
7413     fi
7414     if test -n "$KDEDIR" ; then
7415         kde_incdirs="$KDEDIR/include $kde_incdirs"
7416         if test -z "$supports_multilib" ; then
7417             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7418         else
7419             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7420         fi
7421     fi
7423     dnl What to test
7424     qt_test_include="qstyle.h"
7425     kde_test_include="kapp.h"
7427     if test "$_os" != "OpenBSD"; then
7428         qt_test_library="libqt-mt.so"
7429         kde_test_library="libDCOP.so"
7430     else
7431         qt_test_library="libqt-mt.so*"
7432         kde_test_library="libDCOP.so*"
7433     fi
7435     dnl Check for Qt3 headers
7436     AC_MSG_CHECKING([for Qt3 headers])
7437     qt_incdir="no"
7438     for kde_check in $qt_incdirs ; do
7439         if test -r "$kde_check/$qt_test_include" ; then
7440             qt_incdir="$kde_check"
7441             break
7442         fi
7443     done
7444     AC_MSG_RESULT([$qt_incdir])
7445     if test "x$qt_incdir" = "xno" ; then
7446         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
7447 your Qt3 installation by exporting QTDIR before running "configure".])
7448     fi
7450     dnl Check for Qt3 libraries
7451     AC_MSG_CHECKING([for Qt3 libraries])
7452     qt_libdir="no"
7453     for qt_check in $qt_libdirs ; do
7454         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`" ; then
7455             qt_libdir="$qt_check"
7456             break
7457         fi
7458     done
7459     AC_MSG_RESULT([$qt_libdir])
7460     if test "x$qt_libdir" = "xno" ; then
7461         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
7462 your Qt3 installation by exporting QTDIR before running "configure".])
7463     fi
7465     dnl Check for Meta Object Compiler
7466     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
7467     if test "$MOC" = "no" ; then
7468         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
7469 the root of your Qt3 installation by exporting QTDIR before running "configure".])
7470     fi
7472     dnl Check for KDE3 headers
7473     AC_MSG_CHECKING([for KDE3 headers])
7474     kde_incdir="no"
7475     for kde_check in $kde_incdirs ; do
7476         if test -r "$kde_check/$kde_test_include" ; then
7477             kde_incdir="$kde_check"
7478             break
7479         fi
7480     done
7481     AC_MSG_RESULT([$kde_incdir])
7482     if test "x$kde_incdir" = "xno" ; then
7483         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
7484 your KDE3 installation by exporting KDEDIR before running "configure".])
7485     fi
7487     dnl Check for KDE3 libraries
7488     AC_MSG_CHECKING([for KDE3 libraries])
7489     kde_libdir="no"
7490     for kde_check in $kde_libdirs ; do
7491         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`" ; then
7492             kde_libdir="$kde_check"
7493             break
7494         fi
7495     done
7496     AC_MSG_RESULT([$kde_libdir])
7497     if test "x$kde_libdir" = "xno" ; then
7498         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
7499 your KDE3 installation by exporting KDEDIR before running "configure".])
7500     fi
7502     dnl Set the variables
7503     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7504     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
7506 AC_SUBST(KDE_CFLAGS)
7507 AC_SUBST(KDE_LIBS)
7508 AC_SUBST(MOC)
7510 dnl ===================================================================
7511 dnl KDE4 Integration
7512 dnl ===================================================================
7514 KDE4_CFLAGS=""
7515 KDE4_LIBS=""
7516 MOC4="moc"
7517 KDE_GLIB_CFLAGS=""
7518 KDE_GLIB_LIBS=""
7519 KDE_HAVE_GLIB=""
7520 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
7521     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
7522     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
7524     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
7525     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
7527     if test -n "$supports_multilib" ; then
7528         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
7529         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
7530     fi
7532     if test -n "$QTDIR" ; then
7533         qt_incdirs="$QTDIR/include $qt_incdirs"
7534         if test -z "$supports_multilib" ; then
7535             qt_libdirs="$QTDIR/lib $qt_libdirs"
7536         else
7537             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7538         fi
7539     fi
7540     if test -n "$QT4DIR" ; then
7541         qt_incdirs="$QT4DIR/include $qt_incdirs"
7542         if test -z "$supports_multilib" ; then
7543             qt_libdirs="$QT4DIR/lib $qt_libdirs"
7544         else
7545             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
7546         fi
7547     fi
7549     if test -n "$KDEDIR" ; then
7550         kde_incdirs="$KDEDIR/include $kde_incdirs"
7551         if test -z "$supports_multilib" ; then
7552             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7553         else
7554             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7555         fi
7556     fi
7557     if test -n "$KDE4DIR" ; then
7558         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
7559         if test -z "$supports_multilib" ; then
7560             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
7561         else
7562             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
7563         fi
7564     fi
7566     qt_test_include="Qt/qobject.h"
7567     qt_test_library="libQtCore.so"
7568     kde_test_include="kwindowsystem.h"
7569     kde_test_library="libsolid.so"
7571     AC_MSG_CHECKING([for Qt4 headers])
7572     qt_header_dir="no"
7573     for inc_dir in $qt_incdirs ; do
7574         if test -r "$inc_dir/$qt_test_include" ; then
7575             qt_header_dir="$inc_dir"
7576             break
7577         fi
7578     done
7580     AC_MSG_RESULT([$qt_header_dir])
7581     if test "x$qt_header_dir" = "xno" ; then
7582         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7583     fi
7585     AC_MSG_CHECKING([for Qt4 libraries])
7586     qt_lib_dir="no"
7587     for lib_dir in $qt_libdirs ; do
7588         if test -r "$lib_dir/$qt_test_library" ; then
7589             qt_lib_dir="$lib_dir"
7590             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
7591             break
7592         fi
7593     done
7595     AC_MSG_RESULT([$qt_lib_dir])
7597     if test "x$qt_lib_dir" = "xno" ; then
7598         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7599     fi
7601     dnl Check for Meta Object Compiler
7603     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7604     MOC4="$MOCQT4"
7605     if test "$MOC4" = "no" ; then
7606         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7607         if test "$MOC4" = "no" ; then
7608             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
7609 the root of your Qt installation by exporting QT4DIR before running "configure".])
7610         fi
7611     fi
7613     dnl Check for KDE4 headers
7614     AC_MSG_CHECKING([for KDE4 headers])
7615     kde_incdir="no"
7616     for kde_check in $kde_incdirs ; do
7617         if test -r "$kde_check/$kde_test_include" ; then
7618             kde_incdir="$kde_check"
7619             break
7620         fi
7621     done
7622     AC_MSG_RESULT([$kde_incdir])
7623     if test "x$kde_incdir" = "xno" ; then
7624         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7625     fi
7627     dnl Check for KDE4 libraries
7628     AC_MSG_CHECKING([for KDE4 libraries])
7629     kde_libdir="no"
7630     for kde_check in $kde_libdirs ; do
7631         if test -r "$kde_check/$kde_test_library" ; then
7632             kde_libdir="$kde_check"
7633             break
7634         fi
7635     done
7637     AC_MSG_RESULT([$kde_libdir])
7638     if test "x$kde_libdir" = "xno" ; then
7639         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7640     fi
7642     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7643     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
7645     AC_LANG_PUSH([C++])
7646     save_CXXFLAGS=$CXXFLAGS
7647     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
7648     AC_MSG_CHECKING([whether KDE is >= 4.2])
7649        AC_TRY_RUN([
7650 #include <kdeversion.h>
7652 int main(int argc, char **argv) {
7653        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
7654        else return 1;
7656        ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([KDE version too old])])
7657     CXXFLAGS=$save_CXXFLAGS
7658     AC_LANG_POP([C++])
7660    # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled
7661     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
7662         [KDE_HAVE_GLIB=1],
7663         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
7665 AC_SUBST(KDE4_CFLAGS)
7666 AC_SUBST(KDE4_LIBS)
7667 AC_SUBST(MOC4)
7668 AC_SUBST(KDE_GLIB_CFLAGS)
7669 AC_SUBST(KDE_GLIB_LIBS)
7670 AC_SUBST(KDE_HAVE_GLIB)
7672 dnl ===================================================================
7673 dnl Test for the enabling the lockdown pieces
7674 dnl ===================================================================
7675 AC_MSG_CHECKING([whether to enable the lockdown pieces])
7676 ENABLE_LOCKDOWN=""
7677 if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
7678     ENABLE_LOCKDOWN=YES
7679     AC_MSG_RESULT([yes])
7680 else
7681     AC_MSG_RESULT([no])
7683 AC_SUBST(ENABLE_LOCKDOWN)
7685 dnl ===================================================================
7686 dnl Test whether to include Evolution 2 support
7687 dnl ===================================================================
7688 AC_MSG_CHECKING([whether to enable evolution 2 support])
7689 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
7690     AC_MSG_RESULT([yes])
7691     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
7692     ENABLE_EVOAB2="TRUE"
7693 else
7694     ENABLE_EVOAB2=""
7695     AC_MSG_RESULT([no])
7697 AC_SUBST(ENABLE_EVOAB2)
7698 AC_SUBST(GOBJECT_CFLAGS)
7699 AC_SUBST(GOBJECT_LIBS)
7701 dnl ===================================================================
7702 dnl Test whether to include KDE AB support
7703 dnl ===================================================================
7704 AC_MSG_CHECKING([whether to enable KDE address book support])
7705 if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
7706     AC_MSG_RESULT([yes])
7707     AC_LANG_PUSH([C++])
7708     save_CXXFLAGS=$CXXFLAGS
7709     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
7710     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
7711        AC_TRY_RUN([
7712 #include <kdeversion.h>
7714 int main(int argc, char **argv) {
7715        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
7716        else return 1;
7718        ], [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])])
7719     CXXFLAGS=$save_CXXFLAGS
7720     AC_LANG_POP([C++])
7721     ENABLE_KAB=TRUE
7722 else
7723     AC_MSG_RESULT([no])
7724     ENABLE_KAB=
7726 AC_SUBST(ENABLE_KAB)
7728 dnl ===================================================================
7729 dnl Test whether to include MathMLDTD
7730 dnl ===================================================================
7731 AC_MSG_CHECKING([whether to include MathMLDTD])
7732 if test -n "$enable_mathmldtd"; then
7733     if test "$enable_mathmldtd" = "no"; then
7734         AC_MSG_RESULT([no])
7735         SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7736     else
7737         AC_MSG_RESULT([yes])
7738         BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7739     fi
7740 else
7741     AC_MSG_RESULT([no])
7742     SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7745 dnl ===================================================================
7746 dnl Test which themes to include
7747 dnl ===================================================================
7748 AC_MSG_CHECKING([which themes to include])
7749 # if none given, use all available themes
7750 if test "z$enable_theme" = "z" -o "z$enable_theme" = "zyes"; then
7751     enable_theme="default crystal hicontrast oxygen tango"
7754 WITH_THEMES=""
7755 for theme in $enable_theme
7757     WITH_THEMES="$WITH_THEMES $theme"
7758     SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[a-z]' '[A-Z]'`"
7759 done
7760 AC_MSG_RESULT([$WITH_THEMES])
7761 AC_SUBST(WITH_THEMES)
7763 dnl ===================================================================
7764 dnl Test whether to integrate helppacks into the product's installer
7765 dnl ===================================================================
7766 AC_MSG_CHECKING([for helppack integration])
7767 if test "z$with_helppack_integration" = "zno" ; then
7768     WITH_HELPPACK_INTEGRATION=NO
7769     AC_MSG_RESULT([no integration])
7770 else
7771     WITH_HELPPACK_INTEGRATION=YES
7772     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
7773     AC_MSG_RESULT([integration])
7775 AC_SUBST(WITH_HELPPACK_INTEGRATION)
7777 dnl ===================================================================
7778 dnl Test whether to integrate extensions into the product's installer
7779 dnl ===================================================================
7780 AC_MSG_CHECKING([for extensions integration])
7781 if test "z$with_extension_integration" = "z" -o "z$with_extension_integration" = "zno" ; then
7782     WITH_EXTENSION_INTEGRATION=NO
7783     AC_MSG_RESULT([no integration])
7784 else
7785     WITH_EXTENSION_INTEGRATION=YES
7786     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
7787     AC_MSG_RESULT([integration])
7789 AC_SUBST(WITH_EXTENSION_INTEGRATION)
7791 dnl ===================================================================
7792 dnl Test whether to include Lightproof extensions
7793 dnl ===================================================================
7794 AC_MSG_CHECKING([for Lightproof extensions integration (only supported languages displayed)])
7795 if test "z$enable_ext_lightproof" = "z" -o "z$enable_ext_lightproof" = "zno" ; then
7796     LIGHTPROOF_LANG=""
7797     AC_MSG_RESULT([no integration])
7798 else
7799     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LIGHTPROOF"
7800     lightproof_supported_langs="en-US hu ru"
7801     if test "z$enable_ext_lightproof" = "zyes" ; then
7802         wanted_lightproof="$lightproof_supported_langs"
7803     else
7804     # check whether the langs are supported by Lightproof
7805     wanted_lightproof=
7806     for lang in $enable_ext_lightproof ; do
7807         if test -n "`echo $lightproof_supported_langs | grep "$lang"`" ; then
7808             wanted_lightproof="$wanted_lightproof $lang"
7809         fi
7810     done
7811     fi
7812     LIGHTPROOF_LANG=
7813     LIGHTPROOF_HU_PACK=
7814     LIGHTPROOF_RU_PACK=
7815     LIGHTPROOF_EN_US_PACK=
7816     # check whether the langs are requested at all
7817     for lang in $wanted_lightproof ; do
7818         if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`" ; then
7819             LIGHTPROOF_LANG="$LIGHTPROOF_LANG $lang"
7820             case $lang in
7821             "hu") LIGHTPROOF_HU_PACK="76345f925e34fef2d29bade4f29108e9-lightproof-hu_1.3.oxt";;
7822             "ru") LIGHTPROOF_RU_PACK="673860e8649cff2ebdc68bd46f2f7f1a-lightproof-ru_0.1.oxt";;
7823             "en-US") LIGHTPROOF_EN_US_PACK="0ab55ac8e88f04258f1d3e79e984382f-lightproof-en-US_0.1.oxt";;
7824             esac
7825         fi
7826     done
7827     AC_MSG_RESULT([$LIGHTPROOF_LANG])
7829 AC_SUBST(LIGHTPROOF_LANG)
7830 AC_SUBST(LIGHTPROOF_HU_PACK)
7831 AC_SUBST(LIGHTPROOF_RU_PACK)
7832 AC_SUBST(LIGHTPROOF_EN_US_PACK)
7834 dnl ===================================================================
7835 dnl Test whether to include Watch Window extension
7836 dnl ===================================================================
7837 AC_MSG_CHECKING([for Watch Window extension integration])
7838 if test "z$enable_ext_watch_window" = "z" -o "z$enable_ext_watch_window" = "zno" ; then
7839     AC_MSG_RESULT([no])
7840     WATCH_WINDOW_EXTENSION_PACK=""
7841 else
7842     AC_MSG_RESULT([yes])
7843     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_WATCH_WINDOW"
7844     WATCH_WINDOW_EXTENSION_PACK="23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt"
7846 AC_SUBST(WATCH_WINDOW_EXTENSION_PACK)
7848 dnl ===================================================================
7849 dnl Test whether to include SmART Gallery (Diagram) extension
7850 dnl ===================================================================
7851 AC_MSG_CHECKING([for SmART Gallery (Diagram) extension integration])
7852 if test "z$enable_ext_diagram" = "z" -o "z$enable_ext_diagram" = "zno" ; then
7853     AC_MSG_RESULT([no])
7854     DIAGRAM_EXTENSION_PACK=""
7855 else
7856     AC_MSG_RESULT([yes])
7857     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_DIAGRAM"
7858     DIAGRAM_EXTENSION_PACK="4a433efb6d385264ebc1d5513782d51c-SmART_0.9.4.oxt"
7860 AC_SUBST(DIAGRAM_EXTENSION_PACK)
7862 dnl ===================================================================
7863 dnl Test whether to include Validator extension
7864 dnl ===================================================================
7865 AC_MSG_CHECKING([for Validator extension integration])
7866 if test "z$enable_ext_validator" = "z" -o "z$enable_ext_validator" = "zno" ; then
7867     AC_MSG_RESULT([no])
7868     VALIDATOR_EXTENSION_PACK=""
7869 else
7870     AC_MSG_RESULT([yes])
7871     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_VALIDATOR"
7872     VALIDATOR_EXTENSION_PACK="bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt"
7874 AC_SUBST(VALIDATOR_EXTENSION_PACK)
7876 dnl ===================================================================
7877 dnl Test whether to include Barcode extension
7878 dnl ===================================================================
7879 AC_MSG_CHECKING([for Barcode extension integration])
7880 if test "z$enable_ext_barcode" = "z" -o "z$enable_ext_barcode" = "zno" ; then
7881     AC_MSG_RESULT([no])
7882     BARCODE_EXTENSION_PACK=""
7883 else
7884     AC_MSG_RESULT([yes])
7885     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_BARCODE"
7886     BARCODE_EXTENSION_PACK="7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt"
7888 AC_SUBST(BARCODE_EXTENSION_PACK)
7890 dnl ===================================================================
7891 dnl Test whether to include ConvertTextToNumber extension
7892 dnl ===================================================================
7893 AC_MSG_CHECKING([for ConvertTextToNumber extension integration])
7894 if test "z$enable_ext_ct2n" = "z" -o "z$enable_ext_ct2n" = "zno" ; then
7895     AC_MSG_RESULT([no])
7896     CT2N_EXTENSION_PACK=""
7897 else
7898     AC_MSG_RESULT([yes])
7899     BUILD_TYPE="$BUILD_TYPE CT2N"
7900     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_CT2N"
7901     CT2N_EXTENSION_PACK="451ccf439a36a568653b024534669971-ConvertTextToNumber_1.3.2.oxt"
7903 AC_SUBST(CT2N_EXTENSION_PACK)
7905 dnl ===================================================================
7906 dnl Test whether to include Numbertext extension
7907 dnl ===================================================================
7908 AC_MSG_CHECKING([for Numbertext extension integration])
7909 if test "z$enable_ext_numbertext" = "z" -o "z$enable_ext_numbertext" = "zno" ; then
7910     AC_MSG_RESULT([no])
7911     NUMBERTEXT_EXTENSION_PACK=""
7912 else
7913     AC_MSG_RESULT([yes])
7914     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NUMBERTEXT"
7915     NUMBERTEXT_EXTENSION_PACK="b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt"
7917 AC_SUBST(NUMBERTEXT_EXTENSION_PACK)
7919 dnl ===================================================================
7920 dnl Test whether to include Hungarian Cross-reference Toolbar extension
7921 dnl ===================================================================
7922 AC_MSG_CHECKING([for Hungarian Cross-reference Toolbar extension integration])
7923 if test "z$enable_ext_hunart" = "z" -o "z$enable_ext_hunart" = "zno" ; then
7924     AC_MSG_RESULT([no])
7925     HUNART_EXTENSION_PACK=""
7926 else
7927     AC_MSG_RESULT([yes])
7928     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_HUNART"
7929     HUNART_EXTENSION_PACK="b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt"
7931 AC_SUBST(HUNART_EXTENSION_PACK)
7933 dnl ===================================================================
7934 dnl Test whether to include Typography Toolbar extension
7935 dnl ===================================================================
7936 AC_MSG_CHECKING([for Typography Toolbar extension integration])
7937 if test "z$enable_ext_typo" = "z" -o "z$enable_ext_typo" = "zno" ; then
7938     AC_MSG_RESULT([no])
7939     TYPO_EXTENSION_PACK=""
7940 else
7941     AC_MSG_RESULT([yes])
7942     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_TYPO"
7943     TYPO_EXTENSION_PACK="9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt"
7945 AC_SUBST(TYPO_EXTENSION_PACK)
7947 dnl ===================================================================
7948 dnl Test whether to include Google Docs extension
7949 dnl ===================================================================
7950 AC_MSG_CHECKING([for Google Docs extension integration])
7951 if test "z$enable_ext_google_docs" = "z" -o "z$enable_ext_google_docs" = "zno" ; then
7952     AC_MSG_RESULT([no])
7953     GOOGLE_DOCS_EXTENSION_PACK=""
7954 else
7955     AC_MSG_RESULT([yes])
7956     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_GOOGLE_DOCS"
7957     GOOGLE_DOCS_EXTENSION_PACK="cea0f63d5985ba4fcbd882031df44346-gdocs_3.0.0_modified.oxt"
7959 AC_SUBST(GOOGLE_DOCS_EXTENSION_PACK)
7961 dnl ===================================================================
7962 dnl Test whether to include NLPSolver extension
7963 dnl ===================================================================
7964 AC_MSG_CHECKING([for NLPSolver extension integration])
7965 if test "z$enable_ext_nlpsolver" = "z" -o "z$enable_ext_nlpsolver" = "zno" ; then
7966     AC_MSG_RESULT([no])
7967 else
7968     AC_MSG_RESULT([yes])
7969     BUILD_TYPE="$BUILD_TYPE NLPSOLVER"
7970     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NLPSOLVER"
7973 dnl ===================================================================
7974 dnl Test whether to include LanguageTool extension
7975 dnl ===================================================================
7976 AC_MSG_CHECKING([for LanguageTool extension integration])
7977 if test "z$enable_ext_languagetool" = "z" -o "z$enable_ext_languagetool" = "zno" ; then
7978     AC_MSG_RESULT([no])
7979 else
7980     AC_MSG_RESULT([yes])
7981     BUILD_TYPE="$BUILD_TYPE LANGUAGETOOL"
7982     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LANGUAGETOOL"
7985 dnl ===================================================================
7986 dnl Test whether to include oooblogger extension
7987 dnl ===================================================================
7988 AC_MSG_CHECKING([for oooblogger extension integration])
7989 if test "z$enable_ext_oooblogger" = "z" -o "z$enable_ext_oooblogger" = "zno" ; then
7990     AC_MSG_RESULT([no])
7991     OOOBLOGGER_EXTENSION_PACK=""
7992 else
7993     AC_MSG_RESULT([yes])
7994     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_OOOBLOGGER"
7995     OOOBLOGGER_EXTENSION_PACK="b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt"
7997 AC_SUBST(OOOBLOGGER_EXTENSION_PACK)
7999 dnl ===================================================================
8000 dnl Test whether to include Sun Professional Template Pack
8001 dnl ===================================================================
8002 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
8003 if test "z$with_sun_templates" = "z" -o "z$with_sun_templates" = "zno" ; then
8004     SUNTEMPLATES_LANG=""
8005     AC_MSG_RESULT([no integration])
8006 else
8007     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
8008     sun_supported_langs="en-US de it fr es hu"
8009     if test "z$with_sun_templates" = "zyes" ; then
8010         wanted_sun_templates="$sun_supported_langs"
8011     else
8012         # check whether the langs are supported by Sun
8013         wanted_sun_templates=
8014         for lang in $with_sun_templates ; do
8015             if test -n "`echo $sun_supported_langs | grep "$lang"`" ; then
8016                 wanted_sun_templates="$wanted_sun_templates $lang"
8017             fi
8018         done
8019     fi
8020     SUNTEMPLATES_LANG=
8021     SUNTEMPLATES_DE_PACK=
8022     SUNTEMPLATES_EN_US_PACK=
8023     SUNTEMPLATES_ES_PACK=
8024     SUNTEMPLATES_FR_PACK=
8025     SUNTEMPLATES_HU_PACK=
8026     SUNTEMPLATES_IT_PACK=
8027     # check whether the langs are requested at all
8028     for lang in $wanted_sun_templates ; do
8029     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`" ; then
8030         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
8031         case $lang in
8032         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
8033         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
8034         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
8035         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
8036         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
8037         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
8038         esac
8039     fi
8040     done
8041     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
8043 AC_SUBST(SUNTEMPLATES_LANG)
8044 AC_SUBST(SUNTEMPLATES_DE_PACK)
8045 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
8046 AC_SUBST(SUNTEMPLATES_ES_PACK)
8047 AC_SUBST(SUNTEMPLATES_FR_PACK)
8048 AC_SUBST(SUNTEMPLATES_HU_PACK)
8049 AC_SUBST(SUNTEMPLATES_IT_PACK)
8051 dnl ===================================================================
8052 dnl Test whether to include fonts
8053 dnl ===================================================================
8054 AC_MSG_CHECKING([whether to include third-party fonts])
8055 if test "$with_fonts" != "no" ; then
8056     AC_MSG_RESULT([yes])
8057     WITH_FONTS=YES
8058     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
8059 else
8060     AC_MSG_RESULT([no])
8061     WITH_FONTS=NO
8062     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
8064 AC_SUBST(WITH_FONTS)
8066 AC_MSG_CHECKING([whether to include Agfa Monotype fonts])
8067 if test "$with_agfa_monotype_fonts" = "yes" ; then
8068     AC_MSG_RESULT([yes])
8069     WITH_AGFA_MONOTYPE_FONTS=YES
8070     SCPDEFS="$SCPDEFS -DWITH_AGFA_MONOTYPE_FONTS"
8071     BUILD_TYPE="$BUILD_TYPE AGFA_MONOTYPE_FONTS"
8072 else
8073     AC_MSG_RESULT([no])
8074     WITH_AGFA_MONOTYPE_FONTS=NO
8076 AC_SUBST(WITH_AGFA_MONOTYPE_FONTS)
8078 dnl ===================================================================
8079 dnl Test whether to include ppds
8080 dnl ===================================================================
8081 AC_MSG_CHECKING([whether to include PPDs])
8082 if test "$with_ppds" != "no"; then
8083     AC_MSG_RESULT([yes])
8084 else
8085     AC_MSG_RESULT([no])
8086     WITHOUT_PPDS=YES
8087     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
8089 AC_SUBST(WITHOUT_PPDS)
8091 dnl ===================================================================
8092 dnl Test whether to include afms
8093 dnl ===================================================================
8094 AC_MSG_CHECKING([whether to include AFMs])
8095 if test "$with_afms" != "no"; then
8096     AC_MSG_RESULT([yes])
8097     BUILD_TYPE="$BUILD_TYPE AFMS"
8098 else
8099     AC_MSG_RESULT([no])
8100     WITHOUT_AFMS=YES
8101     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
8103 AC_SUBST(WITHOUT_AFMS)
8105 dnl ===================================================================
8106 dnl Test whether to include extra galleries
8107 dnl ===================================================================
8108 AC_MSG_CHECKING([whether to include extra galleries])
8109 if test "z$enable_extra_gallery" = "z" -o "z$enable_extra_gallery" = "zno" ; then
8110     AC_MSG_RESULT([no])
8111     WITH_EXTRA_GALLERY=NO
8112     OOOP_GALLERY_PACK=""
8113 else
8114     AC_MSG_RESULT([yes])
8115     WITH_EXTRA_GALLERY=YES
8116     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
8117     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
8118     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
8120 AC_SUBST(WITH_EXTRA_GALLERY)
8121 AC_SUBST(OOOP_GALLERY_PACK)
8123 dnl ===================================================================
8124 dnl Test whether to include extra templates
8125 dnl ===================================================================
8126 AC_MSG_CHECKING([whether to include extra templates])
8127 if test "z$enable_extra_template" = "z" -o "z$enable_extra_template" = "zno" ; then
8128     AC_MSG_RESULT([no])
8129     WITH_EXTRA_TEMPLATE=NO
8130     OOOP_TEMPLATES_PACK=""
8131 else
8132     AC_MSG_RESULT([yes])
8133     WITH_EXTRA_TEMPLATE=YES
8134     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
8135     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
8136     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
8138 AC_SUBST(WITH_EXTRA_TEMPLATE)
8139 AC_SUBST(OOOP_TEMPLATES_PACK)
8141 dnl ===================================================================
8142 dnl Test whether to include extra samples
8143 dnl ===================================================================
8144 AC_MSG_CHECKING([whether to include extra samples])
8145 if test "z$enable_extra_sample" = "z" -o "z$enable_extra_sample" = "zno" ; then
8146     AC_MSG_RESULT([no])
8147     WITH_EXTRA_SAMPLE=NO
8148     OOOP_SAMPLES_PACK=""
8149 else
8150     AC_MSG_RESULT([yes])
8151     WITH_EXTRA_SAMPLE=YES
8152     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
8153     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
8154     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
8156 AC_SUBST(WITH_EXTRA_SAMPLE)
8157 AC_SUBST(OOOP_SAMPLES_PACK)
8159 dnl ===================================================================
8160 dnl Test whether to include extra fonts
8161 dnl ===================================================================
8162 AC_MSG_CHECKING([whether to include extra fonts])
8163 if test "z$enable_extra_font" = "z" -o "z$enable_extra_font" = "zno" ; then
8164     AC_MSG_RESULT([no])
8165     WITH_EXTRA_FONT=NO
8166     OOOP_FONTS_PACK=""
8167 else
8168     AC_MSG_RESULT([yes])
8169     WITH_EXTRA_FONT=YES
8170     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
8171     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
8172     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
8174 AC_SUBST(WITH_EXTRA_FONT)
8175 AC_SUBST(OOOP_FONTS_PACK)
8177 dnl ===================================================================
8178 dnl Test whether to build global menu support
8179 dnl ===================================================================
8180 AC_MSG_CHECKING([whether to build global menu support])
8181 if test "z$enable_lomenubar" = "z" -o "z$enable_lomenubar" = "zno" ; then
8182     AC_MSG_RESULT([no])
8183     ENABLE_LOMENUBAR="FALSE"
8184 else
8185     AC_MSG_RESULT([yes])
8186     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]))
8187     ENABLE_LOMENUBAR="TRUE"
8189 AC_SUBST(ENABLE_LOMENUBAR)
8191 dnl ===================================================================
8192 dnl Test whether to enable online update service
8193 dnl ===================================================================
8194 AC_MSG_CHECKING([whether to enable online update])
8195 ENABLE_ONLINE_UPDATE=
8196 if test "z$enable_online_update" = "z" ; then
8197     if test "$_os" = "WINNT" -o "$_os" = "Darwin" ; then
8198         AC_MSG_RESULT([yes])
8199         ENABLE_ONLINE_UPDATE="TRUE"
8200     else
8201         AC_MSG_RESULT([no])
8202     fi
8203 else
8204     if test "z$enable_online_update" = "zyes" ; then
8205         AC_MSG_RESULT([yes])
8206         ENABLE_ONLINE_UPDATE="TRUE"
8207     else
8208         AC_MSG_RESULT([no])
8209     fi
8211 AC_SUBST(ENABLE_ONLINE_UPDATE)
8213 dnl ===================================================================
8214 dnl Test whether build target is Release Build
8215 dnl ===================================================================
8216 AC_MSG_CHECKING([whether build target is Release Build])
8217 if test "z$enable_release_build" = "z" -o "z$enable_release_build" = "zno" ; then
8218     AC_MSG_RESULT([no])
8219     ENABLE_RELEASE_BUILD="FALSE"
8220 else
8221     AC_MSG_RESULT([yes])
8222     ENABLE_RELEASE_BUILD="TRUE"
8224 AC_SUBST(ENABLE_RELEASE_BUILD)
8226 dnl ===================================================================
8227 dnl Test whether to enable ActiveX embedding
8228 dnl ===================================================================
8229 if test "$_os" = "WINNT"; then
8230     AC_MSG_CHECKING([whether to enable ActiveX embedding of LibreOffice components])
8231     if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
8232         ENABLE_ACTIVEX_COMPONENT="TRUE"
8233         AC_MSG_RESULT([yes])
8234         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
8235     else
8236         ENABLE_ACTIVEX_COMPONENT=""
8237         AC_MSG_RESULT([no])
8238     fi
8239     AC_SUBST(ENABLE_ACTIVEX_COMPONENT)
8240     AC_SUBST(SCPDEFS)
8243 AC_MSG_CHECKING([whether and how to use Xinerama])
8244 if test "$_os" = "Darwin"; then
8245     USE_XINERAMA=YES
8246     XINERAMA_LINK=dynamic
8247     AC_MSG_RESULT([yes])
8248 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
8249     if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
8250         # we have both versions, let the user decide but use the dynamic one
8251         # per default
8252         USE_XINERAMA=YES
8253         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
8254             XINERAMA_LINK=dynamic
8255         else
8256             XINERAMA_LINK=static
8257         fi
8258     elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
8259         # we have only the dynamic version
8260         USE_XINERAMA=YES
8261         XINERAMA_LINK=dynamic
8262     elif test -e "$XLIB/libXinerama.a"; then
8263         # static version
8264         if echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
8265             USE_XINERAMA=YES
8266             XINERAMA_LINK=static
8267         else
8268             USE_XINERAMA=NO
8269             XINERAMA_LINK=none
8270         fi
8271     else
8272         # no Xinerama
8273         USE_XINERAMA=NO
8274         XINERAMA_LINK=none
8275     fi
8276     if test "$USE_XINERAMA" = "YES"; then
8277         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
8278         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
8279             [AC_MSG_ERROR(Xinerama header not found.)], [])
8280         XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
8281         if test "$_os" = "FreeBSD"; then
8282             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
8283         fi
8284         if test "$_os" = "Linux"; then
8285             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
8286         fi
8287         AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
8288             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
8289     else
8290         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
8291     fi
8292 else
8293     USE_XINERAMA=NO
8294     XINERAMA_LINK=none
8295     AC_MSG_RESULT([no])
8297 AC_SUBST(USE_XINERAMA)
8298 AC_SUBST(XINERAMA_LINK)
8300 dnl ===================================================================
8301 dnl Checks for librsvg
8302 dnl ===================================================================
8304 dnl ENABLE_LIBRSVG is set to "" (for NO), SYSTEM or INTERNAL. The
8305 dnl SYSTEM_LIBRSVG, SYSTEM_GDKPIXBUF etc are redundant.
8307 ENABLE_LIBRSVG=""
8308 LIBRSVG_CFLAGS=""
8309 LIBRSVG_LIBS=""
8311 AC_MSG_CHECKING([what librsvg to use])
8313 case "$enable_librsvg" in
8314 no|disable)
8315     AC_MSG_RESULT([none])
8316     enable_librsvg=no
8317     ;;
8319 ""|yes|auto)
8320     if test $build_os = cygwin -o \
8321            $_os = Darwin; then
8322         dnl When building on/for these OSes always use the internal one,
8323         dnl if at all. Add more OSes above as needed.
8324         AC_MSG_RESULT([internal])
8325         enable_librsvg=internal
8326     elif test  $_os = iOS -o $_os = Android; then
8327         AC_MSG_RESULT([none])
8328         enable_librsvg=no
8329     else
8330         if test "$with_system_libs" = yes; then
8331             AC_MSG_RESULT([system])
8332             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8333             enable_librsvg=system
8334         elif test "$with_system_libs" = no; then
8335             AC_MSG_RESULT([internal])
8336             enable_librsvg=internal
8337         else
8338             AC_MSG_RESULT([checking further])
8339             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14,, [:])
8340             if test -z "$LIBRSVG_PKG_ERRORS"; then
8341                 enable_librsvg=system
8342             else
8343                 enable_librsvg=internal
8344             fi
8345         fi
8346     fi
8347     ;;
8349 internal)
8350     AC_MSG_RESULT([internal])
8351     ;;
8353 system)
8354     if test $_os = WINNT -a "$WITH_MINGW" != yes; then
8355         AC_MSG_ERROR([Must use internal librsvg when building with MSVC])
8356     fi
8357     AC_MSG_RESULT([system])
8358     PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8359     ;;
8362     AC_MSG_ERROR([Incorrect --enable-librsvg option])
8363     ;;
8364 esac
8366 dnl By now enable_librsvg should be "system", "internal" or "no"
8367 case $enable_librsvg in
8368 system)
8369     ENABLE_LIBRSVG=SYSTEM
8370     SYSTEM_LIBRSVG=YES
8371     ;;
8373 internal)
8374     ENABLE_LIBRSVG=INTERNAL
8375     SYSTEM_LIBRSVG=NO
8376     BUILD_TYPE="$BUILD_TYPE LIBRSVG"
8377     ;;
8380     ENABLE_LIBRSVG=NO
8381     SYSTEM_LIBRSVG=NO
8382     ;;
8385     AC_MSG_ERROR([Internal configure script error, invalid enable_librsvg value "$enable_librsvg"])
8386     ;;
8387 esac
8389 AC_SUBST(ENABLE_LIBRSVG)
8390 AC_SUBST(LIBRSVG_CFLAGS)
8391 AC_SUBST(LIBRSVG_LIBS)
8392 AC_SUBST(SYSTEM_LIBRSVG)
8394 dnl ===================================================================
8395 dnl Test whether to build cairo or rely on the system version
8396 dnl ===================================================================
8398 SYSTEM_CAIRO=""
8400 AC_MSG_CHECKING([whether to use the system cairo])
8402 if test "$with_system_cairo" = yes -o \( "$with_system_libs" = yes -a "$with_system_cairo" != no \); then
8403     SYSTEM_CAIRO=YES
8404     AC_MSG_RESULT([yes])
8406     PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
8408     if test "$with_system_xrender_headers" = "yes"; then
8409          AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
8410          AC_TRY_RUN([
8411 #include <X11/extensions/Xrender.h>
8413 int main(int argc, char **argv) {
8414 #ifdef PictStandardA8
8415       return 0;
8416 #else
8417       return 1;
8418 #endif
8420         ],
8421         [AC_MSG_RESULT([yes])],
8422         [AC_MSG_ERROR([no, X headers too old.])]
8423         )
8424     fi
8425 else
8426     AC_MSG_RESULT([no])
8428     if test $_os = Android; then
8429         dnl For Android cairo isn't
8430         dnl buildable yet.
8431         :
8432     elif test $_os = WINNT; then
8433         dnl We only need cairo for Windows if we
8434         dnl build librsvg or directx disabled
8435         if test "$ENABLE_LIBRSVG" != NO -o -z "$ENABLE_DIRECTX"; then
8436             BUILD_TYPE="$BUILD_TYPE CAIRO"
8437         fi
8438     else
8439         BUILD_TYPE="$BUILD_TYPE CAIRO"
8440     fi
8443 AC_SUBST(SYSTEM_CAIRO)
8444 AC_SUBST(CAIRO_CFLAGS)
8445 AC_SUBST(CAIRO_LIBS)
8448 dnl ===================================================================
8449 dnl Test whether to build gdk-pixbuf or rely on the system version
8450 dnl ===================================================================
8452 AC_MSG_CHECKING([whether to use the system gdk-pixbuf])
8454 dnl As long as the only thing we need gdk-pixbuf for is below
8455 dnl librsvg, use the same --enable-librsvg (possibly implied
8456 dnl by --with-system-libs) to override this.
8458 if test "$SYSTEM_LIBRSVG" = YES; then
8459     SYSTEM_GDKPIXBUF=YES
8460     AC_MSG_RESULT([yes])
8461 else
8462     case "$_os" in
8463     WINNT|Darwin|iOS|Android)
8464         SYSTEM_GDKPIXBUF=NO
8465         AC_MSG_RESULT([no])
8466         ;;
8467     *)
8468         SYSTEM_GDKPIXBUF=YES
8469         AC_MSG_RESULT([yes])
8470         ;;
8471     esac
8473 AC_SUBST(SYSTEM_GDKPIXBUF)
8475 dnl ===================================================================
8476 dnl Test whether to build GLib or rely on the system version
8477 dnl ===================================================================
8479 AC_MSG_CHECKING([whether to use the system GLib])
8481 dnl As long as the only thing we need GLib for is below
8482 dnl librsvg, use the same --enable-librsvg (possibly implied
8483 dnl by --with-system-libs) to override this.
8485 if test "$SYSTEM_LIBRSVG" = YES; then
8486     SYSTEM_GLIB=YES
8487     AC_MSG_RESULT([yes])
8488 else
8489     case "$_os" in
8490     WINNT|Darwin|iOS|Android)
8491         SYSTEM_GLIB=NO
8492         AC_MSG_RESULT([no])
8493         ;;
8494     *)
8495         SYSTEM_GLIB=YES
8496         AC_MSG_RESULT([yes])
8497         ;;
8498     esac
8500 AC_SUBST(SYSTEM_GLIB)
8502 dnl ===================================================================
8503 dnl Test whether to build gettext runtime (libintl) or rely on the
8504 dnl system version
8505 dnl ===================================================================
8507 AC_MSG_CHECKING([whether to use the system gettext runtime])
8509 if test "$with_system_gettext" = yes -o \( "$with_system_libs" = yes -a "$with_system_gettext" != no \); then
8510     SYSTEM_GETTEXT=YES
8511     AC_MSG_RESULT([yes])
8512 else
8513     case "$_os" in
8514     WINNT|Darwin|iOS|Android)
8515         SYSTEM_GETTEXT=NO
8516         AC_MSG_RESULT([no])
8517         ;;
8518     *)
8519         SYSTEM_GETTEXT=YES
8520         AC_MSG_RESULT([yes])
8521         ;;
8522     esac
8524 AC_SUBST(SYSTEM_GETTEXT)
8526 dnl ===================================================================
8527 dnl Test whether to build libcroco or rely on the system version
8528 dnl ===================================================================
8530 AC_MSG_CHECKING([whether to use the system libcroco])
8532 dnl As long as the only thing we need libcroco for is below
8533 dnl librsvg, use the same --enable-librsvg (possibly implied
8534 dnl by --with-system-libs) to override this.
8536 if test "$SYSTEM_LIBRSVG" = YES; then
8537     SYSTEM_LIBCROCO=YES
8538     AC_MSG_RESULT([yes])
8539 else
8540     case "$_os" in
8541     WINNT|Darwin|iOS|Android)
8542         SYSTEM_LIBCROCO=NO
8543         AC_MSG_RESULT([no])
8544         ;;
8545     *)
8546         SYSTEM_LIBCROCO=YES
8547         AC_MSG_RESULT([yes])
8548         ;;
8549     esac
8551 AC_SUBST(SYSTEM_LIBCROCO)
8553 dnl ===================================================================
8554 dnl Test whether to build Pango or rely on the system version
8555 dnl ===================================================================
8557 AC_MSG_CHECKING([whether to use the system pango])
8559 dnl As long as the only thing we need Pango for is below
8560 dnl librsvg, use the same --enable-librsvg (possibly implied
8561 dnl by --with-system-libs) to override this.
8563 if test "$SYSTEM_LIBRSVG" = YES; then
8564     SYSTEM_PANGO=YES
8565     AC_MSG_RESULT([yes])
8566 else
8567     case "$_os" in
8568     WINNT|Darwin|iOS|Android)
8569         SYSTEM_PANGO=NO
8570         AC_MSG_RESULT([no])
8571         ;;
8572     *)
8573         SYSTEM_PANGO=YES
8574         AC_MSG_RESULT([yes])
8575         ;;
8576     esac
8578 AC_SUBST(SYSTEM_PANGO)
8580 dnl ===================================================================
8581 dnl Test whether to build libgsf or rely on the system version
8582 dnl ===================================================================
8584 AC_MSG_CHECKING([whether to use the system libgsf])
8586 dnl As long as the only thing we need libgsf for is below librsvg (is
8587 dnl it?), use the same --enable-librsvg (possibly implied by
8588 dnl --with-system-libs) to override this.
8590 if test "$SYSTEM_LIBRSVG" = YES; then
8591     SYSTEM_LIBGSF=YES
8592     AC_MSG_RESULT([yes])
8593 else
8594     case "$_os" in
8595     WINNT|Darwin|iOS|Android)
8596         SYSTEM_LIBGSF=NO
8597         AC_MSG_RESULT([no])
8598         ;;
8599     *)
8600         SYSTEM_LIBGSF=YES
8601         AC_MSG_RESULT([yes])
8602         ;;
8603     esac
8605 AC_SUBST(SYSTEM_LIBGSF)
8607 dnl ===================================================================
8608 dnl Test whether to build libpng or rely on the system version
8609 dnl ===================================================================
8611 AC_MSG_CHECKING([whether to use the system libpng])
8613 dnl How should and does this interact with the checks for libpng
8614 dnl related to use of libpng in the quickstarter above? This needs to
8615 dnl be unified.
8617 if test "$with_system_libpng" = yes -o \( "$with_system_libs" = yes -a "$with_system_libpng" != no \); then
8618     SYSTEM_LIBPNG=YES
8619     AC_MSG_RESULT([yes])
8620 else
8621     case "$_os" in
8622     WINNT|Darwin|iOS|Android)
8623         SYSTEM_LIBPNG=NO
8624         AC_MSG_RESULT([no])
8625         ;;
8626     *)
8627         SYSTEM_LIBPNG=YES
8628         AC_MSG_RESULT([no])
8629         ;;
8630     esac
8632 AC_SUBST(SYSTEM_LIBPNG)
8634 dnl ===================================================================
8635 dnl Test whether to build libjpeg or rely on the system version
8636 dnl ===================================================================
8637 dnl FIXME: this is currently because we have jpeg-6b for our filters
8638 dnl        and jpeg-8 as dependency for librsvg
8639 dnl        this should be unified into using only one version for both
8641 AC_MSG_CHECKING([whether to use the system libjpeg])
8643 if test "$SYSTEM_JPEG" == "YES"; then
8644     SYSTEM_LIBJPEG=YES
8645     AC_MSG_RESULT([yes])
8646 else
8647     case "$_os" in
8648     WINNT|Darwin|iOS|Android)
8649         SYSTEM_LIBJPEG=NO
8650         AC_MSG_RESULT([no])
8651         ;;
8652     *)
8653         SYSTEM_LIBJPEG=YES
8654         AC_MSG_RESULT([yes])
8655         ;;
8656     esac
8658 AC_SUBST(SYSTEM_LIBJPEG)
8660 dnl ===================================================================
8661 dnl Check for runtime JVM search path
8662 dnl ===================================================================
8663 if test "$SOLAR_JAVA" != ""; then
8664     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
8665     if test -n "$with_jvm_path" && test "$with_jvm_path" != "no"; then
8666         AC_MSG_RESULT([yes])
8667         if ! test -d "$with_jvm_path"; then
8668             AC_MSG_ERROR(["$with_jvm_path" not a directory])
8669         fi
8670         if ! test -d "$with_jvm_path"jvm; then
8671             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
8672         fi
8673         JVM_ONE_PATH_CHECK="$with_jvm_path"
8674         AC_SUBST(JVM_ONE_PATH_CHECK)
8675     else
8676         AC_MSG_RESULT([no])
8677     fi
8680 dnl ===================================================================
8681 dnl Test for the presence of Ant and that it works
8682 dnl ===================================================================
8684 if test "$SOLAR_JAVA" != ""; then
8685     ANT_HOME=; export ANT_HOME
8686     WITH_ANT_HOME=; export WITH_ANT_HOME
8687     if test -z "$with_ant_home"; then
8688         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
8689     else
8690         if test "$_os" = "WINNT"; then
8691             with_ant_home=`cygpath -u "$with_ant_home"`
8692         fi
8693         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
8694         WITH_ANT_HOME=$with_ant_home
8695         ANT_HOME=$with_ant_home
8696     fi
8698     if test -z "$ANT"; then
8699         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
8700     else
8701         # resolve relative or absolute symlink
8702         while test -h "$ANT"; do
8703             a_cwd=`pwd`
8704             a_basename=`basename "$ANT"`
8705             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
8706             cd "`dirname "$ANT"`"
8707             cd "`dirname "$a_script"`"
8708             ANT="`pwd`"/"`basename "$a_script"`"
8709             cd "$a_cwd"
8710         done
8712         AC_MSG_CHECKING([if $ANT works])
8713         cat > conftest.java << EOF
8714         public class conftest {
8715             int testmethod(int a, int b) {
8716                     return a + b;
8717             }
8718         }
8721         cat > conftest.xml << EOF
8722         <project name="conftest" default="conftest">
8723         <target name="conftest">
8724             <javac srcdir="." includes="conftest.java">
8725             </javac>
8726         </target>
8727         </project>
8730         oldJAVA_HOME=$JAVA_HOME
8731         if test "$JAVACISGCJ" = "yes"; then
8732             JAVA_HOME=; export JAVA_HOME
8733             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
8734         else
8735             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
8736         fi
8737         AC_TRY_EVAL(ant_cmd)
8738         if test $? = 0 && test -f ./conftest.class ; then
8739             AC_MSG_RESULT([Ant works])
8740             if test -z "$WITH_ANT_HOME"; then
8741                 ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
8742                 if test -z "$ANT_HOME"; then
8743                     ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
8744                 fi
8745             else
8746                 ANT_HOME="$WITH_ANT_HOME"
8747             fi
8748         else
8749             echo "configure: Ant test failed" >&5
8750             cat conftest.java >&5
8751             cat conftest.xml >&5
8752             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
8753             ANT_HOME=""
8754             echo "Ant does not work - Some Java projects will not build!" >>warn
8755         fi
8756         JAVA_HOME=$oldJAVA_HOME
8757         rm -f conftest* core core.* *.core
8758     fi
8759     if test -z "$ANT_HOME"; then
8760         ANT_HOME="NO_ANT_HOME"
8761     fi
8762     AC_SUBST(ANT_HOME)
8764     dnl Checking for ant.jar
8765     if test "$ANT_HOME" != "NO_ANT_HOME"; then
8766         AC_MSG_CHECKING([Ant lib directory])
8767         if test -f $ANT_HOME/lib/ant.jar; then
8768             ANT_LIB="$ANT_HOME/lib"
8769         else
8770             if test -f $ANT_HOME/ant.jar; then
8771                 ANT_LIB="$ANT_HOME"
8772             else
8773                 if test -f /usr/share/java/ant.jar; then
8774                     ANT_LIB=/usr/share/java
8775                 else
8776                     if test -f /usr/share/ant-core/lib/ant.jar; then
8777                         ANT_LIB=/usr/share/ant-core/lib
8778                     else
8779                         if test -f $ANT_HOME/lib/ant/ant.jar; then
8780                             ANT_LIB="$ANT_HOME/lib/ant"
8781                         else
8782                             if test -f /usr/share/lib/ant/ant.jar; then
8783                                 ANT_LIB=/usr/share/lib/ant
8784                             else
8785                                 AC_MSG_ERROR([Ant libraries not found!])
8786                             fi
8787                         fi
8788                     fi
8789                 fi
8790             fi
8791         fi
8792         AC_MSG_RESULT([Ant lib directory found.])
8793     fi
8794     AC_SUBST(ANT_LIB)
8796     ant_minver=1.6.0
8797     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
8799     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
8800     ant_version=`$ANT -version | $AWK '{ print $4; }'`
8801     ant_version_major=`echo $ant_version | cut -d. -f1`
8802     ant_version_minor=`echo $ant_version | cut -d. -f2`
8803     echo "configure: ant_version $ant_version " >&5
8804     echo "configure: ant_version_major $ant_version_major " >&5
8805     echo "configure: ant_version_minor $ant_version_minor " >&5
8806     if test "$ant_version_major" -ge "2"; then
8807         AC_MSG_RESULT([yes, $ant_version])
8808     elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
8809         AC_MSG_RESULT([yes, $ant_version])
8810     else
8811         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
8812     fi
8814     if test "$ENABLE_MEDIAWIKI" = "YES"; then
8815         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
8816         rm -rf confdir
8817         mkdir confdir
8818         cat > conftest.java << EOF
8819             public class conftest {
8820                 int testmethod(int a, int b) {
8821                     return a + b;
8822                 }
8823             }
8826         cat > conftest.xml << EOF
8827             <project name="conftest" default="conftest">
8828             <target name="conftest" depends="copytest">
8829                 <javac srcdir="." includes="conftest.java">
8830                 </javac>
8831             </target>
8832             <target name="copytest">
8833                  <copy todir="confdir">
8834                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
8835                  <filterset/>
8836                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
8837                  </copy>
8838             </target>
8839             </project>
8842         if test "$JAVACISGCJ" = "yes"; then
8843             JAVA_HOME=; export JAVA_HOME
8844             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
8845         else
8846             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
8847         fi
8848         AC_TRY_EVAL(ant_cmd)
8849         if test $? = 0 && test -f ./conftest.class ; then
8850             AC_MSG_RESULT([yes])
8851             rm -rf confdir
8852         else
8853             echo "configure: Ant test failed" >&5
8854             cat conftest.java >&5
8855             cat conftest.xml >&5
8856             rm -rf confdir
8857             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
8858         fi
8859     fi
8860     rm -f conftest* core core.* *.core
8863 OOO_JUNIT_JAR=
8864 if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
8865     AC_MSG_CHECKING([for JUnit 4])
8866     if test "$with_junit" = "yes"; then
8867         if test -e /usr/share/java/junit4.jar; then
8868             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
8869         else
8870            if test -e /usr/share/lib/java/junit.jar; then
8871               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
8872            else
8873               OOO_JUNIT_JAR=/usr/share/java/junit.jar
8874            fi
8875         fi
8876     else
8877         OOO_JUNIT_JAR=$with_junit
8878     fi
8879     if test "$_os" = "WINNT"; then
8880         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
8881     fi
8882     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
8883         grep org/junit/Before.class > /dev/null 2>&5
8884     if test $? -eq 0; then
8885         # check if either class-path entry is available for hamcrest or
8886         # it's bundled
8887         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |grep -q hamcrest || \
8888             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |grep -q 'Class-Path: hamcrest'; then
8889             AC_MSG_RESULT([$OOO_JUNIT_JAR])
8890         else
8891             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
8892 provide a full junit jar or use --without-junit])
8893         fi
8894     else
8895         AC_MSG_RESULT([no])
8896         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
8897 location (/usr/share/java), specify its pathname via
8898 --with-junit=..., or disable it via --without-junit])
8899     fi
8901 AC_SUBST(OOO_JUNIT_JAR)
8903 dnl ===================================================================
8904 dnl Product version
8905 dnl ===================================================================
8906 AC_MSG_CHECKING([for product version])
8907 [eval $(sed -n -e 's/ //g' -e '/PRODUCTVERSION=/p' solenv/inc/productversion.mk)]
8908 AC_MSG_RESULT([$PRODUCTVERSION])
8909 AC_SUBST(PRODUCTVERSION)
8911 dnl ===================================================================
8912 dnl Dealing with l10n options
8913 dnl ===================================================================
8914 AC_MSG_CHECKING([which languages to be built])
8915 # get list of all languages
8916 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
8917 # the sed command does the following:
8918 #   + if a line ends with a backslash, append the next line to it
8919 #   + adds " on the beginning of the value (after =)
8920 #   + adds " at the end of the value
8921 #   + removes en-US; we want to put it on the beginning
8922 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
8923 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' solenv/inc/langlist.mk)]
8924 ALL_LANGS="en-US $completelangiso"
8925 # check the configured localizations
8926 WITH_LANG="$with_lang"
8927 if test -z "$WITH_LANG"; then
8928     AC_MSG_RESULT([en-US])
8929 else
8930     AC_MSG_RESULT([$WITH_LANG])
8931     GIT_REPO_NAMES="$GIT_REPO_NAMES translations"
8933 # check that the list is valid
8934 for lang in $WITH_LANG ; do
8935     test "$lang" = "ALL" && continue;
8936     test "$lang" = "kid" && continue;
8937     # need to check for the exact string, so add space before and after the list of all languages
8938     for vl in $ALL_LANGS ; do
8939         if test "$vl" = "$lang" ; then
8940            break;
8941         fi
8942     done
8943     if test "$vl" != "$lang" ; then
8944         AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
8945     fi
8946 done
8947 # list with substituted ALL
8948 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
8949 # this variable is used only by bin/distro-install-* helper scripts
8950 # they need a real list of languages
8951 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
8952 AC_SUBST(ALL_LANGS)
8953 AC_SUBST(WITH_LANG)
8954 AC_SUBST(WITH_LANG_LIST)
8955 AC_SUBST(GIT_REPO_NAMES)
8957 AC_MSG_CHECKING([for another 'intro' bitmap])
8958 INTRO_BITMAP=
8959 if test -z "$with_intro_bitmap" -o "$with_intro_bitmap" = "no" ; then
8960     INTRO_BITMAP=
8961     AC_MSG_RESULT([none])
8962 else
8963     case "$with_intro_bitmap" in
8964     *.png) INTRO_BITMAP="$with_intro_bitmap" ;;
8965     *)     AC_MSG_WARN([Intro bitmap should be a .png file!]) ;;
8966     esac
8967     AC_MSG_RESULT([$INTRO_BITMAP])
8969 AC_SUBST(INTRO_BITMAP)
8971 AC_MSG_CHECKING([for custom 'intro' progress bar color])
8972 PROGRESSBARCOLOR=
8973 if test -z "$with_intro_progressbar_color" ; then
8974    PROGRESSBARCOLOR="126,170,23"
8975    AC_MSG_RESULT([none])
8976 else
8977    PROGRESSBARCOLOR="$with_intro_progressbar_color"
8978    AC_MSG_RESULT([$PROGRESSBARCOLOR])
8980 AC_SUBST(PROGRESSBARCOLOR)
8982 AC_MSG_CHECKING([for custom 'intro' progress bar size])
8983 PROGRESSSIZE=
8984 if test -z "$with_intro_progressbar_size" ; then
8985    PROGRESSSIZE="319,10"
8986    AC_MSG_RESULT([none])
8987 else
8988    PROGRESSSIZE="$with_intro_progressbar_size"
8989    AC_MSG_RESULT([$PROGRESSSIZE])
8991 AC_SUBST(PROGRESSSIZE)
8993 AC_MSG_CHECKING([for custom 'intro' progress bar position])
8994 PROGRESSPOSITION=
8995 if test -z "$with_intro_progressbar_position" ; then
8996    PROGRESSPOSITION="164,225"
8997    AC_MSG_RESULT([none])
8998 else
8999    PROGRESSPOSITION="$with_intro_progressbar_position"
9000    AC_MSG_RESULT([$PROGRESSPOSITION])
9002 AC_SUBST(PROGRESSPOSITION)
9004 AC_MSG_CHECKING([for custom 'intro' progress bar frame color])
9005 PROGRESSFRAMECOLOR=
9006 if test -z "$with_intro_progressbar_frame_color" ; then
9007    PROGRESSFRAMECOLOR="207,208,211"
9008    AC_MSG_RESULT([none])
9009 else
9010    PROGRESSFRAMECOLOR="$with_intro_progressbar_frame_color"
9011    AC_MSG_RESULT([$PROGRESSFRAMECOLOR])
9013 AC_SUBST(PROGRESSFRAMECOLOR)
9015 AC_MSG_CHECKING([for another 'about' bitmap])
9016 ABOUT_BITMAP=
9017 if test -z "$with_about_bitmap" -o "$with_about_bitmap" = "no" ; then
9018     ABOUT_BITMAP=
9019     AC_MSG_RESULT([none])
9020 else
9021    case "$with_about_bitmap" in
9022    *.png) ABOUT_BITMAP="$with_about_bitmap" ;;
9023    *)     AC_MSG_WARN([About bitmap should be a .png file!]) ;;
9024    esac
9025    AC_MSG_RESULT([$ABOUT_BITMAP])
9027 AC_SUBST(ABOUT_BITMAP)
9029 AC_MSG_CHECKING([for another 'start center left' bitmap])
9030 STARTCENTER_LEFT_BITMAP=
9031 if test -z "$with_startcenter_left_bitmap" -o "$with_startcenter_left_bitmap" = "no" ; then
9032    STARTCENTER_LEFT_BITMAP=
9033    AC_MSG_RESULT([none])
9034 else
9035    case "$with_startcenter_left_bitmap" in
9036       *.png) STARTCENTER_LEFT_BITMAP="$with_startcenter_left_bitmap" ;;
9037       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9038    esac
9039    AC_MSG_RESULT([$STARTCENTER_LEFT_BITMAP])
9041 AC_SUBST(STARTCENTER_LEFT_BITMAP)
9043 AC_MSG_CHECKING([for another 'start center right' bitmap])
9044 STARTCENTER_RIGHT_BITMAP=
9045 if test -z "$with_startcenter_right_bitmap" -o "$with_startcenter_right_bitmap" = "no" ; then
9046    STARTCENTER_RIGHT_BITMAP=
9047    AC_MSG_RESULT([none])
9048 else
9049    case "$with_startcenter_right_bitmap" in
9050       *.png) STARTCENTER_RIGHT_BITMAP="$with_startcenter_right_bitmap" ;;
9051       *)     AC_MSG_WARN([Startcenter right bitmap should be a .png file!]) ;;
9052    esac
9053    AC_MSG_RESULT([$STARTCENTER_RIGHT_BITMAP])
9055 AC_SUBST(STARTCENTER_RIGHT_BITMAP)
9057 AC_MSG_CHECKING([for another 'start center rtl left' bitmap])
9058 STARTCENTER_RTL_LEFT_BITMAP=
9059 if test -z "$with_startcenter_rtl_left_bitmap" -o "$with_startcenter_rtl_left_bitmap" = "no" ; then
9060    STARTCENTER_RTL_LEFT_BITMAP=
9061    AC_MSG_RESULT([none])
9062 else
9063    case "$with_startcenter_rtl_left_bitmap" in
9064       *.png) STARTCENTER_RTL_LEFT_BITMAP="$with_startcenter_rtl_left_bitmap" ;;
9065       *)     AC_MSG_WARN([Startcenter rtl left bitmap should be a .png file!]) ;;
9066    esac
9067    AC_MSG_RESULT([$STARTCENTER_RTL_LEFT_BITMAP])
9069 AC_SUBST(STARTCENTER_RTL_LEFT_BITMAP)
9071 AC_MSG_CHECKING([for another 'start center rtl right' bitmap])
9072 STARTCENTER_RTL_RIGHT_BITMAP=
9073 if test -z "$with_startcenter_rtl_right_bitmap" -o "$with_startcenter_rtl_right_bitmap" = "no" ; then
9074    STARTCENTER_RTL_RIGHT_BITMAP=
9075    AC_MSG_RESULT([none])
9076 else
9077    case "$with_startcenter_rtl_right_bitmap" in
9078       *.png) STARTCENTER_RTL_RIGHT_BITMAP="$with_startcenter_rtl_right_bitmap" ;;
9079       *)     AC_MSG_WARN([Startcenter rtl right bitmap should be a .png file!]) ;;
9080    esac
9081    AC_MSG_RESULT([$STARTCENTER_RTL_RIGHT_BITMAP])
9083 AC_SUBST(STARTCENTER_RTL_RIGHT_BITMAP)
9085 AC_MSG_CHECKING([for another 'start center space' bitmap])
9086 STARTCENTER_SPACE_BITMAP=
9087 if test -z "$with_startcenter_space_bitmap" -o "$with_startcenter_space_bitmap" = "no" ; then
9088    STARTCENTER_SPACE_BITMAP=
9089    AC_MSG_RESULT([none])
9090 else
9091    case "$with_startcenter_space_bitmap" in
9092       *.png) STARTCENTER_SPACE_BITMAP="$with_startcenter_space_bitmap" ;;
9093       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9094    esac
9095    AC_MSG_RESULT([$STARTCENTER_SPACE_BITMAP])
9097 AC_SUBST(STARTCENTER_SPACE_BITMAP)
9099 OOO_VENDOR=
9100 AC_MSG_CHECKING([for vendor])
9101 if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
9102     AC_MSG_RESULT([not set])
9103 else
9104     OOO_VENDOR="$with_vendor"
9105     AC_MSG_RESULT([$OOO_VENDOR])
9107 AC_SUBST(OOO_VENDOR)
9109 UNIXWRAPPERNAME=
9110 AC_MSG_CHECKING([for UNIX wrapper name])
9111 if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
9112     AC_MSG_RESULT([not set])
9113 else
9114     UNIXWRAPPERNAME="$with_unix_wrapper"
9115     AC_MSG_RESULT([$UNIXWRAPPERNAME])
9117 AC_SUBST(UNIXWRAPPERNAME)
9119 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
9120 if test "$with_compat_oowrappers" = "yes" ; then
9121     WITH_COMPAT_OOWRAPPERS=YES
9122     AC_MSG_RESULT(yes)
9123 else
9124     WITH_COMPAT_OOWRAPPERS=
9125     AC_MSG_RESULT(no)
9127 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
9129 AC_MSG_CHECKING([for product name])
9130 PRODUCTNAME=AC_PACKAGE_NAME
9131 AC_MSG_RESULT([$PRODUCTNAME])
9132 AC_SUBST(PRODUCTNAME)
9134 AC_MSG_CHECKING([for prefix])
9135 PREFIXDIR="$prefix"
9136 AC_MSG_RESULT([$PREFIXDIR])
9137 AC_SUBST(PREFIXDIR)
9139 AC_MSG_CHECKING([for libdir])
9140 LIBDIR=[$(eval echo $(eval echo $libdir))]
9141 AC_MSG_RESULT([$LIBDIR])
9142 AC_SUBST(LIBDIR)
9144 AC_MSG_CHECKING([for data dir])
9145 DATADIR=[$(eval echo $(eval echo $datadir))]
9146 AC_MSG_RESULT([$DATADIR])
9147 AC_SUBST(DATADIR)
9149 AC_MSG_CHECKING([for man dir])
9150 MANDIR=[$(eval echo $(eval echo $mandir))]
9151 AC_MSG_RESULT([$MANDIR])
9152 AC_SUBST(MANDIR)
9154 AC_MSG_CHECKING([for doc dir])
9155 DOCDIR=[$(eval echo $(eval echo $docdir))]
9156 AC_MSG_RESULT([$DOCDIR])
9157 AC_SUBST(DOCDIR)
9159 AC_MSG_CHECKING([whether to statically link to Gtk])
9160 if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
9161     ENABLE_STATIC_GTK="TRUE"
9162     AC_MSG_RESULT([yes])
9163 else
9164     ENABLE_STATIC_GTK="FALSE"
9165     AC_MSG_RESULT([no])
9167 AC_SUBST(ENABLE_STATIC_GTK)
9169 AC_MSG_CHECKING([whether to use layout dialogs])
9170 if test -n "$enable_layout" && test "$enable_layout" != "no"; then
9171     ENABLE_LAYOUT="TRUE"
9172     AC_MSG_RESULT([yes])
9173 else
9174     ENABLE_LAYOUT="FALSE"
9175     AC_MSG_RESULT([no])
9177 AC_SUBST(ENABLE_LAYOUT)
9179 # ===================================================================
9180 # De- or increase default verbosity of build process
9181 # ===================================================================
9182 AC_MSG_CHECKING([build verbosity])
9183 if test -n "$enable_verbose"; then
9184     if test "$enable_verbose" = "yes"; then
9185         VERBOSE="TRUE"
9186         AC_MSG_RESULT([high])
9187     fi
9188     if test "$enable_verbose" = "no"; then
9189         VERBOSE="FALSE"
9190         AC_MSG_RESULT([low])
9191     fi
9192 else
9193     AC_MSG_RESULT([not set])
9195 AC_SUBST(VERBOSE)
9197 dnl ===================================================================
9198 dnl Use zenity during build
9199 dnl ===================================================================
9200 AC_MSG_CHECKING([whether to use zenity during build])
9201 if test "$enable_zenity" = "yes"; then
9202     AC_MSG_RESULT([yes])
9203     AC_PATH_PROGS( ZNTY, zenity )
9204     if test -z "$ZNTY"; then
9205         ENABLE_ZENITY=FALSE
9206     else
9207         ENABLE_ZENITY=TRUE
9208     fi
9209 else
9210     ENABLE_ZENITY=FALSE
9211     AC_MSG_RESULT([no])
9213 AC_SUBST(ENABLE_ZENITY)
9216 dnl ===================================================================
9217 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
9218 dnl --enable-dependency-tracking configure option
9219 dnl ===================================================================
9220 AC_MSG_CHECKING([whether to enable dependency tracking])
9221 if test "$enable_dependency_tracking" = "no"; then
9222     nodep=TRUE
9223     AC_MSG_RESULT([no])
9224 else
9225     AC_MSG_RESULT([yes])
9227 AC_SUBST(nodep)
9229 dnl ===================================================================
9230 dnl Number of CPUs to use during the build
9231 dnl ===================================================================
9232 AC_MSG_CHECKING([for number of processors to use])
9233 if test -n "$with_num_cpus"; then
9234     BUILD_NCPUS=$with_num_cpus
9235 else
9236     case `uname -s` in
9238     Darwin|FreeBSD|NetBSD|OpenBSD)
9239         BUILD_NCPUS=`sysctl -n hw.ncpu`
9240         ;;
9242     *)
9243         BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
9244         ;;
9245     esac
9247     # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
9248     # unexpected format, 'wc -l' will have returned 0.
9249     if test "$BUILD_NCPUS" -eq 0; then
9250         BUILD_NCPUS=1
9251     fi
9253 AC_MSG_RESULT([$BUILD_NCPUS])
9254 AC_SUBST(BUILD_NCPUS)
9256 # ===================================================================
9257 # Creating bigger shared library to link against
9258 # ===================================================================
9259 AC_MSG_CHECKING([whether to create a big library for better performance])
9260 MERGELIBS=
9261 if test "$enable_mergelibs" = "yes"; then
9262     MERGELIBS="TRUE"
9263     AC_MSG_RESULT([yes])
9264 else
9265     AC_MSG_RESULT([no])
9267 AC_SUBST(MERGELIBS)
9269 dnl ===================================================================
9270 dnl Number of parallel jobs to be executed by dmake
9271 dnl ===================================================================
9272 AC_MSG_CHECKING([for maximum of jobs per processor])
9273 BUILD_MAX_JOBS="1"
9274 if test "z$with_max_jobs" != "z"; then
9275     BUILD_MAX_JOBS="$with_max_jobs"
9276 else
9277     if test "$enable_icecream" = "yes" ; then
9278         BUILD_MAX_JOBS="10"
9279     fi
9281 AC_MSG_RESULT([$BUILD_MAX_JOBS])
9282 AC_SUBST(BUILD_MAX_JOBS)
9284 # =====================================================================
9285 # determine the parallelism for gnu make
9286 # =====================================================================
9287 AC_MSG_CHECKING([for maximum parallelism for gmake])
9288 if test $BUILD_MAX_JOBS -gt $BUILD_NCPUS ; then
9289     GMAKE_PARALLELISM="$BUILD_MAX_JOBS"
9290 else
9291     GMAKE_PARALLELISM="$BUILD_NCPUS"
9293 GMAKE_MODULE_PARALLELISM="$BUILD_MAX_JOBS"
9294 if test "$no_parallelism_make" = "YES" ; then
9295     if test -z "$with_num_cpus"; then
9296         GMAKE_PARALLELISM="1";
9297         if test $GMAKE_MODULE_PARALLELISM -gt 1 ; then
9298             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
9299             if test -z "$with_num_cpus"; then
9300                 echo "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this." >> warn
9301             fi
9302             GMAKE_MODULE_PARALLELISM="1"
9303         fi
9304     else
9305         GMAKE_PARALLELISM="$BUILD_NCPUS";
9306         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
9307     fi
9310 # GMAKE_PARALLELISM is used in tail_build
9311 # GMAKE_MODULE_PARALLELISM is used when building individual gbuildified module
9312 AC_MSG_RESULT([per module:$GMAKE_MODULE_PARALLELISM, for tail_build:$GMAKE_PARALLELISM])
9313 AC_SUBST(GMAKE_PARALLELISM)
9314 AC_SUBST(GMAKE_MODULE_PARALLELISM)
9316 dnl ===================================================================
9317 dnl Setting up the environment.
9318 dnl ===================================================================
9319 echo "setting up the build environment variables..."
9321 if test -z "$COMPATH"; then
9322     AC_MSG_ERROR([No compiler found.])
9324 AC_SUBST(COMPATH)
9326 AC_MSG_CHECKING([solver path])
9327 if test -z "$with_local_solver"; then
9328     LOCAL_SOLVER="DEFAULT"
9329     AC_MSG_RESULT([default])
9330 else
9331     LOCAL_SOLVER=$with_local_solver
9332     AC_MSG_RESULT([$with_local_solver])
9334 AC_SUBST(LOCAL_SOLVER)
9336 AC_SUBST(BUILD_TYPE)
9338 # make sure config.guess is +x; we execute config.guess, so it has to be so;
9339 chmod +x ./config.guess
9341 dnl Setting up the post_download check script
9342 dnl Using autoconf here, so that the migration from the previous state
9343 dnl (checks for the additional Windows downloads were directly in
9344 dnl configure.in) is as easy as possible
9345 echo "setting up the post_download check script"
9346 autoconf post_download.in > post_download
9347 chmod +x post_download
9349 # Generate a configuration timestamp we can use for deps
9350 if test -f set_soenv; then
9351     mv -f set_soenv set_soenv.last
9352 else
9353     echo > set_soenv.last
9356 AC_OUTPUT([set_soenv Makefile bin/repo-list])
9358 # touch the config timestamp file set_soenv.stamp
9359 if test ! -f set_soenv.stamp; then
9360     echo > set_soenv.stamp
9361 elif diff set_soenv set_soenv.last >/dev/null 2>&1; then
9362     echo "Configuration unchanged - avoiding scp2 stamp update"
9363 else
9364     echo > set_soenv.stamp
9367 dnl Run the set_soenv script to setup the Env.Host.sh script that sets
9368 dnl environment variables for the build.
9369 chmod +x set_soenv
9371 ./set_soenv
9373 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: