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