fix invalid superflous #endif from 5bd2890a56125d391b42f34d51e2e0c57b0a80b0
[LibreOffice.git] / configure.in
blob0a2970bc08f8534c790dbfce972467fa24aa13da
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(cmis,
526     AS_HELP_STRING([--without-cmis],
527         [Disable experimental CMIS interface.]),
530 AC_ARG_WITH(gnu-patch,
531     AS_HELP_STRING([--with-gnu-patch],
532         [Specify location of GNU patch on Solaris or FreeBSD.]),
535 AC_ARG_WITH(gnu-cp,
536     AS_HELP_STRING([--with-gnu-cp],
537         [Specify location of GNU cp on Solaris or FreeBSD.]),
540 AC_ARG_WITH(system-graphite,
541     AS_HELP_STRING([--with-system-graphite],
542         [Use graphite library already installed on system.]),
545 AC_ARG_WITH(external-tar,
546     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
547         [Specify path to tarfiles manually.]),
548     TARFILE_LOCATION=$withval ,
551 AC_ARG_WITH(linked-git,
552     AS_HELP_STRING([--with-linked-git=<OTHER_CLONE_DIR>],
553         [Specify another checkout's clonedir to re-use. This makes use of
554                  git-new-workdir, and saves a lot of diskspace when having multiple
555                  trees side-by-side.]),
556     GIT_LINK_SRC=$withval ,
559 AC_ARG_WITH(openldap,
560     AS_HELP_STRING([--with-openldap],
561         [Enables the use of the OpenLDAP LDAP SDK instead of the Netscape/Mozilla one.]),
564 AC_ARG_WITH(vba-package-format,
565     AS_HELP_STRING([--with-vba-package-format],
566         [Specify package format for vba compatibility api. Specifying  "builtin"
567          means the api component and associated type library are  part of the
568          installation set. Specifying "extn" creates an uno extension that is
569          part of the installation set (located in the program directory) that
570          MUST be optionly registered using either the unopkg executeable or the
571          extension manager gui.])
572     [
573                           Note: "builtin" is the default, "extn" can cause
574                           problems.
576                           Usage:     --with-vba-package-format="builtin" or
577                                      --with-vba-package-format="extn"
578     ],
581 AC_ARG_WITH(theme,
582     AS_HELP_STRING([--with-theme="theme1 theme2..."],
583         [Choose which themes to include. By default those themes with an '*' are included.
584          Possible choices: *default, *crystal, *hicontrast, *oxygen, *tango, classic, industrial.]),
587 AC_ARG_WITH(helppack-integration,
589   --without-helppack-integration      It will not integrate the helppacks to the installer
590                           of the product.
591                           Please use this switch to use the online help or separate help packages.],
594 AC_ARG_WITH(fonts,
595     AS_HELP_STRING([--without-fonts],
596         [LibreOffice includes some third-party fonts to provide a reliable basis for
597          help content, templates, samples, etc. When these fonts are already
598          known to be available on the system then you should use this option.]),
601 AC_ARG_WITH(ppds,
602     AS_HELP_STRING([--without-ppds],
603         [Removes Postscript Printer definition files from LibreOffice
604          installation set, for people building for specific distributions where
605          PPDs are known to be already available (every recent distro with CUPS backend).]),
608 AC_ARG_WITH(afms,
609     AS_HELP_STRING([--without-afms],
610         [Removes bitmap font files from LibreOffice installation set, for people
611          building for specific distributions where AFM files or TrueType Fonts
612          are known to be available.]),
615 AC_ARG_WITH(agfa-monotype-fonts,
616      AS_HELP_STRING([--with-agfa-monotype-fonts],
617           [This switch should only be enabled for those who have the right
618            to use or distribute the proprietary Agfa Monotype
619            fonts.])
622 AC_ARG_WITH(epm,
623     AS_HELP_STRING([--with-epm],
624         [Decides which epm to use. Default is to use the one from the system if
625          one is built. When either this is not there or you say =internal epm
626          will be built.]),
629 AC_ARG_WITH(package-format,
630     AS_HELP_STRING([--with-package-format],
631         [Specify package format(s) for LibreOffice installsets. Default is the
632          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
633          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
634           installed, msi. Example: --with-package-format="deb dmg"]),
637 AC_ARG_WITH(system-stdlibs,
638     AS_HELP_STRING([--with-system-stdlibs],
639         [Use libstdc++/libgcc_s already on system.]),
642 AC_ARG_WITH(system-cairo,
643     AS_HELP_STRING([--with-system-cairo],
644         [Use Cairo libraries already on system.]),
647 AC_ARG_WITH(mozilla-version,
648     AS_HELP_STRING([--with-mozilla-version],
649         [Choose which version of Mozilla to use while building Mozilla.
650          (default=1.7.5) Note that not all versions are supported.]),
653 AC_ARG_WITH(mozilla-toolkit,
654     AS_HELP_STRING([--with-mozilla-toolkit],
655         [Choose which GUI toolkit to use while building Mozilla components. (default=gtk2)]),
658 AC_ARG_WITH(myspell-dicts,
659     AS_HELP_STRING([--without-myspell-dicts],
660         [Removes myspell dictionaries from LibreOffice installation set, for
661          people building for specific distributions where the myspell dictionaries
662          are installed from other sources.]),
665 AC_ARG_WITH(system-dicts,
666     AS_HELP_STRING([--with-system-dicts],
667         [Use dictionaries from system paths- Specify them via
668          --with-{dict,hyph,thes}-path=/path if you want to override the default ones.]),
671 AC_ARG_WITH(external-dict-dir,
672     AS_HELP_STRING([--with-external-dict-dir],
673         [Specify external dictionary dir.]),
676 AC_ARG_WITH(external-hyph-dir,
677     AS_HELP_STRING([--with-external-hyph-dir],
678         [Specify external hyphenation pattern dir.]),
681 AC_ARG_WITH(external-thes-dir,
682     AS_HELP_STRING([--with-external-thes-dir],
683         [Specify external thesaurus dir.]),
686 AC_ARG_WITH(system-libs,
687     AS_HELP_STRING([--with-system-libs],
688         [Use libraries already on system -- enables all --with-system-* flags except
689          mozilla, libvisio, libexttextcat and translate-toolkit.]),
692 AC_ARG_WITH(system-headers,
693     AS_HELP_STRING([--with-system-headers],
694         [Use headers already on system -- enables all --with-system-* flags for
695          external packages whose headers are the only entities used i.e.
696          boost/vigra/odbc/sane/xrender-header(s).]),
699 AC_ARG_WITH(system-jars,
700     AS_HELP_STRING([--without-system-jars],
701         [When building with --with-system-libs, also the needed jars are expected
702          on the system. Use this to disable that (except for the db case where
703          --with-system-db *has to* imply using the db.jar from there, too).]),
706 AC_ARG_WITH(system-zlib,
707     AS_HELP_STRING([--with-system-zlib],
708         [Use zlib already on system.]),
711 AC_ARG_WITH(system-openssl,
712     AS_HELP_STRING([--with-system-openssl],
713         [Use OpenSSL already on system.]),
716 AC_ARG_WITH(system-jpeg,
717     AS_HELP_STRING([--with-system-jpeg],
718         [Use jpeg already on system.]),
721 AC_ARG_WITH(system-expat,
722     AS_HELP_STRING([--with-system-expat],
723         [Use expat already on system.]),
726 AC_ARG_WITH(system-libcmis,
727     AS_HELP_STRING([--with-system-libcmis],
728         [Use libcmis already on system.]),
731 AC_ARG_WITH(system-libvisio,
732     AS_HELP_STRING([--with-system-libvisio],
733         [Use libvisio already on system.]),
736 AC_ARG_WITH(system-libwpd,
737     AS_HELP_STRING([--with-system-libwpd],
738         [Use libwpd already on system.]),
741 AC_ARG_WITH(system-libwps,
742     AS_HELP_STRING([--with-system-libwps],
743         [Use libwps already on system.]),
746 AC_ARG_WITH(system-libwpg,
747     AS_HELP_STRING([--with-system-libwpg],
748         [Use libwpg already on system.]),
751 AC_ARG_WITH(system-libxml,
752     AS_HELP_STRING([--with-system-libxml],
753         [Use libxml already on system.]),
756 AC_ARG_WITH(system-translate-toolkit,
757     AS_HELP_STRING([--with-system-translate-toolkit],
758         [Use translate-toolkit already on system.]))
760 AC_ARG_WITH(system-icu,
761     AS_HELP_STRING([--with-system-icu],
762         [Use icu already on system.]))
764 AC_ARG_WITH(system-poppler,
765     AS_HELP_STRING([--with-system-poppler],
766         [Use system poppler. (only needed for pdfimport extension)]))
768 AC_ARG_WITH(system-db,
769     AS_HELP_STRING([--with-system-db],
770         [Use Berkeley db already on system.]))
772 AC_ARG_WITH(system-lucene,
773     AS_HELP_STRING([--with-system-lucene],
774         [Use Lucene already on system.]))
776 AC_ARG_WITH(system-apache-commons,
777     AS_HELP_STRING([--with-system-apache-commons],
778         [Use Apache commons libraries already on system.]))
780 AC_ARG_WITH(lucene-core-jar,
781     AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
782         [Specify path to jarfile manually.]),
783     LUCENE_CORE_JAR=$withval)
785 AC_ARG_WITH(lucene-analyzers-jar,
786     AS_HELP_STRING([--with-lucene-analyzers-jar=JARFILE],
787         [Specify path to jarfile manually.]),
788     LUCENE_ANALYZERS_JAR=$withval ,)
790 AC_ARG_WITH(system-mysql,
791     AS_HELP_STRING([--with-system-mysql],
792         [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice
793          extension. Requires MYSQLCONFIG to point to the mysql_config executable.]))
795 AC_ARG_WITH(libmysql-path,
796     AS_HELP_STRING([--with-libmysql-path],
797         [Use Connector/C (libmysql) installation for building the MySQL
798          Connector/LibreOffice extension.])
799     [
800                           Usage:     --with-libmysql-path=<absolute path to
801                                                   your Connector/C installation>
802     ],
805 AC_ARG_WITH(system-mysql-cppconn,
806     AS_HELP_STRING([--with-system-mysql-cppconn],
807         [Use MySQL C++ Connector libraries already on system.]))
809 AC_ARG_WITH(system-hsqldb,
810     AS_HELP_STRING([--with-system-hsqldb],
811         [Use hsqldb already on system.]))
813 AC_ARG_WITH(hsqldb-jar,
814     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
815         [Specify path to jarfile manually.]),
816     HSQLDB_JAR=$withval)
818 AC_ARG_WITH(system-beanshell,
819     AS_HELP_STRING([--with-system-beanshell],
820         [Use beanshell already on system.]))
822 AC_ARG_WITH(beanshell-jar,
823     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
824         [Specify path to jarfile manually.]),
825     BSH_JAR=$withval)
827 AC_ARG_WITH(commons-codec-jar,
828     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
829         [Specify path to jarfile manually.]),
830     COMMONS_CODEC_JAR=$withval)
832 AC_ARG_WITH(commons-lang-jar,
833     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
834         [Specify path to jarfile manually.]),
835     COMMONS_LANG_JAR=$withval)
837 AC_ARG_WITH(commons-httpclient-jar,
838     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
839         [Specify path to jarfile manually.]),
840     COMMONS_HTTPCLIENT_JAR=$withval)
842 AC_ARG_WITH(commons-logging-jar,
843     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
844         [Specify path to jarfile manually.]),
845     COMMONS_LOGGING_JAR=$withval)
847 AC_ARG_WITH(servlet-api-jar,
848     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
849         [Specify path to jarfile manually.]),
850     SERVLETAPI_JAR=$withval)
852 AC_ARG_WITH(system-jfreereport,
853     AS_HELP_STRING([--with-system-jfreereport],
854         [Use JFreeReport already on system.]))
856 AC_ARG_WITH(sac-jar,
857     AS_HELP_STRING([--with-sac-jar=JARFILE],
858         [Specify path to jarfile manually.]),
859     SAC_JAR=$withval)
861 AC_ARG_WITH(libxml-jar,
862     AS_HELP_STRING([--with-libxml-jar=JARFILE],
863         [Specify path to jarfile manually.]),
864     LIBXML_JAR=$withval)
866 AC_ARG_WITH(flute-jar,
867     AS_HELP_STRING([--with-flute-jar=JARFILE],
868         [Specify path to jarfile manually.]),
869     FLUTE_JAR=$withval)
871 AC_ARG_WITH(jfreereport-jar,
872     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
873         [Specify path to jarfile manually.]),
874     JFREEREPORT_JAR=$withval)
876 AC_ARG_WITH(liblayout-jar,
877     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
878         [Specify path to jarfile manually.]),
879     LIBLAYOUT_JAR=$withval)
881 AC_ARG_WITH(libloader-jar,
882     AS_HELP_STRING([--with-libloader-jar=JARFILE],
883         [Specify path to jarfile manually.]),
884     LIBLOADER_JAR=$withval)
886 AC_ARG_WITH(libloader-jar,
887     AS_HELP_STRING([--with-libloader-jar=JARFILE],
888         [Specify path to jarfile manually.]),
889     LIBLOADER_JAR=$withval)
891 AC_ARG_WITH(libformula-jar,
892     AS_HELP_STRING([--with-libformula-jar=JARFILE],
893         [Specify path to jarfile manually.]),
894     LIBFORMULA_JAR=$withval)
896 AC_ARG_WITH(librepository-jar,
897     AS_HELP_STRING([--with-librepository-jar=JARFILE],
898         [Specify path to jarfile manually.]),
899     LIBREPOSITORY_JAR=$withval)
901 AC_ARG_WITH(libfonts-jar,
902     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
903         [Specify path to jarfile manually.]),
904     LIBFONTS_JAR=$withval)
906 AC_ARG_WITH(libserializer-jar,
907     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
908         [Specify path to jarfile manually.]),
909     LIBSERIALIZER_JAR=$withval)
911 AC_ARG_WITH(libbase-jar,
912     AS_HELP_STRING([--with-libbase-jar=JARFILE],
913         [Specify path to jarfile manually.]),
914     LIBBASE_JAR=$withval)
916 AC_ARG_WITH(system-saxon,
917     AS_HELP_STRING([--with-system-saxon],
918         [Use saxon already on system.]))
920 AC_ARG_WITH(saxon-jar,
921     AS_HELP_STRING([--with-saxon-jar=JARFILE],
922         [Specify path to jarfile manually.]),
923     SAXON_JAR=$withval)
925 AC_ARG_WITH(system-libxslt,
926     AS_HELP_STRING([--with-system-libxslt],
927         [Use libxslt already on system.]))
929 AC_ARG_WITH(system-odbc,
930     AS_HELP_STRING([--with-system-odbc],
931         [Use the odbc headers already on system.]))
933 AC_ARG_WITH(system-sane,
934     AS_HELP_STRING([--with-system-sane],
935         [Use sane.h already on system.]))
937 AC_ARG_WITH(system-xrender-headers,
938     AS_HELP_STRING([--with-system-xrender-headers],
939         [Use XRender headers already on system.]))
941 AC_ARG_WITH(system-mesa-headers,
942     AS_HELP_STRING([--with-system-mesa-headers],
943         [Use Mesa headers already on system.]))
945 AC_ARG_WITH(system-curl,
946     AS_HELP_STRING([--with-system-curl],
947         [Use curl already on system.]))
949 AC_ARG_WITH(system-boost,
950     AS_HELP_STRING([--with-system-boost],
951         [Use boost already on system.]))
953 AC_ARG_WITH(system-mdds,
954     AS_HELP_STRING([--with-system-mdds],
955         [Use mdds already on system.]))
957 AC_ARG_WITH(system-vigra,
958     AS_HELP_STRING([--with-system-vigra],
959         [Use vigra already on system.]))
961 AC_ARG_WITH(system-neon,
962     AS_HELP_STRING([--with-system-neon],
963         [Use neon already on system.]))
965 AC_ARG_WITH(system-hunspell,
966     AS_HELP_STRING([--with-system-hunspell],
967         [Use libhunspell already on system.]))
969 AC_ARG_WITH(system-mythes,
970     AS_HELP_STRING([--with-system-mythes],
971         [Use mythes already on system.]))
973 AC_ARG_WITH(system-altlinuxhyph,
974     AS_HELP_STRING([--with-system-altlinuxhyph],
975         [Use ALTLinuxhyph already on system.]))
977 AC_ARG_WITH(system-lpsolve,
978     AS_HELP_STRING([--with-system-lpsolve],
979         [Use lpsolve already on system.]))
981 AC_ARG_WITH(system-libexttextcat,
982     AS_HELP_STRING([--with-system-libexttextcat],
983         [Use libexttextcat already on system.]))
985 AC_ARG_WITH(system-cppunit,
986     AS_HELP_STRING([--with-system-cppunit],
987         [Use cppunit already on system.]))
989 AC_ARG_WITH(system-redland,
990     AS_HELP_STRING([--with-system-redland],
991         [Use redland library already on system.]))
993 AC_ARG_WITH(system-mozilla,
994     AS_HELP_STRING([--with-system-mozilla],
995         [Use Mozilla already on system. Note that some components cannot be built
996          against a contemporary Mozilla. The flavour used can be specified by
997          --with-system-mozilla=<flavour>. Supported are: libxul (default),
998          xulrunner, firefox, seamonkey, mozilla.]),
999     WITH_SYSTEM_MOZILLA=$withval ,
1000 WITH_SYSTEM_MOZILLA=no)
1002 AC_ARG_WITH(system-gettext,
1003     AS_HELP_STRING([--with-system-gettext],
1004         [Use gettext runtime library already on system.]))
1006 AC_ARG_WITH(system-libpng,
1007     AS_HELP_STRING([--with-system-libpng],
1008         [Use libpng already on system.]))
1010 AC_ARG_WITH(linker-hash-style,
1011     AS_HELP_STRING([--with-linker-hash-style],
1012         [Use linker with --hash-style=<style> when linking shared objects.
1013          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1014          if supported on the build system, and "sysv" otherwise.]))
1016 AC_ARG_WITH(stlport,
1017     AS_HELP_STRING([--with-stlport],
1018         [Build the STLPort library for compatibility with old extensions for
1019          architectures where STLPort used to be used.]),
1020     with_stlport=$withval ,
1021 with_stlport=auto)
1023 AC_ARG_WITH(jdk-home,
1024     AS_HELP_STRING([--with-jdk-home],
1025         [If you have installed JDK 1.3 or later on your system please supply the
1026          path here. Note that this is not the location of the java command but the
1027          location of the entire distribution.])
1028     [
1029                           Usage:     --with-jdk-home=<absolute path to JDK home>
1030     ],
1033 AC_ARG_WITH(gxx_include_path,
1034     AS_HELP_STRING([--with-gxx-include-path],
1035         [If you want to override the autodetected g++ include path.])
1036     [
1037                           Usage:     --with-gxx-include-path=<absolute path to
1038                                                                 g++ include dir>
1039     ],
1042 AC_ARG_WITH(help,
1043     AS_HELP_STRING([--with-help],
1044         [Enable the build of help.
1046          To build without help, use --without-help.]))
1048 AC_ARG_WITH(java,
1049     AS_HELP_STRING([--with-java],
1050         [Specify the name of the Java interpreter command. Typically "java"
1051          which is the default.
1053          To build without support for Java components, applets, accessibility
1054          or the XML filters written in Java, use --without-java or --with-java=no.])
1055     [
1056                           Usage:     --with-java==<java command>
1057                                      --without-java
1058     ],
1059     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1060     [ with_java=java ]
1063 AC_ARG_WITH(java_target_version,
1064     AS_HELP_STRING([--with-java-target-version],
1065         [Generate class files that will work on JVMs with the specified version.
1066          For example, use --with-java-target-version=1.4 to make sure that the
1067          application will work with JVM 1.4 even when compiled with JDK 1.5.])
1068     [
1069                           This option is ignored when you compile with gcj/gij.
1071                           Usage:     --with-java-target-version=<jvm version>
1072     ],
1075 AC_ARG_WITH(jvm-path,
1076     AS_HELP_STRING([--with-jvm-path],
1077         [Use a specific JVM search path at runtime.])
1078     [
1079                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1081                           e. g.: --with-jvm-path=/usr/lib/
1082                                  to find JRE/JDK in /usr/lib/jvm/
1083     ],
1086 AC_ARG_WITH(ant-home,
1087     AS_HELP_STRING([--with-ant-home],
1088         [If you have installed Jakarta Ant on your system, please supply the path here.
1089          Note that this is not the location of the Ant binary but the location
1090          of the entire distribution.])
1091     [
1092                           Usage:     --with-ant-home=<absolute path to Ant home>
1093     ],
1096 AC_ARG_WITH(junit,
1097     AS_HELP_STRING([--with-junit],
1098         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1099          --without-junit disables those tests. Not relevant in the --without-java case.])
1100     [
1101                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1102     ],
1103 ,with_junit=yes)
1105 AC_ARG_WITH(perl-home,
1106     AS_HELP_STRING([--with-perl-home],
1107         [If you have installed Perl 5 Distribution, on your system, please
1108          supply the path here. Note that this is not the location of the Perl
1109          binary but the location of the entire distribution.])
1110     [
1111                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1112     ],
1115 AC_ARG_WITH(cl-home,
1116     AS_HELP_STRING([--with-cl-home],
1117         [For Windows NT users, please supply the path for the Microsoft C/C++
1118          compiler. Note that this is not the location of the compiler binary but
1119          the location of the entire distribution.])
1120     [
1121                           Usage:     --with-cl-home=<absolute path to Microsoft
1122                                                             C/C++ compiler home>
1123     ],
1126 AC_ARG_WITH(mspdb-path,
1127     AS_HELP_STRING([--with-mspdb-path],
1128         [For Microsoft C/C++ compiler users, please supply the path pointing to
1129          the mspdb80.dll (if using Visual Studio 2008) or mspdb100.dl (if using
1130          Visual Studio 2010).])
1131     [
1132                           Usage:     --with-mspdb-path=<path to
1133                                                        mspdb80.dll/mspdb100.dll>
1134     ],
1137 AC_ARG_WITH(midl-path,
1138     AS_HELP_STRING([--with-midl-path],
1139         [For Microsoft compiler users, please supply the path pointing to the midl.exe.])
1140     [
1141                           Usage:     --with-midl-path=<abs. path to midl.exe>
1142     ],
1145 AC_ARG_WITH(csc-path,
1146     AS_HELP_STRING([--with-csc-path],
1147         [For Windows builds, please supply the path pointing to the csc.exe.
1148          Usually found automatically when building on Windows.])
1149     [
1150                           Usage:     --with-csc-path=<abs. path to csc.exe>
1151     ],
1154 AC_ARG_WITH(nsis-path,
1155     AS_HELP_STRING([--with-nsis-path],
1156         [For Windows builds, please supply the directory where makensis
1157          is located. If makensis is found in PATH or this option is
1158          properly supplied a self-contained executable installer for
1159          LibreOffice will be created.])
1160     [
1161                           Usage:     --with-nsis-path=<path to directory containing makensis>
1162     ],
1165 AC_ARG_WITH(dotnet-framework-home,
1166     AS_HELP_STRING([--with-dotnet-framework-home],
1167         [For Microsoft compiler users, please supply the path pointing to
1168          lib/mscoree.lib, usually something like:
1169          "/cygdrive/c/Program Files/Windows SDKs/Windows/v7.0"])
1170     [
1171                           Note that in most cases it will be automatically
1172                           found, though.
1174                           Usage:     --with-dotnet-framework-home=<absolute path to .NET
1175                                                           Framework>
1176     ],
1179 AC_ARG_WITH(windows-sdk-home,
1180     AS_HELP_STRING([--with-windows-sdk-home],
1181         [For Windows builds, please supply the path to the Windows SDK.
1182          Usually found automatically when building on Windows.])
1183     [
1184                           Usage:     --with-windows-sdk-home=<absolute path to Windows SDK>
1185     ],
1188 AC_ARG_WITH(directx-home,
1189     AS_HELP_STRING([--with-directx-home],
1190         [For Windows users, please supply the path to the Microsoft DirectX SDK.])
1191     [
1192                           Usage:     --with-directx-home=<absolute path to
1193                                                           Microsoft DirectX SDK>
1194     ],
1197 AC_ARG_WITH(mozilla-build,
1198     AS_HELP_STRING([--with-mozilla-build],
1199         [For Windows users, please supply the path to the Mozilla build tools.])
1200     [
1201                           Usage:     --with-mozilla-build=<absolute path to
1202                                                           Mozilla build tools>
1204                           At the moment of this writing, an installer for the
1205                           mozilla build tools can be obtained from http://ftp.
1206                           mozilla.org/pub/mozilla.org/mozilla/libraries/win32.
1207     ],
1208     MOZILLABUILD=$withval ,
1211 AC_ARG_WITH(local-solver,
1212     AS_HELP_STRING([--with-local-solver],
1213         [If you have solver in a location other than ./solver, please supply the path here.])
1214     [
1215                           Usage:     --with-local-solver=<abs. path to solver>
1216     ],
1219 AC_ARG_WITH(lang,
1220     AS_HELP_STRING([--with-lang],
1221         [Use this option to build LibreOffice with additional language support.
1222          English (US) is always included by default.
1223          Separate multiple languages with space.
1224          For all languages, use --with-lang=ALL.])
1225     [
1226                           Usage:     --with-lang="es sw tu cs sk"
1227     ],
1230 dnl ===================================================================
1231 dnl Branding
1232 dnl ===================================================================
1234 AC_ARG_WITH(intro-bitmap,
1235 [  --with-intro-bitmap    Prefer the specified intro bitmap over the
1236                           the default one.
1238                           Usage:     --with-intro-bitmap=/path/my_ooo_intro.png
1239 ],,)
1241 AC_ARG_WITH(intro-progressbar-color,
1242 [  --with-intro-progressbar-color    Set color of progress bar on intro screen.
1243                                      Comma separated RGB values in decimal format.
1245                           Usage: --with-intro-progressbar-color=126,170,23
1246 ],,)
1248 AC_ARG_WITH(intro-progressbar-size,
1249 [  --with-intro-progressbar-size     Set size of progress bar on intro screen.
1250                                      Comma separated values in decimal format.
1252                           Usage: --with-intro-progressbar-size=319,10
1253 ],,)
1255 AC_ARG_WITH(intro-progressbar-position,
1256 [  --with-intro-progressbar-position Set position of progress bar on intro screen.
1257                                      Comma separated values in decimal format.
1259                           Usage: --with-intro-progressbar-position=164,225
1260 ],,)
1262 AC_ARG_WITH(intro-progressbar-frame-color,
1263 [  --with-intro-progressbar-frame-color    Set color of progress bar frame on intro screen.
1264                                            Comma separated RGB values in decimal format.
1266                           Usage: --with-intro-progressbar-frame-color=207,208,211
1267 ],,)
1269 AC_ARG_WITH(about-bitmap,
1270 [  --with-about-bitmap    Similarly to --with-intro-bitmap, this allows
1271                           specification of bitmap for the About box.
1273                           Usage:     --with-about-bitmap=/path/my_ooo_about.png
1274 ],,)
1276 AC_ARG_WITH(startcenter-left-bitmap,
1277 [  --with-startcenter-left-bitmap    Similarly to --with-intro-bitmap, this allows
1278                                      specification of bitmap for the Start center.
1280                           Usage: --with-startcenter-left-bitmap=/path/my_backing_left.png
1281 ],,)
1283 AC_ARG_WITH(startcenter-right-bitmap,
1284 [  --with-startcenter-right-bitmap    Similarly to --with-intro-bitmap, this allows
1285                                       specification of bitmap for the Start center.
1287                           Usage: --with-startcenter-right-bitmap=/path/my_backing_right.png
1288 ],,)
1290 AC_ARG_WITH(startcenter-rtl-left-bitmap,
1291 [  --with-startcenter-rtl-left-bitmap    Similarly to --with-intro-bitmap, this allows
1292                                          specification of bitmap for the Start center.
1294                           Usage: --with-startcenter-rtl-left-bitmap=/path/my_backing_rtl_left.png
1295 ],,)
1297 AC_ARG_WITH(startcenter-rtl-right-bitmap,
1298 [  --with-startcenter-rtl-right-bitmap    Similarly to --with-intro-bitmap, this allows
1299                                           specification of bitmap for the Start center.
1301                           Usage: --with-startcenter-rtl-right-bitmap=/path/my_backing_rtl_right.png
1302 ],,)
1304 AC_ARG_WITH(startcenter-space-bitmap,
1305 [  --with-startcenter-space-bitmap    Similarly to --with-intro-bitmap, this allows
1306                                       specification of bitmap for the Start center.
1308                           Usage: --with-startcenter-space-bitmap=/path/my_backing_space.png
1309 ],,)
1311 AC_ARG_WITH(vendor,
1312     AS_HELP_STRING([--with-vendor],
1313         [Set vendor of the build.])
1314     [
1315                           Usage:     --with-vendor="John the Builder"
1316     ],
1319 AC_ARG_WITH(unix-wrapper,
1320     AS_HELP_STRING([--with-unix-wrapper],
1321         [Redefines the name of the UNIX wrapper that will be used in the desktop
1322          files and in the desktop-integration RPMs.])
1323     [
1324                           Usage:     --with-unix-wrapper=ooffice
1325     ],
1328 AC_ARG_WITH(compat-oowrappers,
1329     AS_HELP_STRING([--with-compat-oowrappers],
1330         [Install oo* wrappers in parallel with
1331          lo* ones to keep backward compatibility.
1332          Has effect only with make distro-pack-install]),
1335 AC_ARG_WITH(asm-home,
1336     AS_HELP_STRING([--with-asm-home],
1337         [For Windows, please supply the path for the ml.exe or ml64.exe assembler.])
1338     [
1339                           Usage:     --with-asm-home=<path to assembler directory>
1340     ],
1343 AC_ARG_WITH(os-version,
1344     AS_HELP_STRING([--with-os-version],
1345         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1346     [
1347                           Usage:     --with-os-version=<OSVERSION>
1348     ],
1351 AC_ARG_WITH(mingw-cross-compiler,
1352     AS_HELP_STRING([--with-mingw-cross-compiler],
1353         [Specify the MinGW cross-compiler to use.])
1354     [
1355                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1357                           When building on the ODK on Unix and building unowinreg.dll,
1358                           specify the MinGW C++ cross-compiler.
1359     ],
1362 AC_ARG_WITH(build-version,
1363     AS_HELP_STRING([--with-build-version],
1364         [Allows the builder to add a custom version tag that will appear in the
1365          Help/About box for QA purposes.])
1366     [
1367                           Usage:     --with-build-version="Built by Jim"
1368     ],
1369     with_build_version=$withval ,
1372 AC_ARG_WITH(alloc,
1373     AS_HELP_STRING([--with-alloc],
1374         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1375          Note that on FreeBSD/NetBSD system==jemalloc]),
1378 AC_ARG_WITH(sun-templates,
1379     AS_HELP_STRING([--with-sun-templates],
1380         [Integrate Sun template packages.]),
1383 AC_ARG_WITH(num-cpus,
1384     AS_HELP_STRING([--with-num-cpus],
1385         [Number of build processes/cpus to use (number of projects that will build at the same time).
1386          Multi-process/multi-cpu builds can save a lot of time on multi-cpu machines.
1387          Defaults to the number of CPUs on the machine.]),
1390 AC_ARG_WITH(max-jobs,
1391     AS_HELP_STRING([--with-max-jobs],
1392         [Maximum number of jobs per one CPU that will be issued at the same time by dmake.
1393          The real number of the jobs is affected by the --with-num-cpus too, it can get up to CPUS*max_jobs.
1394          Defaults to 1, unless you configure --enable-icecream - then to 10.]),
1397 dnl ===================================================================
1398 dnl MacOSX build and runtime environment options
1399 dnl ===================================================================
1401 AC_ARG_WITH(macosx-sdk,
1402     AS_HELP_STRING([--with-macosx-sdk],
1403         [Use a specific SDK for building.])
1404     [
1405                           Usage:     --with-macosx-sdk=<version>
1407                           e. g.: --with-macosx-sdk=10.4
1409                           there are 3 options to controle the MacOSX build:
1410                           --with-macosx-sdk (refered as 'sdl' below)
1411                           --with-macosx-version-min-required (refered as 'min' below)
1412                           --with-macosx-version-max-allowed (refered as 'max' below)
1414                           the connection between these value and the default they take is as follow:
1415                           ( ? means not specified on the command line, constraint: x <= y <= z)
1417                           ==========================================
1418                            command line      || config result
1419                           ==========================================
1420                           min  | max  | sdk  || min  | max  | sdk  |
1421                           ?    | ?    | ?    || 10.4 | 10.4 | 10.4 |
1422                           ?    | ?    | 10.x || 10.4 | 10.4 | 10.x |
1423                           ?    | 10.x | ?    || 10.4 | 10.x | 10.x |
1424                           ?    | 10.x | 10.y || 10.4 | 10.x | 10.y |
1425                           10.x | ?    | ?    || 10.x | 10.x | 10.x |
1426                           10.x | ?    | 10.y || 10.x | 10.x | 10.y |
1427                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1428                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1431                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1432                           for a detailled technical explanation of these variables
1434                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1436     ],
1439 AC_ARG_WITH(macosx-version-min-required,
1440     AS_HELP_STRING([--with-macosx-version-min-required],
1441         [set the minimum OS version needed to run the built LibreOffice])
1442     [
1443                           Usage:     --with-macosx-version-min-required=<version>
1445                           e. g.: --with-macos-version-min-required=10.4
1446                           see --with-macosx-sdk for more info
1447     ],
1450 AC_ARG_WITH(macosx-version-max-allowed,
1451     AS_HELP_STRING([--with-macosx-version-max-allowed],
1452         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1453     [
1454                           Usage:     --with-macosx-version-max-allowed=<version>
1456                           e. g.: --with-macos-version-max-allowed=10.6
1457                           see --with-macosx-sdk for more info
1458     ],
1462 BUILD_TYPE="LibO"
1463 SCPDEFS=""
1464 GIT_REPO_NAMES=""
1465 MINGW_EXTERNAL_DLLS=""
1467 if test -n "$SOLARENV" ; then
1468     AC_MSG_ERROR([You have sourced Env.Host.sh in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
1471 echo "********************************************************************"
1472 echo "*"
1473 echo "*   Running ${PACKAGE_NAME} build configuration."
1474 echo "*"
1475 echo "********************************************************************"
1476 echo ""
1478 dnl ===================================================================
1479 dnl checks build and host OSes
1480 dnl ===================================================================
1481 AC_CANONICAL_HOST
1483 if test "$cross_compiling" = "yes"; then
1484     CROSS_COMPILING=YES
1485 else
1486     CROSS_COMPILING=
1487     BUILD_TYPE="$BUILD_TYPE NATIVE"
1489 AC_SUBST(CROSS_COMPILING)
1491 if test "$build_os" = "cygwin"; then
1492     EXEEXT_FOR_BUILD=.exe
1493 else
1494     EXEEXT_FOR_BUILD=
1496 AC_SUBST(EXEEXT_FOR_BUILD)
1498 dnl ===================================================================
1499 dnl check for required programs (grep, awk, sed, bash)
1500 dnl ===================================================================
1501 cat /dev/null > warn
1503 if test "z$EUID" = "z0" -a "z`uname -o 2>/dev/null`" = "zCygwin"; then
1504     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
1507 save_CC=$CC
1508 save_CXX=$CXX
1510 AC_PROG_EGREP
1511 AC_PROG_AWK
1512 AC_PATH_PROG( AWK, $AWK)
1513 if test -z "$AWK"; then
1514     AC_MSG_ERROR([install awk to run this script])
1517 AC_PATH_PROGS(SED, sed )
1518 if test -z "$SED"; then
1519     AC_MSG_ERROR([install sed to run this script])
1522 AC_PATH_PROG(BASH, bash)
1523 if test -z "$BASH"; then
1524     AC_MSG_ERROR([bash not found in \$PATH])
1526 AC_SUBST(BASH)
1528 AC_MSG_CHECKING([for GNU or BSD tar])
1529 for a in $GNUTAR gtar gnutar tar; do
1530     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
1531     if test $? -eq 0;  then
1532         GNUTAR=$a
1533         break
1534     fi
1535 done
1536 AC_MSG_RESULT($GNUTAR)
1537 if test -z "$GNUTAR"; then
1538     AC_MSG_ERROR([not found. install GNU or BSD tar.])
1540 AC_SUBST(GNUTAR)
1542 dnl ===================================================================
1543 dnl The following is a list of supported systems.
1544 dnl Sequential to keep the logic very simple
1545 dnl These values may be checked and reset later.
1546 dnl ===================================================================
1547 #defaults unless the os test overrides this:
1548 test_randr=yes
1549 test_cups=yes
1550 test_fontconfig=yes
1552 case "$host_os" in
1554 solaris*)
1555     test_gtk=yes
1556     build_gstreamer=yes
1557     test_kde=yes
1558     test_freetype=yes
1559     test_gstreamer=yes
1560     _os=SunOS
1561     AC_PATH_PROG( GNUTAR, gtar,,$PATH:/usr/sfw/bin)
1562     if test -z "$GNUTAR"; then
1563         AC_MSG_ERROR([gtar (GNU tar) not found but needed. Install it (Sun Freeware package).])
1564     fi
1565     AC_SUBST(GNUTAR)
1567     dnl ===========================================================
1568     dnl Check whether we're using Solaris 6,7,8 - SPARC or Intel.
1569     dnl ===========================================================
1570     AC_MSG_CHECKING([the Solaris operating system release])
1571     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
1572     if test "$_os_release" -lt "6"; then
1573         AC_MSG_ERROR([use Solaris >= 6 to build LibreOffice])
1574     else
1575         AC_MSG_RESULT([ok ($_os_release)])
1576     fi
1578     dnl Check whether we're using a SPARC or i386 processor
1579     AC_MSG_CHECKING([the processor type])
1580     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
1581         AC_MSG_RESULT([ok ($host_cpu)])
1582     else
1583         AC_MSG_ERROR([only SPARC and i386 processors are supported])
1584     fi
1585     ;;
1587 linux-gnu*|k*bsd*-gnu*)
1588     test_gtk=yes
1589     build_gstreamer=yes
1590     test_kde=yes
1591     test_kde4=yes
1592     test_freetype=yes
1593     test_unix_quickstarter=yes
1594     _os=Linux
1595     ;;
1597 gnu)
1598     test_randr=no
1599     _os=GNU
1600      ;;
1602 cygwin*|interix*|mingw32*)
1604     # When building on Windows normally with MSVC under Cygwin,
1605     # configure thinks that the host platform (the platform the
1606     # built code will run on) is Cygwin, even if it obviously is
1607     # Windows, which in Autoconf terminology is called
1608     # "mingw32". (Which is misleading as MinGW is the name of the
1609     # tool-chain, not an operating system.)
1611     # Somewhat confusing, yes. But this configure script doesn't
1612     # look at $host etc that much, it mostly uses its own $_os
1613     # variable, set here in this case statement.
1615     # When cross-compiling to Windows from Unix, the host platform
1616     # is "mingw32" (because in that case it is the MinGW
1617     # tool-chain that is used).
1619     test_cups=no
1620     test_randr=no
1621     test_freetype=no
1622     test_fontconfig=no
1623     _os=WINNT
1625     # If the host OS matches "mingw32*", that means we are using the
1626     # MinGW cross-compiler, because we don't see the point in building
1627     # LibreOffice using MinGW on Windows. If you want to build on
1628     # Windows, use MSVC. If you want to use MinGW, surely you want to
1629     # cross-compile (from Linux or some other Unix).
1631     case "$host_os" in
1632     mingw32*)
1633         WITH_MINGW=yes
1634         if test -z "$CC" ; then
1635             CC="$host_cpu-$host_vendor-$host_os-gcc"
1636         fi
1637         if test -z "$CXX" ; then
1638             CXX="$host_cpu-$host_vendor-$host_os-g++"
1639         fi
1640         ;;
1641     esac
1642     ;;
1644 darwin*) # Mac OS X or iOS
1645     test_gtk=yes
1646     test_randr=no
1647     test_freetype=no
1648     test_fontconfig=no
1649     if test "$host_cpu" = "arm"; then
1650         _os=iOS
1651         test_gtk=no
1652         test_cups=no
1653     else
1654         _os=Darwin
1655     fi
1656     enable_systray=no
1659 freebsd*)
1660     test_gtk=yes
1661     build_gstreamer=yes
1662     test_kde=yes
1663     test_kde4=yes
1664     test_freetype=yes
1665     AC_MSG_CHECKING([the FreeBSD operating system release])
1666     if test -n "$with_os_version"; then
1667         OSVERSION="$with_os_version"
1668     else
1669         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1670     fi
1671     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1672     AC_MSG_CHECKING([which thread library to use])
1673     if test "$OSVERSION" -lt "500016"; then
1674         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1675         PTHREAD_LIBS="-pthread"
1676     elif test "$OSVERSION" -lt "502102"; then
1677         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1678         PTHREAD_LIBS="-lc_r"
1679     else
1680         PTHREAD_CFLAGS=""
1681         PTHREAD_LIBS="-pthread"
1682     fi
1683     AC_MSG_RESULT([$PTHREAD_LIBS])
1684     _os=FreeBSD
1685     ;;
1687 *netbsd*)
1688     test_gtk=yes
1689     build_gstreamer=yes
1690     test_kde=no
1691     test_kde4=yes
1692     test_freetype=yes
1693     PTHREAD_LIBS="-pthread -lpthread"
1694     _os=NetBSD
1695     ;;
1697 aix*)
1698     test_randr=no
1699     test_freetype=yes
1700     PTHREAD_LIBS=-pthread
1701     _os=AIX
1702     ;;
1704 openbsd*)
1705     test_gtk=yes
1706     test_kde=yes
1707     test_freetype=yes
1708     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1709     PTHREAD_LIBS="-pthread"
1710     _os=OpenBSD
1711     ;;
1713 dragonfly*)
1714     test_gtk=yes
1715     build_gstreamer=yes
1716     test_kde=yes
1717     test_kde4=yes
1718     test_freetype=yes
1719     PTHREAD_LIBS="-pthread"
1720     _os=DragonFly
1721     ;;
1723 linux-androideabi*)
1724     build_gstreamer=no
1725     test_cups=no
1726     test_fontconfig=no
1727     test_freetype=no
1728     test_gtk=no
1729     test_kde=no
1730     test_kde4=no
1731     test_randr=no
1732     test_unix_quickstarter=no
1733     _os=Android
1734     ;;
1737     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1738     ;;
1739 esac
1741 if test "$_os" = "AIX"; then
1742     AC_PATH_PROG(GAWK, gawk)
1743     if test -z "$GAWK"; then
1744         AC_MSG_ERROR([gawk not found in \$PATH])
1745     fi
1748 AC_SUBST(WITH_MINGW)
1749 AC_SUBST(OSVERSION)
1750 AC_SUBST(PTHREAD_CFLAGS)
1751 AC_SUBST(PTHREAD_LIBS)
1753 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
1754 dnl desktop OSes from "mobile" ones.
1756 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
1757 dnl In other words, that when building for an OS that is not a
1758 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
1760 dnl Note the direction of the implication; there is no assumption that
1761 dnl cross-compiling would imply a non-desktop OS.
1763 if test $_os != iOS -a $_os != Android; then
1764     BUILD_TYPE="$BUILD_TYPE DESKTOP"
1767 dnl ===================================================================
1768 dnl Extra check for Windows. Cygwin builds need gcc to build dmake
1769 dnl although MSVC is used to build other build-time tools and 
1770 dnl LibreOffice itself.
1771 dnl ===================================================================
1772 if test "$build_os" = "cygwin" ; then
1773     AC_MSG_CHECKING([for Cygwin gcc/g++])
1774     if which gcc > /dev/null && which g++ > /dev/null ; then
1775         AC_MSG_RESULT([found])
1776     else
1777         AC_MSG_ERROR([Cygwin gcc and g++ are needed, please install them.])
1778     fi
1783 dnl ===================================================================
1784 dnl  Checks if ccache is available
1785 dnl ===================================================================
1786 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \) ; then
1787     if test -z "$CC" ; then
1788         if test -z "$CXX" ; then
1789             AC_PATH_PROG([CCACHE],[ccache],[not found])
1790             if test "$CCACHE" = "not found" ; then
1791                 CCACHE=""
1792             else
1793                 CCACHE="ccache"
1794                 # need to check for ccache version: otherwise prevents
1795                 # caching of the results (like "-x objective-c++" for Mac)
1796                 if test $_os = Darwin -o $_os = iOS; then
1797                     # check ccache version
1798                     AC_MSG_CHECKING([whether version of ccache is suitable])
1799                     CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
1800                     CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1801                     if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
1802                         AC_MSG_RESULT([yes])
1803                     else
1804                         AC_MSG_RESULT([no])
1805                         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. ccache will not be used.])
1806                         CCACHE=""
1807                     fi
1808                 fi
1809             fi
1810         else
1811             AC_MSG_NOTICE([Automatic ccache detection ingored: CXX is pre-defined])
1812             CCACHE=""
1813         fi
1814     else
1815         AC_MSG_NOTICE([Automatic ccache detection ingored: CC is pre-defined])
1816         CCACHE=""
1817     fi
1818 else
1819     CCACHE=""
1822 if test "$CCACHE" != "" ; then
1823     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
1824     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
1825     if test "$ccache_size" = "" ; then
1826         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
1827         if test "$ccache_size" = "" ; then
1828             ccache_size=0
1829         fi
1830         # we could not determine the size or it was less than 1GB -> disable auto-ccache
1831         if test $ccache_size -lt 1024 ; then
1832             CCACHE=""
1833             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
1834             echo "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled" >> warn
1835         else
1836             # warn that ccache may be too small for debug build
1837             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1838             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1839         fi
1840     else
1841         if test $ccache_size -lt 5  ; then
1842             #warn that ccache may be too small for debug build
1843             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
1844             echo "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build" >> warn
1845         fi
1846     fi
1849 dnl ===================================================================
1850 dnl  Checks for C compiler,
1851 dnl  The check for the C++ compiler is later on.
1852 dnl ===================================================================
1853 GCC_HOME_SET="true"
1854 AC_MSG_CHECKING([gcc home])
1855 if test -z "$with_gcc_home"; then
1856     if test "$enable_icecream" = "yes" ; then
1857         GCC_HOME="/opt/icecream"
1858     else
1859         GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1860         GCC_HOME_SET="false"
1861     fi
1862 else
1863     GCC_HOME="$with_gcc_home"
1865 AC_MSG_RESULT($GCC_HOME)
1866 AC_SUBST(GCC_HOME)
1868 if test "$GCC_HOME_SET" = "true" ; then
1869     if test -z "$CC"; then
1870         CC="$GCC_HOME/bin/gcc"
1871     fi
1872     if test -z "$CXX"; then
1873         CXX="$GCC_HOME/bin/g++"
1874     fi
1877 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1878 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
1879     AC_PROG_CC
1882 COMPATH=`dirname "$CC"`
1883 if test "$COMPATH" = "." ; then
1884     AC_PATH_PROGS(COMPATH, $CC)
1885     dnl double square bracket to get single because of M4 quote...
1886     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1888 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1893 dnl ===================================================================
1894 dnl  Test MacOSX sdk and version requirement
1895 dnl ===================================================================
1896 if test "$_os" = "Darwin" ; then
1898     if test "$with_macosx_version_min_required" = "" ; then
1899         with_macosx_version_min_required="10.4"
1900     fi
1902     if test "$with_macosx_version_max_allowed" = "" ; then
1903         with_macosx_version_max_allowed="$with_macosx_version_min_required"
1904     fi
1906     if test "$with_macosx_sdk" = "" ; then
1907         with_macosx_sdk="$with_macosx_version_max_allowed"
1908     fi
1910     case "$with_macosx_sdk" in
1912     10.4)
1913         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.4u.sdk"
1914         if test ! -d "$MACOSX_SDK_PATH"; then
1915           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.4u.sdk"
1916         fi
1917         macosx_sdk_value="1040"
1918         ;;
1919     10.5)
1920         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"
1921         if test ! -d "$MACOSX_SDK_PATH"; then
1922           MACOSX_SDK_PATH="/Developer-old/SDKs/MacOSX10.5.sdk"
1923         fi
1924         macosx_sdk_value="1050"
1925         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
1926         echo "Building with a SDK > 10.4 is experimental" >> warn
1927         ;;
1928     10.6)
1929         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk"
1930         macosx_sdk_value="1060"
1931         AC_MSG_WARN([Building with a SDK > 10.4 is experimental])
1932         echo "Building with a SDK > 10.4 is experimental" >> warn
1933         ;;
1934     10.7)
1935         MACOSX_SDK_PATH="/Developer/SDKs/MacOSX10.7.sdk"
1936         macosx_sdk_value="1070"
1937         AC_MSG_WARN([Building with SDK 10.7 is known to fail in vcl])
1938         echo "Building with SDK 10.7 is known to fail in vcl" >> warn
1939         ;;
1940     *)
1941         AC_MSG_ERROR([$with_macosx_sdk is not a supported SDK value, supported value are 10.4, 10.5, 10.6 and 10.7])
1942         ;;
1943     esac
1944     AC_MSG_CHECKING([the presence of the SDK $with_macosx_sdk])
1945     if test -d "$MACOSX_SDK_PATH" ; then
1946         AC_MSG_RESULT([$MACOSX_SDK_PATH ok])
1947     else
1948         AC_MSG_ERROR([$MACOSX_SDK_PATH not found])
1949     fi
1950     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
1952     case "$with_macosx_version_min_required" in
1954     10.4)
1955         MAC_OS_X_VERSION_MIN_REQUIRED="1040"
1956         ;;
1957     10.5)
1958         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
1959         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
1960         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
1961         if [ -z $save_CC ] ; then
1962             CC="gcc-4.2 -m32"
1963             CXX="g++-4.2 -m32"
1964         fi
1965         ;;
1966     10.6)
1967         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
1968         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
1969         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
1970         if [ -z "$save_CC" ] ; then
1971             CC="gcc-4.2 -m32"
1972             CXX="g++-4.2 -m32"
1973         fi
1974         ;;
1975     10.7)
1976         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
1977         AC_MSG_WARN([Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build])
1978         echo "Building with a minimum version requirement > 10.4 break 10.4 compatibility. do not use for deliverable build" >>warn
1979         if [ -z "$save_CC" ] ; then
1980             CC="gcc-4.2 -m32"
1981             CXX="g++-4.2 -m32"
1982         fi
1983         ;;
1984     *)
1985         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])
1986         ;;
1987     esac
1989     case "$with_macosx_version_max_allowed" in
1991     10.4)
1992         MAC_OS_X_VERSION_MAX_ALLOWED="1040"
1993         ;;
1994     10.5)
1995         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
1996         ;;
1997     10.6)
1998         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
1999         ;;
2000     10.7)
2001         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2002         ;;
2003     *)
2004         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])
2005         ;;
2006     esac
2008     AC_MSG_CHECKING([that macosx-verion-min-required is coherent with macosx-version-max-allowed])
2009     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED ; then
2010         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2011     else
2012         AC_MSG_RESULT([ok])
2013     fi
2015     AC_MSG_CHECKING([that macosx-verion-max-allowed is coherent macos-with-sdk])
2016     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $macosx_sdk_value ; then
2017         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2018     else
2019         AC_MSG_RESULT([ok])
2020     fi
2021     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2022     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2024 AC_SUBST(MACOSX_SDK_PATH)
2025 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2026 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2027 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2029 dnl ===================================================================
2030 dnl  Test the gcc version,  3 is OK
2031 dnl ===================================================================
2032 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) -a "$GCC" = "yes"; then
2033     AC_MSG_CHECKING([the GNU C compiler version])
2034     _gcc_version=`$CC -dumpversion`
2035     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2036     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2038     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$GCCVER" -ge "040100" ; then
2039         if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
2040             export CC="$GCC_HOME/bin/gcc-4.0"
2041             #  export CC to have it available in set_soenv -> config.guess
2042             GCCVER2=`$CC -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2043             if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
2044                 GCCVER=$GCCVER2
2045             fi
2046         fi
2047         if test "$GCCVER" -ge "040100" ; then
2048             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])
2049         else
2050             AC_MSG_RESULT([implicitly using CC=$CC])
2051         fi
2052     else
2053         AC_MSG_RESULT([checked (gcc $_gcc_version)])
2054     fi
2059 # prefix C with ccache if needed
2061 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" ; then
2062     if test "$CCACHE" != "" ; then
2063         AC_MSG_CHECKING([whether $CC is already ccached])
2066         AC_LANG_PUSH([C])
2067         save_CFLAGS=$CFLAGS
2068         CFLAGS="$CFLAGS --ccache-skip -O2"
2069         dnl an empty program will do, we're checking the compiler flags
2070         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2071                           [use_ccache=yes], [use_ccache=no])
2072         if test $use_ccache = yes ; then
2073             AC_MSG_RESULT([yes])
2074         else
2075             CC="$CCACHE $CC"
2076             AC_MSG_RESULT([no])
2077         fi
2078         CFLAGS=$save_CFLAGS
2079         AC_LANG_POP([C])
2080     fi
2084 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2085 if test "$GCC" = "yes"; then
2086     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2087     bsymbolic_functions_ldflags_save=$LDFLAGS
2088     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2089     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2090 #include <stdio.h>
2091         ],[
2092 printf ("hello world\n");
2093         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2094     if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
2095         AC_MSG_RESULT( found )
2096     else
2097         AC_MSG_RESULT( not found )
2098     fi
2099     LDFLAGS=$bsymbolic_functions_ldflags_save
2101 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2103 dnl ===================================================================
2104 dnl Set up a different compiler to produce tools to run on the build
2105 dnl machine when doing cross-compilation
2106 dnl ===================================================================
2108 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
2109 if test "$cross_compiling" = "yes"; then
2110     AC_MSG_CHECKING([for BUILD platform configuration])
2111     echo
2112     rm -rf CONF-FOR-BUILD Env.Build.sh
2113     mkdir CONF-FOR-BUILD
2114     tar cf - \
2115         Makefile.in \
2116         bin/repo-list.in \
2117         bootstrap.1 \
2118         config.guess \
2119         configure \
2120         ooo.lst.in \
2121         oowintool \
2122         post_download.in \
2123         set_soenv.in \
2124         solenv/inc/langlist.mk \
2125         solenv/inc/postset.mk \
2126         desktop/scripts/soffice.sh.in \
2127     | (cd CONF-FOR-BUILD && tar xf -)
2128     (
2129     unset COM GUI GUIBASE OS CPU CPUNAME
2130     unset CC CXX SYSBASE CFLAGS
2131     unset PYTHON_CFLAGS PYTHON_LIBS
2132     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
2133     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
2134     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
2135     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
2136     cd CONF-FOR-BUILD
2137     sub_conf_opts=""
2138     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
2139     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
2140     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
2141     ./configure \
2142         --disable-mozilla \
2143         --disable-build-mozilla \
2144         --disable-zenity \
2145         --with-num-cpus="$with_num_cpus" \
2146         --with-max-jobs="$with_max_jobs" \
2147         $sub_conf_opts \
2148         2>&1 | sed -e 's/^/    /'
2149     test -f ./Env.Host.sh 2>/dev/null || exit
2150     cp Env.Host.sh ../Env.Build.sh
2151     . ./Env.Host.sh
2152     for V in COM GUI GUIBASE OS CPU CPUNAME CC CXX GXX_INCLUDE_PATH MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
2153              SYSTEM_LIBXSLT; do
2154         VV='$'$V
2155         VV=`eval "echo $VV"`
2156         if test -n "$VV"; then
2157             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
2158             echo "$line" >>build-config
2159         fi
2160     done
2162     for V in OUTDIR PATH SOLARINC SOLARLIB WORKDIR; do
2163         VV='$'$V
2164         VV=`eval "echo $VV"`
2165         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
2166         if test -n "$VV"; then
2167             line="${V}_FOR_BUILD='$VV'"
2168             echo "$line" >>build-config
2169         fi
2170     done
2171     )
2172     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
2173     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])
2174     perl -pi -e 's,/CONF-FOR-BUILD,,g' Env.Build.sh
2175     eval `cat CONF-FOR-BUILD/build-config`
2176     AC_MSG_RESULT([checking for BUILD platform configuration... done])
2177     rm -rf CONF-FOR-BUILD
2178 else
2179     CC_FOR_BUILD="$CC"
2180     CXX_FOR_BUILD="$CXX"
2182 AC_SUBST(COM_FOR_BUILD)
2183 AC_SUBST(GUI_FOR_BUILD)
2184 AC_SUBST(GUIBASE_FOR_BUILD)
2185 AC_SUBST(OS_FOR_BUILD)
2186 AC_SUBST(CPU_FOR_BUILD)
2187 AC_SUBST(CPUNAME_FOR_BUILD)
2188 AC_SUBST(CC_FOR_BUILD)
2189 AC_SUBST(CXX_FOR_BUILD)
2190 AC_SUBST(GXX_INCLUDE_PATH_FOR_BUILD)
2191 AC_SUBST(INPATH_FOR_BUILD)
2192 AC_SUBST(OUTPATH_FOR_BUILD)
2193 AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD)
2194 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
2196 AC_SUBST(OUTDIR_FOR_BUILD)
2197 AC_SUBST(PATH_FOR_BUILD)
2198 AC_SUBST(SOLARINC_FOR_BUILD)
2199 AC_SUBST(SOLARLIB_FOR_BUILD)
2200 AC_SUBST(WORKDIR_FOR_BUILD)
2202 UPD="`echo AC_PACKAGE_VERSION | sed "s/\.//"`0"
2203 SOURCEVERSION="OOO$UPD"
2204 AC_SUBST(UPD)
2205 AC_SUBST(SOURCEVERSION)
2207 dnl ===================================================================
2208 dnl Set the ENABLE_CRASHDUMP variable.
2209 dnl ===================================================================
2210 AC_MSG_CHECKING([whether to enable crashdump feature])
2211 if test "$enable_crashdump" = "yes"; then
2212     ENABLE_CRASHDUMP="TRUE"
2213     BUILD_TYPE="$BUILD_TYPE CRASHREP"
2214     AC_MSG_RESULT([yes])
2215 else
2216     ENABLE_CRASHDUMP=""
2217     AC_MSG_RESULT([no])
2219 AC_SUBST(ENABLE_CRASHDUMP)
2222 dnl ===================================================================
2223 dnl Windows specific tests and stuff
2224 dnl ===================================================================
2225 if test "$_os" = "WINNT"; then
2227     dnl Include twain scanners
2228     BUILD_TYPE="$BUILD_TYPE TWAIN"
2230     dnl Set the CL_X64 variable if we are building a 64-bit LibreOffice.
2231     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2232     if test "z$enable_cl_x64" = "z" -o "$enable_cl_x64" = "no"; then
2233         CL_X64=""
2234         AC_MSG_RESULT([no])
2235     else
2236         CL_X64="TRUE"
2237         AC_MSG_RESULT([yes])
2238     fi
2239     AC_SUBST(CL_X64)
2241     AC_MSG_CHECKING([whether to use DirectX])
2242     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2243         ENABLE_DIRECTX="TRUE"
2244         AC_MSG_RESULT([yes])
2245     else
2246         ENABLE_DIRECTX=""
2247         AC_MSG_RESULT([no])
2248     fi
2249     AC_SUBST(ENABLE_DIRECTX)
2251     AC_MSG_CHECKING([whether to use ActiveX])
2252     if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
2253         DISABLE_ACTIVEX=""
2254         AC_MSG_RESULT([yes])
2255     else
2256         DISABLE_ACTIVEX="TRUE"
2257         AC_MSG_RESULT([no])
2258     fi
2259     AC_SUBST(DISABLE_ACTIVEX)
2261     AC_MSG_CHECKING([whether to use ATL])
2262     if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE"; then
2263         DISABLE_ATL=""
2264         AC_MSG_RESULT([yes])
2265     elif test "$enable_atl" = ""; then
2266         if test "$WITH_MINGW" = "yes"; then
2267             DISABLE_ATL="TRUE"
2268             AC_MSG_RESULT([no])
2269         else
2270             DISABLE_ATL=""
2271             AC_MSG_RESULT([yes])
2272         fi
2273     else
2274         DISABLE_ATL="TRUE"
2275         AC_MSG_RESULT([no])
2276     fi
2277     AC_SUBST(DISABLE_ATL)
2280 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
2281 dnl ===================================================================
2282 AC_MSG_CHECKING([whether to turn warnings to errors])
2283 if test -n "$enable_werror" && test "$enable_werror" != "no"; then
2284     ENABLE_WERROR="TRUE"
2285     AC_MSG_RESULT([yes])
2286 else
2287     ENABLE_WERROR="FALSE"
2288     AC_MSG_RESULT([no])
2290 AC_SUBST(ENABLE_WERROR)
2292 dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
2293 dnl ===================================================================
2294 AC_MSG_CHECKING([whether to do a debug build])
2295 if test -n "$enable_debug" && test "$enable_debug" != "no"; then
2296     ENABLE_DEBUG="TRUE"
2297     enable_symbols="yes"
2298     AC_MSG_RESULT([yes])
2299 else
2300     ENABLE_DEBUG="FALSE"
2301     AC_MSG_RESULT([no])
2303 AC_SUBST(ENABLE_DEBUG)
2305 dnl Set the ENABLE_DBGUTIL variable
2306 dnl ===================================================================
2307 AC_MSG_CHECKING([whether to build with additional debug utilities])
2308 if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2309     PROEXT=""
2310     PRODUCT=""
2311     AC_MSG_RESULT([yes])
2312     if test $_os = WINNT -a \
2313             \( "$enable_mozilla" = yes -o \
2314                "$enable_nss_module" = yes -o \
2315                "$enable_build_mozilla" = yes \); then
2316         # We can't build against the Mozilla stuff if using _DEBUG, will get linking errors
2317         # See connectivity/drivers/mozab
2318         AC_MSG_WARN([Also disabling Mozilla stuff then])
2319         enable_mozilla=no
2320         enable_nss_module=no
2321         enable_build_mozilla=no
2322     fi
2323 else
2324     PRODUCT="full"
2325     PROEXT=".pro"
2326     AC_MSG_RESULT([no, full product build])
2328 AC_SUBST(PRODUCT)
2329 AC_SUBST(PROEXT)
2331 # Set the ENABLE_LTO variable
2332 # ===================================================================
2333 AC_MSG_CHECKING([whether to use link-time optimization])
2334 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2335     ENABLE_LTO="TRUE"
2336     AC_MSG_RESULT([yes])
2337 else
2338     ENABLE_LTO=""
2339     AC_MSG_RESULT([no])
2341 AC_SUBST(ENABLE_LTO)
2343 dnl whether to include symbols into final build.
2344 dnl ===================================================================
2345 AC_MSG_CHECKING([whether to include symbols])
2346 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
2347     ENABLE_SYMBOLS="TRUE"
2348     AC_MSG_RESULT([yes])
2349 else
2350     ENABLE_SYMBOLS=
2351     AC_MSG_RESULT([no])
2353 AC_SUBST(ENABLE_SYMBOLS)
2355 dnl Determine if the solver is to be stripped or not.
2356 dnl ===================================================================
2357 AC_MSG_CHECKING([whether to strip the solver or not.])
2358 if test "z$enable_strip_solver" = "zno"; then
2359     DISABLE_STRIP="TRUE"
2360     AC_MSG_RESULT([no])
2361 else
2362     if test -n "$ENABLE_SYMBOLS"; then
2363         DISABLE_STRIP="TRUE"
2364         AC_MSG_RESULT([no])
2365     else
2366         DISABLE_STRIP=
2367         AC_MSG_RESULT([yes])
2368     fi
2370 AC_SUBST(DISABLE_STRIP)
2372 dnl check for cups support
2373 dnl ===================================================================
2374 if test "$test_cups" = "yes"; then
2375     AC_MSG_CHECKING([whether cups support is present])
2376     AC_CHECK_LIB(cups, cupsPrintFiles)
2377     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
2378     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
2379         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
2380     fi
2384 # check for fontconfig support
2385 AC_MSG_CHECKING([whether we need fontconfig])
2386 if test "z$test_fontconfig" = "zyes"; then
2387     ENABLE_FONTCONFIG="TRUE"
2388     AC_MSG_RESULT([yes])
2389     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
2390 else
2391     ENABLE_FONTCONFIG=""
2392     AC_MSG_RESULT([no])
2394 AC_SUBST(ENABLE_FONTCONFIG)
2395 AC_SUBST(FONTCONFIG_CFLAGS)
2396 AC_SUBST(FONTCONFIG_LIBS)
2398 dnl whether to find & fetch external tarballs?
2399 dnl ===================================================================
2400 if test -z "$TARFILE_LOCATION"; then
2401     TARFILE_LOCATION="DEFAULT"
2403 AC_SUBST(TARFILE_LOCATION)
2405 if test "z$enable_fetch_external" != "zno" ; then
2406     DO_FETCH_TARBALLS="YES"
2408 AC_SUBST(DO_FETCH_TARBALLS)
2411 dnl git-new-workdir
2412 dnl ===================================================================
2413 AC_SUBST(GIT_LINK_SRC)
2415 dnl Disable legacy binary file formats filters
2416 dnl ===================================================================
2417 AC_MSG_CHECKING([whether to enable filters for legacy binary file formats (StarOffice 5.2)])
2418 if test "$enable_binfilter" = "no"; then
2419     WITH_BINFILTER="NO"
2420     AC_MSG_RESULT([no])
2421 else
2422     WITH_BINFILTER="YES"
2423     BUILD_TYPE="$BUILD_TYPE BINFILTER"
2424     GIT_REPO_NAMES="$GIT_REPO_NAMES binfilter"
2425     AC_MSG_RESULT([yes])
2427 AC_SUBST(WITH_BINFILTER)
2429 AC_MSG_CHECKING([whether to build help])
2430 if test "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
2431     AC_MSG_RESULT([yes])
2432     BUILD_TYPE="$BUILD_TYPE HELP"
2433     SCPDEFS="$SCPDEFS -DWITH_HELP"
2434     GIT_REPO_NAMES="$GIT_REPO_NAMES help"
2435 else
2436     AC_MSG_RESULT([no])
2439 dnl Enable ugly pieces of code we're better off without
2440 dnl ===================================================================
2441 if test "$enable_ugly" = "yes"; then
2442     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2443     SCPDEFS="$SCPDEFS -DWITH_UGLY"
2444     ENABLE_UGLY=YES
2445 else
2446     ENABLE_UGLY=NO
2448 AC_SUBST(ENABLE_UGLY)
2450 dnl ===================================================================
2451 dnl Disable rpath in shared libraries?
2452 dnl ===================================================================
2453 AC_MSG_CHECKING([whether to use RPATH in shared libraries])
2454 if test "$enable_rpath" = "no"; then
2455     ENABLE_RPATH="no"
2456 else
2457     ENABLE_RPATH="yes"
2459 AC_MSG_RESULT([$ENABLE_RPATH])
2460 AC_SUBST(ENABLE_RPATH)
2462 dnl Test whether to include MySpell dictionaries
2463 dnl ===================================================================
2464 AC_MSG_CHECKING([whether to include MySpell dictionaries])
2465 if test -z "$with_myspell_dicts" || test "$with_myspell_dicts" = "yes"; then
2466     AC_MSG_RESULT([yes])
2467     WITH_MYSPELL_DICTS=YES
2468     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
2469     GIT_REPO_NAMES="$GIT_REPO_NAMES dictionaries"
2470 else
2471     AC_MSG_RESULT([no])
2472     WITH_MYSPELL_DICTS=NO
2474 AC_SUBST(WITH_MYSPELL_DICTS)
2476 AC_MSG_CHECKING([whether to use dicts from external paths])
2477 if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
2478     AC_MSG_RESULT([yes])
2479     SYSTEM_DICTS=YES
2480     AC_MSG_CHECKING([for spelling dictionary directory])
2481     if test -n "$with_external_dict_dir"; then
2482         DICT_SYSTEM_DIR=file://$with_external_dict_dir
2483     else
2484         DICT_SYSTEM_DIR=file:///usr/share/hunspell
2485     fi
2486     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
2487     AC_MSG_CHECKING([for hyphenation patterns directory])
2488     if test -n "$with_external_hyph_dir"; then
2489         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
2490     else
2491         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
2492     fi
2493     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
2494     AC_MSG_CHECKING([for thesaurus directory])
2495     if test -n "$with_external_thes_dir"; then
2496         THES_SYSTEM_DIR=file://$with_external_thes_dir
2497     else
2498         THES_SYSTEM_DIR=file:///usr/share/mythes
2499     fi
2500     AC_MSG_RESULT([$THES_SYSTEM_DIR])
2501 else
2502     AC_MSG_RESULT([no])
2503     SYSTEM_DICTS=NO
2505 AC_SUBST(SYSTEM_DICTS)
2506 AC_SUBST(DICT_SYSTEM_DIR)
2507 AC_SUBST(HYPH_SYSTEM_DIR)
2508 AC_SUBST(THES_SYSTEM_DIR)
2510 dnl ===================================================================
2511 dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
2512 dnl ===================================================================
2513 AC_MSG_CHECKING([whether to enable pch feature])
2514 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
2515     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2516         ENABLE_PCH="TRUE"
2517         AC_MSG_RESULT([yes])
2518 dnl There is no PCH support in GCC versions prior to this
2519     elif test "$GCC" = "yes"; then
2520         ENABLE_PCH="TRUE"
2521         AC_MSG_RESULT([yes])
2522     else
2523         ENABLE_PCH=""
2524         AC_MSG_WARN([Precompiled header not yet supported for your platform/compiler])
2525     fi
2526 else
2527     ENABLE_PCH=""
2528     AC_MSG_RESULT([no])
2530 AC_SUBST(ENABLE_PCH)
2532 dnl ===================================================================
2533 dnl Search all the common names for GNU make
2534 dnl ===================================================================
2535 AC_MSG_CHECKING([for GNU make])
2537 # try to use our own make if it is available and GNUMAKE was not already defined
2538 if test -z "$GNUMAKE"; then
2539     if test -x "/opt/lo/bin/make"; then
2540         GNUMAKE="/opt/lo/bin/make"
2541     fi
2544 for a in "$MAKE" $GNUMAKE make gmake gnumake; do
2545     $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
2546     if test $? -eq 0;  then
2547         GNUMAKE=$a
2548         break
2549     fi
2550 done
2551 AC_MSG_RESULT($GNUMAKE)
2552 if test -z "$GNUMAKE"; then
2553     AC_MSG_ERROR([not found. install GNU make.])
2556 AC_MSG_CHECKING([the GNU make version])
2557 _make_version=`$GNUMAKE --version | grep GNU | grep -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
2558 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2559 if test "$_make_longver" -ge "038200" ; then
2560     AC_MSG_RESULT([$GNUMAKE $_make_version])
2562 elif test "$_make_longver" -ge "038100" ; then
2563     AC_MSG_RESULT([$GNUMAKE $_make_version])
2564     AC_MSG_CHECKING([for GNU make bug 20033])
2565     TESTGMAKEBUG20033=`mktemp -d`
2566     cat > $TESTGMAKEBUG20033/Makefile << EOF
2567 A := \$(wildcard *.a)
2569 .PHONY: all
2570 all: \$(A:.a=.b)
2571         @echo survived bug20033. #dont kill these tabs, you will break the Makefile!!!!
2573 .PHONY: setup
2574 setup:
2575         @touch 1.a 2.a 3.a 4.a 5.a 6.a
2577 define d1
2578 @echo lala \$(1)
2579 @sleep 1
2580 endef
2582 define d2
2583 @echo tyty \$(1)
2584 @sleep 1
2585 endef
2587 %.b : %.a
2588         \$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | sha1sum))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
2589         \$(call d1,\$(CHECKSUM)),\
2590         \$(call d2,\$(CHECKSUM)))
2592     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
2593         no_parallelism_make="YES"
2594         AC_MSG_RESULT([yes, disable parallelism])
2595     else
2596         AC_MSG_RESULT([no, keep parallelism enabled])
2597     fi
2598     rm -rf $TESTGMAKEBUG20033
2599 else
2600     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
2602 AC_SUBST(GNUMAKE)
2604 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`;
2605 STALE_MAKE=
2606 make_warning=
2607 if test "z$_make_ver_check" = "z"; then
2608    STALE_MAKE=TRUE
2610 AC_SUBST(STALE_MAKE)
2612 dnl ===================================================================
2613 dnl  Test the Solaris compiler version
2614 dnl ===================================================================
2615 if test "$_os" = "SunOS"; then
2616     if test "$CC" = "cc"; then
2617         AC_PATH_PROGS(_cc, cc)
2618         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2619         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2620         dnl cc -V outputs to standard error!!!!
2621         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2622         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2623         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2624         if test "$_sunstudio_major" != "5"; then
2625             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2626         else
2627             _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" }'`
2628             if test "$_sunstudio_minor" = "false"; then
2629                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2630             else
2631                 dnl compiler will do
2632                 AC_MSG_RESULT([checked])
2633             fi
2634         fi
2635     fi
2638 HAVE_LD_HASH_STYLE=FALSE
2639 WITH_LINKER_HASH_STYLE=
2640 AC_MSG_CHECKING( for --hash-style gcc linker support )
2641 if test "$GCC" = "yes" ; then
2642     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes" ; then
2643         hash_styles="gnu sysv"
2644     elif test "$with_linker_hash_style" = "no" ; then
2645         hash_styles=
2646     else
2647         hash_styles="$with_linker_hash_style"
2648     fi
2650     for hash_style in $hash_styles ; do
2651         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
2652         hash_style_ldflags_save=$LDFLAGS
2653         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
2655         AC_LINK_IFELSE([AC_LANG_PROGRAM(
2656             [
2657 #include <stdio.h>
2658             ],[
2659 printf ("");
2660             ])],
2661             [ if ./conftest$EXEEXT; then
2662                   HAVE_LD_HASH_STYLE=TRUE
2663                   WITH_LINKER_HASH_STYLE=$hash_style
2664               fi],
2665             [HAVE_LD_HASH_STYLE=FALSE])
2666         LDFLAGS=$hash_style_ldflags_save
2667     done
2669     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
2670         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
2671     else
2672         AC_MSG_RESULT( no )
2673     fi
2674     LDFLAGS=$hash_style_ldflags_save
2675 else
2676     AC_MSG_RESULT( no )
2678 AC_SUBST(HAVE_LD_HASH_STYLE)
2679 AC_SUBST(WITH_LINKER_HASH_STYLE)
2681 dnl ===================================================================
2682 dnl Check whether there's a Perl version available.
2683 dnl ===================================================================
2684 if test -z "$with_perl_home"; then
2685     AC_PATH_PROG(PERL, perl)
2686 else
2687     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
2688     _perl_path="$with_perl_home/bin/perl"
2689     if test -x "$_perl_path"; then
2690         PERL=$_perl_path
2691     else
2692         AC_MSG_ERROR([$_perl_path not found])
2693     fi
2696 dnl ===================================================================
2697 dnl Testing for Perl version 5 or greater.
2698 dnl $] is the Perl version variable, it is returned as an integer
2699 dnl ===================================================================
2700 if test "$PERL"; then
2701     AC_MSG_CHECKING([the Perl version])
2702     ${PERL} -e "exit($]);"
2703     _perl_version=$?
2704     if test "$_perl_version" -lt 5; then
2705         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2706     fi
2707     AC_MSG_RESULT([checked (perl $_perl_version)])
2708 else
2709     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2711 AC_SUBST(PERL)
2713 dnl ===================================================================
2714 dnl Testing for required Perl modules
2715 dnl ===================================================================
2717 AC_MSG_CHECKING([for required Perl modules])
2718 if `$PERL -e 'use Archive::Zip; use Cwd;'`; then
2719     AC_MSG_RESULT([all modules found])
2720 else
2721     AC_MSG_ERROR([Failed to find some modules])
2724 dnl ===================================================================
2725 dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2726 dnl ===================================================================
2727 SHOWINCLUDES_PREFIX=
2728 if test "$_os" = "WINNT"; then
2729     if test "$WITH_MINGW" != "yes"; then
2730         AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
2731         if test -z "$with_cl_home"; then
2732             vctest=`./oowintool --msvc-productdir`;
2733             if test "$CL_X64" = ""; then
2734                 if test -x "$vctest/bin/cl.exe"; then
2735                     with_cl_home=$vctest;
2736                 fi
2737             else
2738                 if test -x "$vctest/bin/amd64/cl.exe"; then
2739                     with_cl_home=$vctest;
2740                 fi
2741             fi
2742         else
2743             with_cl_home=`cygpath -u "$with_cl_home"`
2744         fi
2745         with_cl_home=`cygpath -d "$with_cl_home"`
2746         with_cl_home=`cygpath -u "$with_cl_home"`
2747         AC_MSG_RESULT([$with_cl_home])
2749         dnl ===========================================================
2750         dnl  Check for mspdb80.dll/mspdb100.dll
2751         dnl ===========================================================
2752         dnl MSVS 2008/10 Compiler
2753         if test -n "$with_mspdb_path";then
2754             with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2755         fi
2756         if test -e "$with_mspdb_path/mspdb80.dll" -o -e "$with_mspdb_path/mspdb100.dll"; then
2757             MSPDB_PATH="$with_mspdb_path"
2758         fi
2759         dnl MSVS 2008 case
2760         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2761             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2762         fi
2763         dnl Windows SDK 6.0 case
2764         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2765             MSPDB_PATH="$with_cl_home/bin"
2766         fi
2767         dnl MSVS 2010 case
2768         if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb100.dll"; then
2769             MSPDB_PATH="$with_cl_home/../Common7/IDE"
2770         fi
2772         if test -z "$MSPDB_PATH";then
2773             dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2774             AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2775             AC_PATH_PROG(MSPDB_PATH, mspdb100.dll)
2776             MSPDB_PATH=`dirname "$MSPDB_PATH"`
2777         fi
2779         if test -z "$MSPDB_PATH"; then
2780             AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
2781         fi
2782         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2783         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2784         dnl The path needs to be added before cl is called
2785         PATH="$MSPDB_PATH:$PATH"
2787         AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2788         if test -z "$CC"; then
2789             if test "$CL_X64" = ""; then
2790                 if test -x "$with_cl_home/bin/cl.exe"; then
2791                     CC="$with_cl_home/bin/cl.exe"
2792                 fi
2793             else
2794                 if test -x "$with_cl_home/bin/amd64/cl.exe"; then
2795                     CC="$with_cl_home/bin/amd64/cl.exe"
2796                 fi
2797             fi
2798             if test -z "$CC"; then
2799                 AC_PATH_PROG(CC, cl.exe)
2800             fi
2801             # This gives us a posix path with 8.3 filename restrictions
2802             CC=`cygpath -d "$CC"`
2803             CC=`cygpath -u "$CC"`
2804         fi
2806         if test -n "$CC"; then
2807             # Remove /cl.exe from CC case insensitive
2808             AC_MSG_RESULT([found ($CC)])
2809             if test "$CL_X64" = ""; then
2810                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
2811             else
2812                 if test -n "$with_cl_home"; then
2813                     COMPATH=`echo $with_cl_home`
2814                 fi
2815             fi
2816             export INCLUDE=`cygpath -d "$COMPATH/Include"`
2817             dnl  Check which Microsoft C/C++ compiler is found
2818             AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2819             # The following finds Microsoft, matches nn.nn.nnnn then pulls numbers out.
2820             CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft/ && /..\\...\\...../ {
2821                             x = match( \\\$0, /..\\...\\...../ )
2822                             CCversion = substr( \\\$0, RSTART, RLENGTH)
2823                             tokencount = split (CCversion,vertoken,\".\")
2824                             for ( i = 1 ; i <= tokencount ; i++ ) {
2825                                 printf (\"%04d\",vertoken[[i]] )
2826                             }
2827                             }"`
2828             if test "$CCNUMVER" -ge "001600000000"; then
2829                 COMEX=13
2830                 MSVSVER=2010
2831             elif test "$CCNUMVER" -ge "001500000000"; then
2832                 COMEX=12
2833                 MSVSVER=2008
2834             else
2835                 AC_MSG_ERROR([Compiler too old. Use Microsoft Visual Studio 2008 or 2010.])
2836             fi
2837             AC_MSG_RESULT([found compiler version $CCNUMVER (MSVS $MSVSVER).])
2838         else
2839             AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
2840         fi
2842         dnl We need to guess the prefix of the -showIncludes output, it can be
2843         dnl localized
2844         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
2845         echo "#include <stdlib.h>" > conftest.c
2846         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
2847             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
2848         rm -f conftest.c conftest.obj
2849         if test -z "$SHOWINCLUDES_PREFIX" ; then
2850             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
2851         else
2852             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
2853         fi
2855         # Check for 64-bit (cross-)compiler to use to build the 64-bit
2856         # version of the Explorer extension (and maybe other small
2857         # bits, too) needed when installing a 32-bit LibreOffice on a
2858         # 64-bit OS. The 64-bit Explorer extension is a feature that
2859         # has been present since long in OOo. Don't confuse it with
2860         # building LibreOffice itself as 64-bit code, which is
2861         # unfished work and highly experimental.
2863         BUILD_X64=
2864         CC_X64_BINARY=
2865         LINK_X64_BINARY=
2866         LIBMGR_X64_BINARY=
2868         AC_MSG_CHECKING([for a x64 compiler and libraries for 64bit ActiveX component])
2869         if test "$CL_X64" = "" -a -f "$with_cl_home/atlmfc/lib/amd64/atls.lib"; then
2870             # Prefer native x64 compiler to cross-compiler, in case we are running
2871             # the build on a 64-bit OS.
2872             if "$with_cl_home/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2873                 BUILD_X64=TRUE
2874                 CC_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
2875                 CXX_X64_BINARY="$with_cl_home/bin/amd64/cl.exe"
2876                 LINK_X64_BINARY="$with_cl_home/bin/amd64/link.exe"
2877                 LIBMGR_X64_BINARY="$with_cl_home/bin/amd64/lib.exe"
2878             elif "$with_cl_home/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
2879                 BUILD_X64=TRUE
2880                 CC_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
2881                 CXX_X64_BINARY="$with_cl_home/bin/x86_amd64/cl.exe"
2882                 LINK_X64_BINARY="$with_cl_home/bin/x86_amd64/link.exe"
2883                 LIBMGR_X64_BINARY="$with_cl_home/bin/x86_amd64/lib.exe"
2884             fi
2885         fi
2886         if test "$BUILD_X64" = TRUE; then
2887             AC_MSG_RESULT([found])
2888         else
2889             AC_MSG_RESULT([not found])
2890             AC_MSG_WARN([Installation set will not contain the 64-bit Explorer extension])
2891         fi
2892         AC_SUBST(BUILD_X64)
2894         # These are passed to the environment through set_soenv.in as usual, and then
2895         # used in set_wntx64.mk
2896         AC_SUBST(CC_X64_BINARY)
2897         AC_SUBST(CXX_X64_BINARY)
2898         AC_SUBST(LINK_X64_BINARY)
2899         AC_SUBST(LIBMGR_X64_BINARY)
2901     else
2902         AC_MSG_CHECKING([the compiler is MinGW])
2903         MACHINE_PREFIX=`$CC -dumpmachine`
2904         if echo $MACHINE_PREFIX | grep -q mingw32; then
2905             AC_MSG_RESULT([yes])
2906         else
2907             AC_MSG_ERROR([Compiler is not MinGW.])
2908         fi
2909     fi
2911 AC_SUBST(COMEX)
2912 AC_SUBST(MSPDB_PATH)
2913 AC_SUBST(SHOWINCLUDES_PREFIX)
2915 dnl ===================================================================
2916 dnl Check for pkg-config
2917 dnl ===================================================================
2918 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2919     PKG_PROG_PKG_CONFIG
2922 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2924     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
2925     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
2926     # explicitly. Or put /path/to/compiler in PATH yourself.
2928     AC_CHECK_TOOL(AR,ar)
2929     AC_CHECK_TOOL(NM,nm)
2930     AC_CHECK_TOOL(OBJDUMP,objdump)
2931     AC_CHECK_TOOL(RANLIB,ranlib)
2932     AC_CHECK_TOOL(STRIP,strip)
2933     if test "$_os" = "WINNT"; then
2934         AC_CHECK_TOOL(DLLTOOL,dlltool)
2935         AC_CHECK_TOOL(WINDRES,windres)
2936     fi
2938 AC_SUBST(AR)
2939 AC_SUBST(DLLTOOL)
2940 AC_SUBST(NM)
2941 AC_SUBST(OBJDUMP)
2942 AC_SUBST(PKG_CONFIG)
2943 AC_SUBST(RANLIB)
2944 AC_SUBST(STRIP)
2945 AC_SUBST(WINDRES)
2947 dnl ===================================================================
2948 dnl pkg-config checks on Mac OS X
2949 dnl ===================================================================
2951 if test $_os = Darwin; then
2952     AC_MSG_CHECKING([for bogus pkg-config])
2953     if test -n "$PKG_CONFIG"; then
2954         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | grep -q Mono.framework; then
2955             AC_MSG_RESULT([yes, from Mono])
2956         else
2957             AC_MSG_RESULT([yes, from unknown origin])
2958         fi
2959         AC_MSG_WARN([This might have unexpected consequences, please consider hiding $PKG_CONFIG])
2960         echo "Having a $PKG_CONFIG might have unexpected consequences, please consider hiding it" >>warn
2961     else
2962         AC_MSG_RESULT([no])
2963     fi
2966 dnl ===================================================================
2967 dnl  .NET needs special treatment
2968 dnl (does the above comment really mean .NET, or is it misusing
2969 dnl that to mean Visual Studio .NET 2003 ? And does this also
2970 dnl in fact apply equally to what we actually support, i.e.
2971 dnl Visual Studio 2008 and 2010?)
2972 dnl ===================================================================
2973 if test "$build_os" = "cygwin"; then
2974     dnl Check midl.exe
2975     AC_PATH_PROG(MIDL_PATH, midl.exe)
2976     if test -n "$MIDL_PATH";then
2977         MIDL_PATH=`dirname "$MIDL_PATH"`
2978     fi
2979     if test -n "$with_midl_path";then
2980         with_midl_path=`cygpath -u "$with_midl_path"`
2981     fi
2982     if test -x "$with_midl_path/midl.exe"; then
2983         MIDL_PATH="$with_midl_path"
2984     fi
2985     if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
2986         MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
2987     fi
2988     if test -z "$MIDL_PATH" ; then
2989         vstest=`./oowintool --msvs-productdir`;
2990         if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
2991             MIDL_PATH="$vstest/Common7/Tools/Bin"
2992         fi
2993     fi
2994     if test -z "$MIDL_PATH" ; then
2995         winsdktest=`./oowintool --windows-sdk-home`
2996         if test -x "$winsdktest/Bin/midl.exe" ; then
2997             MIDL_PATH="$winsdktest/Bin"
2998         fi
2999     fi
3000     if test ! -x "$MIDL_PATH/midl.exe"; then
3001         AC_MSG_ERROR([midl.exe not found. Make sure it's in PATH or use --with-midl-path])
3002     fi
3003     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3004     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
3005     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
3007     dnl Check csc.exe
3008     AC_PATH_PROG(CSC_PATH, csc.exe)
3009     if test -n "$CSC_PATH";then
3010         CSC_PATH=`dirname "$CSC_PATH"`
3011     fi
3012     if test -n "$with_csc_path";then
3013         with_csc_path=`cygpath -u "$with_csc_path"`
3014     fi
3015     if test -x "$with_csc_path/csc.exe"; then
3016         CSC_PATH="$with_csc_path"
3017     else
3018        csctest=`./oowintool --csc-compilerdir`;
3019        if test -x "$csctest/csc.exe"; then
3020            CSC_PATH="$csctest"
3021        fi
3022     fi
3023     if test ! -x "$CSC_PATH/csc.exe"; then
3024         AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
3025     fi
3026     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3027     CSC_PATH=`cygpath -d "$CSC_PATH"`
3028     CSC_PATH=`cygpath -u "$CSC_PATH"`
3030     dnl Check mscoree.lib / .NET Framework dir
3031     AC_MSG_CHECKING(.NET Framework)
3032     if test -n "$with_dotnet_framework_home"; then
3033         with_dotnet_framework_home=`cygpath -u "$with_dotnet_framework_home"`
3034     fi
3035     if test -f "$with_dotnet_framework_home/lib/mscoree.lib"; then
3036         DOTNET_FRAMEWORK_HOME="$with_dotnet_framework_home"
3037     fi
3038     if test -z "$DOTNET_FRAMEWORK_HOME" ; then
3039         frametest=`./oowintool --dotnetsdk-dir`
3040         if test -f "$frametest/lib/mscoree.lib"; then
3041             DOTNET_FRAMEWORK_HOME="$frametest"
3042         else
3043             frametest=`./oowintool --windows-sdk-home`
3044             if test -f "$frametest/lib/mscoree.lib"; then
3045                 DOTNET_FRAMEWORK_HOME="$frametest"
3046             fi
3047         fi
3048     fi
3049     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
3050         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-dotnet-framework-home])
3051     fi
3052     AC_MSG_RESULT(found)
3053     # Convert to posix path with 8.3 filename restrictions ( No spaces )
3054     DOTNET_FRAMEWORK_HOME=`cygpath -d "$DOTNET_FRAMEWORK_HOME"`
3055     DOTNET_FRAMEWORK_HOME=`cygpath -u "$DOTNET_FRAMEWORK_HOME"`
3056     AC_SUBST(MIDL_PATH)
3057     AC_SUBST(CSC_PATH)
3058     AC_SUBST(DOTNET_FRAMEWORK_HOME)
3061 dnl ===================================================================
3062 dnl Check if stdc headers are available excluding MSVC.
3063 dnl ===================================================================
3064 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3065     AC_HEADER_STDC
3068 dnl ===================================================================
3069 dnl Testing for C++ compiler and version...
3070 dnl ===================================================================
3072 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3073     AC_PROG_CXX
3074 else
3075     if test -n "$CC" -a -z "$CXX"; then
3076         CXX="$CC"
3077     fi
3080 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
3081 if test "$GXX" = "yes"; then
3082     AC_MSG_CHECKING([the GNU C++ compiler version])
3084     _gpp_version=`$CXX -dumpversion`
3085     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
3087     if test "$_os" = "Darwin" -a "$with_macosx_sdk" = "10.4" -a "$_gpp_majmin" -ge "401" ; then
3088         if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
3089             export CXX="$GCC_HOME/bin/g++-4.0"
3090             _gpp_majmin_2=`$CXX -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
3091             if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
3092                 _gpp_majmin=$_gpp_majmin_2
3093             fi
3094         fi
3095         if test "$_gpp_majmin" -ge "401" ; then
3096             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])
3097         else
3098             AC_MSG_RESULT([implicitly using CXX=$CXX])
3099         fi
3100     else
3101         AC_MSG_RESULT([checked (g++ $_gpp_version)])
3102     fi
3104     if test "$_gpp_majmin" = "304"; then
3105         AC_MSG_CHECKING([whether $CXX has the enum bug])
3106         AC_RUN_IFELSE([AC_LANG_SOURCE([[
3107             extern "C" void abort (void);
3108             extern "C" void exit (int status);
3110             enum E { E0, E1, E2, E3, E4, E5 };
3112             void test (enum E e)
3113             {
3114                 if (e == E2 || e == E3 || e == E1)
3115                     exit (1);
3116             }
3118             int main (void)
3119             {
3120                 test (E4);
3121                 test (E5);
3122                 test (E0);
3123                 return 0;
3124             }
3125             ]])],[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])],[])
3126     fi
3130 # prefx CXX with ccache if needed
3132 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3133     if test "$CCACHE" != "" ; then
3134         AC_MSG_CHECKING([whether $CXX is already ccached])
3135         AC_LANG_PUSH([C++])
3136         save_CXXFLAGS=$CXXFLAGS
3137         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
3138         dnl an empty program will do, we're checking the compiler flags
3139         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3140                           [use_ccache=yes], [use_ccache=no])
3141         if test $use_ccache = yes ; then
3142             AC_MSG_RESULT([yes])
3143         else
3144             CXX="$CCACHE $CXX"
3145             AC_MSG_RESULT([no])
3146         fi
3147         CXXFLAGS=$save_CXXFLAGS
3148         AC_LANG_POP([C++])
3149     fi
3152 dnl ===================================================================
3153 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
3154 dnl ===================================================================
3156 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3157     AC_PROG_CXXCPP
3159     dnl Check whether there's a C pre-processor.
3160     dnl ===================================================================
3161     dnl When using SunStudio compiler, there is a bug with the cc
3162     dnl preprocessor, so use CC preprocessor as the cc preprocessor
3163     dnl See Issuezilla #445.
3164     dnl ===================================================================
3165     if test "$_os" = "SunOS"; then
3166         CPP=$CXXCPP
3167     else
3168         AC_PROG_CPP
3169     fi
3173 dnl ===================================================================
3174 dnl Find integral type sizes and alignments
3175 dnl ===================================================================
3177 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
3179     AC_CHECK_SIZEOF(long)
3180     AC_CHECK_SIZEOF(short)
3181     AC_CHECK_SIZEOF(int)
3182     AC_CHECK_SIZEOF(long long)
3183     AC_CHECK_SIZEOF(double)
3184     AC_CHECK_SIZEOF(void*)
3186     SIZEOF_SHORT=$ac_cv_sizeof_short
3187     SIZEOF_INT=$ac_cv_sizeof_int
3188     SIZEOF_LONG=$ac_cv_sizeof_long
3189     SIZEOF_LONGLONG=$ac_cv_sizeof_long_long
3190     SIZEOF_DOUBLE=$ac_cv_sizeof_double
3191     SIZEOF_POINTER=$ac_cv_sizeof_voidp
3193     dnl Allow build without AC_CHECK_ALIGNOF, grrr
3194     m4_pattern_allow([AC_CHECK_ALIGNOF])
3195     m4_ifdef([AC_CHECK_ALIGNOF],
3196       ,
3197       [
3198          dnl We know that the ALIGNOF_ variables are used only when cross-compiling
3199          dnl in sal/typesconfig/makefile.mk...
3200          if test "$cross_compiling" = "yes"; then
3201             AC_MSG_ERROR([When cross-compiling you must use a recent Autoconf with [AC_][CHECK_ALIGNOF]])
3202          fi
3203          m4_define([AC_CHECK_ALIGNOF],
3204             [
3205                AC_MSG_WARN([Cannot determine alignment of $1])
3206                AS_TR_SH([ac_cv_alignof_$3])=unknown
3207             ])
3208       ])
3210     AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
3211     AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
3212     AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
3213     AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
3215     ALIGNOF_SHORT=$ac_cv_alignof_short
3216     ALIGNOF_INT=$ac_cv_alignof_int
3217     ALIGNOF_LONG=$ac_cv_alignof_long
3218     ALIGNOF_DOUBLE=$ac_cv_alignof_double
3220     AC_C_BIGENDIAN
3221     WORDS_BIGENDIAN=$ac_cv_c_bigendian
3223     dnl Check for large file support
3224     AC_SYS_LARGEFILE
3225     if test -n "$ac_cv_sys_file_offset_bits"; then
3226         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
3227     fi
3228     if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
3229         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
3230     fi
3231 else
3232     # Hardcode for MSVC
3233     SIZEOF_SHORT=2
3234     SIZEOF_INT=4
3235     SIZEOF_LONG=4
3236     SIZEOF_LONGLONG=8
3237     if test "$CL_X64" = ""; then
3238         SIZEOF_POINTER=4
3239     else
3240         SIZEOF_POINTER=8
3241     fi
3242     ALIGNOF_SHORT=2
3243     ALIGNOF_INT=4
3244     ALIGNOF_LONG=4
3245     ALIGNOF_DOUBLE=8
3246     WORDS_BIGENDIAN=no
3247     LFS_CFLAGS=''
3249 AC_SUBST(WORDS_BIGENDIAN)
3250 AC_SUBST(LFS_CFLAGS)
3252 AC_SUBST(SIZEOF_SHORT)
3253 AC_SUBST(SIZEOF_INT)
3254 AC_SUBST(SIZEOF_LONG)
3255 AC_SUBST(SIZEOF_LONGLONG)
3256 AC_SUBST(SIZEOF_DOUBLE)
3257 AC_SUBST(SIZEOF_POINTER)
3258 AC_SUBST(ALIGNOF_SHORT)
3259 AC_SUBST(ALIGNOF_INT)
3260 AC_SUBST(ALIGNOF_LONG)
3261 AC_SUBST(ALIGNOF_DOUBLE)
3263 dnl ===================================================================
3264 dnl Check if valgrind.h is available
3265 dnl ===================================================================
3266 if test "$cross_compiling" != "yes" -a "$enable_dbgutil" != "no" -a \
3267         -z "$VALGRIND_CFLAGS"; then
3268     dnl Test $prefix (currently only testing for /usr and /usr/local)
3269     dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
3270     prev_cppflags=$CPPFLAGS
3271     CPPFLAGS="-I/usr/include/valgrind"
3272     AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
3273     if test -z "$VALGRIND_CFLAGS"; then
3274         CPPFLAGS="-I/usr/local/include/valgrind"
3275         AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
3276     fi
3277     if test -n "$VALGRIND_CFLAGS"; then
3278         CPPFLAGS=$VALGRIND_CFLAGS
3279         AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
3280     fi
3281     CPPFLAGS=$prev_cppflags
3283 AC_SUBST([VALGRIND_CFLAGS])
3285 dnl ===================================================================
3286 dnl Set the gcc/gxx include directories
3287 dnl ===================================================================
3288 # Removed the special FreeBSD treatment. The problem was that with_gxx_include_path
3289 # often contains an i386 which is expanded as a macro.
3290 if test "$GXX" = "yes"; then
3291     AC_MSG_CHECKING([for g++ include path])
3292     if test -z "$with_gxx_include_path"; then
3293         with_gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
3294         if test "$with_gxx_include_path" = "/usr/libexec/(null)/include"; then
3295             with_gxx_include_path="/usr/include"
3296         fi
3297         if echo $with_gxx_include_path | grep -q linux; then
3298             # workaround for Mandriva - issue 100049
3299             with_gxx_include_path=`cd $with_gxx_include_path && pwd`
3300         fi
3301     fi
3302     dnl This is the original code...
3303     dnl with_gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include
3304     if test -z "$with_gxx_include_path"; then
3305         with_gxx_include_path="NO_GXX_INCLUDE"
3306         AC_MSG_RESULT([none])
3307     else
3308         AC_MSG_RESULT([$with_gxx_include_path])
3309     fi
3310 else
3311     with_gxx_include_path="NO_GXX_INCLUDE"
3313 GXX_INCLUDE_PATH="$with_gxx_include_path"
3314 AC_SUBST(GXX_INCLUDE_PATH)
3316 dnl ===================================================================
3317 dnl Set the MinGW include directories
3318 dnl ===================================================================
3319 if test "$WITH_MINGW" = "yes"; then
3320     AC_MSG_CHECKING([for MinGW include path])
3321     cat >conftest.$ac_ext <<_ACEOF
3322 #include <stddef.h>
3323 #include <bits/c++config.h>
3324 _ACEOF
3325     _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`
3326     rm conftest.$ac_ext
3327     if test -z "$_mingw_lib_include_path"; then
3328         _mingw_lib_include_path="NO_LIB_INCLUDE"
3329         AC_MSG_RESULT([no MinGW include path])
3330     else
3331         AC_MSG_RESULT([$_mingw_lib_include_path])
3332     fi
3333     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
3334     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
3336     mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
3337     MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
3339     AC_LANG_PUSH([C++])
3341     AC_MSG_CHECKING([for dynamic libgcc])
3342     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3343 #include <iostream>
3344 using namespace std;
3345 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[   
3346             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
3347             if test -n "$MINGW_GCCDLL"; then
3348                 MINGW_SHARED_GCCLIB=YES
3349                 AC_MSG_RESULT([ $MINGW_GCCDLL])
3350             else
3351                 MINGW_SHARED_GCCLIB=NO
3352                 AC_MSG_RESULT([no])
3353             fi
3354        ],[ AC_MSG_RESULT([no])
3355        
3356     ])
3358     AC_MSG_CHECKING([for dynamic libstdc++])
3359     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3360 #include <iostream>
3361 using namespace std;
3362 ]], [[ cout << "Hello there." << endl; ]])],[   
3363             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
3364             if test -n "$MINGW_GXXDLL"; then
3365                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
3366                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
3367                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
3368                 MINGW_SHARED_GXXLIB=YES
3369                 AC_MSG_RESULT([$MINGW_GXXDLL])
3370             else
3371                 MINGW_SHARED_GXXLIB=NO
3372                 AC_MSG_RESULT([no])
3373             fi
3374        ],[ AC_MSG_RESULT([no])
3375        
3376     ])
3378     AC_LANG_POP([C++])
3380     AC_SUBST(MINGW_CLIB_DIR)
3381     AC_SUBST(MINGW_SHARED_GCCLIB)
3382     AC_SUBST(MINGW_SHARED_GXXLIB)
3383     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
3384     AC_SUBST(MINGW_GCCDLL)
3385     AC_SUBST(MINGW_GXXDLL)
3388 dnl ===================================================================
3389 dnl Extra checking for the SunOS compiler
3390 dnl ===================================================================
3391 if test "$_os" = "SunOS"; then
3392     dnl SunStudio C++ compiler packaged with SunStudio C compiler
3393     if test "$CC" = "cc"; then
3394     AC_MSG_CHECKING([SunStudio C++ Compiler])
3395         if test "$CXX" != "CC"; then
3396             AC_MSG_WARN([SunStudio C++ was not found])
3397             echo "SunStudio C++ was not found" >> warn
3398         else
3399             AC_MSG_RESULT([checked])
3400         fi
3401     fi
3404 dnl *************************************************************
3405 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
3406 dnl *************************************************************
3407 if test "$WITH_MINGW" = "yes"; then
3408     AC_MSG_CHECKING([exception type])
3409     AC_LANG_PUSH([C++])
3410     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
3412         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
3414         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
3415     ])
3416     AC_MSG_RESULT($exceptions_type)
3417     AC_LANG_POP([C++])
3420 EXCEPTIONS="$exceptions_type"
3421 AC_SUBST(EXCEPTIONS)
3423 dnl ===================================================================
3424 dnl Checks for what the default STL should be
3425 dnl ===================================================================
3426 AC_MSG_CHECKING([Whether building STLPort library makes sense])
3427 BUILD_STLPORT="no"
3428 if test "$_os" = "Linux"; then
3429     case "$host_cpu" in
3430     i?86)
3431         case "$host_os" in
3432         k*bsd*-gnu*)
3433             BUILD_STLPORT="no"
3434             ;;
3435         *)
3436             BUILD_STLPORT="yes"
3437             ;;
3438         esac
3439         ;;
3440     *)
3441         BUILD_STLPORT="no"
3442         ;;
3443     esac
3444 elif test "$_os" = "SunOS"; then
3445     BUILD_STLPORT="yes"
3446 elif test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
3447     BUILD_STLPORT="yes"
3448 elif test "$_os" = "FreeBSD"; then
3449     BUILD_STLPORT="yes"
3451 if test "$BUILD_STLPORT" = "yes" ; then
3452     AC_MSG_RESULT([yes])
3453 else
3454     AC_MSG_RESULT([no])
3457 AC_MSG_CHECKING([Whether STLPort library will be actually built])
3458 if test "$with_stlport" = "auto" -o "$BUILD_STLPORT" = "no"; then
3459     with_stlport=$BUILD_STLPORT
3461 if test "$with_stlport" = "yes" ; then
3462     AC_MSG_RESULT([yes])
3463     WITH_STLPORT=YES
3464     SCPDEFS="$SCPDEFS -DWITH_STLPORT"
3465     BUILD_TYPE="$BUILD_TYPE STLPORT"
3466 else
3467     WITH_STLPORT=NO
3468     AC_MSG_RESULT([no])
3471 AC_SUBST(WITH_STLPORT)
3473 dnl ===================================================================
3474 dnl thread-safe statics
3475 dnl ===================================================================
3476 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
3477 unset HAVE_THREADSAFE_STATICS
3478 if test "$GCC" = "yes"; then
3479     save_CXXFLAGS=$CXXFLAGS
3480     CXXFLAGS="$CXXFLAGS -fthreadsafe-statics"
3481     AC_LANG_PUSH([C++])
3482     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)],[HAVE_THREADSAFE_STATICS=TRUE],[])
3483     AC_LANG_POP([C++])
3484     CXXFLAGS=$save_CXXFLAGS
3485     if test "$HAVE_THREADSAFE_STATICS" = "TRUE"; then
3486         dnl Some C++ runtimes use a single lock for all static variables, which
3487         dnl can cause deadlock in multi-threaded applications.  This is not
3488         dnl easily tested here; for POSIX-based systems, if executing the
3489         dnl following C++ program does not terminate then the tool chain
3490         dnl apparently has this problem:
3491         dnl
3492         dnl   #include <pthread.h>
3493         dnl   int h() { return 0; }
3494         dnl   void * g(void * unused) {
3495         dnl     static int n = h();
3496         dnl     return &n;
3497         dnl   }
3498         dnl   int f() {
3499         dnl     pthread_t t;
3500         dnl     pthread_create(&t, 0, g, 0);
3501         dnl     pthread_join(t, 0);
3502         dnl     return 0;
3503         dnl   }
3504         dnl   int main() {
3505         dnl     static int n = f();
3506         dnl     return n;
3507         dnl   }
3508         dnl
3509         dnl Mac OS X up to at least 10.7.1 is known to have this problem:
3510         if test "$_os" = "Darwin"; then
3511             unset HAVE_THREADSAFE_STATICS
3512             AC_MSG_RESULT([broken (i.e., no)])
3513         else
3514             AC_MSG_RESULT([yes])
3515         fi
3516     else
3517         AC_MSG_RESULT([no])
3518     fi
3519 else
3520     AC_MSG_RESULT([unknown (assuming no)])
3522 AC_SUBST(HAVE_THREADSAFE_STATICS)
3524 dnl ===================================================================
3525 dnl visibility and c++0x features
3526 dnl ===================================================================
3527 if test "$GCC" = "yes"; then
3528     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
3529     save_CFLAGS=$CFLAGS
3530     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
3531     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
3532     CFLAGS=$save_CFLAGS
3533     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3534         AC_MSG_RESULT([yes])
3535     else
3536         AC_MSG_RESULT([no])
3537     fi
3539     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
3540     save_CFLAGS=$CFLAGS
3541     CFLAGS="$CFLAGS -Werror -Wno-long-double"
3542     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
3543     CFLAGS=$save_CFLAGS
3544     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
3545         AC_MSG_RESULT([yes])
3546     else
3547         AC_MSG_RESULT([no])
3548     fi
3550     AC_MSG_CHECKING([whether $CC supports -mno-avx])
3551     save_CFLAGS=$CFLAGS
3552     CFLAGS="$CFLAGS -Werror -mno-avx"
3553     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
3554     CFLAGS=$save_CFLAGS
3555     if test "$HAVE_GCC_AVX" = "TRUE"; then
3556         AC_MSG_RESULT([yes])
3557     else
3558         AC_MSG_RESULT([no])
3559     fi
3561     AC_MSG_CHECKING([whether $CC supports -std=c++0x without Language Defect 757])
3562     save_CXXFLAGS=$CXXFLAGS
3563     CXXFLAGS="$CXXFLAGS -std=c++0x"
3564     AC_LANG_PUSH([C++])
3566     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3567 #include <stddef.h>
3569 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
3571 namespace
3573         struct b
3574         {
3575                 int i;
3576                 int j;
3577         };
3579 ]], [[
3580 struct a
3582         int i;
3583         int j;
3585 a thinga[]={{0,0}, {1,1}};
3586 b thingb[]={{0,0}, {1,1}};
3587 size_t i = sizeof(sal_n_array_size(thinga));
3588 size_t j = sizeof(sal_n_array_size(thingb));
3589 return !(i != 0 && j != 0);
3590 ]])],[HAVE_CXX0X=TRUE],[])
3592     AC_LANG_POP([C++])
3593     CXXFLAGS=$save_CXXFLAGS
3594     if test "$HAVE_CXX0X" = "TRUE"; then
3595         AC_MSG_RESULT([yes])
3596     else
3597         AC_MSG_RESULT([no])
3598     fi
3601 AC_SUBST(HAVE_CXX0X)
3602 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
3603 AC_SUBST(HAVE_GCC_AVX)
3605 dnl ===================================================================
3606 dnl system stl sanity tests
3607 dnl ===================================================================
3608 HAVE_GCC_VISIBILITY_BROKEN=
3609 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) ; then
3611     AC_LANG_PUSH([C++])
3613     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3614         AC_MSG_CHECKING([if STL headers are visibility safe])
3615         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
3616         AC_MSG_RESULT([$stlvisok])
3617         if test "$stlvisok" = "no"; then
3618             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
3619             echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
3620             unset HAVE_GCC_VISIBILITY_FEATURE
3621         fi
3622     fi
3624     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3625         sharedlink_ldflags_save=$LDFLAGS
3626         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
3628         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
3629         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3630 #include <sstream>
3631 using namespace std;
3632             ]], [[
3633 istringstream strm( "test" ); return 0;
3634             ]])],[$EGREP -q  unresolvable conftest.err;
3635             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
3636         ])
3637         AC_MSG_RESULT([$gccvisok])
3638         if test "$gccvisok" = "no"; then
3639             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
3640             echo "Your gcc is not -fvisibility-inlines-hidden safe, disabling that." >> warn
3641             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
3642         fi
3644         LDFLAGS=$sharedlink_ldflags_save
3645     fi
3647     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3648         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
3649         cat >visibility.cxx <<_ACEOF
3650 #pragma GCC visibility push(hidden)
3651 struct __attribute__ ((visibility ("default"))) TestStruct {
3652   static void Init();
3654 __attribute__ ((visibility ("default"))) void TestFunc() {
3655   TestStruct::Init();
3657 _ACEOF
3658         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
3659             gccvisbroken=yes
3660         else
3661             case "$host_cpu" in
3662             i?86|x86_64)
3663                 if test "$_os" = "Darwin"; then
3664                     gccvisbroken=no
3665                 else
3666                     if $EGREP -q '@PLT' visibility.s; then
3667                         gccvisbroken=no
3668                     else
3669                         gccvisbroken=yes
3670                     fi
3671                 fi
3672                 ;;
3673             *)
3674                 gccvisbroken=no
3675                 ;;
3676             esac
3677         fi
3678         rm -f visibility.s visibility.cxx
3680         AC_MSG_RESULT([$gccvisbroken])
3681         if test "$gccvisbroken" = "yes"; then
3682             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
3683             echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
3684             unset HAVE_GCC_VISIBILITY_FEATURE
3685         fi
3686     fi
3688     AC_LANG_POP([C++])
3691 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3692 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
3694 dnl ===================================================================
3695 dnl allocator
3696 dnl ===================================================================
3697 AC_MSG_CHECKING([which memory allocator to use])
3698 if test "$with_alloc" = "system"; then
3699     AC_MSG_RESULT([system])
3700     ALLOC="SYS_ALLOC";
3701     AC_CHECK_FUNCS([malloc realloc calloc free])
3703 if test "$with_alloc" = "tcmalloc"; then
3704     AC_MSG_RESULT(tcmalloc)
3705     if ! echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3706         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3707     fi
3708     AC_CHECK_LIB(tcmalloc, malloc, [],
3709         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3710     ALLOC="TCMALLOC";
3712 if test "$with_alloc" = "jemalloc"; then
3713     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3714         AC_MSG_RESULT(jemalloc)
3715         save_CFLAGS=$CFLAGS
3716         CFLAGS="$CFLAGS -pthread"
3717         AC_CHECK_LIB(jemalloc, malloc, [],
3718             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3719         ALLOC="JEMALLOC";
3720         CFLAGS=$save_CFLAGS
3721     else
3722         AC_MSG_RESULT([system])
3723         ALLOC="SYS_ALLOC";
3724         AC_CHECK_FUNCS([malloc realloc calloc free])
3725     fi
3727 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3728     AC_MSG_RESULT([internal])
3730 AC_SUBST(ALLOC)
3732 dnl ===================================================================
3733 dnl Custom build version
3734 dnl ===================================================================
3736 AC_MSG_CHECKING([whether to add custom build version])
3737 if test "z$with_build_version" != "z"; then
3738     BUILD_VER_STRING=$with_build_version
3739     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3740 else
3741     BUILD_VER_STRING=
3742     AC_MSG_RESULT([no])
3744 AC_SUBST(BUILD_VER_STRING)
3746 dnl ===================================================================
3747 dnl Java support enable
3748 dnl ===================================================================
3749 AC_MSG_CHECKING([whether to build with Java support])
3750 if test "$with_java" != "no"; then
3751     AC_MSG_RESULT([yes])
3752     SOLAR_JAVA="TRUE"
3753 else
3754     AC_MSG_RESULT([no])
3755     SOLAR_JAVA=""
3758 AC_SUBST(SOLAR_JAVA)
3760 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
3761 dnl want there to be *run-time* (and build-time) support for Java extensions in the
3762 dnl built LibreOffice.
3763 dnl SOLAR_JAVA="BUILD" indicate build-time only support (no runtime support)
3764 dnl SOLAR_JAVA="" indicate no java support at all
3766 if test "$_os" = "Linux" && test "$host_cpu" = "powerpc"; then
3767     # IBMs JDK needs this...
3768     JITC_PROCESSOR_TYPE=6
3769     export JITC_PROCESSOR_TYPE
3771 AC_SUBST([JITC_PROCESSOR_TYPE])
3773 if test $_os = "WINNT"; then
3774     WITH_VC_REDIST="TRUE"
3776 AC_SUBST(WITH_VC_REDIST)
3778 dnl ===================================================================
3779 dnl Checks for Java
3780 dnl ===================================================================
3781 if test "$SOLAR_JAVA" != ""; then
3783     # Windows-specific tests
3784     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3785         if test "$CL_X64" != ""; then
3786             bitness="64-bit"
3787             otherbitness="32-bit"
3788         else
3789             bitness="32-bit"
3790             otherbitness="64-bit"
3791         fi
3793         if test -z "$with_jdk_home"; then
3795             # Unfortunately apparently no way to find, if needed, the 64-bit
3796             # JDK in the Registry from the 32-bit Perl oowintool
3798             _jdk_home=`./oowintool --jdk-home`
3799             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
3800                 with_jdk_home="$_jdk_home"
3801                 howfound="found by oowintool"
3802             else
3803                 AC_MSG_ERROR([No JDK found by oowintool, pass the --with-jdk-home option pointing to a $bitness JDK])
3804             fi
3805         else
3806             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
3807             howfound="you passed"
3808         fi
3809     fi
3811     JAVA_HOME=; export JAVA_HOME
3812     if test -z "$with_jdk_home"; then
3813         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
3814     else
3815         _java_path="$with_jdk_home/bin/$with_java"
3816         dnl Check if there is a Java interpreter at all.
3817         if test -x "$_java_path"; then
3818             JAVAINTERPRETER=$_java_path
3819         else
3820             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
3821         fi
3822     fi
3824     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3825         # Check that the JDK found is correct architecture
3826         # Why is this necessary, we don't link with any library from the JDK I think,
3828         shortjdkhome=`cygpath -d "$with_jdk_home"`
3829         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
3830             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
3831             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
3832         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
3833             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
3834             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
3835         fi
3837         if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
3838             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3839         fi
3840         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3841         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3842     elif test "$_os" = "Darwin"; then
3843         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
3844         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
3845         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
3846         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
3847         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
3848             AC_MSG_RESULT([yes])
3849             JAVAIFLAGS=-d32
3850         else
3851             AC_MSG_RESULT([no])
3852         fi
3853     fi
3856 dnl ===================================================================
3857 dnl Checks for JDK.
3858 dnl ===================================================================
3859 if test "$SOLAR_JAVA" != ""; then
3860     _gij_longver=0
3861     AC_MSG_CHECKING([the installed JDK])
3862     if test -n "$JAVAINTERPRETER"; then
3863         dnl java -version sends output to stderr!
3864         if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3865             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3866         elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
3867             JDK=gcj
3868             AC_MSG_RESULT([checked (gcj)])
3869             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
3870             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3872         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "BEA"` -gt 0; then
3873             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3874         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | grep -c "IBM"` -gt 0; then
3875             JDK=ibm
3877             dnl IBM JDK specific tests
3878             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3879             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3881             if test "$_jdk_ver" -lt 10500; then
3882                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
3883             fi
3885             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
3887             if test "$with_jdk_home" = ""; then
3888                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
3889 you must use the "--with-jdk-home" configure option explicitly])
3890             fi
3892            JAVA_HOME=$with_jdk_home
3894         else
3895             JDK=sun
3897             dnl Sun JDK specific tests
3898             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3899             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3901             if test "$_jdk_ver" -lt 10500; then
3902                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
3903             fi
3904             AC_MSG_RESULT([checked (JDK $_jdk)])
3905             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3906             if test "$_os" = "WINNT"; then
3907                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3908             fi
3909         fi
3910     else
3911         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
3912     fi
3913 else
3914     dnl Java disabled
3915     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
3918 _java_target_ver="1.5"
3919 dnl ===================================================================
3920 dnl Check for target Java bytecode version
3921 dnl ===================================================================
3922 if test "$SOLAR_JAVA" != ""; then
3923     AC_MSG_CHECKING([for target Java bytecode version])
3924     if test "$JDK" = "gcj" -o "$JDK" = "kaffe"; then
3925     AC_MSG_RESULT([default by $JDK])
3926     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
3927         AC_MSG_WARN([Value defined by --with-java-target-version is ignored!])
3928     fi
3929     else
3930     if test -n "$with_java_target_version" -a "$with_java_target_version" != "no" ; then
3931         _java_target_ver="$with_java_target_version"
3932         AC_MSG_RESULT([$_java_target_ver])
3933     elif test $_jdk_ver -gt 10000 ; then
3934         _java_target_ver=`echo "$_jdk_ver" | $AWK '{ maj=substr($0,1,1); min=substr($0,2,2); print int(maj)"."int(min) }'`
3935         AC_MSG_RESULT([$_java_target_ver])
3936     else
3937         AC_MSG_ERROR([Unable to guess Java bytecode version from Java version!])
3938     fi
3939     fi
3941     if ! test -z "$_java_target_ver" -o \
3942         "$_java_target_ver" = "1.1" -o \
3943             "$_java_target_ver" = "1.2" -o \
3944         "$_java_target_ver" = "1.3" -o \
3945         "$_java_target_ver" = "1.4" -o \
3946         "$_java_target_ver" = "1.5" -o \
3947         "$_java_target_ver" = "1.6" -o \
3948         "$_java_target_ver" = "5" ; then
3949         AC_MSG_ERROR([$_java_target_ver is not a supported Java bytecode version!])
3950     fi
3952     JAVA_SOURCE_VER="$_java_target_ver"
3953     JAVA_TARGET_VER="$_java_target_ver"
3956 dnl ===================================================================
3957 dnl Checks for javac
3958 dnl ===================================================================
3959 if test "$SOLAR_JAVA" != ""; then
3960     if test "$JDK" = "gcj"; then
3961         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
3962     else
3963         javacompiler="javac"
3964     fi
3965     if test -z "$with_jdk_home"; then
3966         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
3967     else
3968         _javac_path="$with_jdk_home/bin/$javacompiler"
3969         dnl Check if there is a Java compiler at all.
3970         if test -x "$_javac_path"; then
3971             JAVACOMPILER=$_javac_path
3972         fi
3973     fi
3974     if test -z "$JAVACOMPILER"; then
3975         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
3976     fi
3977     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
3978         if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
3979             JAVACOMPILER="${JAVACOMPILER}.exe"
3980         fi
3981         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
3982         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
3983     fi
3985     if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
3986         AC_MSG_CHECKING([re-checking JDK])
3987         JDK=gcj
3988         AC_MSG_RESULT([checked (ecj)])
3989         #TODO: what's to do here? some switch to do 1.5 compiling?
3990         JAVAFLAGS="-source 1.5 -target 1.5"
3991         _gij_longver="40200"
3992     fi
3995 JAVACISGCJ=""
3996 dnl ===================================================================
3997 dnl Checks that javac is gcj
3998 dnl ===================================================================
3999 if test "$SOLAR_JAVA" != ""; then
4000     if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
4001         JAVACISGCJ="yes"
4002     fi
4004 AC_SUBST(JAVACISGCJ)
4006 JAVACISKAFFE=""
4007 dnl ===================================================================
4008 dnl Checks that javac is kaffe
4009 dnl ===================================================================
4010 if test "$SOLAR_JAVA" != ""; then
4011     if test `$JAVACOMPILER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
4012         JAVACISKAFFE="yes"
4013     fi
4015 AC_SUBST(JAVACISKAFFE)
4017 dnl ===================================================================
4018 dnl Checks for javadoc
4019 dnl ===================================================================
4020 if test "$SOLAR_JAVA" != ""; then
4021     if test -z "$with_jdk_home"; then
4022         AC_PATH_PROG(JAVADOC, javadoc)
4023     else
4024         _javadoc_path="$with_jdk_home/bin/javadoc"
4025         dnl Check if there is a javadoc at all.
4026         if test -x "$_javadoc_path"; then
4027             JAVADOC=$_javadoc_path
4028         else
4029             AC_PATH_PROG(JAVADOC, javadoc)
4030         fi
4031     fi
4032     if test -z "$JAVADOC"; then
4033         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
4034     fi
4035     if test "$build_os" = "cygwin" -a "$_os" = "WINNT"; then
4036         if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
4037             JAVADOC="${JAVADOC}.exe"
4038         fi
4039         JAVADOC=`cygpath -d "$JAVADOC"`
4040         JAVADOC=`cygpath -u "$JAVADOC"`
4041     fi
4044 if test "$SOLAR_JAVA" != ""; then
4045     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
4046     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
4047         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
4048            # try to recover first by looking whether we have a alternatives
4049            # system as in Debian or newer SuSEs where following /usr/bin/javac
4050            # over /etc/alternatives/javac leads to the right bindir where we
4051            # just need to strip a bit away to get a valid JAVA_HOME
4052            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
4053         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
4054             # maybe only one level of symlink (e.g. on Mac)
4055             JAVA_HOME=$(readlink $JAVACOMPILER)
4056             if test "$(dirname $JAVA_HOME)" = "."; then
4057                 # we've got no path to trim back
4058                 JAVA_HOME=""
4059             fi
4060         else
4061             # else warn
4062             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
4063             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
4064             echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
4065             echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
4066         fi
4067         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
4068         if test "$JAVA_HOME" != "/usr"; then
4069             if test "$_os" = "Darwin"; then
4070                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
4071                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
4072                 dnl Tiger already returns a JDK path..
4073                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
4074             else
4075                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
4076             fi
4077         fi
4078     fi
4079     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
4081     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
4082     if test -z "$JAVA_HOME"; then
4083         if test "x$with_jdk_home" = "x"; then
4084             cat > findhome.java <<_ACEOF
4085 [import java.io.File;
4087 class findhome
4089     public static void main(String args[])
4090     {
4091         String jrelocation = System.getProperty("java.home");
4092         File jre = new File(jrelocation);
4093         System.out.println(jre.getParent());
4094     }
4096 _ACEOF
4097             AC_MSG_CHECKING([if javac works])
4098             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
4099             AC_TRY_EVAL(javac_cmd)
4100             if test $? = 0 && test -f ./findhome.class ; then
4101                 AC_MSG_RESULT([javac works])
4102             else
4103                 echo "configure: javac test failed" >&5
4104                 cat findhome.java >&5
4105                 AC_MSG_ERROR([javac does not work - java projects will not build!])
4106             fi
4107             AC_MSG_CHECKING([if gij knows its java.home])
4108             JAVA_HOME=`$JAVAINTERPRETER findhome`
4109             if test $? = 0 && test "$JAVA_HOME" != "" ; then
4110                 AC_MSG_RESULT([$JAVA_HOME])
4111             else
4112                 echo "configure: java test failed" >&5
4113                 cat findhome.java >&5
4114                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
4115             fi
4116             # clean-up after ourselves
4117             rm -f ./findhome.java ./findhome.class
4118         else
4119             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
4120         fi
4121     fi
4123     dnl second sanity check JAVA_HOME if possible
4124     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
4125         # now check if $JAVA_HOME is really valid
4126         if test "$_os" = "Darwin"; then
4127             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
4128                 JAVA_HOME_OK="NO"
4129             fi
4130         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
4131             JAVA_HOME_OK="NO"
4132         fi
4133         if test "$JAVA_HOME_OK" = "NO"; then
4134             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
4135             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
4136             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
4137             echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
4138             echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
4139             echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
4140         fi
4141     fi
4144 AWTLIB=
4146 if test "$SOLAR_JAVA" != ""; then
4147     AC_MSG_CHECKING([for jawt lib name])
4148     if test "$JDK" = "gcj"; then
4149         save_CFLAGS=$CFLAGS
4150         save_LDFLAGS=$LDFLAGS
4151         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4152         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
4153         exec 6>/dev/null # no output
4154         AC_CHECK_HEADER(jni.h, [],
4155                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
4156         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
4157         exec 6>&1 # output on again
4158         CFLAGS=$save_CFLAGS
4159         LDFLAGS=$save_LDFLAGS
4160     fi
4161     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
4162     # A workaround is to link also against libpmawt.so
4163     if test "$JDK" = "ibm" ; then
4164         save_CFLAGS=$CFLAGS
4165         save_LDFLAGS=$LDFLAGS
4166         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
4167         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
4168         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
4169         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
4170         export LD_LIBRARY_PATH
4171         exec 6>/dev/null # no output
4172         AC_CHECK_HEADER(jni.h, [],
4173                     [AC_MSG_ERROR([jni.h could not be found.])], [])
4174         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
4175         if test -z "$AWTLIB"; then
4176             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
4177             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
4178         fi
4179         exec 6>&1 # output on again
4180         CFLAGS=$save_CFLAGS
4181         LDFLAGS=$save_LDFLAGS
4182         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
4183     fi
4184     if test -z "$AWTLIB"; then
4185         AWTLIB=-ljawt
4186     fi
4187     AC_MSG_RESULT([$AWTLIB])
4188     AC_SUBST(AWTLIB)
4191 AC_SUBST(JAVA_HOME)
4192 AC_SUBST(JDK)
4193 AC_SUBST(JAVAFLAGS)
4194 AC_SUBST(JAVA_SOURCE_VER)
4195 AC_SUBST(JAVA_TARGET_VER)
4196 AC_SUBST(JAVAINTERPRETER)
4197 AC_SUBST(JAVAIFLAGS)
4198 AC_SUBST(JAVACOMPILER)
4199 AC_SUBST(JAVADOC)
4201 dnl ===================================================================
4202 dnl Checks for specific files.
4203 dnl ===================================================================
4205 dnl ===================================================================
4206 dnl Checks for programs.
4207 dnl ===================================================================
4209 dnl ===================================================================
4210 dnl Check whether we already have dmake
4211 dnl ===================================================================
4212 AC_PATH_PROG(DMAKE, dmake, no)
4213 if test "$DMAKE" = "no"; then
4214     BUILD_DMAKE=YES
4215     echo "dmake will be built on ./bootstrap"
4216 else
4217     AC_MSG_CHECKING([whether the found dmake is the right dmake])
4218     # we need to find out whether that dmake we found is "our" dmake
4219     # or the dmake from Sun's SunStudio Compiler which is something
4220     # different
4221     # This test _should_ work because the one accepts -V (ours) and one
4222     # (the other) not...
4223     $DMAKE -V 2>/dev/null | grep 'dmake .* Version .*' >/dev/null
4224     if test $? -eq 0; then
4225         BUILD_DMAKE=NO
4226         AC_MSG_RESULT([yes])
4227         AC_MSG_CHECKING([the dmake version])
4228         DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
4229         if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
4230             AC_MSG_RESULT([OK, >= 4.11])
4231         elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
4232             test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
4233             AC_MSG_RESULT([OK, >= 4.11])
4234         else
4235             AC_MSG_RESULT([too old. >= 4.11 is needed])
4236             echo "A newer dmake will be built on ./bootstrap"
4237             BUILD_DMAKE=YES
4238         fi
4239     else
4240         AC_MSG_RESULT([no])
4241         echo "dmake will be built on ./bootstrap"
4242         BUILD_DMAKE=YES
4243     fi
4245 AC_SUBST(BUILD_DMAKE)
4247 AC_MSG_CHECKING([whether to enable EPM for packing])
4248 BUILD_EPM=NO
4249 if test "$enable_epm" = "yes"; then
4250     AC_MSG_RESULT([yes])
4251     dnl ===================================================================
4252     dnl Check for epm - not needed for Windows
4253     dnl ===================================================================
4254     if test "$_os" != "WINNT"; then
4255         if test -n "$with_epm"; then
4256             EPM=$with_epm
4257         else
4258             AC_PATH_PROG(EPM, epm, no)
4259         fi
4260         if test "$EPM" = "no" || test "$EPM" = "internal"; then
4261             echo "EPM will be built."
4262             BUILD_EPM=YES
4263             BUILD_TYPE="$BUILD_TYPE EPM"
4264         else
4265             # Gentoo has some epm which is something different...
4266             AC_MSG_CHECKING([whether the found epm is the right epm])
4267             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
4268                 AC_MSG_RESULT([yes])
4269             else
4270                 AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
4271             fi
4272             AC_MSG_CHECKING([epm version])
4273             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
4274             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
4275                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
4276                 AC_MSG_RESULT([OK, >= 3.7])
4277                 BUILD_EPM=NO
4278                 if test "$_os" = "Darwin"; then
4279                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
4280                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
4281                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4282                         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)])
4283                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
4284                         AC_MSG_RESULT([$_pm, ok])
4285                     else # we never should get here, but go safe
4286                         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)])
4287                     fi
4288                 fi
4289             else
4290                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
4291                 echo "EPM will be built."
4292                 BUILD_EPM=YES
4293                 BUILD_TYPE="$BUILD_TYPE EPM"
4294             fi
4295         fi
4296     fi
4298     # test which package format to use
4299     AC_MSG_CHECKING([which package format to use])
4301     # defaults
4302     case "$_os" in
4303     Darwin)
4304         PKGFORMAT=dmg
4305         ;;
4306     SunOS)
4307         PKGFORMAT=pkg
4308         ;;
4309     Linux)
4310         # if building on Debian, default should be deb...
4311         if test -e /etc/debian_version; then
4312             PKGFORMAT=deb
4313         else
4314             PKGFORMAT=rpm
4315         fi
4316         ;;
4317     AIX)
4318         PKGFORMAT=rpm
4319         ;;
4320     OpenBSD|DragonFly)
4321         PKGFORMAT=portable
4322         ;;
4323     *BSD)
4324         PKGFORMAT=bsd
4325         ;;
4326     WINNT)
4327         PKGFORMAT=msi
4328         ;;
4329     # we never should get here since we check the arciecture/os at the beginning,
4330     # but go sure...
4331     *)
4332         AC_MSG_ERROR([unknown system])
4333     esac
4334     if test -n "$with_package_format"; then
4335         for i in $with_package_format; do
4336             case "$i" in
4337             aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4338                 ;;
4339             *)
4340                 AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4341 aix - AIX software distribution
4342 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4343 depot or swinstall - HP-UX software distribution
4344 deb - Debian software distribution
4345 inst or tardist - IRIX software distribution
4346 osx - MacOS X software distribution
4347 pkg - Solaris software distribution
4348 rpm - RedHat software distribution
4349 setld - Tru64 (setld) software distribution
4350 native - "Native" software distribution for the platform
4351 portable - Portable software distribution
4352 LibreOffice additionally supports:
4353 archive - .tar.gz or .zip
4354 dmg - Mac OS X .dmg
4355 installed - installation tree
4356 msi - Windows .msi
4357             ])
4358                 ;;
4359             esac
4360         done
4361         PKGFORMAT="$with_package_format"
4362     fi
4363     AC_MSG_RESULT([$PKGFORMAT])
4364     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
4365         AC_MSG_CHECKING([for rpm])
4366         for a in "$RPM" rpmbuild rpm; do
4367             $a --usage >/dev/null 2> /dev/null
4368             if test $? -eq 0; then
4369                 RPM=$a
4370                 break
4371             else
4372                 $a --version >/dev/null 2> /dev/null
4373                 if test $? -eq 0; then
4374                     RPM=$a
4375                     break
4376                 fi
4377             fi
4378         done
4379         if test -z "$RPM" ; then
4380             AC_MSG_ERROR([not found])
4381         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
4382             RPM_PATH=`which $RPM`
4383             AC_MSG_RESULT([$RPM_PATH])
4384         else
4385             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
4386         fi
4387     fi
4388     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
4389         AC_PATH_PROG(DPKG, dpkg, no)
4390         if test "$DPKG" = "no"; then
4391             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
4392         fi
4393     fi
4394     if echo "PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
4395         if test "$_os" = "Darwin"; then
4396             AC_MSG_CHECKING([for PackageMaker availability])
4397             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
4398                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
4399             else
4400                 AC_MSG_RESULT([ok])
4401             fi
4402         else
4403             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
4404         fi
4405     fi
4406     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
4407        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4408         if test "$EPM" != "no" && test "$EPM" != "internal"; then
4409             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
4410                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
4411                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
4412                     AC_MSG_RESULT([yes])
4413                 else
4414                     AC_MSG_RESULT([no])
4415                     if echo "$PKGFORMAT" | grep -q rpm; then
4416                         _pt="rpm"
4417                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
4418                         echo "the rpms will need to be installed with --nodeps" >> warn
4419                     else
4420                         _pt="pkg"
4421                     fi
4422                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
4423                     echo "the ${_pt}s will not be relocateable" >> warn
4424                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
4425                                  relocation will work, you need to patch your epm with the
4426                                  patch in epm/epm-3.7.patch or build with
4427                                  --with-epm=internal which will build a suitable epm])
4428                 fi
4429             fi
4430         fi
4431     fi
4432     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4433         AC_PATH_PROG(PKGMK, pkgmk, no)
4434         if test "$PKGMK" = "no"; then
4435             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
4436         fi
4437     fi
4438     AC_SUBST(RPM)
4439     AC_SUBST(DPKG)
4440     AC_SUBST(PKGMK)
4441 else
4442     AC_MSG_RESULT([no])
4443     EPM=NO
4444     PKGFORMAT=native
4446 AC_SUBST(EPM)
4447 AC_SUBST(BUILD_EPM)
4448 AC_SUBST(PKGFORMAT)
4450 dnl ===================================================================
4451 dnl Check for gperf
4452 dnl ===================================================================
4453 AC_PATH_PROG(GPERF, gperf)
4454 if test -z "$GPERF"; then
4455     AC_MSG_ERROR([gperf not found but needed. Install it.])
4457 AC_MSG_CHECKING([gperf version])
4458 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
4459     AC_MSG_RESULT([OK])
4460 else
4461     AC_MSG_ERROR([too old, you need at least 3.0.0])
4463 AC_SUBST(GPERF)
4465 dnl ===================================================================
4466 dnl Check for building stax
4467 dnl ===================================================================
4468 AC_MSG_CHECKING([whether to build the stax])
4469 if test "$with_system_saxon" = "no" -a "$with_system_jars" = "no" -a "$SOLAR_JAVA" != ""; then
4470     if test -f "./stax/download/jsr173_1.0_api.jar"; then
4471         BUILD_STAX=NO
4472         AC_MSG_RESULT([no, will use the prebuilt stax/download/jsr173_1.0_api.jar])
4473     else
4474         BUILD_STAX=YES
4475         AC_MSG_RESULT([yes])
4476     fi
4478 AC_SUBST(BUILD_STAX)
4480 dnl ===================================================================
4481 dnl Check for building ODK
4482 dnl ===================================================================
4483 AC_MSG_CHECKING([whether to build the ODK])
4484 if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
4485     AC_MSG_RESULT([yes])
4487     if test "$with_java" != "no"; then
4488         AC_MSG_CHECKING([whether to build unowinreg.dll])
4489         if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
4490             # build on Win by default
4491             enable_build_unowinreg=yes
4492         fi
4493         if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
4494             AC_MSG_RESULT([no])
4495             BUILD_UNOWINREG=NO
4496         else
4497             AC_MSG_RESULT([yes])
4498             BUILD_UNOWINREG=YES
4499         fi
4500         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
4501             if test -z "$with_mingw_cross_compiler"; then
4502                 dnl Guess...
4503                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
4504             elif test -x "$with_mingw_cross_compiler"; then
4505                  MINGWCXX="$with_mingw_cross_compiler"
4506             else
4507                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
4508             fi
4510             if test "$MINGWCXX" = "false"; then
4511                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
4512             fi
4514             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
4515             if test -x "$mingwstrip_test"; then
4516                 MINGWSTRIP="$mingwstrip_test"
4517             else
4518                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
4519             fi
4521             if test "$MINGWSTRIP" = "false"; then
4522                 AC_MSG_ERROR(MinGW32 binutils not found.)
4523             fi
4524         fi
4525     fi
4526     BUILD_TYPE="$BUILD_TYPE ODK"
4527 else
4528     AC_MSG_RESULT([no])
4529     BUILD_UNOWINREG=NO
4531 AC_SUBST(BUILD_UNOWINREG)
4532 AC_SUBST(MINGWCXX)
4533 AC_SUBST(MINGWSTRIP)
4535 dnl ===================================================================
4536 dnl Check for system stdlibs
4537 dnl ===================================================================
4538 AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
4539 if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
4540     test "$with_system_stdlibs" != "no"; then
4541     AC_MSG_RESULT([no])
4542     SYSTEM_STDLIBS=YES
4543 else
4544     AC_MSG_RESULT([yes])
4545     SYSTEM_STDLIBS=NO
4547 AC_SUBST(SYSTEM_STDLIBS)
4549 dnl ===================================================================
4550 dnl Check for system zlib
4551 dnl ===================================================================
4552 AC_MSG_CHECKING([which zlib to use])
4553 if test -n "$with_system_zlib" -o -n "$with_system_libs" -o \
4554         "$_os" != "WINNT" && \
4555     test "$with_system_zlib" != "no"; then
4556     AC_MSG_RESULT([external])
4557     SYSTEM_ZLIB=YES
4558     AC_CHECK_HEADER(zlib.h, [],
4559         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
4560     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
4561         [AC_MSG_ERROR(zlib not found or functional)], [])
4562 else
4563     AC_MSG_RESULT([internal])
4564     SYSTEM_ZLIB=NO
4565     BUILD_TYPE="$BUILD_TYPE ZLIB"
4567 AC_SUBST(SYSTEM_ZLIB)
4569 dnl ===================================================================
4570 dnl Check for system jpeg
4571 dnl ===================================================================
4572 AC_MSG_CHECKING([which jpeg to use])
4573 if test -n "$with_system_jpeg" -o -n "$with_system_libs" -o \
4574         "$_os" = "Linux" && \
4575     test "$with_system_jpeg" != "no"; then
4576     AC_MSG_RESULT([external])
4577     SYSTEM_JPEG=YES
4578     AC_CHECK_HEADER(jpeglib.h, [],
4579         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
4580     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
4581     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
4582 else
4583     AC_MSG_RESULT([internal])
4584     SYSTEM_JPEG=NO
4585     BUILD_TYPE="$BUILD_TYPE JPEG"
4587 AC_SUBST(SYSTEM_JPEG)
4589 dnl ===================================================================
4590 dnl Check for system expat
4591 dnl ===================================================================
4592 AC_MSG_CHECKING([which expat to use])
4593 if test -n "$with_system_expat" -o -n "$with_system_libs" && \
4594     test "$with_system_expat" != "no"; then
4595     AC_MSG_RESULT([external])
4596     SYSTEM_EXPAT=YES
4597     AC_CHECK_HEADER(expat.h, [],
4598         [AC_MSG_ERROR(expat.h not found. install expat)], [])
4599     AC_CHECK_LIB(expat, XML_ParserCreate, [],
4600     [AC_MSG_RESULT(expat library not found or functional.)], [])
4601     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libexpat-1.dll"
4602 else
4603     AC_MSG_RESULT([internal])
4604     SYSTEM_EXPAT=NO
4605     BUILD_TYPE="$BUILD_TYPE EXPAT"
4607 AC_SUBST(SYSTEM_EXPAT)
4609 dnl ===================================================================
4610 dnl Check for system libvisio
4611 dnl ===================================================================
4612 AC_MSG_CHECKING([which libvisio to use])
4613 if test -n "$with_system_libvisio" -a "$with_system_libvisio" = "yes"; then
4614     AC_MSG_RESULT([external])
4615     SYSTEM_LIBVISIO=YES
4616     PKG_CHECK_MODULES( LIBVISIO, libvisio-0.0 )
4617 else
4618     AC_MSG_RESULT([internal])
4619     SYSTEM_LIBVISIO=NO
4620     BUILD_TYPE="$BUILD_TYPE LIBVISIO"
4622 AC_SUBST(SYSTEM_LIBVISIO)
4623 AC_SUBST(LIBVISIO_CFLAGS)
4624 AC_SUBST(LIBVISIO_LIBS)
4626 dnl ===================================================================
4627 dnl Check for system libcmis
4628 dnl ===================================================================
4629 if test "x$with_cmis" != "xno" ; then
4630     AC_MSG_CHECKING([which libcmis to use])
4631     if test -n "$with_system_libcmis" -o -n "$with_system_libs" && \
4632             test "$with_system_libcmis" != "no"; then
4633         AC_MSG_RESULT([external])
4634         SYSTEM_LIBCMIS=YES
4635         PKG_CHECK_MODULES( LIBCMIS, libcmis-0.2 )
4636     else
4637         AC_MSG_RESULT([internal])
4638         SYSTEM_LIBCMIS=NO
4639         BUILD_TYPE="$BUILD_TYPE LIBCMIS"
4640     fi
4641     AC_SUBST(SYSTEM_LIBCMIS)
4642     AC_SUBST(LIBCMIS_CFLAGS)
4643     AC_SUBST(LIBCMIS_LIBS)
4647 dnl ===================================================================
4648 dnl Check for system libwpd
4649 dnl ===================================================================
4650 AC_MSG_CHECKING([which libwpd to use])
4651 if test -n "$with_system_libwpd" -o -n "$with_system_libs" && \
4652         test "$with_system_libwpd" != "no"; then
4653     AC_MSG_RESULT([external])
4654     SYSTEM_LIBWPD=YES
4655     PKG_CHECK_MODULES( LIBWPD, libwpd-0.9 libwpd-stream-0.9 )
4656 else
4657     AC_MSG_RESULT([internal])
4658     SYSTEM_LIBWPD=NO
4659     BUILD_TYPE="$BUILD_TYPE LIBWPD"
4661 AC_SUBST(SYSTEM_LIBWPD)
4662 AC_SUBST(LIBWPD_CFLAGS)
4663 AC_SUBST(LIBWPD_LIBS)
4665 dnl ===================================================================
4666 dnl Check for system cppunit
4667 dnl ===================================================================
4668 AC_MSG_CHECKING([which cppunit to use])
4669 if test -n "$with_system_cppunit" -o -n "$with_system_libs" && \
4670         test "$with_system_cppunit" != "no"; then
4671     AC_MSG_RESULT([external])
4672     SYSTEM_CPPUNIT=YES
4673     # might work for earlier, too but go sure:
4674     PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
4675 else
4676     AC_MSG_RESULT([internal])
4677     SYSTEM_CPPUNIT=NO
4678     BUILD_TYPE="$BUILD_TYPE CPPUNIT"
4680 AC_SUBST(SYSTEM_CPPUNIT)
4681 AC_SUBST(CPPUNIT_CFLAGS)
4682 AC_SUBST(CPPUNIT_LIBS)
4684 dnl ===================================================================
4685 dnl Check whether freetype is available
4686 dnl ===================================================================
4687 if test  "$test_freetype" = "yes"; then
4688     AC_MSG_CHECKING([whether freetype is available])
4689     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
4691 AC_SUBST(FREETYPE_CFLAGS)
4692 AC_SUBST(FREETYPE_LIBS)
4694 dnl ===================================================================
4695 dnl Check for system libwps
4696 dnl ===================================================================
4697 AC_MSG_CHECKING([which libwps to use])
4698 if test -n "$with_system_libwps" -o -n "$with_system_libs" && \
4699         test "$with_system_libwps" != "no"; then
4700     AC_MSG_RESULT([external])
4701     SYSTEM_LIBWPS=YES
4702     PKG_CHECK_MODULES( LIBWPS, libwps-0.2 )
4703 else
4704     AC_MSG_RESULT([internal])
4705     SYSTEM_LIBWPS=NO
4706     BUILD_TYPE="$BUILD_TYPE LIBWPS"
4708 AC_SUBST(SYSTEM_LIBWPS)
4709 AC_SUBST(LIBWPS_CFLAGS)
4710 AC_SUBST(LIBWPS_LIBS)
4712 dnl ===================================================================
4713 dnl Check for system libwpg
4714 dnl ===================================================================
4715 AC_MSG_CHECKING([which libwpg to use])
4716 if test -n "$with_system_libwpg" -o -n "$with_system_libs" && \
4717         test "$with_system_libwpg" != "no"; then
4718     AC_MSG_RESULT([external])
4719     SYSTEM_LIBWPG=YES
4720     PKG_CHECK_MODULES( LIBWPG, libwpg-0.2 )
4721 else
4722     AC_MSG_RESULT([internal])
4723     SYSTEM_LIBWPG=NO
4724     BUILD_TYPE="$BUILD_TYPE LIBWPG"
4726 AC_SUBST(SYSTEM_LIBWPG)
4727 AC_SUBST(LIBWPG_CFLAGS)
4728 AC_SUBST(LIBWPG_LIBS)
4730 dnl ===================================================================
4731 dnl Check whether freetype2 supports emboldening
4732 dnl ===================================================================
4733 if test  "$test_freetype" = "yes"; then
4734     save_CPPFLAGS="$CPPFLAGS"
4735     save_LDFLAGS="$LDFLAGS"
4736     save_LIBS="$LIBS"
4737     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
4738     LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
4739     AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
4740                  [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4741     LDFLAGS="$save_LDFLAGS"
4742     CPPFLAGS="$save_CPPFLAGS"
4743     LIBS="$save_LIBS"
4745 AC_SUBST(USE_FT_EMBOLDEN)
4747 if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
4748        test "$with_system_libxslt" != "no"; then
4749     if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
4750            test "$with_system_libxml" = "no"; then
4751         # somehow AC_MSG_WARN won't work...
4752         echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
4753         echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
4754         with_system_libxml=yes
4755     fi
4757 if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
4758        test "$with_system_libxml" != "no"; then
4759     if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
4760            test "$with_system_libxslt" = "no"; then
4761         # somehow AC_MSG_WARN won't work...
4762         echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
4763         echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
4764         with_system_libxslt=yes
4765     fi
4768 # ===================================================================
4769 # Check for system libxslt
4770 # ===================================================================
4771 AC_MSG_CHECKING([which libxslt to use])
4772 if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
4773        "$_os" = "Darwin" && \
4774        test "$with_system_libxslt" != "no"; then
4775     AC_MSG_RESULT([external])
4776     SYSTEM_LIBXSLT=YES
4777     if test "$_os" = "Darwin"; then
4778         dnl make sure to use SDK path
4779         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4780         dnl omit -L/usr/lib
4781         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
4782     else
4783         PKG_CHECK_MODULES(LIBXSLT, libxslt)
4784     fi
4786     dnl Check for xsltproc
4787     AC_PATH_PROG(XSLTPROC, xsltproc, no)
4788     if test "$XSLTPROC" = "no"; then
4789         AC_MSG_ERROR([xsltproc is required])
4790     fi
4792     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libxslt-1.dll"
4793 else
4794     AC_MSG_RESULT([internal])
4795     SYSTEM_LIBXSLT=NO
4796     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4798     if test "$cross_compiling" = "yes"; then
4799         AC_PATH_PROG(XSLTPROC, xsltproc, no)
4800         if test "$XSLTPROC" = "no"; then
4801             AC_MSG_ERROR([xsltproc is required])
4802         fi
4803     fi
4805 AC_SUBST(SYSTEM_LIBXSLT)
4806 AC_SUBST(LIBXSLT_CFLAGS)
4807 AC_SUBST(LIBXSLT_LIBS)
4808 AC_SUBST(XSLTPROC)
4810 # ===================================================================
4811 # Check for system libxml
4812 # ===================================================================
4813 AC_MSG_CHECKING([which libxml to use])
4814 if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
4815             "$_os" = "Darwin" -o $_os = iOS && \
4816         test "$with_system_libxml" != "no"; then
4817     AC_MSG_RESULT([external])
4818     SYSTEM_LIBXML=YES
4819     if test "$_os" = "Darwin"; then
4820         dnl make sure to use SDK path
4821         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
4822         dnl omit -L/usr/lib
4823         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
4824     elif test $_os = iOS; then
4825         dnl make sure to use SDK path
4826         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
4827         LIBXML_CFLAGS="-I$usr/include/libxml2"
4828         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
4829     else
4830         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4831     fi
4832     BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
4833     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS zlib1.dll libxml2-2.dll"
4834 else
4835     AC_MSG_RESULT([internal])
4836     SYSTEM_LIBXML=NO
4837     BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
4839 AC_SUBST(SYSTEM_LIBXML)
4840 AC_SUBST(LIBXML_CFLAGS)
4841 AC_SUBST(LIBXML_LIBS)
4843 dnl ===================================================================
4844 dnl Checks for Python
4845 dnl ===================================================================
4847 AC_MSG_CHECKING([which Python to use])
4849 case "$enable_python" in
4850 no|disable)
4851     enable_python=no
4852     AC_MSG_RESULT([none])
4853     DISABLE_PYTHON=TRUE
4854     ;;
4855 ""|yes|auto)
4856     if test $build_os = cygwin; then
4857         dnl When building on Windows we don't attempt to use any installed
4858         dnl "system"  Python.
4859         dnl
4860         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
4861         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
4862         dnl MinGW cross-compilation setups.)
4863         AC_MSG_RESULT([internal])
4864         enable_python=internal
4865     elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4866         AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4867         enable_python=internal
4868     else
4869         AC_MSG_RESULT([checking below])
4870         enable_python=auto
4871     fi
4872     ;;
4873 internal)
4874     AC_MSG_RESULT([internal])
4875     ;;
4876 system)
4877     if test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
4878         AC_MSG_ERROR([Cannot use "system" Python, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
4879     fi
4880     AC_MSG_RESULT([system])
4881     ;;
4883     AC_MSG_ERROR([Incorrect --enable-python option])
4884     ;;
4885 esac
4887 AC_SUBST(DISABLE_PYTHON)
4889 if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then
4890     AC_MSG_ERROR([Must use internal Python when building with MSVC])
4893 if test $enable_python != no; then
4894     BUILD_TYPE="$BUILD_TYPE PYUNO"
4897 if test "$cross_compiling" = yes; then
4898     if test $enable_python = auto; then
4899         enable_python=system
4900     fi
4901 else
4902     if test $enable_python = system; then
4903         # This causes an error if no python command is found
4904         # Note that this takes the system python called just "python",
4905         # which isn't actually what we want on MacOSX when building
4906         # against the 10.6 SDK. But that shouldn't matter, we
4907         # select the correct python command manually below anyway.
4908         AM_PATH_PYTHON([2.6])
4909     elif test $enable_python = auto; then
4910         dnl This allows lack of system Python
4911         AM_PATH_PYTHON([2.6],, [:])
4913         if test "$PYTHON" = :; then
4914             enable_python=internal
4915         else
4916             enable_python=system
4917         fi
4918     fi
4921 if test $enable_python = system; then
4922     if test $_os = Darwin; then
4923         # We already have logic above to make sure the system Python
4924         # is used only when building against SDK 10.6 or newer.
4926         # Make sure we use the 2.6 Python when building against the
4927         # 10.6 SDK.
4928         case $with_macosx_sdk in
4929         10.6)
4930             python_version=2.6;;
4931         10.7)
4932             python_version=2.7;;
4933         *)
4934             # ???
4935             python_version=2.7;;
4936         esac
4937         PYTHON=python$python_version
4939         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
4940         PYTHON_LIBS="-framework Python"
4941     fi
4942     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
4943         # Fallback: Accept these in the environment, or as set above
4944         # for MacOSX.
4945         :
4946     elif test "$cross_compiling" != yes; then
4947         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
4948         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4949         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
4950         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
4951         if $PKG_CONFIG --exists python-$python_version; then
4952             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
4953             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version`"
4954         else
4955             PYTHON_CFLAGS="-I$python_include"
4956             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
4957         fi
4958     elif test "$cross_compiling" = yes; then
4959         dnl How to find out the cross-compilation Python installation path?
4960         dnl Let's hardocode what we know for different distributions for now...
4962         for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw ; do
4963             for python_version in 2.6 ; do
4964                 if test -f ${python_sysroot}/include/python${python_version}/Python.h; then
4965                     PYTHON_CFLAGS="-I ${python_sysroot}/include/python$python_version"
4966                     PYTHON_LIBS="-L ${python_sysroot}lib -lpython$python_version $python_libs"
4967                     break
4968                 fi
4969             done
4970             test -n "$PYTHON_CFLAGS" && break
4971         done
4972     fi
4975 dnl By now enable_python should be "system", "internal" or "no"
4976 case $enable_python in
4977 system)
4978     SYSTEM_PYTHON=YES
4980     dnl Check if the headers really work
4981     save_CPPFLAGS="$CPPFLAGS"
4982     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4983     AC_CHECK_HEADER(Python.h, [],
4984        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
4985        [])
4986     CPPFLAGS="$save_CPPFLAGS"
4988     dnl FIXME Check if the Python library can be linked with, too?
4989     ;;
4991 internal)
4992     SYSTEM_PYTHON=NO
4993     BUILD_TYPE="$BUILD_TYPE PYTHON"
4994     # Embedded Python dies without Home set
4995     if test "z$HOME" = "z"; then
4996         export HOME="";
4997     fi
4998     # bz2 tarball and bzip2 is not standard
4999     if test -z "$BZIP2"; then
5000         AC_PATH_PROG( BZIP2, bzip2)
5001         if test -z "$BZIP2"; then
5002             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
5003         fi
5004     fi
5005     ;;
5007     SYSTEM_PYTHON=NO
5008     ;;
5010     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
5011     ;;
5012 esac
5014 AC_SUBST(SYSTEM_PYTHON)
5015 AC_SUBST(PYTHON_CFLAGS)
5016 AC_SUBST(PYTHON_LIBS)
5018 dnl ===================================================================
5019 dnl Check for system translate-toolkit
5020 dnl ===================================================================
5021 AC_MSG_CHECKING([which translate-toolkit to use])
5022 if test "$with_system_translate_toolkit" = "yes" ; then
5023     AC_MSG_RESULT([system])
5024     SYSTEM_TRANSLATE_TOOLKIT=YES
5026     AC_PATH_PROGS(OO2PO, oo2po)
5027     if test -z "$OO2PO"; then
5028         AC_MSG_ERROR([install translate-toolkit or use --without-system-translate-toolkit])
5029     fi
5031     AC_PATH_PROGS(PO2OO, po2oo)
5032     if test -z "$PO2OO"; then
5033         AC_MSG_ERROR([install translate-toolkit or use --without-system-translate-toolkit])
5034     fi
5036     $PO2OO --help | grep -q '\-\-skipsource'
5037     if test $? -ne 0 ;  then
5038         AC_MSG_ERROR([$PO2OO does not support --skipsource; use translate-toolkit >= 1.9 or use --without-system-translate-toolkit])
5039     fi
5040 else
5041     AC_MSG_RESULT([internal])
5042     SYSTEM_TRANSLATE_TOOLKIT=NO
5043     BUILD_TYPE="$BUILD_TYPE TRANSLATE_TOOLKIT"
5045 AC_SUBST(SYSTEM_TRANSLATE_TOOLKIT)
5047 dnl ===================================================================
5048 dnl Check for system Berkeley db
5049 dnl ===================================================================
5050 AC_MSG_CHECKING([which db to use])
5051 if test -n "$with_system_db" -o -n "$with_system_libs" && \
5052     test "$with_system_db" != "no"; then
5053     SYSTEM_DB=YES
5054     AC_MSG_RESULT([external])
5056     db_header=
5057     for dbver in 5.1 5.0 5 4.8 4.7 4; do
5058         for dash in - ''; do
5059             AC_CHECK_HEADER([db$dash$dbver/db.h],
5060                 [ db_header="db$dash$dbver/db.h"; break 2 ])
5061         done
5062     done
5064     if test -z "$db_header"; then
5065         AC_CHECK_HEADER([db/db.h], [db_header='db/db.h'; dbver=''])
5066     fi
5068     if test -z "$db_header"; then
5069        AC_CHECK_HEADER(db.h, [ db_header='db.h'; dbver='' ])
5070     fi
5072     if test -z "$db_header"; then
5073         AC_MSG_ERROR([db.h not found. Use the correct -I flag, or install the Berkeley db development package.])
5074     fi
5076     AC_MSG_CHECKING([whether db is at least 4.1])
5077     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])])
5079     SYSTEM_DB_CFLAGS="-DSYSTEM_DB_HEADER='<$db_header>'"
5081     DB_LIB=
5082     dnl At least on OpenBSD dbver is not appended to the library
5083     if test "$_os" = "OpenBSD"; then
5084         dbver=''
5085     fi
5086     for dash in - ''; do
5087         AC_CHECK_LIB(db$dash$dbver, dbopen,
5088             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5089         AC_CHECK_LIB(db$dash$dbver, __db185_open,
5090             [ DB_LIB="db$dash$dbver"; DB_CPPLIB="db_cxx$dash$dbver"; break ])
5091     done
5093     if test -z "$DB_LIB" ; then
5094         AC_MSG_ERROR([db library not found. Use the correct -L flag,
5095 or install the Berkeley db development package.])
5096     fi
5098     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
5099     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libdb-4.8.dll"
5100 else
5101     AC_MSG_RESULT([internal])
5102     SYSTEM_DB=NO
5103     BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
5105 AC_SUBST(SYSTEM_DB)
5106 AC_SUBST(SYSTEM_DB_CFLAGS)
5107 AC_SUBST(DB_LIB)
5108 AC_SUBST(DB_CPPLIB)
5110 dnl ===================================================================
5111 dnl Check for system lucene
5112 dnl ===================================================================
5113 if test "$with_java" != "no"; then
5114 AC_MSG_CHECKING([which lucene to use])
5115 if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
5116         test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
5117     AC_MSG_RESULT([external])
5118     SYSTEM_LUCENE=YES
5119     if test -z $LUCENE_CORE_JAR; then
5120          AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
5121             [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
5122             [
5123               AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
5124                 [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
5125                 [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
5126                    [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
5127                    [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
5128                   )
5129                 ]
5130               )
5131             ]
5132          )
5133     else
5134         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5135                [AC_MSG_ERROR(lucene-core.jar not found.)], [])
5136     fi
5138     if test -z $LUCENE_ANALYZERS_JAR; then
5139         AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
5140             [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
5141             [
5142               AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
5143                 [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
5144                 [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
5145               )
5146             ]
5147         )
5148     else
5149         AC_CHECK_FILE($LUCENE_CORE_JAR, [],
5150                [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
5151     fi
5152     AC_MSG_CHECKING([whether lucene is version 2.x])
5153     export LUCENE_CORE_JAR
5154     if $PERL -e 'use Archive::Zip;
5155             my $file = "$ENV{'LUCENE_CORE_JAR'}";
5156             my $zip = Archive::Zip->new( $file );
5157             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5158             if ( $mf =~ m/Specification-Version: 2.*/ ) {
5159                 exit 0;
5160             } else {
5161                 exit 1;
5162             }'; then
5163         AC_MSG_RESULT([yes])
5164     else
5165         AC_MSG_ERROR([no, you need lucene 2])
5166     fi
5168 else
5169     AC_MSG_RESULT([internal])
5170     SYSTEM_LUCENE=NO
5171     BUILD_TYPE="$BUILD_TYPE LUCENE"
5174 AC_SUBST(SYSTEM_LUCENE)
5175 AC_SUBST(LUCENE_CORE_JAR)
5176 AC_SUBST(LUCENE_ANALYZERS_JAR)
5178 AC_MSG_CHECKING([whether to build the MySQL Connector extension])
5179 if test "x$enable_ext_mysql_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
5180     AC_MSG_RESULT([yes])
5181     ENABLE_MYSQLC=YES
5182     BUILD_TYPE="$BUILD_TYPE MYSQLC"
5183 else
5184     AC_MSG_RESULT([no])
5185     ENABLE_MYSQLC=NO
5187 AC_SUBST(ENABLE_MYSQLC)
5189 if test "$ENABLE_MYSQLC" = "YES"; then
5191     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MYSQLC"
5193     dnl ===================================================================
5194     dnl Check for system MySQL
5195     dnl ===================================================================
5196     AC_MSG_CHECKING([for mysql pre-requisites])
5197     if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
5198            test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
5199         AC_MSG_RESULT([external MySQL])
5200         SYSTEM_MYSQL=YES
5201         AC_PATH_PROG( MYSQLCONFIG, mysql_config)
5202         AC_MSG_CHECKING([MySQL version])
5203         MYSQL_VERSION=`$MYSQLCONFIG --version`
5204         MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
5205         if test "$MYSQL_MAJOR" -ge "5"; then
5206             AC_MSG_RESULT([OK])
5207         else
5208             AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
5209         fi
5210         AC_MSG_CHECKING([for MySQL Client library])
5211         MYSQL_INC=`$MYSQLCONFIG --include`
5212         MYSQL_LIB=`$MYSQLCONFIG --libs`
5213         MYSQL_DEFINES=`$MYSQLCONFIG --cflags | $SED -e s,$MYSQL_INC,,`
5214         AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
5215     else
5216         SYSTEM_MYSQL=NO
5217         if test -n "$with_libmysql_path"; then
5218             AC_MSG_RESULT([external Connector/C (libmysql)])
5219             LIBMYSQL=libmysql.so
5220             if test "$_os" = "Darwin"; then
5221                 LIBMYSQL=libmysql.dylib
5222             elif test "$_os" = "WINNT"; then
5223                 LIBMYSQL=libmysql.dll
5224             fi
5225             AC_MSG_CHECKING([for $LIBMYSQL])
5226             if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
5227                 AC_MSG_RESULT([found.])
5228                 LIBMYSQL_PATH=$with_libmysql_path
5229             else
5230                 AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
5231             fi
5232         else
5233             AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
5234         fi
5235     fi
5236     AC_SUBST(SYSTEM_MYSQL)
5237     AC_SUBST(MYSQL_INC)
5238     AC_SUBST(MYSQL_LIB)
5239     AC_SUBST(MYSQL_DEFINES)
5240     AC_SUBST(LIBMYSQL_PATH)
5242     AC_LANG_PUSH([C++])
5243     dnl ===================================================================
5244     dnl Check for system MySQL C++ Connector
5245     dnl ===================================================================
5246     # FIXME!
5247     # who thought this too-generic cppconn dir was a good idea?
5248     AC_MSG_CHECKING([MySQL Connector/C++])
5249     if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
5250             test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
5251         AC_MSG_RESULT([external])
5252         SYSTEM_MYSQL_CPPCONN=YES
5253         AC_LANG_PUSH([C++])
5254         AC_CHECK_HEADER(mysql_driver.h, [],
5255                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
5256         AC_CHECK_LIB(mysqlcppconn, main, [],
5257                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
5258         AC_MSG_CHECKING([version])
5259         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5260 #include <mysql_driver.h>
5262 int main(int argc, char **argv) {
5263     sql::Driver *driver;
5264     driver = get_driver_instance();
5265     if (driver->getMajorVersion() > 1 || \
5266        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
5267        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
5268         return 0;
5269       else
5270         return 1;
5272       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
5274         AC_LANG_POP([C++])
5276     else
5277         AC_MSG_RESULT([internal])
5278         AC_MSG_CHECKING([for mysqlcppconn module])
5279         if test -d mysqlcppconn; then
5280             AC_MSG_RESULT([OK])
5281         else
5282             AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
5283         fi
5284         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
5285         SYSTEM_MYSQL_CPPCONN=NO
5286     fi
5287     AC_LANG_POP([C++])
5288     AC_SUBST(SYSTEM_MYSQL_CPPCONN)
5291 dnl ===================================================================
5292 dnl Check for system hsqldb
5293 dnl ===================================================================
5294 if test "$with_java" != "no"; then
5295 AC_MSG_CHECKING([which hsqldb to use])
5296 if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
5297        test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
5298     AC_MSG_RESULT([external])
5299     SYSTEM_HSQLDB=YES
5300     if test -z $HSQLDB_JAR; then
5301         HSQLDB_JAR=/usr/share/java/hsqldb.jar
5302     fi
5303     AC_CHECK_FILE($HSQLDB_JAR, [],
5304                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
5305     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
5306     export HSQLDB_JAR
5307     if $PERL -e 'use Archive::Zip;
5308             my $file = "$ENV{'HSQLDB_JAR'}";
5309             my $zip = Archive::Zip->new( $file );
5310             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
5311             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
5312                push @l, split(/\n/, $mf);
5313                foreach my $line (@l) {
5314                   if ($line =~ m/Specification-Version:/) {
5315                       ($t, $version) = split (/:/,$line);
5316                       $version =~ s/^\s//;
5317                       ($a, $b, $c, $d) = split (/\./,$version);
5318                       if ($c == "0" && $d > "8")  {
5319                           exit 0;
5320                       } else {
5321                           exit 1;
5322                       }
5323                   }
5324                }
5325             } else {
5326                 exit 1;
5327             }'; then
5328         AC_MSG_RESULT([yes])
5329     else
5330         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
5331     fi
5332 else
5333     AC_MSG_RESULT([internal])
5334     SYSTEM_HSQLDB=NO
5335     BUILD_TYPE="$BUILD_TYPE HSQLDB"
5337 AC_SUBST(SYSTEM_HSQLDB)
5338 AC_SUBST(HSQLDB_JAR)
5341 dnl ===================================================================
5342 dnl Check for system beanshell
5343 dnl ===================================================================
5344 if test "$with_java" != "no"; then
5345 AC_MSG_CHECKING([which beanshell to use])
5346 if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
5347        test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
5348     AC_MSG_RESULT([external])
5349     SYSTEM_BSH=YES
5350     if test -z $BSH_JAR; then
5351         BSH_JAR=/usr/share/java/bsh.jar
5352     fi
5353     AC_CHECK_FILE($BSH_JAR, [],
5354                [AC_MSG_ERROR(bsh.jar not found.)], [])
5355 else
5356     AC_MSG_RESULT([internal])
5357     SYSTEM_BSH=NO
5358     BUILD_TYPE="$BUILD_TYPE BSH"
5361 AC_SUBST(SYSTEM_BSH)
5362 AC_SUBST(BSH_JAR)
5365 dnl ===================================================================
5366 dnl Check for system saxon
5367 dnl ===================================================================
5368 if test "$with_java" != "no"; then
5369 AC_MSG_CHECKING([which saxon to use])
5370 if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
5371        test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
5372     AC_MSG_RESULT([external])
5373     SYSTEM_SAXON=YES
5374     if test -z $SAXON_JAR; then
5375         AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5376             [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5377             [
5378               AC_CHECK_FILE(/usr/share/java/saxon.jar,
5379                 [ SAXON_JAR=/usr/share/java/saxon.jar ],
5380                 [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5381                     [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5382                     [ AC_MSG_ERROR(saxon.jar replacement not found)]
5383                   )
5384                 ]
5385               )
5386             ]
5387           )
5388     else
5389         AC_CHECK_FILE($SAXON_JAR, [],
5390                [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
5391     fi
5392     if test -n "$SERIALIZER_JAR"; then
5393         AC_CHECK_FILE($SERIALIZER_JAR, [],
5394                [AC_MSG_ERROR(serializer.jar not found.)], [])
5395         AC_SUBST(SERIALIZER_JAR)
5396     fi
5398     dnl Saxon comes in two practically available versions, the out-of-date saxonb which
5399     dnl supports the Java extensions that LibreOffice uses, and the up-to-date saxon he
5400     dnl "home edition" version, which is crippled to not support those Java extensions.
5401     dnl And as an aside the he one also needs to be tweaked to include
5402     dnl a META-INF/services to broadcast that it supports the jaxp transform factory
5404     AC_MSG_CHECKING([if saxon works])
5405     cat > saxontest.java <<_ACEOF
5406 [import javax.xml.transform.TransformerFactory;
5407 import javax.xml.transform.Transformer;
5408 import javax.xml.transform.stream.StreamSource;
5409 import java.io.*;
5411 import net.sf.saxon.FeatureKeys;
5413 class saxontest {
5414     public static void main(String[] args) {
5415       System.setProperty("javax.xml.transform.TransformerFactory",
5416         "net.sf.saxon.TransformerFactoryImpl");
5417       try {
5418         TransformerFactory tfactory = TransformerFactory.newInstance();
5419     // some external saxons (Debian, Ubuntu, ...) have this disabled
5420     // per default
5421     tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
5422         System.out.println("TransformerFactory is" +
5423           tfactory.getClass().getName());
5424         Transformer transformer = tfactory.newTransformer(
5425           new StreamSource(new File(args[0])));
5426       } catch(Exception e){
5427         e.printStackTrace(System.err);
5428         System.exit(-1);
5429       }
5430       System.exit(0);
5431     }
5434 _ACEOF
5436     cat > saxontest.xsl<<_ACEOF
5437 [<?xml version="1.0" encoding="UTF-8"?>
5438 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5439  <xsl:template match="/">
5440   <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
5441  </xsl:template>
5442 </xsl:stylesheet>
5444 _ACEOF
5446     javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
5447     AC_TRY_EVAL(javac_cmd)
5448     if test $? = 0 && test -f ./saxontest.class ; then
5449         java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
5450         AC_TRY_EVAL(java_cmd)
5451         if test $? = 0; then
5452             AC_MSG_RESULT([yes])
5453         else
5454             cat saxontest.java >&5
5455             AC_MSG_RESULT([no])
5456             AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
5457         fi
5458     else
5459         AC_MSG_RESULT([no])
5460         cat saxontest.java >&5
5461         AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
5462     fi
5463 else
5464     AC_MSG_RESULT([internal])
5465     SYSTEM_SAXON=NO
5466     NEED_SAXON=TRUE
5469 AC_SUBST(SYSTEM_SAXON)
5470 AC_SUBST(SAXON_JAR)
5472 if test -n "$NEED_SAXON"; then
5473     BUILD_TYPE="$BUILD_TYPE SAXON"
5476 dnl ===================================================================
5477 dnl Check for system curl
5478 dnl ===================================================================
5479 if test "$_os" = "Darwin" -a "$with_system_curl" != "no"; then
5480     with_system_curl=yes
5482 AC_MSG_CHECKING([which libcurl to use])
5483 if test -n "$with_system_curl" -o -n "$with_system_libs" && \
5484     test "$with_system_curl" != "no"; then
5485     AC_MSG_RESULT([external])
5486     SYSTEM_CURL=YES
5488     curl_version=""
5489     if test "$cross_compiling" = "yes"; then
5490         dnl At least the OBS mingw32-libcurl-devel package
5491         dnl comes with a proper .pc file
5492         PKG_CHECK_MODULES(CURL, libcurl,, [:])
5493         if test -n "$CURL_PKG_ERRORS"; then
5494             AC_MSG_RESULT([no])
5495         else
5496             curl_version=`$PKG_CONFIG --modversion libcurl`
5497         fi
5498     fi
5499     if test -z "$curl_version"; then
5500         AC_PATH_PROG(CURLCONFIG, curl-config)
5501         if test -z "$CURLCONFIG"; then
5502             AC_MSG_ERROR([install the libcurl development package])
5503         fi
5504         CURL_LIBS=`$CURLCONFIG --libs`
5505         CURL_CFLAGS=`$CURLCONFIG --cflags`
5506         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
5507     fi
5509     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
5511     case $curl_version in
5512     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
5513     dnl so they need to be doubled to end up in the configure script
5514     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
5515         AC_MSG_RESULT([yes, you have $curl_version])
5516         ;;
5517     *)
5518         AC_MSG_ERROR([no, you have $curl_version])
5519         ;;
5520     esac
5522     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libintl-8.dll libidn-11.dll libnspr4.dll nssutil3.dll libplc4.dll libplds4.dll nss3.dll ssl3.dll libgpg-error-0.dll libgcrypt-11.dll libssh2-1.dll libcurl-4.dll"
5523 else
5524     AC_MSG_RESULT([internal])
5525     SYSTEM_CURL=NO
5526     BUILD_TYPE="$BUILD_TYPE CURL"
5528 AC_SUBST(SYSTEM_CURL)
5529 AC_SUBST(CURL_CFLAGS)
5530 AC_SUBST(CURL_LIBS)
5532 dnl ===================================================================
5533 dnl Check for system boost
5534 dnl ===================================================================
5535 AC_MSG_CHECKING([which boost to use])
5536 if test -n "$with_system_boost" -o -n "$with_system_headers" && \
5537         test "$with_system_boost" != "no"; then
5538     AC_MSG_RESULT([external])
5539     SYSTEM_BOOST=YES
5540     AC_LANG_PUSH([C++])
5541     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
5542        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
5543     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
5544        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
5545     AC_CHECK_HEADER(boost/function.hpp, [],
5546        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
5547     AC_CHECK_HEADER([boost/unordered_map.hpp], [HAVE_BOOST_UNORDERED_MAP=TRUE],
5548                    [AC_MSG_WARN([boost/unordered_map.hpp not found])], [])
5550     save_CXXFLAGS=$CXXFLAGS
5551     CXXFLAGS="$CXXFLAGS -fno-exceptions"
5552     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
5553     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
5554 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
5556     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
5557         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
5558     else
5559         AC_MSG_RESULT([yes])
5560     fi
5561     CXXFLAGS=$save_CXXFLAGS
5562     AC_LANG_POP([C++])
5563 else
5564     AC_MSG_RESULT([internal])
5565     BUILD_TYPE="$BUILD_TYPE BOOST"
5566     SYSTEM_BOOST=NO
5567     HAVE_BOOST_UNORDERED_MAP=TRUE
5569 AC_SUBST([HAVE_BOOST_UNORDERED_MAP])
5570 AC_SUBST(SYSTEM_BOOST)
5572 dnl ===================================================================
5573 dnl Check for system mdds
5574 dnl ===================================================================
5575 AC_MSG_CHECKING([which mdds to use])
5576 if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
5577         test "$with_system_mdds" != "no"; then
5578     AC_MSG_RESULT([external])
5579     SYSTEM_MDDS=YES
5581     dnl ===================================================================
5582     dnl Determine which hash container mdds shall use
5583     dnl ===================================================================
5584     AC_MSG_CHECKING([which hash container mdds shall use])
5585     if test "x$HAVE_CXX0X" = "xTRUE"; then
5586         MDDS_CPPFLAGS="-std=c++0x"
5587         AC_MSG_RESULT([std::unordered_map])
5588     else
5589         MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5590         AC_MSG_RESULT([boost::unordered_map])
5591     fi
5593     AC_LANG_PUSH([C++])
5594     save_CPPFLAGS="$CPPFLAGS"
5595     CPPFLAGS="$CPPFLAGS $MDDS_CPPFLAGS"
5596     AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
5597         [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
5598     AC_CHECK_HEADER(mdds/mixed_type_matrix.hpp, [],
5599         [AC_MSG_ERROR(mdds/mixed_type_matrix.hpp not found. install mdds >= 0.4.0)], [])
5600     CPPFLAGS="$save_CPPFLAGS"
5601     save_CXXFLAGS="$CXXFLAGS"
5602     CXXFLAGS="$CXXFLAGS $MDDS_CPPFLAGS"
5603     AC_MSG_CHECKING([for correct signature of ::mdds::flat_segment_tree])
5604     AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <mdds/flat_segment_tree.hpp>
5606     int main(int argc, char **argv) {
5607         ::mdds::flat_segment_tree<long, short> db(0, 100, 0);
5608         short val;
5609         if (!db.search(5, val).second)
5610             return 1;
5611         return 0;
5612     }
5613 ]])],[ac_cv_cxx_mdds_flat_segment_tree_correct=yes],[ac_cv_cxx_mdds_flat_segment_tree_correct=no],[])
5615     if test "$ac_cv_cxx_mdds_flat_segment_tree_correct" = "yes"; then
5616         AC_MSG_RESULT([yes])
5617     else
5618         AC_MSG_ERROR([no, install mdds >= 0.5.0])
5619     fi
5620     CXXFLAGS=$save_CXXFLAGS
5621     AC_LANG_POP([C++])
5622 else
5623     AC_MSG_RESULT([internal])
5624     BUILD_TYPE="$BUILD_TYPE MDDS"
5625     SYSTEM_MDDS=NO
5627     dnl ===================================================================
5628     dnl Determine which hash container mdds shall use
5629     dnl ===================================================================
5630     AC_MSG_CHECKING([which hash container mdds shall use])
5631     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
5632     AC_MSG_RESULT([boost::unordered_map])
5634 AC_SUBST(SYSTEM_MDDS)
5635 AC_SUBST([MDDS_CPPFLAGS])
5637 dnl ===================================================================
5638 dnl Check for system vigra
5639 dnl ===================================================================
5640 AC_MSG_CHECKING([which vigra to use])
5641 if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
5642         test "$with_system_vigra" != "no"; then
5643     AC_MSG_RESULT([external])
5644     SYSTEM_VIGRA=YES
5645     AC_LANG_PUSH([C++])
5646     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
5647        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
5648     AC_LANG_POP([C++])
5649 else
5650     AC_MSG_RESULT([internal])
5651     BUILD_TYPE="$BUILD_TYPE VIGRA"
5652     SYSTEM_VIGRA=NO
5654 AC_SUBST(SYSTEM_VIGRA)
5656 dnl ===================================================================
5657 dnl Check for system odbc
5658 dnl ===================================================================
5659 AC_MSG_CHECKING([which odbc headers to use])
5660 if test -n "$with_system_odbc" -o -n "$with_system_headers" && \
5661         test "$with_system_odbc" != "no"; then
5662     AC_MSG_RESULT([external])
5663     SYSTEM_ODBC_HEADERS=YES
5665     AC_CHECK_HEADER(sqlext.h, [],
5666       [AC_MSG_ERROR(odbc not found. install odbc)], [])
5667 else
5668     AC_MSG_RESULT([internal])
5669     SYSTEM_ODBC_HEADERS=NO
5670     BUILD_TYPE="$BUILD_TYPE UNIXODBC"
5672 AC_SUBST(SYSTEM_ODBC_HEADERS)
5674 AC_MSG_CHECKING([whether to enable build of Mozilla/Mozilla NSS-using components])
5675 if test "$enable_mozilla" = "no"; then
5676     AC_MSG_RESULT([no])
5677     WITH_MOZILLA=NO
5678     ENABLE_NSS_MODULE=NO
5679 else
5680     AC_MSG_RESULT([yes])
5681     WITH_MOZILLA=YES
5683 AC_SUBST(WITH_MOZILLA)
5685 AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
5686 if test "$enable_mozilla" = "no"; then
5687     AC_MSG_RESULT([no])
5688 elif test "$with_system_mozilla" = "yes"; then
5689     AC_MSG_RESULT([no, not possible with system-mozilla])
5690 else
5691     AC_MSG_RESULT([yes])
5694 AC_MSG_CHECKING([whether to build XML Security support])
5695 if test "$enable_mozilla" = "no"; then
5696     AC_MSG_RESULT([no, since Mozilla (NSS) disabled but needed])
5697 else
5698     AC_MSG_RESULT([yes])
5701 AC_MSG_CHECKING([whether to build LDAP configuration backend])
5702 if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
5703     if test "$enable_mozilla" = "yes" || test "$with_openldap" = "yes"; then
5704         AC_MSG_RESULT([yes])
5705         WITH_LDAP=YES
5706     else
5707         AC_MSG_RESULT([no. Either Mozilla or OpenLDAP needed])
5708         WITH_LDAP=NO
5709     fi
5710 else
5711     AC_MSG_RESULT([no])
5712     WITH_LDAP=NO
5715 if test "$WITH_LDAP" = "YES"; then
5716     dnl ===================================================================
5717     dnl Test whether we want to use the Mozilla or the OpenLDAP LDAP SDK
5718     dnl ===================================================================
5719     AC_MSG_CHECKING([which LDAP SDK to use])
5720     if test -n "$with_openldap" && test "$with_openldap" != "no"; then
5721         AC_MSG_RESULT([OpenLDAP])
5722         WITH_OPENLDAP=YES
5723         AC_CHECK_HEADERS(ldap.h, [],
5724            [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
5725         AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
5726            [AC_MSG_ERROR(openldap lib not found or functional)], [])
5727         # rumours say that OpenLDAP doesn't have that function. I looked and
5728         # it has it. Test for it to be sure
5729         AC_CHECK_LIB(ldap, ldap_set_option, [],
5730                 [AC_MSG_ERROR(openldap lib not found or functional)], [])
5731     else
5732         AC_MSG_RESULT([Netscape/Mozilla])
5733         # TODO. Actually do a sanity check and check for
5734         # LDAP_OPT_SIZELIMIT and LDAP_X_OPT_CONNECT_TIMEOUT
5735         WITH_OPENLDAP=NO
5736     fi
5738 AC_SUBST(WITH_LDAP)
5739 AC_SUBST(WITH_OPENLDAP)
5741 dnl ===================================================================
5742 dnl Check for system mozilla
5743 dnl ===================================================================
5744 AC_MSG_CHECKING([which Mozilla to use])
5745 if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
5746     AC_MSG_RESULT([external])
5747     SYSTEM_MOZILLA=YES
5748     ENABLE_NSS_MODULE=NO
5749     enable_nss_module=no
5750     AC_MSG_CHECKING([which Mozilla flavour to use])
5751     if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
5752         MOZ_FLAVOUR=libxul
5753     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
5754         MOZ_FLAVOUR=xulrunner
5755     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
5756         MOZ_FLAVOUR=seamonkey
5757     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
5758         MOZ_FLAVOUR=firefox
5759     elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
5760         MOZ_FLAVOUR=mozilla
5761     else
5762         MOZ_FLAVOUR=libxul
5763     fi
5764     tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
5765     AC_MSG_RESULT($tmp)
5767     PKG_CHECK_MODULES( MOZ_NSS, nss, STANDALONENSS="TRUE", STANDALONENSS="" )
5768     if test -z "$STANDALONENSS"; then
5769         PKG_CHECK_MODULES( MOZ_NSS, $MOZ_FLAVOUR-nss )
5770     else
5771         NSS_LIB="-L`$PKG_CONFIG --variable=libdir nss`"
5772         AC_SUBST(NSS_LIB)
5773     fi
5775     if $PKG_CONFIG --exists nspr ; then
5776         PKG_CHECK_MODULES( MOZ_NSPR, nspr )
5777         NSPR_LIB="-L`$PKG_CONFIG --variable=libdir nspr`"
5778         AC_SUBST(NSPR_LIB)
5779     else
5780         PKG_CHECK_MODULES( MOZ_NSPR, $MOZ_FLAVOUR-nspr )
5781     fi
5783     if test "$MOZ_FLAVOUR" != "libxul"; then
5784         PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
5785         MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
5786         MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
5787     fi
5789     if test -z "$HASXPCOM"; then
5790         PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
5791         MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
5792         MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
5793         if ! test -e "$MOZ_LIB/libxul.so"; then
5794             MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
5795             if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
5796                 MOZ_LIB="$MOZ_LIB/sdk/lib"
5797             fi
5798         fi
5799     fi
5801     save_CPPFLAGS="$CPPFLAGS"
5802     save_LDFLAGS="$LDFLAGS"
5803     save_LIBS="$LIBS"
5804     CPPFLAGS="$CPPFLAGS $MOZ_NSS_CFLAGS"
5805     LDFLAGS="$LDFLAGS $MOZ_NSS_LIBS"
5806     AC_CHECK_LIB(nss3, PK11_GetCertFromPrivateKey, [],
5807       [AC_MSG_ERROR(PK11_GetCertFromPrivateKey missing but needed.
5808 See https://bugzilla.mozilla.org/show_bug.cgi?id=262274.
5809 Fixed since nss 3.9.3 (contained by e.g. mozilla >= 1.7.5))], [])
5810     LDFLAGS="$save_LDFLAGS"
5811     CPPFLAGS="$save_CPPFLAGS"
5812     LIBS="$save_LIBS"
5814     MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
5815     if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
5816         AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
5817         if test -d "$MOZ_INC/ldap"; then
5818             AC_MSG_RESULT([yes])
5819             MOZ_LDAP_CFLAGS="-I$MOZ_INC"
5820         else
5821             AC_MSG_ERROR([no.
5822 Could not find LDAP header include files in $MOZ_INC/ldap.
5823 Please recompile $tmp with --enable-ldap or use --with-openldap.])
5824         fi
5825     fi
5827     #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
5828     #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
5829     if test "$MOZ_FLAVOUR" = "libxul"; then
5830         MOZ_FLAVOUR="mozilla"
5831     fi
5833 elif test "$enable_mozilla" = "no"; then
5834     AC_MSG_RESULT([none])
5835     WITH_MOZILLA=NO
5836     ENABLE_NSS_MODULE=NO
5837     enable_nss_module=no
5838 else
5839     AC_MSG_RESULT([internal])
5840     SYSTEM_MOZILLA=NO
5841     BUILD_TYPE="$BUILD_TYPE MOZ"
5842 if test -z "$with_mozilla_version"; then
5843     MOZILLA_VERSION=
5844 else
5845     AC_MSG_CHECKING([which Mozilla version to build])
5846     MOZILLA_VERSION=$with_mozilla_version
5847     enable_build_mozilla=1
5848     AC_MSG_RESULT([$MOZILLA_VERSION])
5851 AC_SUBST(MOZILLA_VERSION)
5853 AC_MSG_CHECKING([for toolkit Mozilla should use])
5854 if test -z "$with_mozilla_toolkit"; then
5855     if test "$_os" != "WINNT" ; then
5856         if test "$_os" = "Darwin" ; then
5857             MOZILLA_TOOLKIT=mac
5858             AC_MSG_RESULT([mac])
5859         else
5860             MOZILLA_TOOLKIT=gtk2
5861             AC_MSG_RESULT([gtk2])
5862         fi
5863     fi
5864 else
5865     MOZILLA_TOOLKIT=$with_mozilla_toolkit
5866     enable_build_mozilla=1
5867     AC_MSG_RESULT([$MOZILLA_TOOLKIT])
5870 AC_SUBST(MOZILLA_TOOLKIT)
5872 # default to enabling build mozilla
5873 if test "$enable_build_mozilla" != "no"; then
5874     enable_build_mozilla=yes
5875 else
5876     enable_build_mozilla=
5879 AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
5880 if test -n "$enable_build_mozilla"; then
5881     BUILD_MOZAB="TRUE"
5882     AC_MSG_RESULT([yes])
5883 else
5884     BUILD_MOZAB=""
5885     AC_MSG_RESULT([no])
5888 AC_MSG_CHECKING([whether to build provided NSS module])
5889 if test "$enable_nss_module" != "no"; then
5890     ENABLE_NSS_MODULE="YES"
5891     BUILD_TYPE="$BUILD_TYPE NSS"
5892     AC_MSG_RESULT([yes])
5893     if test "$build_os" = "cygwin"; then
5894         AC_MSG_CHECKING([for Mozilla build tooling])
5895         if test -z "$MOZILLABUILD" ; then
5896             AC_MSG_ERROR([Mozilla build tooling not found.
5897 Use the --with-mozilla-build option after installing the tools obtained
5898 from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
5899         else
5900             if test \( "$WITH_MINGW" = "yes" \) ; then
5901                 if test ! -d "$MOZILLABUILD" ; then
5902                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
5903                 else
5904                     AC_MSG_RESULT([ok])
5905                 fi
5906             else
5907                 if test ! -d "$MOZILLABUILD/moztools" \
5908                         -o ! -d "$MOZILLABUILD/msys" ; then
5909                     AC_MSG_ERROR([Mozilla build tooling incomplete!])
5910                 else
5911                     AC_MSG_RESULT([ok])
5912                 fi
5913             fi
5914         fi
5915     fi
5916 else
5917     ENABLE_NSS_MODULE="NO"
5918     AC_MSG_RESULT([no])
5922 if test "$BUILD_MOZAB" = "TRUE"; then
5923     if test "$_os" = "WINNT"; then
5924         if test "$WITH_MINGW" != "yes"; then
5925             # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
5926             if test "$MSVSVER" != "2005"; then
5927                 AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio 2005 only.])
5928             fi
5929         else
5930             AC_MSG_WARN([Building SeaMonkey with MinGW is not tested, and likely to break.])
5931             echo "Building SeaMonkey with MinGW is not tested, and likely to break." >> warn
5932         fi
5933     fi
5935     if test -z "$MOZILLA_VERSION"; then
5936         MOZILLA_VERSION=1.1.14
5937     fi
5938     MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
5939     MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst.in`
5940     AC_MSG_CHECKING([for Mozilla sources])
5941     if test -z "$MOZILLA_FETCH_FILE"; then
5942         AC_MSG_RESULT([not found])
5943         HAVE_MOZILLA_TARBALL=n
5944     else
5945         AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
5946         if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
5947             if test -z "$DO_FETCH"; then
5948                 AC_MSG_RESULT([will be fetched])
5949                 HAVE_MOZILLA_TARBALL=y
5950             else
5951                 AC_MSG_RESULT([not found])
5952                 HAVE_MOZILLA_TARBALL=n
5953             fi
5954         else
5955             AC_MSG_RESULT([found])
5956             HAVE_MOZILLA_TARBALL=y
5957         fi
5958     fi
5959     if test "$HAVE_MOZILLA_TARBALL" != "y"; then
5960         AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
5961 Use "./download" to download.])
5962     fi
5963     if test "$_os" = "WINNT"; then
5964         AC_MSG_CHECKING([for moztools binaries])
5965         if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
5966             AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
5967 (from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
5968         else
5969             AC_MSG_RESULT([ok])
5970         fi
5971     elif test "$_os" = "Darwin"; then
5972         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
5973         if test -z "$MOZIDL"; then
5974             AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build Mozilla with Mac toolkit.])
5975         fi
5976     else
5977         # Generic Unix/Linux section
5978         if test "$MOZILLA_TOOLKIT" = "gtk2"; then
5979             PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
5980             if test -z "$MOZGTK"; then
5981                 AC_MSG_ERROR([GTK2 is needed to build Mozilla.])
5982             fi
5983             PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
5984             if test -z "$MOZIDL"; then
5985                 AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build Mozilla.])
5986             fi
5987         else
5988             PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
5989             if test -z "$MOZGTK"; then
5990                 AC_MSG_ERROR([GTK+ 1.2 is needed when not using GTK2 to build Mozilla.])
5991             fi
5992             PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
5993             if test -z "$MOZIDL"; then
5994                 AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build Mozilla.])
5995             fi
5996         fi
5997     fi
6000 AC_SUBST(BUILD_MOZAB)
6003 AC_SUBST(ENABLE_NSS_MODULE)
6004 AC_SUBST(MOZILLABUILD)
6005 AC_SUBST(SYSTEM_MOZILLA)
6006 AC_SUBST(MOZ_FLAVOUR)
6007 AC_SUBST(MOZ_INC)
6008 AC_SUBST(MOZ_LIB)
6009 AC_SUBST(MOZ_LIB_XPCOM)
6010 AC_SUBST(MOZ_NSPR_CFLAGS)
6011 AC_SUBST(MOZ_NSS_CFLAGS)
6012 AC_SUBST(MOZ_LDAP_CFLAGS)
6014 dnl ===================================================================
6015 dnl Check for system sane
6016 dnl ===================================================================
6017 AC_MSG_CHECKING([which sane header to use])
6018 if test -n "$with_system_sane" -o -n "$with_system_headers" && \
6019         test "$with_system_sane" != "no"; then
6020     AC_MSG_RESULT([external])
6021     SYSTEM_SANE_HEADER=YES
6022     AC_CHECK_HEADER(sane/sane.h, [],
6023       [AC_MSG_ERROR(sane not found. install sane)], [])
6024 else
6025     AC_MSG_RESULT([internal])
6026     SYSTEM_SANE_HEADER=NO
6027     BUILD_TYPE="$BUILD_TYPE SANE"
6029 AC_SUBST(SYSTEM_SANE_HEADER)
6031 dnl ===================================================================
6032 dnl Check for system icu
6033 dnl ===================================================================
6034 SYSTEM_GENBRK=
6035 SYSTEM_GENCCODE=
6036 SYSTEM_GENCMN=
6037 ICU_MAJOR=
6038 ICU_MINOR=
6039 ICU_MICRO=
6040 ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
6041 AC_MSG_CHECKING([which icu to use])
6042 if test -n "$with_system_icu" -o -n "$with_system_libs" && \
6043         test "$with_system_icu" != "no"; then
6044     AC_MSG_RESULT([external])
6045     SYSTEM_ICU=YES
6046     AC_LANG_PUSH([C++])
6047     AC_MSG_CHECKING([for unicode/rbbi.h])
6048     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
6049     AC_LANG_POP([C++])
6051     ICUPATH="$PATH"
6052     if test "$WITH_MINGW" = "yes" ; then
6053         ICUPATH="/usr/i686-w64-mingw32/sys-root/mingw/bin:$ICUPATH"
6054     fi
6055     AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
6057     AC_MSG_CHECKING([ICU version])
6058     ICU_VERSION=`$ICUCONFIG --noverify --version`
6059     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
6060     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
6061     ICU_MICRO=`echo $ICU_VERSION | cut -d"." -f3`
6063     if test "$ICU_MAJOR" -ge "4"; then
6064         AC_MSG_RESULT([OK, $ICU_VERSION])
6065     else
6066         AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
6067     fi
6069     if test "$cross_compiling" != "yes"; then
6070         # using the system icu tools can lead to version confusion, use the
6071         # ones from the build environment when cross-compiling
6072         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
6073         if test -z "$SYSTEM_GENBRK"; then
6074             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
6075         fi
6076         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6077         if test -z "$SYSTEM_GENCCODE"; then
6078             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
6079         fi
6080         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
6081         if test -z "$SYSTEM_GENCMN"; then
6082             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
6083         fi
6084         if test "$ICU_MAJOR" -ge "5" -o "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4"; then
6085             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6086         fi
6087     fi
6089     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS icui18n$ICU_MAJOR$ICU_MINOR.dll icuuc$ICU_MAJOR$ICU_MINOR.dll icudata$ICU_MAJOR$ICU_MINOR.dll"
6090 else
6091     AC_MSG_RESULT([internal])
6092     SYSTEM_ICU="NO"
6093     ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
6094     BUILD_TYPE="$BUILD_TYPE ICU"
6096 AC_SUBST(SYSTEM_ICU)
6097 AC_SUBST(SYSTEM_GENBRK)
6098 AC_SUBST(SYSTEM_GENCCODE)
6099 AC_SUBST(SYSTEM_GENCMN)
6100 AC_SUBST(ICU_MAJOR)
6101 AC_SUBST(ICU_MINOR)
6102 AC_SUBST(ICU_MICRO)
6103 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
6105 dnl ===================================================================
6106 dnl Graphite
6107 dnl ===================================================================
6109 AC_MSG_CHECKING([whether to enable graphite support])
6110 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
6111     AC_MSG_RESULT([yes])
6112     ENABLE_GRAPHITE="TRUE"
6113     AC_MSG_CHECKING([which graphite to use])
6114     if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
6115         test "$with_system_graphite" != "no"; then
6116         AC_MSG_RESULT([external])
6117         SYSTEM_GRAPHITE=YES
6118         PKG_CHECK_MODULES( GRAPHITE, graphite2 >= 0.9.3 )
6119         MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libgraphite2.dll"
6120     else
6121         AC_MSG_RESULT([internal])
6122         SYSTEM_GRAPHITE=NO
6123         BUILD_TYPE="$BUILD_TYPE GRAPHITE"
6124     fi
6125 else
6126     AC_MSG_RESULT([no])
6128 AC_SUBST(ENABLE_GRAPHITE)
6129 AC_SUBST(SYSTEM_GRAPHITE)
6130 AC_SUBST(GRAPHITE_LIBS)
6131 AC_SUBST(GRAPHITE_CFLAGS)
6133 dnl ===================================================================
6134 dnl Checks for libraries.
6135 dnl ===================================================================
6136 dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
6137 dnl See if we have the AppKit framework for building with Quartz graphics.
6139 if test  "$_os" = "Darwin"; then
6140     if test "x$with_x" = "xyes"; then
6141         AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
6142     else
6143         AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
6144         if test -d "/System/Library/Frameworks/AppKit.framework/"; then
6145             AC_MSG_RESULT([yes])
6146             x_includes="no_x_includes"
6147             x_libraries="no_x_libraries"
6148             dnl disable some things used on other Unix versions but not on the aqua build
6149             enable_gtk=no
6150         else
6151             AC_MSG_ERROR([No AppKit.framewrok found])
6152         fi
6153     fi
6156 if test $_os = iOS -o $_os = Android; then
6157     enable_gtk=no
6160 dnl ***************************************
6161 dnl testing for X libraries and includes...
6162 dnl ***************************************
6163 if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
6164     dnl Mac OS X using Aqua graphics. Don't check for X11.
6165     :
6166 elif test "$_os" != "WINNT" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6167     AC_PATH_X
6168     AC_PATH_XTRA
6169     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
6171     if test "x$x_includes" = "x"; then
6172         x_includes="default_x_includes"
6173     fi
6174     if test "x$x_libraries" = "x"; then
6175         x_libraries="default_x_libraries"
6176     fi
6177     dnl The variables $x_libraries and $x_includes are set.
6178     if test -z "$x_libraries"; then
6179         AC_MSG_ERROR([No X libraries found]) # Exit
6180     fi
6181     if test -z "$x_includes"; then
6182         AC_MSG_ERROR([No X includes found]) # Exit
6183     fi
6184     CFLAGS="$CFLAGS $X_CFLAGS"
6185     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
6186     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
6187     dnl Check if the XauDisposeAuth symbol is provided by libXau.
6188     AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
6189 else
6190     x_includes="no_x_includes"
6191     x_libraries="no_x_libraries"
6193 if test -z "$x_includes"; then
6194     x_includes="no_x_includes"
6196 if test -z "$x_libraries"; then
6197     x_libraries="no_x_libraries"
6199 if test "$x_includes" = "default_x_includes"; then
6200     XINC="/usr/include"
6201 else
6202     XINC="$x_includes"
6204 AC_SUBST(XINC)
6205 if test "$x_libraries" = "default_x_libraries"; then
6206     XLIB=`$PKG_CONFIG --variable=libdir x11`
6207     if test "x$XLIB" = x; then
6208         XLIB="/usr/lib"
6209     fi
6210 else
6211     XLIB="$x_libraries"
6213 AC_SUBST(XLIB)
6214 AC_SUBST(XAU_LIBS)
6216 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "Android" -a "$_os" != "iOS"; then
6217     dnl ===================================================================
6218     dnl Check for Composite.h for Mozilla plugin
6219     dnl ===================================================================
6220     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
6221      [#include <X11/Intrinsic.h>])
6225 dnl ===================================================================
6226 dnl Check for system Xrender
6227 dnl ===================================================================
6228 AC_MSG_CHECKING([whether to link to Xrender])
6229 if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
6230     AC_MSG_RESULT([yes])
6231     XRENDER_LINK=YES
6232     with_system_xrender_headers=yes
6233 else
6234     AC_MSG_RESULT([no, dynamically open it])
6235     XRENDER_LINK=NO
6237 AC_MSG_CHECKING([which Xrender headers to use])
6238 if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
6239         test "$with_system_xrender_headers" != "no"; then
6240     AC_MSG_RESULT([external])
6241     SYSTEM_XRENDER_HEADERS=YES
6242     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
6243       [AC_MSG_ERROR(Xrender not found. install X)], [])
6244 else
6245     AC_MSG_RESULT([internal])
6246     SYSTEM_XRENDER_HEADERS=NO
6247     BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
6249 if test "$XRENDER_LINK" = "YES"; then
6250     AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
6251       [AC_MSG_ERROR(libXrender not found or functional)], [])
6253 AC_SUBST(SYSTEM_XRENDER_HEADERS)
6254 AC_SUBST(XRENDER_LINK)
6256 dnl ===================================================================
6257 dnl Check for XRandr
6258 dnl ===================================================================
6259 AC_MSG_CHECKING([whether to enable RandR support])
6260 if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
6261     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
6262         XRANDR_DLOPEN="TRUE"
6263         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
6264     else
6265         AC_MSG_RESULT([yes])
6266         XRANDR_DLOPEN="FALSE"
6267         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
6268         if test "$ENABLE_RANDR" != "TRUE"; then
6269             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
6270                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
6271             XRANDR_CFLAGS=" "
6272             AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
6273               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
6274             XRANDR_LIBS="-lXrandr "
6275             ENABLE_RANDR="TRUE"
6276         fi
6277     fi
6278 else
6279     ENABLE_RANDR=""
6280     AC_MSG_RESULT([no])
6282 AC_SUBST(XRANDR_DLOPEN)
6283 AC_SUBST(XRANDR_CFLAGS)
6284 AC_SUBST(XRANDR_LIBS)
6285 AC_SUBST(ENABLE_RANDR)
6287 dnl ===================================================================
6288 dnl Check for building neon
6289 dnl ===================================================================
6290 AC_MSG_CHECKING([whether to use neon])
6291 if test "$enable_neon" = "no"; then
6292     AC_MSG_RESULT([no])
6293     DISABLE_NEON=TRUE
6294     AC_SUBST(DISABLE_NEON)
6295 else
6296     AC_MSG_RESULT([yes])
6297 dnl ===================================================================
6298 dnl Check for system neon
6299 dnl ===================================================================
6300 AC_MSG_CHECKING([which neon to use])
6301 if test -n "$with_system_neon" -o -n "$with_system_libs" && \
6302         test "$with_system_neon" != "no"; then
6303     AC_MSG_RESULT([external])
6304     PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
6305     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
6306     NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
6307     SYSTEM_NEON=YES
6308     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libtasn1-3.dll libgnutls-26.dll libneon-27.dll"
6309 else
6310     AC_MSG_RESULT([internal])
6311     SYSTEM_NEON=NO
6312     NEON_LIBS=-lneon
6313     NEON_CFLAGS=
6314     BUILD_TYPE="$BUILD_TYPE NEON"
6316 AC_SUBST(SYSTEM_NEON)
6317 AC_SUBST(NEON_VERSION)
6318 AC_SUBST(NEON_LIBS)
6319 AC_SUBST(NEON_CFLAGS)
6322 dnl ===================================================================
6323 dnl Check for system openssl
6324 dnl ===================================================================
6325 if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6326         "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
6327     with_system_openssl=yes
6329 AC_MSG_CHECKING([which libssl to use])
6330 if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
6331         test "$with_system_openssl" != "no"; then
6332     AC_MSG_RESULT([external])
6333     # Mac OS builds should get out without extra stuff is the Mac porters'
6334     # wish. And pkg-config is although Xcode ships a .pc for openssl
6335     if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
6336             "$_os" = "DragonFly"; then
6337         OPENSSL_CFLAGS=
6338         OPENSSL_LIBS="-lssl -lcrypto"
6339     else
6340         PKG_CHECK_MODULES( OPENSSL, openssl )
6341     fi
6342     SYSTEM_OPENSSL=YES
6343     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libssl-8.dll libcrypto-8.dll"
6344 else
6345     AC_MSG_RESULT([internal])
6346     SYSTEM_OPENSSL=NO
6347     BUILD_TYPE="$BUILD_TYPE OPENSSL"
6349 AC_SUBST(SYSTEM_OPENSSL)
6350 AC_SUBST(OPENSSL_CFLAGS)
6351 AC_SUBST(OPENSSL_LIBS)
6353 dnl ===================================================================
6354 dnl Check for system redland
6355 dnl ===================================================================
6356 AC_MSG_CHECKING([which redland library to use])
6357 if test -n "$with_system_redland" -o -n "$with_system_libs" && \
6358         test "$with_system_redland" != "no"; then
6359     AC_MSG_RESULT([external])
6360     SYSTEM_REDLAND=YES
6361     dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
6362     PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
6363     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libraptor-1.dll librasqal-2.dll libsqlite3-0.dll librdf-0.dll"
6364 else
6365     AC_MSG_RESULT([internal])
6366     BUILD_TYPE="$BUILD_TYPE REDLAND"
6367     SYSTEM_REDLAND=NO
6369 AC_SUBST(SYSTEM_REDLAND)
6370 AC_SUBST(REDLAND_CFLAGS)
6371 AC_SUBST(REDLAND_LIBS)
6373 dnl ===================================================================
6374 dnl Check for system hunspell
6375 dnl ===================================================================
6376 AC_MSG_CHECKING([which libhunspell to use])
6377 if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
6378         test "$with_system_hunspell" != "no"; then
6379     AC_MSG_RESULT([external])
6380     SYSTEM_HUNSPELL=YES
6381     AC_LANG_PUSH([C++])
6382     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
6383     if test "$HUNSPELL_PC" != "TRUE"; then
6384         AC_CHECK_HEADER(hunspell.hxx, [],
6385             [
6386             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
6387             [AC_MSG_ERROR(hunspell headers not found.)], [])
6388             ], [])
6389         AC_CHECK_LIB(hunspell, main, [],
6390            [ AC_MSG_ERROR(hunspell library not found.) ], [])
6391         HUNSPELL_LIBS=-lhunspell
6392     fi
6393     AC_LANG_POP([C++])
6394     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhunspell-1.3-0.dll"
6395 else
6396     AC_MSG_RESULT([internal])
6397     SYSTEM_HUNSPELL=NO
6398     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
6400 AC_SUBST(SYSTEM_HUNSPELL)
6401 AC_SUBST(HUNSPELL_CFLAGS)
6402 AC_SUBST(HUNSPELL_LIBS)
6404 dnl ===================================================================
6405 dnl Checking for altlinuxhyph
6406 dnl ===================================================================
6407 AC_MSG_CHECKING([which altlinuxhyph to use])
6408 if test -n "$with_system_altlinuxhyph" -o -n "$with_system_libs" && \
6409         test "$with_system_altlinuxhyph" != "no"; then
6410     AC_MSG_RESULT([external])
6411     SYSTEM_HYPH=YES
6412     AC_CHECK_HEADER(hyphen.h, [],
6413        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
6414     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
6415        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
6416        [#include <hyphen.h>])
6417     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
6418         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6419     if test -z "$HYPHEN_LIB"; then
6420         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
6421            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6422     fi
6423     if test -z "$HYPHEN_LIB"; then
6424         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
6425            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
6426     fi
6427     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libhyphen-0.dll"
6428 else
6429     AC_MSG_RESULT([internal])
6430     SYSTEM_HYPH=NO
6431     BUILD_TYPE="$BUILD_TYPE HYPHEN"
6433 AC_SUBST(SYSTEM_HYPH)
6434 AC_SUBST(HYPHEN_LIB)
6436 dnl ===================================================================
6437 dnl Checking for mythes
6438 dnl ===================================================================
6439 AC_MSG_CHECKING([which mythes to use])
6440 if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
6441        test "$with_system_mythes" != "no"; then
6442     AC_MSG_RESULT([external])
6443     SYSTEM_MYTHES=YES
6444     AC_LANG_PUSH([C++])
6445     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
6446     if test "$MYTHES_PKGCONFIG" = "no"; then
6447         AC_CHECK_HEADER(mythes.hxx, [],
6448             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
6449         AC_CHECK_LIB(mythes-1.2, main, [],
6450             [ MYTHES_FOUND=no], [])
6451     if test "$MYTHES_FOUND" = "no"; then
6452         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
6453                 [ MYTHES_FOUND=no], [])
6454     fi
6455     if test "$MYTHES_FOUND" = "no"; then
6456         AC_MSG_ERROR([mythes library not found!.])
6457     fi
6458     fi
6459     AC_LANG_POP([C++])
6460     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libmythes-1.2-0.dll"
6461 else
6462     AC_MSG_RESULT([internal])
6463     SYSTEM_MYTHES=NO
6464     BUILD_TYPE="$BUILD_TYPE MYTHES"
6466 AC_SUBST(SYSTEM_MYTHES)
6467 AC_SUBST(MYTHES_CFLAGS)
6468 AC_SUBST(MYTHES_LIBS)
6470 dnl ===================================================================
6471 dnl Checking for lpsolve
6472 dnl ===================================================================
6473 AC_MSG_CHECKING([which lpsolve to use])
6474 if test -n "$with_system_lpsolve" -o -n "$with_system_libs" && \
6475         test "$with_system_lpsolve" != "no"; then
6476     AC_MSG_RESULT([external])
6477     SYSTEM_LPSOLVE=YES
6478     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
6479        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
6480     # some systems need this. Like Ubuntu....
6481     AC_CHECK_LIB(m, floor)
6482     AC_CHECK_LIB(dl, dlopen)
6483     AC_CHECK_LIB(lpsolve55, make_lp, ,
6484         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
6485     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS lpsolve55.dll"
6486 else
6487     AC_MSG_RESULT([internal])
6488     SYSTEM_LPSOLVE=NO
6489     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
6491 AC_SUBST(SYSTEM_LPSOLVE)
6493 dnl ===================================================================
6494 dnl Checking for libexttextcat
6495 dnl ===================================================================
6496 AC_MSG_CHECKING([which libexttextcat to use])
6497 if test "x$with_system_libexttextcat" = "xyes"; then
6498     AC_MSG_RESULT([external])
6499     SYSTEM_LIBEXTTEXTCAT=YES
6500     PKG_CHECK_MODULES([LIBEXTTEXTCAT], [libexttextcat])
6501     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
6502 else
6503     AC_MSG_RESULT([internal])
6504     SYSTEM_LIBEXTTEXTCAT=NO
6505     BUILD_TYPE="$BUILD_TYPE LIBEXTTEXTCAT"
6507 AC_SUBST(SYSTEM_LIBEXTTEXTCAT)
6508 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
6509 AC_SUBST(LIBEXTTEXTCAT_CFLAGS)
6510 AC_SUBST(LIBEXTTEXTCAT_LIBS)
6512 dnl ***************************************
6513 dnl testing libc version for Linux...
6514 dnl ***************************************
6515 if test "$_os" = "Linux"; then
6516     AC_MSG_CHECKING([whether libc is >= 2.1.1])
6517     exec 6>/dev/null # no output
6518     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
6519     exec 6>&1 # output on again
6520     if test "$HAVE_LIBC"; then
6521         AC_MSG_RESULT([yes])
6522     else
6523         AC_MSG_ERROR([no, upgrade libc])
6524     fi
6527 if test "$_os" != "WINNT"; then
6528     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
6529     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
6530     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
6531         SYSTEM_LIBC=YES
6532     fi
6533 else
6534     HAVE_GETOPT=NO
6535     HAVE_READDIR_R=NO
6536     SYSTEM_LIBC=YES
6538 AC_SUBST(HAVE_GETOPT)
6539 AC_SUBST(HAVE_READDIR_R)
6540 AC_SUBST(SYSTEM_LIBC)
6542 dnl =========================================
6543 dnl Check for the Windows  SDK.
6544 dnl =========================================
6545 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
6546 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
6547 if test "$_os" = "WINNT"; then
6548     AC_MSG_CHECKING([for Windows SDK])
6549     if test "$build_os" = "cygwin"; then
6550         if test -z "$with_windows_sdk_home"; then
6551             # This first line will detect a February 2003 Microsoft Platform SDK
6552             WINDOWS_SDK_HOME=`./oowintool --windows-sdk-home`
6553             # But there might be also an April 2005 PSDK, unfortunately MS changed
6554             # the registry entry. (we prefer the old version!?)
6555             if test -z "$WINDOWS_SDK_HOME"; then
6556                 WINDOWS_SDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
6557             fi
6558             # normalize if found
6559             if test -n "$WINDOWS_SDK_HOME"; then
6560                 WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6561                 WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6562             fi
6563         else
6564             WINDOWS_SDK_HOME=`cygpath -u "$with_windows_sdk_home"`
6565         fi
6566     fi
6567     if test -n "$WINDOWS_SDK_HOME"; then
6568         # Remove a possible trailing backslash
6569         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6570         # Problem with current PSDK (iz 49865)
6571         # (What "current" does that mean?)
6572         if test -f "$WINDOWS_SDK_HOME/Lib/libcp.lib"; then
6573             AC_MSG_ERROR([
6574 Some modules do not build correctly with MS Platform SDK - April 2005
6575 Edition if the library ($WINDOWS_SDK_HOME/Lib/libcp.lib) is found.
6576 Remove/rename/backup that file and restart configure. Details about this
6577 problem can be found in issue 49856.])
6578         fi
6580         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6581              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6582              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6583             HAVE_PSDK_H="yes"
6584         else
6585             HAVE_PSDK_H="no"
6586         fi
6587         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6588             HAVE_PSDK_LIB="yes"
6589         else
6590             HAVE_PSDK_LIB="no"
6591         fi
6593         if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
6594             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6595 the  Windows SDK are installed.])
6596         fi
6598         if test ! -x "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
6599              -o ! -x "$WINDOWS_SDK_HOME/bin/msidb.exe" \
6600              -o ! -x "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
6601              -o ! -x "$WINDOWS_SDK_HOME/bin/msitran.exe" ; then
6602             AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
6603         fi
6604     fi
6606     if test -z "$WINDOWS_SDK_HOME"; then
6607         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6608     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
6609         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
6610     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
6611         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
6612     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
6613         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
6614     else
6615         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6616     fi
6618 AC_SUBST(WINDOWS_SDK_HOME)
6620 dnl =========================================
6621 dnl Check for the Microsoft DirectX SDK.
6622 dnl =========================================
6623 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
6624     AC_MSG_CHECKING([for DirectX SDK])
6625     if test "$build_os" = "cygwin"; then
6626         if test -z "$with_directx_home"; then
6627             dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
6628             if test -n "$DXSDK_DIR"; then
6629                 DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
6630                 DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
6631             fi
6632             # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
6633             # the "DirectX SDK not found" error later
6634         else
6635             DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
6636         fi
6637         # Remove a possible trailing backslash
6638         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
6639     elif test -n "$with_directx_home"; then
6640         DIRECTXSDK_HOME="$with_directx_home"
6641     fi
6643     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
6644         HAVE_DIRECTXSDK_H="yes"
6645     else
6646         HAVE_DIRECTXSDK_H="no"
6647     fi
6649     # MS changed the location of the libraries with Dec 2004 DirectX SDK
6650     if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
6651         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
6652     else
6653         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
6654     fi
6656     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
6657         HAVE_DIRECTXSDK_LIB="yes"
6658     else
6659         HAVE_DIRECTXSDK_LIB="no"
6660     fi
6662     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
6663         AC_MSG_RESULT([found])
6664     else
6665         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
6666     fi
6668 AC_SUBST(DIRECTXSDK_HOME)
6669 AC_SUBST(DIRECTXSDK_LIB)
6671 dnl ============================================
6672 dnl Check for Nullsoft Scriptable Install System
6673 dnl ============================================
6674 NSIS_PATH=""
6675 if test "$_os" = "WINNT" ; then
6676     if test -z "$with_nsis_path"; then
6677         AC_PATH_PROG(NSIS_PATH, makensis)
6678         if test -n "$NSIS_PATH"; then
6679             NSIS_PATH=`dirname "$NSIS_PATH"`
6680         elif test "$build_os" = "cygwin"; then
6681             AC_MSG_CHECKING([for NSIS])
6682             nsistest=`./oowintool --nsis-dir`;
6683             nsistest=`cygpath -d -m "$nsistest"`
6684             nsistest=`cygpath -u "$nsistest"`
6685             if test -x "$nsistest/nsis.exe"; then
6686                 NSIS_PATH="$nsistest"
6687                 AC_MSG_RESULT([found ($NSIS_PATH)])
6688             else
6689                 AC_MSG_RESULT([no, no self-contained installer will be built.])
6690             fi
6691         fi
6692     else
6693         AC_MSG_CHECKING([for NSIS])
6694         if test "$build_os" = "cygwin"; then
6695             with_nsis_path=`cygpath -u "$with_nsis_path"`
6696         fi
6697         if test -e "$with_nsis_path/makensis$EXEEXT_FOR_BUILD"; then
6698             NSIS_PATH="$with_nsis_path"
6699         fi
6700         if test -z "$NSIS_PATH"; then
6701             AC_MSG_RESULT([no, no self-contained installer will be built.])
6702         else
6703             if test "$build_os" = "cygwin"; then
6704                 NSIS_PATH=`cygpath -d "$NSIS_PATH"`
6705                 NSIS_PATH=`cygpath -u "$NSIS_PATH"`
6706             fi
6707             AC_MSG_RESULT([found ($NSIS_PATH)])
6708         fi
6709     fi
6711 AC_SUBST(NSIS_PATH)
6713 dnl ***************************************
6714 dnl Checking for bison and flex
6715 dnl ***************************************
6716 AC_PATH_PROG(BISON, bison)
6717 if test -z "$BISON"; then
6718     AC_MSG_ERROR([no bison found in \$PATH, install it])
6719 else
6720     AC_MSG_CHECKING([the bison version])
6721     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
6722     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
6723     # Accept newer than 1.875 or older(equal) than 1.75
6724     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
6725         if test "$_bison_version" = "1.875" ; then
6726             AC_MSG_WARN([suspect ($BISON $_bison_version)])
6727             echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
6728         else
6729             AC_MSG_RESULT([checked ($BISON $_bison_version)])
6730         fi
6731     else
6732         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
6733     fi
6735 AC_PATH_PROG(FLEX, flex)
6736 if test -z "$FLEX"; then
6737     AC_MSG_ERROR([no flex found in \$PATH, install it])
6739 dnl ***************************************
6740 dnl Checking for patch
6741 dnl ***************************************
6742 AC_PATH_PROG(PATCH, patch)
6743 if test -z "$PATCH"; then
6744     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
6747 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
6748 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
6749     if test -z "$with_gnu_patch"; then
6750         GNUPATCH=$PATCH
6751     else
6752         if test -x "$with_gnu_patch"; then
6753             GNUPATCH=$with_gnu_patch
6754         else
6755             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
6756         fi
6757     fi
6759     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
6760     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
6761         AC_MSG_RESULT([yes])
6762     else
6763         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
6764     fi
6767 dnl We also need to check for --with-gnu-cp
6769 if test -z "$with_gnu_cp"; then
6770     # check the place where the good stuff is hidden on Solaris...
6771     if test -x /usr/gnu/bin/cp; then
6772         GNUCP=/usr/gnu/bin/cp
6773     else
6774         AC_PATH_PROGS(GNUCP, gnucp cp)
6775     fi
6776     if test -z $GNUCP; then
6777         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
6778     fi
6779 else
6780     if test -x "$with_gnu_cp"; then
6781         GNUCP=$with_gnu_cp
6782     else
6783         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
6784     fi
6787 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
6788 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
6789     AC_MSG_RESULT([yes])
6790 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
6791     AC_MSG_RESULT([yes])
6792 else
6793     case "$build_os" in
6794     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
6795         GNUCP=''
6796         AC_MSG_RESULT([no gnucp found - using the system's cp command])
6797         ;;
6798     *)
6799         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
6800         ;;
6801     esac
6804 AC_SUBST(GNUPATCH)
6805 AC_SUBST(GNUCP)
6807 dnl ***************************************
6808 dnl testing assembler path
6809 dnl ***************************************
6810 ML_EXE=""
6811 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
6812     if test "$CL_X64" = ""; then
6813         assembler=ml.exe
6814         assembler_bin=bin
6815     else
6816         assembler=ml64.exe
6817         assembler_bin=bin/amd64
6818     fi
6819     if test -n "$with_asm_home"; then
6820         with_asm_home=`cygpath -u "$with_asm_home"`
6821     fi
6822     if test -x "$with_asm_home/$assembler"; then
6823         AC_MSG_CHECKING([$assembler assembler path])
6824         AC_MSG_RESULT([$with_asm_home/$assembler])
6825         ML_EXE="$with_asm_home/$assembler"
6826     else
6827         AC_PATH_PROG(ML_EXE, $assembler)
6828         if test -z "$ML_EXE"; then
6829             AC_MSG_CHECKING([$with_cl_home/$assembler_bin/$assembler])
6830             if test -x "$with_cl_home/$assembler_bin/$assembler"; then
6831                 with_asm_home=$with_cl_home/$assembler_bin
6832                 AC_MSG_RESULT([found])
6833                 ML_EXE="$with_cl_home/$assembler_bin/$assembler"
6834             else
6835                 AC_MSG_ERROR([Configure did not find $assembler assembler.])
6836             fi
6837         else
6838             with_asm_home="ASM_IN_PATH"
6839             ML_EXE="$assembler"
6840         fi
6841     fi
6842 else
6843     with_asm_home="NO_ASM_HOME"
6845 ASM_HOME="$with_asm_home"
6846 AC_SUBST(ASM_HOME)
6847 AC_SUBST(ML_EXE)
6849 dnl ===================================================================
6850 dnl We need zip and unzip
6851 dnl ===================================================================
6852 AC_PATH_PROG(ZIP, zip)
6853 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
6854 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
6855     AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
6858 AC_PATH_PROG(UNZIP, unzip)
6859 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
6861 dnl ===================================================================
6862 dnl Zip must be a specific type for different build types.
6863 dnl ===================================================================
6864 if test $build_os = cygwin; then
6865     if test -n "`$ZIP -h | grep -i WinNT`" ; then
6866         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
6867     fi
6870 dnl ===================================================================
6871 dnl Test which vclplugs have to be built.
6872 dnl ===================================================================
6873 R=""
6874 GTK3_CFLAGS=""
6875 GTK3_LIBS=""
6876 ENABLE_GTK3=""
6877 if test "x$enable_gtk3" = "xyes"; then
6878     if test "$with_system_cairo" != yes; then
6879         echo "System cairo required for gtk3 support, please use --system-cairo"
6880     fi
6881     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
6882     if test "x$ENABLE_GTK3" = "xTRUE"; then
6883         R="gtk3"
6884     fi
6886 AC_SUBST(GTK3_LIBS)
6887 AC_SUBST(GTK3_CFLAGS)
6888 AC_SUBST(ENABLE_GTK3)
6890 AC_MSG_CHECKING([which VCLplugs shall be built])
6891 ENABLE_GTK=""
6892 if test "x$enable_gtk" = "xyes"; then
6893     ENABLE_GTK="TRUE"
6894     R="gtk $R"
6896 AC_SUBST(ENABLE_GTK)
6898 ENABLE_KDE=""
6899 if test "x$enable_kde" = "xyes"; then
6900     ENABLE_KDE="TRUE"
6901     R="$R kde"
6903 AC_SUBST(ENABLE_KDE)
6905 ENABLE_KDE4=""
6906 if test "x$enable_kde4" = "xyes"; then
6907     ENABLE_KDE4="TRUE"
6908     R="$R kde4"
6910 AC_SUBST(ENABLE_KDE4)
6912 if test -z "$R"; then
6913     AC_MSG_RESULT([none])
6914 else
6915     AC_MSG_RESULT([$R])
6918 dnl ===================================================================
6919 dnl GCONF check
6920 dnl ===================================================================
6922 ENABLE_GCONF=""
6923 AC_MSG_CHECKING([whether to enable GConf support])
6924 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gconf" = "yes"; then
6925     ENABLE_GCONF="TRUE"
6926     AC_MSG_RESULT([yes])
6927     PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6928 else
6929     AC_MSG_RESULT([no])
6931 AC_SUBST(ENABLE_GCONF)
6933 dnl ===================================================================
6934 dnl Gnome VFS check
6935 dnl ===================================================================
6937 ENABLE_GNOMEVFS=""
6938 AC_MSG_CHECKING([whether to enable GNOME VFS support])
6939 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
6940     ENABLE_GNOMEVFS="TRUE"
6941     AC_MSG_RESULT([yes])
6942     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
6943     if test "$ENABLE_GCONF" != "TRUE"; then
6944         PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6945     fi
6946 else
6947     AC_MSG_RESULT([no])
6949 AC_SUBST(ENABLE_GNOMEVFS)
6951 dnl ===================================================================
6952 dnl Check whether the gtk 2.0 libraries are available.
6953 dnl ===================================================================
6955 GTK_CFLAGS=""
6956 GTK_LIBS=""
6957 ENABLE_SYSTRAY_GTK=""
6958 ENABLE_DBUS=""
6959 if test  "$test_gtk" = "yes"; then
6961     if test "$ENABLE_GTK" = "TRUE" ; then
6962         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]))
6963         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]))
6964         BUILD_TYPE="$BUILD_TYPE GTK"
6966         if test "x$enable_systray" = "xyes"; then
6967             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
6968                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
6969                             [ ENABLE_SYSTRAY_GTK="" ])
6970         fi
6972         AC_MSG_CHECKING([whether to enable DBUS support])
6973         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
6974             ENABLE_DBUS="TRUE"
6975             AC_MSG_RESULT([yes])
6976             PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
6977         else
6978             AC_MSG_RESULT([no])
6979         fi
6981         AC_MSG_CHECKING([whether to enable GIO support])
6982         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
6983             if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
6984                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
6985             fi
6986             ENABLE_GIO="TRUE"
6987             AC_MSG_RESULT([yes])
6988             PKG_CHECK_MODULES( GIO, gio-2.0 )
6989         else
6990             AC_MSG_RESULT([no])
6991         fi
6992     fi
6994 AC_SUBST(ENABLE_GIO)
6995 AC_SUBST(ENABLE_DBUS)
6996 AC_SUBST(ENABLE_SYSTRAY_GTK)
6997 AC_SUBST(GTK_CFLAGS)
6998 AC_SUBST(GTK_LIBS)
6999 AC_SUBST(GTHREAD_CFLAGS)
7000 AC_SUBST(GTHREAD_LIBS)
7002 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
7003 AC_SUBST(LIBPNG_LIBS)
7004 AC_SUBST(LIBPNG_CFLAGS)
7006 AC_MSG_CHECKING([whether to enable libpng linking in quickstarter])
7007 if test "x$enable_unix_libpng" = "xyes"; then
7008     AC_MSG_RESULT([yes])
7009 else
7010     AC_MSG_RESULT([no])
7011     ENABLE_QUICKSTART_LIBPNG=""
7013 AC_SUBST(ENABLE_QUICKSTART_LIBPNG)
7015 SPLIT_APP_MODULES=""
7016 if test "$enable_split_app_modules" = "yes"; then
7017     SPLIT_APP_MODULES="YES"
7019 AC_SUBST(SPLIT_APP_MODULES)
7021 SPLIT_OPT_FEATURES=""
7022 if test "$enable_split_opt_features" = "yes"; then
7023     SPLIT_OPT_FEATURES="YES"
7025 AC_SUBST(SPLIT_OPT_FEATURES)
7027 ENABLE_CAIRO_CANVAS="FALSE"
7028 if test "$enable_cairo_canvas" = "yes" ; then
7029    ENABLE_CAIRO_CANVAS="TRUE"
7031 AC_SUBST(ENABLE_CAIRO_CANVAS)
7033 ENABLE_CMIS="FALSE"
7034 if test "x$with_cmis" != "xno" ; then
7035    ENABLE_CMIS="TRUE"
7037 AC_SUBST(ENABLE_CMIS)
7039 dnl ===================================================================
7040 dnl Check whether the GStreamer libraries are available.
7041 dnl ===================================================================
7043 ENABLE_GSTREAMER=""
7045 if test  "$build_gstreamer" = "yes"; then
7047     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
7048     if test "x$enable_gstreamer" != "xno" ; then
7049         ENABLE_GSTREAMER="TRUE"
7050         AC_MSG_RESULT([yes])
7051         PKG_CHECK_MODULES( GSTREAMER, gstreamer-0.10 gstreamer-plugins-base-0.10 )
7052     else
7053         AC_MSG_RESULT([no])
7054     fi
7057 AC_SUBST(ENABLE_GSTREAMER)
7059 dnl ===================================================================
7060 dnl Check whether the OpenGL libraries are available
7061 dnl ===================================================================
7063 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
7064 ENABLE_OPENGL=
7066 if test "$_os" = "Darwin" ; then
7067     # We use frameworks on Mac OS X, no need for detail checks
7068     ENABLE_OPENGL=TRUE
7069     SYSTEM_MESA_HEADERS=YES
7070     AC_MSG_RESULT([yes])
7071 else
7072     if test "x$enable_opengl" != "xno" ; then
7073         if test "$_os" != "WINNT"; then
7074             save_LDFLAGS=$LDFLAGS
7075             LDFLAGS="$LDFLAGS -lm"
7076             AC_MSG_RESULT([yes])
7077             AC_CHECK_LIB(GL, main, [],
7078                       [AC_MSG_ERROR(libGL not installed or functional)], [])
7079             AC_CHECK_LIB(GLU, main, [],
7080                       [AC_MSG_ERROR(libGLU not installed or functional)], [])
7081             ENABLE_OPENGL=TRUE
7082             LDFLAGS=$save_LDFLAGS
7084             dnl ===================================================================
7085             dnl Check for system Mesa
7086             dnl ===================================================================
7087             AC_MSG_CHECKING([which Mesa headers to use])
7088             if test -n "$with_system_mesa_headers" -o -n "$with_system_headers" && \
7089                     test "$with_system_mesa_headers" != "no"; then
7090                 AC_MSG_RESULT([external])
7091                 SYSTEM_MESA_HEADERS=YES
7092                 AC_LANG_PUSH(C)
7093                 AC_CHECK_HEADER(GL/glxext.h, [],
7094                    [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
7095                 AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
7096                 AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
7097                 AC_LANG_POP(C)
7098             else
7099                 AC_MSG_RESULT([internal])
7100                 SYSTEM_MESA_HEADERS=NO
7101                 BUILD_TYPE="$BUILD_TYPE MESA"
7102             fi
7103         else
7104             AC_MSG_RESULT([not on Windows])
7105         fi
7106     else
7107        AC_MSG_RESULT([no])
7108     fi
7111 AC_SUBST(SYSTEM_MESA_HEADERS)
7112 AC_SUBST(ENABLE_OPENGL)
7114 # presenter minimizer extension?
7115 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
7116 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
7117    AC_MSG_RESULT([yes])
7118    ENABLE_MINIMIZER=YES
7119 else
7120    AC_MSG_RESULT([no])
7121    ENABLE_MINIMIZER=NO
7122    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
7124 AC_SUBST(ENABLE_MINIMIZER)
7126 # presenter console extension?
7127 AC_MSG_CHECKING([whether to build the Presenter Console extension])
7128 if test "x$enable_ext_presenter_console" != "xno" -a "x$enable_extension_integration" != "xno"; then
7129    AC_MSG_RESULT([yes])
7130    ENABLE_PRESENTER_SCREEN=YES
7131 else
7132    AC_MSG_RESULT([no])
7133    ENABLE_PRESENTER_SCREEN=NO
7134    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PRESENTER_SCREEN"
7136 AC_SUBST(ENABLE_PRESENTER_SCREEN)
7138 # pdf import extension?
7139 AC_MSG_CHECKING([whether to build the PDF Import extension])
7140 if test "x$enable_ext_pdfimport" != "xno" -a "x$enable_extension_integration" != "xno"; then
7141   AC_MSG_RESULT([yes])
7142   ENABLE_PDFIMPORT=YES
7144   dnl ===================================================================
7145   dnl Check for system poppler
7146   dnl ===================================================================
7147   AC_MSG_CHECKING([which pdf backend to use])
7148   if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
7149        test "$with_system_poppler" != "no"; then
7150       AC_MSG_RESULT([external])
7151       SYSTEM_POPPLER=YES
7152       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
7153       AC_LANG_PUSH([C++])
7154       save_CXXFLAGS=$CXXFLAGS
7155       save_CPPFLAGS=$CPPFLAGS
7156       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
7157       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
7158       AC_CHECK_HEADER([cpp/poppler-version.h], [],
7159                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
7160       CXXFLAGS=$save_CXXFLAGS
7161       CPPFLAGS=$save_CPPFLAGS
7162       AC_LANG_POP([C++])
7163   else
7164       AC_MSG_RESULT([internal])
7165       SYSTEM_POPPLER=NO
7166       BUILD_TYPE="$BUILD_TYPE XPDF"
7167   fi
7168 else
7169   AC_MSG_RESULT([no])
7170   ENABLE_PDFIMPORT=NO
7171   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_PDFIMPORT"
7173 AC_SUBST(ENABLE_PDFIMPORT)
7174 AC_SUBST(SYSTEM_POPPLER)
7175 AC_SUBST(POPPLER_CFLAGS)
7176 AC_SUBST(POPPLER_LIBS)
7179 if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
7180    AC_MSG_CHECKING([for sdext module])
7181    BUILD_TYPE="$BUILD_TYPE SDEXT"
7184 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
7185 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7186   AC_MSG_RESULT([yes])
7187   AC_MSG_CHECKING([for swext module])
7188   ENABLE_MEDIAWIKI=YES
7189   BUILD_TYPE="$BUILD_TYPE SWEXT"
7190   if test  "x$with_java" = "xno"; then
7191     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
7192   fi
7193 else
7194   AC_MSG_RESULT([no])
7195   ENABLE_MEDIAWIKI=NO
7196   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
7198 AC_SUBST(ENABLE_MEDIAWIKI)
7200 if test "$ENABLE_MEDIAWIKI" = "YES"; then
7201     AC_MSG_CHECKING([which Servlet API Jar to use])
7202     if test -n "$with_system_servlet_api"; then
7203         AC_MSG_RESULT([external])
7204         SYSTEM_SERVLETAPI=YES
7205         if test -z "$SERVLETAPI_JAR"; then
7206             SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
7207         fi
7208         AC_CHECK_FILE($SERVLETAPI_JAR, [],
7209               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
7210     else
7211         AC_MSG_RESULT([internal])
7212         SYSTEM_SERVLETAPI=NO
7213         BUILD_TYPE="$BUILD_TYPE TOMCAT"
7214     fi
7216 AC_SUBST(SYSTEM_SERVLETAPI)
7217 AC_SUBST(SERVLETAPI_JAR)
7219 AC_MSG_CHECKING([whether to build the Report Builder extension])
7220 if test "$enable_ext_report_builder" != "no" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
7221     AC_MSG_RESULT([yes])
7222     ENABLE_REPORTBUILDER=YES
7223     AC_MSG_CHECKING([for reportbuilder module])
7224     AC_MSG_CHECKING([which jfreereport libs to use])
7225     if test "$with_system_jfreereport" = "yes" -o "x$with_system_jars" = "xyes"; then
7226         SYSTEM_JFREEREPORT=YES
7227         AC_MSG_RESULT([external])
7228         if test -z $SAC_JAR; then
7229             SAC_JAR=/usr/share/java/sac.jar
7230         fi
7231         AC_CHECK_FILE($SAC_JAR, [],
7232              [AC_MSG_ERROR(sac.jar not found.)], [])
7234         if test -z $LIBXML_JAR; then
7235             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
7236                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
7237                 [
7238                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
7239                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
7240                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
7241                     )
7242                 ]
7243             )
7244         else
7245             AC_CHECK_FILE($LIBXML_JAR, [],
7246                  [AC_MSG_ERROR(libxml.jar not found.)], [])
7247         fi
7249         if test -z $FLUTE_JAR; then
7250             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
7251                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
7252                 [
7253                     AC_CHECK_FILE(/usr/share/java/flute.jar,
7254                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
7255                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
7256                     )
7257                 ]
7258             )
7259         else
7260             AC_CHECK_FILE($FLUTE_JAR, [],
7261                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
7262         fi
7264         if test -z $JFREEREPORT_JAR; then
7265             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
7266                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
7267                 [
7268                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
7269                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
7270                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
7271                     )
7272                 ]
7273             )
7274         else
7275             AC_CHECK_FILE($JFREEREPORT_JAR, [],
7276                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
7277         fi
7279         if test -z $LIBLAYOUT_JAR; then
7280             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
7281                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
7282                 [
7283                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
7284                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
7285                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
7286                     )
7287                 ]
7288             )
7289         else
7290             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
7291                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
7292         fi
7294         if test -z $LIBLOADER_JAR; then
7295             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
7296                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
7297                 [
7298                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
7299                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
7300                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
7301                     )
7302                 ]
7303             )
7304         else
7305             AC_CHECK_FILE($LIBLOADER_JAR, [],
7306                 [AC_MSG_ERROR(libloader.jar not found.)], [])
7307         fi
7309         if test -z $LIBFORMULA_JAR; then
7310             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
7311                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
7312                  [
7313                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
7314                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
7315                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
7316                      )
7317                  ]
7318             )
7319         else
7320             AC_CHECK_FILE($LIBFORMULA_JAR, [],
7321                 [AC_MSG_ERROR(libformula.jar not found.)], [])
7322         fi
7324         if test -z $LIBREPOSITORY_JAR; then
7325             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
7326                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
7327                 [
7328                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
7329                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
7330                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
7331                     )
7332                 ]
7333             )
7334         else
7335             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
7336                 [AC_MSG_ERROR(librepository.jar not found.)], [])
7337         fi
7339         if test -z $LIBFONTS_JAR; then
7340             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
7341                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
7342                 [
7343                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
7344                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
7345                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
7346                     )
7347                 ]
7348             )
7349         else
7350             AC_CHECK_FILE($LIBFONTS_JAR, [],
7351                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
7352         fi
7354         if test -z $LIBSERIALIZER_JAR; then
7355             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
7356                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
7357                 [
7358                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
7359                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
7360                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
7361                     )
7362                 ]
7363             )
7364         else
7365             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
7366                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
7367         fi
7370         if test -z $LIBBASE_JAR; then
7371             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
7372                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
7373                 [
7374                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
7375                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
7376                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
7377                     )
7378                 ]
7379             )
7380         else
7381             AC_CHECK_FILE($LIBBASE_JAR, [],
7382                 [AC_MSG_ERROR(libbase.jar not found.)], [])
7383         fi
7385     else
7386         AC_MSG_RESULT([internal])
7387         AC_MSG_CHECKING([for jfreereport module])
7388         SYSTEM_JFREEREPORT=NO
7389         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
7390     fi
7391     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
7392 else
7393     AC_MSG_RESULT([no])
7394     ENABLE_REPORTBUILDER=NO
7395     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_REPORTDESIGN"
7396     SYSTEM_JFREEREPORT=NO
7398 AC_SUBST(ENABLE_REPORTBUILDER)
7399 AC_SUBST(SYSTEM_JFREEREPORT)
7400 AC_SUBST(SAC_JAR)
7401 AC_SUBST(LIBXML_JAR)
7402 AC_SUBST(FLUTE_JAR)
7403 AC_SUBST(JFREEREPORT_JAR)
7404 AC_SUBST(LIBBASE_JAR)
7405 AC_SUBST(LIBLAYOUT_JAR)
7406 AC_SUBST(LIBLOADER_JAR)
7407 AC_SUBST(LIBFORMULA_JAR)
7408 AC_SUBST(LIBREPOSITORY_JAR)
7409 AC_SUBST(LIBFONTS_JAR)
7410 AC_SUBST(LIBSERIALIZER_JAR)
7412 # this has to be here because both the Wiki Publisher and the SRB use
7413 # commons-logging
7414 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7415     AC_MSG_CHECKING([which Apache commons-* libs to use])
7416     if test "x$with_system_apache_commons" = "xyes" -o "x$with_system_jars" = "xyes"; then
7417         SYSTEM_APACHE_COMMONS=YES
7418         AC_MSG_RESULT([external])
7419         if test "$ENABLE_MEDIAWIKI" = "YES"; then
7420             if test -z $COMMONS_CODEC_JAR; then
7421                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
7422                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
7423                     [
7424                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
7425                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
7426                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
7427                         )
7428                     ]
7429                 )
7430             else
7431                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
7432                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
7433             fi
7435             if test -z $COMMONS_LANG_JAR; then
7436                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
7437                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
7438                     [
7439                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
7440                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
7441                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
7442                             )
7443                     ]
7444                 )
7445             else
7446                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
7447                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
7448             fi
7450             if test -z $COMMONS_HTTPCLIENT_JAR; then
7451                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
7452                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
7453                     [
7454                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
7455                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
7456                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
7457                         )
7458                     ]
7459                 )
7460             else
7461                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
7462                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
7463             fi
7464         fi
7465         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
7466             if test -z $COMMONS_LOGGING_JAR; then
7467                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
7468                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
7469                    [
7470                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
7471                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
7472                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
7473                         )
7474                     ]
7475                 )
7476             else
7477                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
7478                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
7479             fi
7480         fi
7481     else
7482         AC_MSG_RESULT([internal])
7483         SYSTEM_APACHE_COMMONS=NO
7484         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
7485     fi
7487 AC_SUBST(SYSTEM_APACHE_COMMONS)
7488 AC_SUBST(COMMONS_CODEC_JAR)
7489 AC_SUBST(COMMONS_LANG_JAR)
7490 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
7491 AC_SUBST(COMMONS_LOGGING_JAR)
7493 # scripting provider for BeanShell extension?
7494 AC_MSG_CHECKING([whether to build extension for support of scripts in BeanShell])
7495 if test "x$enable_ext_scripting_beanshell" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7496    AC_MSG_RESULT([yes])
7497    ENABLE_SCRIPTING_BEANSHELL=YES
7498 else
7499    AC_MSG_RESULT([no])
7500    ENABLE_SCRIPTING_BEANSHELL=NO
7501    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_BEANSHELL"
7503 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
7505 # scripting provider for JavaScript extension?
7506 AC_MSG_CHECKING([whether to build extension for support of scripts in JavaScript])
7507 if test "x$enable_ext_scripting_javascript" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7508    AC_MSG_RESULT([yes])
7509    ENABLE_SCRIPTING_JAVASCRIPT=YES
7510 else
7511    AC_MSG_RESULT([no])
7512    ENABLE_SCRIPTING_JAVASCRIPT=NO
7513    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_SCRIPTING_JAVASCRIPT"
7515 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
7517 dnl Scripting provider for Python extension?
7518 dnl We always provide this unless we have disabled Python completely
7519 if test $enable_python = no; then
7520     ENABLE_SCRIPTING_PYTHON=NO
7521 else
7522     ENABLE_SCRIPTING_PYTHON=YES
7524 AC_SUBST(ENABLE_SCRIPTING_PYTHON)
7526 supports_multilib=
7527 case "$host_cpu" in
7528 x86_64 | powerpc64 | s390x)
7529     if test "$SIZEOF_LONG" = "8"; then
7530         supports_multilib="yes"
7531     fi
7532     ;;
7534     ;;
7535 esac
7537 dnl ===================================================================
7538 dnl Check whether the Qt3 and KDE3 libraries are available.
7539 dnl ===================================================================
7541 KDE_CFLAGS=""
7542 KDE_LIBS=""
7543 if test "$_os" != "OpenBSD"; then
7544     MOC="moc"
7546 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
7547     dnl Search paths for Qt3 and KDE3
7548     if test -z "$supports_multilib" ; then
7549         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"
7550         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"
7551     else
7552         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"
7553         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"
7554     fi
7555     if test -n "$QTDIR" ; then
7556         qt_incdirs="$QTDIR/include $qt_incdirs"
7557         if test -z "$supports_multilib" ; then
7558             qt_libdirs="$QTDIR/lib $qt_libdirs"
7559         else
7560             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7561         fi
7562     fi
7563     if test -z "$supports_multilib" ; then
7564         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"
7565         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"
7566     else
7567         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"
7568         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"
7569     fi
7570     if test -n "$KDEDIR" ; then
7571         kde_incdirs="$KDEDIR/include $kde_incdirs"
7572         if test -z "$supports_multilib" ; then
7573             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7574         else
7575             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7576         fi
7577     fi
7579     dnl What to test
7580     qt_test_include="qstyle.h"
7581     kde_test_include="kapp.h"
7583     if test "$_os" != "OpenBSD"; then
7584         qt_test_library="libqt-mt.so"
7585         kde_test_library="libDCOP.so"
7586     else
7587         qt_test_library="libqt-mt.so*"
7588         kde_test_library="libDCOP.so*"
7589     fi
7591     dnl Check for Qt3 headers
7592     AC_MSG_CHECKING([for Qt3 headers])
7593     qt_incdir="no"
7594     for kde_check in $qt_incdirs ; do
7595         if test -r "$kde_check/$qt_test_include" ; then
7596             qt_incdir="$kde_check"
7597             break
7598         fi
7599     done
7600     AC_MSG_RESULT([$qt_incdir])
7601     if test "x$qt_incdir" = "xno" ; then
7602         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
7603 your Qt3 installation by exporting QTDIR before running "configure".])
7604     fi
7606     dnl Check for Qt3 libraries
7607     AC_MSG_CHECKING([for Qt3 libraries])
7608     qt_libdir="no"
7609     for qt_check in $qt_libdirs ; do
7610         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`" ; then
7611             qt_libdir="$qt_check"
7612             break
7613         fi
7614     done
7615     AC_MSG_RESULT([$qt_libdir])
7616     if test "x$qt_libdir" = "xno" ; then
7617         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
7618 your Qt3 installation by exporting QTDIR before running "configure".])
7619     fi
7621     dnl Check for Meta Object Compiler
7622     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
7623     if test "$MOC" = "no" ; then
7624         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
7625 the root of your Qt3 installation by exporting QTDIR before running "configure".])
7626     fi
7628     dnl Check for KDE3 headers
7629     AC_MSG_CHECKING([for KDE3 headers])
7630     kde_incdir="no"
7631     for kde_check in $kde_incdirs ; do
7632         if test -r "$kde_check/$kde_test_include" ; then
7633             kde_incdir="$kde_check"
7634             break
7635         fi
7636     done
7637     AC_MSG_RESULT([$kde_incdir])
7638     if test "x$kde_incdir" = "xno" ; then
7639         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
7640 your KDE3 installation by exporting KDEDIR before running "configure".])
7641     fi
7643     dnl Check for KDE3 libraries
7644     AC_MSG_CHECKING([for KDE3 libraries])
7645     kde_libdir="no"
7646     for kde_check in $kde_libdirs ; do
7647         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`" ; then
7648             kde_libdir="$kde_check"
7649             break
7650         fi
7651     done
7652     AC_MSG_RESULT([$kde_libdir])
7653     if test "x$kde_libdir" = "xno" ; then
7654         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
7655 your KDE3 installation by exporting KDEDIR before running "configure".])
7656     fi
7658     dnl Set the variables
7659     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7660     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
7662 AC_SUBST(KDE_CFLAGS)
7663 AC_SUBST(KDE_LIBS)
7664 AC_SUBST(MOC)
7666 dnl ===================================================================
7667 dnl KDE4 Integration
7668 dnl ===================================================================
7670 KDE4_CFLAGS=""
7671 KDE4_LIBS=""
7672 MOC4="moc"
7673 KDE_GLIB_CFLAGS=""
7674 KDE_GLIB_LIBS=""
7675 KDE_HAVE_GLIB=""
7676 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
7677     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
7678     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
7680     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
7681     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
7683     if test -n "$supports_multilib" ; then
7684         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
7685         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
7686     fi
7688     if test -n "$QTDIR" ; then
7689         qt_incdirs="$QTDIR/include $qt_incdirs"
7690         if test -z "$supports_multilib" ; then
7691             qt_libdirs="$QTDIR/lib $qt_libdirs"
7692         else
7693             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7694         fi
7695     fi
7696     if test -n "$QT4DIR" ; then
7697         qt_incdirs="$QT4DIR/include $qt_incdirs"
7698         if test -z "$supports_multilib" ; then
7699             qt_libdirs="$QT4DIR/lib $qt_libdirs"
7700         else
7701             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
7702         fi
7703     fi
7705     if test -n "$KDEDIR" ; then
7706         kde_incdirs="$KDEDIR/include $kde_incdirs"
7707         if test -z "$supports_multilib" ; then
7708             kde_libdirs="$KDEDIR/lib $kde_libdirs"
7709         else
7710             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7711         fi
7712     fi
7713     if test -n "$KDE4DIR" ; then
7714         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
7715         if test -z "$supports_multilib" ; then
7716             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
7717         else
7718             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
7719         fi
7720     fi
7722     qt_test_include="Qt/qobject.h"
7723     qt_test_library="libQtCore.so"
7724     kde_test_include="kwindowsystem.h"
7725     kde_test_library="libsolid.so"
7727     AC_MSG_CHECKING([for Qt4 headers])
7728     qt_header_dir="no"
7729     for inc_dir in $qt_incdirs ; do
7730         if test -r "$inc_dir/$qt_test_include" ; then
7731             qt_header_dir="$inc_dir"
7732             break
7733         fi
7734     done
7736     AC_MSG_RESULT([$qt_header_dir])
7737     if test "x$qt_header_dir" = "xno" ; then
7738         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7739     fi
7741     AC_MSG_CHECKING([for Qt4 libraries])
7742     qt_lib_dir="no"
7743     for lib_dir in $qt_libdirs ; do
7744         if test -r "$lib_dir/$qt_test_library" ; then
7745             qt_lib_dir="$lib_dir"
7746             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
7747             break
7748         fi
7749     done
7751     AC_MSG_RESULT([$qt_lib_dir])
7753     if test "x$qt_lib_dir" = "xno" ; then
7754         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7755     fi
7757     dnl Check for Meta Object Compiler
7759     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7760     MOC4="$MOCQT4"
7761     if test "$MOC4" = "no" ; then
7762         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
7763         if test "$MOC4" = "no" ; then
7764             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
7765 the root of your Qt installation by exporting QT4DIR before running "configure".])
7766         fi
7767     fi
7769     dnl Check for KDE4 headers
7770     AC_MSG_CHECKING([for KDE4 headers])
7771     kde_incdir="no"
7772     for kde_check in $kde_incdirs ; do
7773         if test -r "$kde_check/$kde_test_include" ; then
7774             kde_incdir="$kde_check"
7775             break
7776         fi
7777     done
7778     AC_MSG_RESULT([$kde_incdir])
7779     if test "x$kde_incdir" = "xno" ; then
7780         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7781     fi
7783     dnl Check for KDE4 libraries
7784     AC_MSG_CHECKING([for KDE4 libraries])
7785     kde_libdir="no"
7786     for kde_check in $kde_libdirs ; do
7787         if test -r "$kde_check/$kde_test_library" ; then
7788             kde_libdir="$kde_check"
7789             break
7790         fi
7791     done
7793     AC_MSG_RESULT([$kde_libdir])
7794     if test "x$kde_libdir" = "xno" ; then
7795         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7796     fi
7798     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7799     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
7801     AC_LANG_PUSH([C++])
7802     save_CXXFLAGS=$CXXFLAGS
7803     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
7804     AC_MSG_CHECKING([whether KDE is >= 4.2])
7805        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7806 #include <kdeversion.h>
7808 int main(int argc, char **argv) {
7809        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
7810        else return 1;
7812        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
7813     CXXFLAGS=$save_CXXFLAGS
7814     AC_LANG_POP([C++])
7816    # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled
7817     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
7818         [KDE_HAVE_GLIB=1],
7819         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
7821 AC_SUBST(KDE4_CFLAGS)
7822 AC_SUBST(KDE4_LIBS)
7823 AC_SUBST(MOC4)
7824 AC_SUBST(KDE_GLIB_CFLAGS)
7825 AC_SUBST(KDE_GLIB_LIBS)
7826 AC_SUBST(KDE_HAVE_GLIB)
7828 dnl ===================================================================
7829 dnl Test for the enabling the lockdown pieces
7830 dnl ===================================================================
7831 AC_MSG_CHECKING([whether to enable the lockdown pieces])
7832 ENABLE_LOCKDOWN=""
7833 if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
7834     ENABLE_LOCKDOWN=YES
7835     AC_MSG_RESULT([yes])
7836 else
7837     AC_MSG_RESULT([no])
7839 AC_SUBST(ENABLE_LOCKDOWN)
7841 dnl ===================================================================
7842 dnl Test whether to include Evolution 2 support
7843 dnl ===================================================================
7844 AC_MSG_CHECKING([whether to enable evolution 2 support])
7845 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
7846     AC_MSG_RESULT([yes])
7847     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
7848     ENABLE_EVOAB2="TRUE"
7849 else
7850     ENABLE_EVOAB2=""
7851     AC_MSG_RESULT([no])
7853 AC_SUBST(ENABLE_EVOAB2)
7854 AC_SUBST(GOBJECT_CFLAGS)
7855 AC_SUBST(GOBJECT_LIBS)
7857 dnl ===================================================================
7858 dnl Test whether to include KDE AB support
7859 dnl ===================================================================
7860 AC_MSG_CHECKING([whether to enable KDE address book support])
7861 if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
7862     AC_MSG_RESULT([yes])
7863     AC_LANG_PUSH([C++])
7864     save_CXXFLAGS=$CXXFLAGS
7865     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
7866     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
7867        AC_RUN_IFELSE([AC_LANG_SOURCE([[
7868 #include <kdeversion.h>
7870 int main(int argc, char **argv) {
7871        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
7872        else return 1;
7874        ]])],[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])],[])
7875     CXXFLAGS=$save_CXXFLAGS
7876     AC_LANG_POP([C++])
7877     ENABLE_KAB=TRUE
7878 else
7879     AC_MSG_RESULT([no])
7880     ENABLE_KAB=
7882 AC_SUBST(ENABLE_KAB)
7884 dnl ===================================================================
7885 dnl Test whether to include MathMLDTD
7886 dnl ===================================================================
7887 AC_MSG_CHECKING([whether to include MathMLDTD])
7888 if test -n "$enable_mathmldtd"; then
7889     if test "$enable_mathmldtd" = "no"; then
7890         AC_MSG_RESULT([no])
7891         SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7892     else
7893         AC_MSG_RESULT([yes])
7894         BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7895     fi
7896 else
7897     AC_MSG_RESULT([no])
7898     SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7901 dnl ===================================================================
7902 dnl Test which themes to include
7903 dnl ===================================================================
7904 AC_MSG_CHECKING([which themes to include])
7905 # if none given, use all available themes
7906 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
7907     with_theme="default crystal hicontrast oxygen tango"
7910 WITH_THEMES=""
7911 for theme in $with_theme; do
7912     case $theme in
7913         default|crystal|hicontrast|oxygen|tango) : ;;
7914         *) AC_MSG_ERROR([Unknown value for --with-themes: $theme]) ;;
7915     esac
7916     WITH_THEMES="$WITH_THEMES $theme"
7917     SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
7918 done
7919 AC_MSG_RESULT([$WITH_THEMES])
7920 AC_SUBST([WITH_THEMES])
7922 dnl ===================================================================
7923 dnl Test whether to integrate helppacks into the product's installer
7924 dnl ===================================================================
7925 AC_MSG_CHECKING([for helppack integration])
7926 if test "z$with_helppack_integration" = "zno" ; then
7927     WITH_HELPPACK_INTEGRATION=NO
7928     AC_MSG_RESULT([no integration])
7929 else
7930     WITH_HELPPACK_INTEGRATION=YES
7931     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
7932     AC_MSG_RESULT([integration])
7934 AC_SUBST(WITH_HELPPACK_INTEGRATION)
7936 ###############################################################################
7937 # Extensions checking
7938 ###############################################################################
7939 dnl ===================================================================
7940 dnl Test whether to integrate extensions into the product's installer
7941 dnl ===================================================================
7942 AC_MSG_CHECKING([for extensions integration])
7943 if test "x$enable_extension_integration" != "xno"; then
7944     WITH_EXTENSION_INTEGRATION=YES
7945     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
7946     AC_MSG_RESULT([yes, use integration])
7947 else
7948     WITH_EXTENSION_INTEGRATION=NO
7949     AC_MSG_RESULT([no, do not integrate])
7951 AC_SUBST(WITH_EXTENSION_INTEGRATION)
7953 dnl ===================================================================
7954 dnl Test whether to include Lightproof extensions
7955 dnl ===================================================================
7956 AC_MSG_CHECKING([for Lightproof extensions integration (only supported languages displayed)])
7957 LIGHTPROOF_LANG=
7958 LIGHTPROOF_HU_PACK=
7959 LIGHTPROOF_RU_PACK=
7960 LIGHTPROOF_EN_US_PACK=
7961 if test "x$enable_ext_lightproof" = "xno" -o "x$enable_extension_integration" = "xno"; then
7962     AC_MSG_RESULT([no integration])
7963 else
7964     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LIGHTPROOF"
7965     if test "x$enable_ext_lightproof" = "xyes" -o "x$enable_ext_lightproof" = "x"; then
7966         wanted_lightproof="en-US hu ru"
7967     else
7968         for lang in $enable_ext_lightproof ; do
7969             case $lang in
7970                 en-US|hu|ru)
7971                     wanted_lightproof="$wanted_lightproof $lang"
7972                     ;;
7973                 *)
7974                     AC_MSG_ERROR([Unknown value for --enable-ext-lightproof: $lang])
7975                     ;;
7976                 esac
7977         done
7978     fi
7979     for lang in $wanted_lightproof ; do
7980         LIGHTPROOF_LANG="$LIGHTPROOF_LANG $lang"
7981         case $lang in
7982             en-US) LIGHTPROOF_EN_US_PACK="0ab55ac8e88f04258f1d3e79e984382f-lightproof-en_US-0.1.oxt" ;;
7983             hu) LIGHTPROOF_HU_PACK="76345f925e34fef2d29bade4f29108e9-lightproof-hu_1.3.oxt" ;;
7984             ru) LIGHTPROOF_RU_PACK="673860e8649cff2ebdc68bd46f2f7f1a-lightproof-ru_0.1.oxt" ;;
7985             *) AC_MSG_ERROR([Unknown value for --enable-ext-lightproof: $lang]) ;;
7986         esac
7987     done
7988     AC_MSG_RESULT([$LIGHTPROOF_LANG])
7990 AC_SUBST(LIGHTPROOF_LANG)
7991 AC_SUBST(LIGHTPROOF_HU_PACK)
7992 AC_SUBST(LIGHTPROOF_RU_PACK)
7993 AC_SUBST(LIGHTPROOF_EN_US_PACK)
7995 dnl ===================================================================
7996 dnl Test whether to include Watch Window extension
7997 dnl ===================================================================
7998 AC_MSG_CHECKING([for Watch Window extension integration])
7999 WATCH_WINDOW_EXTENSION_PACK=
8000 if test "x$enable_ext_watch_window" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8001     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_WATCH_WINDOW"
8002     WATCH_WINDOW_EXTENSION_PACK="23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt"
8003     AC_MSG_RESULT([yes])
8004 else
8005     AC_MSG_RESULT([no])
8007 AC_SUBST(WATCH_WINDOW_EXTENSION_PACK)
8009 dnl ===================================================================
8010 dnl Test whether to include SmART Gallery (Diagram) extension
8011 dnl ===================================================================
8012 AC_MSG_CHECKING([for SmART Gallery (Diagram) extension integration])
8013 DIAGRAM_EXTENSION_PACK=
8014 if test "x$enable_ext_diagram" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8015     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_DIAGRAM"
8016     DIAGRAM_EXTENSION_PACK="4a433efb6d385264ebc1d5513782d51c-SmART_0.9.4.oxt"
8017     AC_MSG_RESULT([yes])
8018 else
8019     AC_MSG_RESULT([no])
8021 AC_SUBST(DIAGRAM_EXTENSION_PACK)
8023 dnl ===================================================================
8024 dnl Test whether to include Validator extension
8025 dnl ===================================================================
8026 AC_MSG_CHECKING([for Validator extension integration])
8027 VALIDATOR_EXTENSION_PACK=
8028 if test "x$enable_ext_validator" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8029     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_VALIDATOR"
8030     VALIDATOR_EXTENSION_PACK="bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt"
8031     AC_MSG_RESULT([yes])
8032 else
8033     AC_MSG_RESULT([no])
8035 AC_SUBST(VALIDATOR_EXTENSION_PACK)
8037 dnl ===================================================================
8038 dnl Test whether to include Barcode extension
8039 dnl ===================================================================
8040 AC_MSG_CHECKING([for Barcode extension integration])
8041 BARCODE_EXTENSION_PACK=
8042 if test "x$enable_ext_barcode" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8043     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_BARCODE"
8044     BARCODE_EXTENSION_PACK="7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt"
8045     AC_MSG_RESULT([yes])
8046 else
8047     AC_MSG_RESULT([no])
8049 AC_SUBST([BARCODE_EXTENSION_PACK])
8051 dnl ===================================================================
8052 dnl Test whether to include ConvertTextToNumber extension
8053 dnl ===================================================================
8054 AC_MSG_CHECKING([for ConvertTextToNumber extension integration])
8055 CT2N_EXTENSION_PACK=
8056 if test "x$enable_ext_ct2n" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8057     BUILD_TYPE="$BUILD_TYPE CT2N"
8058     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_CT2N"
8059     CT2N_EXTENSION_PACK="451ccf439a36a568653b024534669971-ConvertTextToNumber_1.3.2.oxt"
8060     AC_MSG_RESULT([yes])
8061 else
8062     AC_MSG_RESULT([no])
8064 AC_SUBST(CT2N_EXTENSION_PACK)
8066 dnl ===================================================================
8067 dnl Test whether to include Numbertext extension
8068 dnl ===================================================================
8069 AC_MSG_CHECKING([for Numbertext extension integration])
8070 NUMBERTEXT_EXTENSION_PACK=
8071 if test "x$enable_ext_numbertext" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8072     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NUMBERTEXT"
8073     NUMBERTEXT_EXTENSION_PACK="b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt"
8074     AC_MSG_RESULT([yes])
8075 else
8076     AC_MSG_RESULT([no])
8078 AC_SUBST(NUMBERTEXT_EXTENSION_PACK)
8080 dnl ===================================================================
8081 dnl Test whether to include Hungarian Cross-reference Toolbar extension
8082 dnl ===================================================================
8083 AC_MSG_CHECKING([for Hungarian Cross-reference Toolbar extension integration])
8084 HUNART_EXTENSION_PACK=
8085 if test "x$enable_ext_hunart" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8086     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_HUNART"
8087     HUNART_EXTENSION_PACK="b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt"
8088     AC_MSG_RESULT([yes])
8089 else
8090     AC_MSG_RESULT([no])
8092 AC_SUBST(HUNART_EXTENSION_PACK)
8094 dnl ===================================================================
8095 dnl Test whether to include Typography Toolbar extension
8096 dnl ===================================================================
8097 AC_MSG_CHECKING([for Typography Toolbar extension integration])
8098 TYPO_EXTENSION_PACK=
8099 if test "x$enable_ext_typo" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8100     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_TYPO"
8101     TYPO_EXTENSION_PACK="9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt"
8102     AC_MSG_RESULT([yes])
8103 else
8104     AC_MSG_RESULT([no])
8106 AC_SUBST(TYPO_EXTENSION_PACK)
8108 dnl ===================================================================
8109 dnl Test whether to include Google Docs extension
8110 dnl ===================================================================
8111 AC_MSG_CHECKING([for Google Docs extension integration])
8112 GOOGLE_DOCS_EXTENSION_PACK=
8113 if test "x$enable_ext_google_docs" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8114     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_GOOGLE_DOCS"
8115     GOOGLE_DOCS_EXTENSION_PACK="cea0f63d5985ba4fcbd882031df44346-gdocs_3.0.0_modified.oxt"
8116     AC_MSG_RESULT([yes])
8117 else
8118     AC_MSG_RESULT([no])
8120 AC_SUBST(GOOGLE_DOCS_EXTENSION_PACK)
8122 dnl ===================================================================
8123 dnl Test whether to include NLPSolver extension
8124 dnl ===================================================================
8125 AC_MSG_CHECKING([for NLPSolver extension integration])
8126 if test "x$enable_ext_nlpsolver" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8127     BUILD_TYPE="$BUILD_TYPE NLPSOLVER"
8128     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_NLPSOLVER"
8129     AC_MSG_RESULT([yes])
8130 else
8131     AC_MSG_RESULT([no])
8134 dnl ===================================================================
8135 dnl Test whether to include LanguageTool extension
8136 dnl ===================================================================
8137 AC_MSG_CHECKING([for LanguageTool extension integration])
8138 if test "x$enable_ext_languagetool" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8139     BUILD_TYPE="$BUILD_TYPE LANGUAGETOOL"
8140     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_LANGUAGETOOL"
8141     AC_MSG_RESULT([yes])
8142 else
8143     AC_MSG_RESULT([no])
8146 dnl ===================================================================
8147 dnl Test whether to include oooblogger extension
8148 dnl ===================================================================
8149 AC_MSG_CHECKING([for oooblogger extension integration])
8150 OOOBLOGGER_EXTENSION_PACK=
8151 if test "x$enable_ext_oooblogger" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8152     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_OOOBLOGGER"
8153     OOOBLOGGER_EXTENSION_PACK="b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt"
8154     AC_MSG_RESULT([yes])
8155 else
8156     AC_MSG_RESULT([no])
8158 AC_SUBST(OOOBLOGGER_EXTENSION_PACK)
8159 ###############################################################################
8161 dnl ===================================================================
8162 dnl Test whether to include Sun Professional Template Pack
8163 dnl ===================================================================
8164 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
8165 if test "z$with_sun_templates" = "z" -o "z$with_sun_templates" = "zno" ; then
8166     SUNTEMPLATES_LANG=""
8167     AC_MSG_RESULT([no integration])
8168 else
8169     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
8170     sun_supported_langs="en-US de it fr es hu"
8171     if test "z$with_sun_templates" = "zyes" ; then
8172         wanted_sun_templates="$sun_supported_langs"
8173     else
8174         # check whether the langs are supported by Sun
8175         wanted_sun_templates=
8176         for lang in $with_sun_templates ; do
8177             if test -n "`echo $sun_supported_langs | grep "$lang"`" ; then
8178                 wanted_sun_templates="$wanted_sun_templates $lang"
8179             fi
8180         done
8181     fi
8182     SUNTEMPLATES_LANG=
8183     SUNTEMPLATES_DE_PACK=
8184     SUNTEMPLATES_EN_US_PACK=
8185     SUNTEMPLATES_ES_PACK=
8186     SUNTEMPLATES_FR_PACK=
8187     SUNTEMPLATES_HU_PACK=
8188     SUNTEMPLATES_IT_PACK=
8189     # check whether the langs are requested at all
8190     for lang in $wanted_sun_templates ; do
8191     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`" ; then
8192         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
8193         case $lang in
8194         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
8195         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
8196         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
8197         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
8198         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
8199         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
8200         esac
8201     fi
8202     done
8203     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
8205 AC_SUBST(SUNTEMPLATES_LANG)
8206 AC_SUBST(SUNTEMPLATES_DE_PACK)
8207 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
8208 AC_SUBST(SUNTEMPLATES_ES_PACK)
8209 AC_SUBST(SUNTEMPLATES_FR_PACK)
8210 AC_SUBST(SUNTEMPLATES_HU_PACK)
8211 AC_SUBST(SUNTEMPLATES_IT_PACK)
8213 dnl ===================================================================
8214 dnl Test whether to include fonts
8215 dnl ===================================================================
8216 AC_MSG_CHECKING([whether to include third-party fonts])
8217 if test "$with_fonts" != "no" ; then
8218     AC_MSG_RESULT([yes])
8219     WITH_FONTS=YES
8220     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
8221 else
8222     AC_MSG_RESULT([no])
8223     WITH_FONTS=NO
8224     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
8226 AC_SUBST(WITH_FONTS)
8228 AC_MSG_CHECKING([whether to include Agfa Monotype fonts])
8229 if test "$with_agfa_monotype_fonts" = "yes" ; then
8230     AC_MSG_RESULT([yes])
8231     WITH_AGFA_MONOTYPE_FONTS=YES
8232     SCPDEFS="$SCPDEFS -DWITH_AGFA_MONOTYPE_FONTS"
8233     BUILD_TYPE="$BUILD_TYPE AGFA_MONOTYPE_FONTS"
8234 else
8235     AC_MSG_RESULT([no])
8236     WITH_AGFA_MONOTYPE_FONTS=NO
8238 AC_SUBST(WITH_AGFA_MONOTYPE_FONTS)
8240 dnl ===================================================================
8241 dnl Test whether to include ppds
8242 dnl ===================================================================
8243 AC_MSG_CHECKING([whether to include PPDs])
8244 if test "$with_ppds" != "no"; then
8245     AC_MSG_RESULT([yes])
8246 else
8247     AC_MSG_RESULT([no])
8248     WITHOUT_PPDS=YES
8249     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
8251 AC_SUBST(WITHOUT_PPDS)
8253 dnl ===================================================================
8254 dnl Test whether to include afms
8255 dnl ===================================================================
8256 AC_MSG_CHECKING([whether to include AFMs])
8257 if test "$with_afms" != "no"; then
8258     AC_MSG_RESULT([yes])
8259     BUILD_TYPE="$BUILD_TYPE AFMS"
8260 else
8261     AC_MSG_RESULT([no])
8262     WITHOUT_AFMS=YES
8263     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
8265 AC_SUBST(WITHOUT_AFMS)
8267 dnl ===================================================================
8268 dnl Test whether to include extra galleries
8269 dnl ===================================================================
8270 AC_MSG_CHECKING([whether to include extra galleries])
8271 if test "z$enable_extra_gallery" = "z" -o "z$enable_extra_gallery" = "zno" ; then
8272     AC_MSG_RESULT([no])
8273     WITH_EXTRA_GALLERY=NO
8274     OOOP_GALLERY_PACK=""
8275 else
8276     AC_MSG_RESULT([yes])
8277     WITH_EXTRA_GALLERY=YES
8278     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
8279     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
8280     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
8282 AC_SUBST(WITH_EXTRA_GALLERY)
8283 AC_SUBST(OOOP_GALLERY_PACK)
8285 dnl ===================================================================
8286 dnl Test whether to include extra templates
8287 dnl ===================================================================
8288 AC_MSG_CHECKING([whether to include extra templates])
8289 if test "z$enable_extra_template" = "z" -o "z$enable_extra_template" = "zno" ; then
8290     AC_MSG_RESULT([no])
8291     WITH_EXTRA_TEMPLATE=NO
8292     OOOP_TEMPLATES_PACK=""
8293 else
8294     AC_MSG_RESULT([yes])
8295     WITH_EXTRA_TEMPLATE=YES
8296     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
8297     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
8298     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
8300 AC_SUBST(WITH_EXTRA_TEMPLATE)
8301 AC_SUBST(OOOP_TEMPLATES_PACK)
8303 dnl ===================================================================
8304 dnl Test whether to include extra samples
8305 dnl ===================================================================
8306 AC_MSG_CHECKING([whether to include extra samples])
8307 if test "z$enable_extra_sample" = "z" -o "z$enable_extra_sample" = "zno" ; then
8308     AC_MSG_RESULT([no])
8309     WITH_EXTRA_SAMPLE=NO
8310     OOOP_SAMPLES_PACK=""
8311 else
8312     AC_MSG_RESULT([yes])
8313     WITH_EXTRA_SAMPLE=YES
8314     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
8315     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
8316     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
8318 AC_SUBST(WITH_EXTRA_SAMPLE)
8319 AC_SUBST(OOOP_SAMPLES_PACK)
8321 dnl ===================================================================
8322 dnl Test whether to include extra fonts
8323 dnl ===================================================================
8324 AC_MSG_CHECKING([whether to include extra fonts])
8325 if test "z$enable_extra_font" = "z" -o "z$enable_extra_font" = "zno" ; then
8326     AC_MSG_RESULT([no])
8327     WITH_EXTRA_FONT=NO
8328     OOOP_FONTS_PACK=""
8329 else
8330     AC_MSG_RESULT([yes])
8331     WITH_EXTRA_FONT=YES
8332     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
8333     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
8334     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
8336 AC_SUBST(WITH_EXTRA_FONT)
8337 AC_SUBST(OOOP_FONTS_PACK)
8339 dnl ===================================================================
8340 dnl Test whether to build global menu support
8341 dnl ===================================================================
8342 AC_MSG_CHECKING([whether to build global menu support])
8343 if test "z$enable_lomenubar" = "z" -o "z$enable_lomenubar" = "zno" ; then
8344     AC_MSG_RESULT([no])
8345     ENABLE_LOMENUBAR="FALSE"
8346 else
8347     AC_MSG_RESULT([yes])
8348     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]))
8349     ENABLE_LOMENUBAR="TRUE"
8351 AC_SUBST(ENABLE_LOMENUBAR)
8353 dnl ===================================================================
8354 dnl Test whether to enable online update service
8355 dnl ===================================================================
8356 AC_MSG_CHECKING([whether to enable online update])
8357 ENABLE_ONLINE_UPDATE=
8358 if test "z$enable_online_update" = "z" ; then
8359     if test "$_os" = "WINNT" -o "$_os" = "Darwin" ; then
8360         AC_MSG_RESULT([yes])
8361         ENABLE_ONLINE_UPDATE="TRUE"
8362     else
8363         AC_MSG_RESULT([no])
8364     fi
8365 else
8366     if test "z$enable_online_update" = "zyes" ; then
8367         AC_MSG_RESULT([yes])
8368         ENABLE_ONLINE_UPDATE="TRUE"
8369     else
8370         AC_MSG_RESULT([no])
8371     fi
8373 AC_SUBST(ENABLE_ONLINE_UPDATE)
8375 dnl ===================================================================
8376 dnl Test whether build target is Release Build
8377 dnl ===================================================================
8378 AC_MSG_CHECKING([whether build target is Release Build])
8379 if test "z$enable_release_build" = "z" -o "z$enable_release_build" = "zno" ; then
8380     AC_MSG_RESULT([no])
8381     ENABLE_RELEASE_BUILD="FALSE"
8382 else
8383     AC_MSG_RESULT([yes])
8384     ENABLE_RELEASE_BUILD="TRUE"
8386 AC_SUBST(ENABLE_RELEASE_BUILD)
8388 dnl ===================================================================
8389 dnl Test whether to enable ActiveX embedding
8390 dnl ===================================================================
8391 if test "$_os" = "WINNT"; then
8392     AC_MSG_CHECKING([whether to enable ActiveX embedding of LibreOffice components])
8393     if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
8394         ENABLE_ACTIVEX_COMPONENT="TRUE"
8395         AC_MSG_RESULT([yes])
8396         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
8397     else
8398         ENABLE_ACTIVEX_COMPONENT=""
8399         AC_MSG_RESULT([no])
8400     fi
8401     AC_SUBST(ENABLE_ACTIVEX_COMPONENT)
8402     AC_SUBST(SCPDEFS)
8405 AC_MSG_CHECKING([whether and how to use Xinerama])
8406 if test "$_os" = "Darwin"; then
8407     USE_XINERAMA=YES
8408     XINERAMA_LINK=dynamic
8409     AC_MSG_RESULT([yes])
8410 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
8411     if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
8412         # we have both versions, let the user decide but use the dynamic one
8413         # per default
8414         USE_XINERAMA=YES
8415         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
8416             XINERAMA_LINK=dynamic
8417         else
8418             XINERAMA_LINK=static
8419         fi
8420     elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
8421         # we have only the dynamic version
8422         USE_XINERAMA=YES
8423         XINERAMA_LINK=dynamic
8424     elif test -e "$XLIB/libXinerama.a"; then
8425         # static version
8426         if echo $host_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
8427             USE_XINERAMA=YES
8428             XINERAMA_LINK=static
8429         else
8430             USE_XINERAMA=NO
8431             XINERAMA_LINK=none
8432         fi
8433     else
8434         # no Xinerama
8435         USE_XINERAMA=NO
8436         XINERAMA_LINK=none
8437     fi
8438     if test "$USE_XINERAMA" = "YES"; then
8439         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
8440         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
8441             [AC_MSG_ERROR(Xinerama header not found.)], [])
8442         XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
8443         if test "$_os" = "FreeBSD"; then
8444             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
8445         fi
8446         if test "$_os" = "Linux"; then
8447             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
8448         fi
8449         AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
8450             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
8451     else
8452         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
8453     fi
8454 else
8455     USE_XINERAMA=NO
8456     XINERAMA_LINK=none
8457     AC_MSG_RESULT([no])
8459 AC_SUBST(USE_XINERAMA)
8460 AC_SUBST(XINERAMA_LINK)
8462 dnl ===================================================================
8463 dnl Checks for librsvg
8464 dnl ===================================================================
8466 dnl ENABLE_LIBRSVG is set to "" (for NO), SYSTEM or INTERNAL. The
8467 dnl SYSTEM_LIBRSVG, SYSTEM_GDKPIXBUF etc are redundant.
8469 ENABLE_LIBRSVG=""
8470 LIBRSVG_CFLAGS=""
8471 LIBRSVG_LIBS=""
8473 AC_MSG_CHECKING([what librsvg to use])
8475 case "$enable_librsvg" in
8476 no|disable)
8477     AC_MSG_RESULT([none])
8478     enable_librsvg=no
8479     ;;
8481 ""|yes|auto)
8482     if test $build_os = cygwin -o \
8483            $_os = Darwin; then
8484         dnl When building on/for these OSes always use the internal one,
8485         dnl if at all. Add more OSes above as needed.
8486         AC_MSG_RESULT([internal])
8487         enable_librsvg=internal
8488     elif test  $_os = iOS -o $_os = Android; then
8489         AC_MSG_RESULT([none])
8490         enable_librsvg=no
8491     else
8492         if test "$with_system_libs" = yes; then
8493             AC_MSG_RESULT([system])
8494             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8495             enable_librsvg=system
8496         elif test "$with_system_libs" = no; then
8497             AC_MSG_RESULT([internal])
8498             enable_librsvg=internal
8499         else
8500             AC_MSG_RESULT([checking further])
8501             PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14,, [:])
8502             if test -z "$LIBRSVG_PKG_ERRORS"; then
8503                 enable_librsvg=system
8504             else
8505                 enable_librsvg=internal
8506             fi
8507         fi
8508     fi
8509     ;;
8511 internal)
8512     AC_MSG_RESULT([internal])
8513     ;;
8515 system)
8516     if test $_os = WINNT -a "$WITH_MINGW" != yes; then
8517         AC_MSG_ERROR([Must use internal librsvg when building with MSVC])
8518     fi
8519     AC_MSG_RESULT([system])
8520     PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.14)
8521     ;;
8524     AC_MSG_ERROR([Incorrect --enable-librsvg option])
8525     ;;
8526 esac
8528 dnl By now enable_librsvg should be "system", "internal" or "no"
8529 case $enable_librsvg in
8530 system)
8531     ENABLE_LIBRSVG=SYSTEM
8532     SYSTEM_LIBRSVG=YES
8533     ;;
8535 internal)
8536     ENABLE_LIBRSVG=INTERNAL
8537     SYSTEM_LIBRSVG=NO
8538     BUILD_TYPE="$BUILD_TYPE LIBRSVG"
8539     ;;
8542     ENABLE_LIBRSVG=NO
8543     SYSTEM_LIBRSVG=NO
8544     ;;
8547     AC_MSG_ERROR([Internal configure script error, invalid enable_librsvg value "$enable_librsvg"])
8548     ;;
8549 esac
8551 AC_SUBST(ENABLE_LIBRSVG)
8552 AC_SUBST(LIBRSVG_CFLAGS)
8553 AC_SUBST(LIBRSVG_LIBS)
8554 AC_SUBST(SYSTEM_LIBRSVG)
8556 dnl ===================================================================
8557 dnl Test whether to build cairo or rely on the system version
8558 dnl ===================================================================
8560 SYSTEM_CAIRO=""
8562 AC_MSG_CHECKING([whether to use the system cairo])
8564 if test "$with_system_cairo" = yes -o \( "$with_system_libs" = yes -a "$with_system_cairo" != no \); then
8565     SYSTEM_CAIRO=YES
8566     AC_MSG_RESULT([yes])
8568     PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
8570     if test "$with_system_xrender_headers" = "yes"; then
8571          AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
8572          AC_RUN_IFELSE([AC_LANG_SOURCE([[
8573 #include <X11/extensions/Xrender.h>
8575 int main(int argc, char **argv) {
8576 #ifdef PictStandardA8
8577       return 0;
8578 #else
8579       return 1;
8580 #endif
8582         ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])
8583         ],[])
8584     fi
8585     MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libfontconfig-1.dll libfreetype-6.dll libpixman-1-0.dll libpng15-15.dll libcairo-2.dll"
8586 else
8587     AC_MSG_RESULT([no])
8589     if test $_os = Android; then
8590         dnl For Android cairo isn't
8591         dnl buildable yet.
8592         :
8593     elif test $_os = WINNT; then
8594         dnl We only need cairo for Windows if we
8595         dnl build librsvg or directx disabled
8596         if test "$ENABLE_LIBRSVG" != NO -o -z "$ENABLE_DIRECTX"; then
8597             BUILD_TYPE="$BUILD_TYPE CAIRO"
8598         fi
8599     else
8600         BUILD_TYPE="$BUILD_TYPE CAIRO"
8601     fi
8604 AC_SUBST(SYSTEM_CAIRO)
8605 AC_SUBST(CAIRO_CFLAGS)
8606 AC_SUBST(CAIRO_LIBS)
8609 dnl ===================================================================
8610 dnl Test whether to build gdk-pixbuf or rely on the system version
8611 dnl ===================================================================
8613 AC_MSG_CHECKING([whether to use the system gdk-pixbuf])
8615 dnl As long as the only thing we need gdk-pixbuf for is below
8616 dnl librsvg, use the same --enable-librsvg (possibly implied
8617 dnl by --with-system-libs) to override this.
8619 if test "$SYSTEM_LIBRSVG" = YES; then
8620     SYSTEM_GDKPIXBUF=YES
8621     AC_MSG_RESULT([yes])
8622 else
8623     case "$_os" in
8624     WINNT|Darwin|iOS|Android)
8625         SYSTEM_GDKPIXBUF=NO
8626         AC_MSG_RESULT([no])
8627         ;;
8628     *)
8629         SYSTEM_GDKPIXBUF=YES
8630         AC_MSG_RESULT([yes])
8631         ;;
8632     esac
8634 AC_SUBST(SYSTEM_GDKPIXBUF)
8636 dnl ===================================================================
8637 dnl Test whether to build GLib or rely on the system version
8638 dnl ===================================================================
8640 AC_MSG_CHECKING([whether to use the system GLib])
8642 dnl As long as the only thing we need GLib for is below
8643 dnl librsvg, use the same --enable-librsvg (possibly implied
8644 dnl by --with-system-libs) to override this.
8646 if test "$SYSTEM_LIBRSVG" = YES; then
8647     SYSTEM_GLIB=YES
8648     AC_MSG_RESULT([yes])
8649 else
8650     case "$_os" in
8651     WINNT|Darwin|iOS|Android)
8652         SYSTEM_GLIB=NO
8653         AC_MSG_RESULT([no])
8654         ;;
8655     *)
8656         SYSTEM_GLIB=YES
8657         AC_MSG_RESULT([yes])
8658         ;;
8659     esac
8661 AC_SUBST(SYSTEM_GLIB)
8663 dnl ===================================================================
8664 dnl Test whether to build gettext runtime (libintl) or rely on the
8665 dnl system version
8666 dnl ===================================================================
8668 AC_MSG_CHECKING([whether to use the system gettext runtime])
8670 if test "$with_system_gettext" = yes -o \( "$with_system_libs" = yes -a "$with_system_gettext" != no \); then
8671     SYSTEM_GETTEXT=YES
8672     AC_MSG_RESULT([yes])
8673 else
8674     case "$_os" in
8675     WINNT|Darwin|iOS|Android)
8676         SYSTEM_GETTEXT=NO
8677         AC_MSG_RESULT([no])
8678         ;;
8679     *)
8680         SYSTEM_GETTEXT=YES
8681         AC_MSG_RESULT([yes])
8682         ;;
8683     esac
8685 AC_SUBST(SYSTEM_GETTEXT)
8687 dnl ===================================================================
8688 dnl Test whether to build libcroco or rely on the system version
8689 dnl ===================================================================
8691 AC_MSG_CHECKING([whether to use the system libcroco])
8693 dnl As long as the only thing we need libcroco for is below
8694 dnl librsvg, use the same --enable-librsvg (possibly implied
8695 dnl by --with-system-libs) to override this.
8697 if test "$SYSTEM_LIBRSVG" = YES; then
8698     SYSTEM_LIBCROCO=YES
8699     AC_MSG_RESULT([yes])
8700 else
8701     case "$_os" in
8702     WINNT|Darwin|iOS|Android)
8703         SYSTEM_LIBCROCO=NO
8704         AC_MSG_RESULT([no])
8705         ;;
8706     *)
8707         SYSTEM_LIBCROCO=YES
8708         AC_MSG_RESULT([yes])
8709         ;;
8710     esac
8712 AC_SUBST(SYSTEM_LIBCROCO)
8714 dnl ===================================================================
8715 dnl Test whether to build Pango or rely on the system version
8716 dnl ===================================================================
8718 AC_MSG_CHECKING([whether to use the system pango])
8720 dnl As long as the only thing we need Pango for is below
8721 dnl librsvg, use the same --enable-librsvg (possibly implied
8722 dnl by --with-system-libs) to override this.
8724 if test "$SYSTEM_LIBRSVG" = YES; then
8725     SYSTEM_PANGO=YES
8726     AC_MSG_RESULT([yes])
8727 else
8728     case "$_os" in
8729     WINNT|Darwin|iOS|Android)
8730         SYSTEM_PANGO=NO
8731         AC_MSG_RESULT([no])
8732         ;;
8733     *)
8734         SYSTEM_PANGO=YES
8735         AC_MSG_RESULT([yes])
8736         ;;
8737     esac
8739 AC_SUBST(SYSTEM_PANGO)
8741 dnl ===================================================================
8742 dnl Test whether to build libgsf or rely on the system version
8743 dnl ===================================================================
8745 AC_MSG_CHECKING([whether to use the system libgsf])
8747 dnl As long as the only thing we need libgsf for is below librsvg (is
8748 dnl it?), use the same --enable-librsvg (possibly implied by
8749 dnl --with-system-libs) to override this.
8751 if test "$SYSTEM_LIBRSVG" = YES; then
8752     SYSTEM_LIBGSF=YES
8753     AC_MSG_RESULT([yes])
8754 else
8755     case "$_os" in
8756     WINNT|Darwin|iOS|Android)
8757         SYSTEM_LIBGSF=NO
8758         AC_MSG_RESULT([no])
8759         ;;
8760     *)
8761         SYSTEM_LIBGSF=YES
8762         AC_MSG_RESULT([yes])
8763         ;;
8764     esac
8766 AC_SUBST(SYSTEM_LIBGSF)
8768 dnl ===================================================================
8769 dnl Test whether to build libpng or rely on the system version
8770 dnl ===================================================================
8772 AC_MSG_CHECKING([whether to use the system libpng])
8774 dnl How should and does this interact with the checks for libpng
8775 dnl related to use of libpng in the quickstarter above? This needs to
8776 dnl be unified.
8778 if test "$with_system_libpng" = yes -o \( "$with_system_libs" = yes -a "$with_system_libpng" != no \); then
8779     SYSTEM_LIBPNG=YES
8780     AC_MSG_RESULT([yes])
8781 else
8782     case "$_os" in
8783     WINNT|Darwin|iOS|Android)
8784         SYSTEM_LIBPNG=NO
8785         AC_MSG_RESULT([no])
8786         ;;
8787     *)
8788         SYSTEM_LIBPNG=YES
8789         AC_MSG_RESULT([no])
8790         ;;
8791     esac
8793 AC_SUBST(SYSTEM_LIBPNG)
8795 dnl ===================================================================
8796 dnl Test whether to build libjpeg or rely on the system version
8797 dnl ===================================================================
8798 dnl FIXME: this is currently because we have jpeg-6b for our filters
8799 dnl        and jpeg-8 as dependency for librsvg
8800 dnl        this should be unified into using only one version for both
8802 AC_MSG_CHECKING([whether to use the system libjpeg])
8804 if test "$SYSTEM_JPEG" == "YES"; then
8805     SYSTEM_LIBJPEG=YES
8806     AC_MSG_RESULT([yes])
8807 else
8808     case "$_os" in
8809     WINNT|Darwin|iOS|Android)
8810         SYSTEM_LIBJPEG=NO
8811         AC_MSG_RESULT([no])
8812         ;;
8813     *)
8814         SYSTEM_LIBJPEG=YES
8815         AC_MSG_RESULT([yes])
8816         ;;
8817     esac
8819 AC_SUBST(SYSTEM_LIBJPEG)
8821 dnl ===================================================================
8822 dnl Check for runtime JVM search path
8823 dnl ===================================================================
8824 if test "$SOLAR_JAVA" != ""; then
8825     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
8826     if test -n "$with_jvm_path" && test "$with_jvm_path" != "no"; then
8827         AC_MSG_RESULT([yes])
8828         if ! test -d "$with_jvm_path"; then
8829             AC_MSG_ERROR(["$with_jvm_path" not a directory])
8830         fi
8831         if ! test -d "$with_jvm_path"jvm; then
8832             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
8833         fi
8834         JVM_ONE_PATH_CHECK="$with_jvm_path"
8835         AC_SUBST(JVM_ONE_PATH_CHECK)
8836     else
8837         AC_MSG_RESULT([no])
8838     fi
8841 dnl ===================================================================
8842 dnl Test for the presence of Ant and that it works
8843 dnl ===================================================================
8845 if test "$SOLAR_JAVA" != ""; then
8846     ANT_HOME=; export ANT_HOME
8847     WITH_ANT_HOME=; export WITH_ANT_HOME
8848     if test -z "$with_ant_home"; then
8849         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
8850     else
8851         if test "$_os" = "WINNT"; then
8852             with_ant_home=`cygpath -u "$with_ant_home"`
8853         fi
8854         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
8855         WITH_ANT_HOME=$with_ant_home
8856         ANT_HOME=$with_ant_home
8857     fi
8859     if test -z "$ANT"; then
8860         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
8861     else
8862         # resolve relative or absolute symlink
8863         while test -h "$ANT"; do
8864             a_cwd=`pwd`
8865             a_basename=`basename "$ANT"`
8866             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
8867             cd "`dirname "$ANT"`"
8868             cd "`dirname "$a_script"`"
8869             ANT="`pwd`"/"`basename "$a_script"`"
8870             cd "$a_cwd"
8871         done
8873         AC_MSG_CHECKING([if $ANT works])
8874         cat > conftest.java << EOF
8875         public class conftest {
8876             int testmethod(int a, int b) {
8877                     return a + b;
8878             }
8879         }
8882         cat > conftest.xml << EOF
8883         <project name="conftest" default="conftest">
8884         <target name="conftest">
8885             <javac srcdir="." includes="conftest.java">
8886             </javac>
8887         </target>
8888         </project>
8891         oldJAVA_HOME=$JAVA_HOME
8892         if test "$JAVACISGCJ" = "yes"; then
8893             JAVA_HOME=; export JAVA_HOME
8894             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
8895         else
8896             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
8897         fi
8898         AC_TRY_EVAL(ant_cmd)
8899         if test $? = 0 && test -f ./conftest.class ; then
8900             AC_MSG_RESULT([Ant works])
8901             if test -z "$WITH_ANT_HOME"; then
8902                 ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
8903                 if test -z "$ANT_HOME"; then
8904                     ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
8905                 fi
8906             else
8907                 ANT_HOME="$WITH_ANT_HOME"
8908             fi
8909         else
8910             echo "configure: Ant test failed" >&5
8911             cat conftest.java >&5
8912             cat conftest.xml >&5
8913             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
8914             ANT_HOME=""
8915             echo "Ant does not work - Some Java projects will not build!" >>warn
8916         fi
8917         JAVA_HOME=$oldJAVA_HOME
8918         rm -f conftest* core core.* *.core
8919     fi
8920     if test -z "$ANT_HOME"; then
8921         ANT_HOME="NO_ANT_HOME"
8922     fi
8923     AC_SUBST(ANT_HOME)
8925     dnl Checking for ant.jar
8926     if test "$ANT_HOME" != "NO_ANT_HOME"; then
8927         AC_MSG_CHECKING([Ant lib directory])
8928         if test -f $ANT_HOME/lib/ant.jar; then
8929             ANT_LIB="$ANT_HOME/lib"
8930         else
8931             if test -f $ANT_HOME/ant.jar; then
8932                 ANT_LIB="$ANT_HOME"
8933             else
8934                 if test -f /usr/share/java/ant.jar; then
8935                     ANT_LIB=/usr/share/java
8936                 else
8937                     if test -f /usr/share/ant-core/lib/ant.jar; then
8938                         ANT_LIB=/usr/share/ant-core/lib
8939                     else
8940                         if test -f $ANT_HOME/lib/ant/ant.jar; then
8941                             ANT_LIB="$ANT_HOME/lib/ant"
8942                         else
8943                             if test -f /usr/share/lib/ant/ant.jar; then
8944                                 ANT_LIB=/usr/share/lib/ant
8945                             else
8946                                 AC_MSG_ERROR([Ant libraries not found!])
8947                             fi
8948                         fi
8949                     fi
8950                 fi
8951             fi
8952         fi
8953         AC_MSG_RESULT([Ant lib directory found.])
8954     fi
8955     AC_SUBST(ANT_LIB)
8957     ant_minver=1.6.0
8958     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
8960     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
8961     ant_version=`$ANT -version | $AWK '{ print $4; }'`
8962     ant_version_major=`echo $ant_version | cut -d. -f1`
8963     ant_version_minor=`echo $ant_version | cut -d. -f2`
8964     echo "configure: ant_version $ant_version " >&5
8965     echo "configure: ant_version_major $ant_version_major " >&5
8966     echo "configure: ant_version_minor $ant_version_minor " >&5
8967     if test "$ant_version_major" -ge "2"; then
8968         AC_MSG_RESULT([yes, $ant_version])
8969     elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
8970         AC_MSG_RESULT([yes, $ant_version])
8971     else
8972         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
8973     fi
8975     if test "$ENABLE_MEDIAWIKI" = "YES"; then
8976         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
8977         rm -rf confdir
8978         mkdir confdir
8979         cat > conftest.java << EOF
8980             public class conftest {
8981                 int testmethod(int a, int b) {
8982                     return a + b;
8983                 }
8984             }
8987         cat > conftest.xml << EOF
8988             <project name="conftest" default="conftest">
8989             <target name="conftest" depends="copytest">
8990                 <javac srcdir="." includes="conftest.java">
8991                 </javac>
8992             </target>
8993             <target name="copytest">
8994                  <copy todir="confdir">
8995                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
8996                  <filterset/>
8997                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
8998                  </copy>
8999             </target>
9000             </project>
9003         if test "$JAVACISGCJ" = "yes"; then
9004             JAVA_HOME=; export JAVA_HOME
9005             ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
9006         else
9007             ant_cmd="$ANT -buildfile conftest.xml 1>&2"
9008         fi
9009         AC_TRY_EVAL(ant_cmd)
9010         if test $? = 0 && test -f ./conftest.class ; then
9011             AC_MSG_RESULT([yes])
9012             rm -rf confdir
9013         else
9014             echo "configure: Ant test failed" >&5
9015             cat conftest.java >&5
9016             cat conftest.xml >&5
9017             rm -rf confdir
9018             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
9019         fi
9020     fi
9021     rm -f conftest* core core.* *.core
9024 OOO_JUNIT_JAR=
9025 if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
9026     AC_MSG_CHECKING([for JUnit 4])
9027     if test "$with_junit" = "yes"; then
9028         if test -e /usr/share/java/junit4.jar; then
9029             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
9030         else
9031            if test -e /usr/share/lib/java/junit.jar; then
9032               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
9033            else
9034               OOO_JUNIT_JAR=/usr/share/java/junit.jar
9035            fi
9036         fi
9037     else
9038         OOO_JUNIT_JAR=$with_junit
9039     fi
9040     if test "$_os" = "WINNT"; then
9041         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
9042     fi
9043     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
9044         grep org/junit/Before.class > /dev/null 2>&5
9045     if test $? -eq 0; then
9046         # check if either class-path entry is available for hamcrest or
9047         # it's bundled
9048         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |grep -q hamcrest || \
9049             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |grep -q 'Class-Path: hamcrest'; then
9050             AC_MSG_RESULT([$OOO_JUNIT_JAR])
9051         else
9052             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
9053 provide a full junit jar or use --without-junit])
9054         fi
9055     else
9056         AC_MSG_RESULT([no])
9057         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
9058 location (/usr/share/java), specify its pathname via
9059 --with-junit=..., or disable it via --without-junit])
9060     fi
9062 AC_SUBST(OOO_JUNIT_JAR)
9064 dnl ===================================================================
9065 dnl Product version
9066 dnl ===================================================================
9067 AC_MSG_CHECKING([for product version])
9068 PRODUCTVERSION=AC_PACKAGE_VERSION
9069 AC_MSG_RESULT([$PRODUCTVERSION])
9070 AC_SUBST(PRODUCTVERSION)
9072 dnl ===================================================================
9073 dnl Dealing with l10n options
9074 dnl ===================================================================
9075 AC_MSG_CHECKING([which languages to be built])
9076 # get list of all languages
9077 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
9078 # the sed command does the following:
9079 #   + if a line ends with a backslash, append the next line to it
9080 #   + adds " on the beginning of the value (after =)
9081 #   + adds " at the end of the value
9082 #   + removes en-US; we want to put it on the beginning
9083 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
9084 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' solenv/inc/langlist.mk)]
9085 ALL_LANGS="en-US $completelangiso"
9086 # check the configured localizations
9087 WITH_LANG="$with_lang"
9088 if test -z "$WITH_LANG"; then
9089     AC_MSG_RESULT([en-US])
9090 else
9091     AC_MSG_RESULT([$WITH_LANG])
9092     GIT_REPO_NAMES="$GIT_REPO_NAMES translations"
9094 # check that the list is valid
9095 for lang in $WITH_LANG ; do
9096     test "$lang" = "ALL" && continue;
9097     # need to check for the exact string, so add space before and after the list of all languages
9098     for vl in $ALL_LANGS ; do
9099         if test "$vl" = "$lang" ; then
9100            break;
9101         fi
9102     done
9103     if test "$vl" != "$lang" ; then
9104         AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
9105     fi
9106 done
9107 # list with substituted ALL
9108 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
9109 # this variable is used only by bin/distro-install-* helper scripts
9110 # they need a real list of languages
9111 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
9112 AC_SUBST(ALL_LANGS)
9113 AC_SUBST(WITH_LANG)
9114 AC_SUBST(WITH_LANG_LIST)
9115 AC_SUBST(GIT_REPO_NAMES)
9117 AC_MSG_CHECKING([for another 'intro' bitmap])
9118 INTRO_BITMAP=
9119 if test -z "$with_intro_bitmap" -o "$with_intro_bitmap" = "no" ; then
9120     INTRO_BITMAP=
9121     AC_MSG_RESULT([none])
9122 else
9123     case "$with_intro_bitmap" in
9124     *.png) INTRO_BITMAP="$with_intro_bitmap" ;;
9125     *)     AC_MSG_WARN([Intro bitmap should be a .png file!]) ;;
9126     esac
9127     AC_MSG_RESULT([$INTRO_BITMAP])
9129 AC_SUBST(INTRO_BITMAP)
9131 AC_MSG_CHECKING([for custom 'intro' progress bar color])
9132 PROGRESSBARCOLOR=
9133 if test -z "$with_intro_progressbar_color" ; then
9134    PROGRESSBARCOLOR="126,170,23"
9135    AC_MSG_RESULT([none])
9136 else
9137    PROGRESSBARCOLOR="$with_intro_progressbar_color"
9138    AC_MSG_RESULT([$PROGRESSBARCOLOR])
9140 AC_SUBST(PROGRESSBARCOLOR)
9142 AC_MSG_CHECKING([for custom 'intro' progress bar size])
9143 PROGRESSSIZE=
9144 if test -z "$with_intro_progressbar_size" ; then
9145    PROGRESSSIZE="319,10"
9146    AC_MSG_RESULT([none])
9147 else
9148    PROGRESSSIZE="$with_intro_progressbar_size"
9149    AC_MSG_RESULT([$PROGRESSSIZE])
9151 AC_SUBST(PROGRESSSIZE)
9153 AC_MSG_CHECKING([for custom 'intro' progress bar position])
9154 PROGRESSPOSITION=
9155 if test -z "$with_intro_progressbar_position" ; then
9156    PROGRESSPOSITION="164,225"
9157    AC_MSG_RESULT([none])
9158 else
9159    PROGRESSPOSITION="$with_intro_progressbar_position"
9160    AC_MSG_RESULT([$PROGRESSPOSITION])
9162 AC_SUBST(PROGRESSPOSITION)
9164 AC_MSG_CHECKING([for custom 'intro' progress bar frame color])
9165 PROGRESSFRAMECOLOR=
9166 if test -z "$with_intro_progressbar_frame_color" ; then
9167    PROGRESSFRAMECOLOR="207,208,211"
9168    AC_MSG_RESULT([none])
9169 else
9170    PROGRESSFRAMECOLOR="$with_intro_progressbar_frame_color"
9171    AC_MSG_RESULT([$PROGRESSFRAMECOLOR])
9173 AC_SUBST(PROGRESSFRAMECOLOR)
9175 AC_MSG_CHECKING([for another 'about' bitmap])
9176 ABOUT_BITMAP=
9177 if test -z "$with_about_bitmap" -o "$with_about_bitmap" = "no" ; then
9178     ABOUT_BITMAP=
9179     AC_MSG_RESULT([none])
9180 else
9181    case "$with_about_bitmap" in
9182    *.png) ABOUT_BITMAP="$with_about_bitmap" ;;
9183    *)     AC_MSG_WARN([About bitmap should be a .png file!]) ;;
9184    esac
9185    AC_MSG_RESULT([$ABOUT_BITMAP])
9187 AC_SUBST(ABOUT_BITMAP)
9189 AC_MSG_CHECKING([for another 'start center left' bitmap])
9190 STARTCENTER_LEFT_BITMAP=
9191 if test -z "$with_startcenter_left_bitmap" -o "$with_startcenter_left_bitmap" = "no" ; then
9192    STARTCENTER_LEFT_BITMAP=
9193    AC_MSG_RESULT([none])
9194 else
9195    case "$with_startcenter_left_bitmap" in
9196       *.png) STARTCENTER_LEFT_BITMAP="$with_startcenter_left_bitmap" ;;
9197       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9198    esac
9199    AC_MSG_RESULT([$STARTCENTER_LEFT_BITMAP])
9201 AC_SUBST(STARTCENTER_LEFT_BITMAP)
9203 AC_MSG_CHECKING([for another 'start center right' bitmap])
9204 STARTCENTER_RIGHT_BITMAP=
9205 if test -z "$with_startcenter_right_bitmap" -o "$with_startcenter_right_bitmap" = "no" ; then
9206    STARTCENTER_RIGHT_BITMAP=
9207    AC_MSG_RESULT([none])
9208 else
9209    case "$with_startcenter_right_bitmap" in
9210       *.png) STARTCENTER_RIGHT_BITMAP="$with_startcenter_right_bitmap" ;;
9211       *)     AC_MSG_WARN([Startcenter right bitmap should be a .png file!]) ;;
9212    esac
9213    AC_MSG_RESULT([$STARTCENTER_RIGHT_BITMAP])
9215 AC_SUBST(STARTCENTER_RIGHT_BITMAP)
9217 AC_MSG_CHECKING([for another 'start center rtl left' bitmap])
9218 STARTCENTER_RTL_LEFT_BITMAP=
9219 if test -z "$with_startcenter_rtl_left_bitmap" -o "$with_startcenter_rtl_left_bitmap" = "no" ; then
9220    STARTCENTER_RTL_LEFT_BITMAP=
9221    AC_MSG_RESULT([none])
9222 else
9223    case "$with_startcenter_rtl_left_bitmap" in
9224       *.png) STARTCENTER_RTL_LEFT_BITMAP="$with_startcenter_rtl_left_bitmap" ;;
9225       *)     AC_MSG_WARN([Startcenter rtl left bitmap should be a .png file!]) ;;
9226    esac
9227    AC_MSG_RESULT([$STARTCENTER_RTL_LEFT_BITMAP])
9229 AC_SUBST(STARTCENTER_RTL_LEFT_BITMAP)
9231 AC_MSG_CHECKING([for another 'start center rtl right' bitmap])
9232 STARTCENTER_RTL_RIGHT_BITMAP=
9233 if test -z "$with_startcenter_rtl_right_bitmap" -o "$with_startcenter_rtl_right_bitmap" = "no" ; then
9234    STARTCENTER_RTL_RIGHT_BITMAP=
9235    AC_MSG_RESULT([none])
9236 else
9237    case "$with_startcenter_rtl_right_bitmap" in
9238       *.png) STARTCENTER_RTL_RIGHT_BITMAP="$with_startcenter_rtl_right_bitmap" ;;
9239       *)     AC_MSG_WARN([Startcenter rtl right bitmap should be a .png file!]) ;;
9240    esac
9241    AC_MSG_RESULT([$STARTCENTER_RTL_RIGHT_BITMAP])
9243 AC_SUBST(STARTCENTER_RTL_RIGHT_BITMAP)
9245 AC_MSG_CHECKING([for another 'start center space' bitmap])
9246 STARTCENTER_SPACE_BITMAP=
9247 if test -z "$with_startcenter_space_bitmap" -o "$with_startcenter_space_bitmap" = "no" ; then
9248    STARTCENTER_SPACE_BITMAP=
9249    AC_MSG_RESULT([none])
9250 else
9251    case "$with_startcenter_space_bitmap" in
9252       *.png) STARTCENTER_SPACE_BITMAP="$with_startcenter_space_bitmap" ;;
9253       *)     AC_MSG_WARN([Startcenter left bitmap should be a .png file!]) ;;
9254    esac
9255    AC_MSG_RESULT([$STARTCENTER_SPACE_BITMAP])
9257 AC_SUBST(STARTCENTER_SPACE_BITMAP)
9259 OOO_VENDOR=
9260 AC_MSG_CHECKING([for vendor])
9261 if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
9262     AC_MSG_RESULT([not set])
9263 else
9264     OOO_VENDOR="$with_vendor"
9265     AC_MSG_RESULT([$OOO_VENDOR])
9267 AC_SUBST(OOO_VENDOR)
9269 UNIXWRAPPERNAME=
9270 AC_MSG_CHECKING([for UNIX wrapper name])
9271 if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
9272     AC_MSG_RESULT([not set])
9273 else
9274     UNIXWRAPPERNAME="$with_unix_wrapper"
9275     AC_MSG_RESULT([$UNIXWRAPPERNAME])
9277 AC_SUBST(UNIXWRAPPERNAME)
9279 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
9280 if test "$with_compat_oowrappers" = "yes" ; then
9281     WITH_COMPAT_OOWRAPPERS=YES
9282     AC_MSG_RESULT(yes)
9283 else
9284     WITH_COMPAT_OOWRAPPERS=
9285     AC_MSG_RESULT(no)
9287 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
9289 AC_MSG_CHECKING([for product name])
9290 PRODUCTNAME=AC_PACKAGE_NAME
9291 AC_MSG_RESULT([$PRODUCTNAME])
9292 AC_SUBST(PRODUCTNAME)
9294 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr [[:upper:]] [[:lower:]]`
9295 AC_MSG_CHECKING([for install dirname])
9296 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes" ; then
9297    INSTALLDIRNAME="$with_install_dirname"
9299 AC_MSG_RESULT([$INSTALLDIRNAME])
9300 AC_SUBST(INSTALLDIRNAME)
9302 AC_MSG_CHECKING([for prefix])
9303 test "x$prefix" = xNONE && prefix=$ac_default_prefix
9304 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
9305 PREFIXDIR="$prefix"
9306 AC_MSG_RESULT([$PREFIXDIR])
9307 AC_SUBST(PREFIXDIR)
9309 AC_MSG_CHECKING([for libdir])
9310 LIBDIR=[$(eval echo $(eval echo $libdir))]
9311 AC_MSG_RESULT([$LIBDIR])
9312 AC_SUBST(LIBDIR)
9314 AC_MSG_CHECKING([for data dir])
9315 DATADIR=[$(eval echo $(eval echo $datadir))]
9316 AC_MSG_RESULT([$DATADIR])
9317 AC_SUBST(DATADIR)
9319 AC_MSG_CHECKING([for man dir])
9320 MANDIR=[$(eval echo $(eval echo $mandir))]
9321 AC_MSG_RESULT([$MANDIR])
9322 AC_SUBST(MANDIR)
9324 AC_MSG_CHECKING([for doc dir])
9325 DOCDIR=[$(eval echo $(eval echo $docdir))]
9326 AC_MSG_RESULT([$DOCDIR])
9327 AC_SUBST(DOCDIR)
9329 AC_MSG_CHECKING([for install dir])
9330 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
9331 AC_MSG_RESULT([$INSTALLDIR])
9332 AC_SUBST(INSTALLDIR)
9334 AC_MSG_CHECKING([whether to statically link to Gtk])
9335 if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
9336     ENABLE_STATIC_GTK="TRUE"
9337     AC_MSG_RESULT([yes])
9338 else
9339     ENABLE_STATIC_GTK="FALSE"
9340     AC_MSG_RESULT([no])
9342 AC_SUBST(ENABLE_STATIC_GTK)
9344 AC_MSG_CHECKING([whether to use layout dialogs])
9345 if test -n "$enable_layout" && test "$enable_layout" != "no"; then
9346     ENABLE_LAYOUT="TRUE"
9347     AC_MSG_RESULT([yes])
9348 else
9349     ENABLE_LAYOUT="FALSE"
9350     AC_MSG_RESULT([no])
9352 AC_SUBST(ENABLE_LAYOUT)
9354 # ===================================================================
9355 # De- or increase default verbosity of build process
9356 # ===================================================================
9357 AC_MSG_CHECKING([build verbosity])
9358 if test -n "$enable_verbose"; then
9359     if test "$enable_verbose" = "yes"; then
9360         VERBOSE="TRUE"
9361         AC_MSG_RESULT([high])
9362     fi
9363     if test "$enable_verbose" = "no"; then
9364         VERBOSE="FALSE"
9365         AC_MSG_RESULT([low])
9366     fi
9367 else
9368     AC_MSG_RESULT([not set])
9370 AC_SUBST(VERBOSE)
9372 dnl ===================================================================
9373 dnl Use zenity during build
9374 dnl ===================================================================
9375 AC_MSG_CHECKING([whether to use zenity during build])
9376 if test "$enable_zenity" = "yes"; then
9377     AC_MSG_RESULT([yes])
9378     AC_PATH_PROGS( ZNTY, zenity )
9379     if test -z "$ZNTY"; then
9380         ENABLE_ZENITY=FALSE
9381     else
9382         ENABLE_ZENITY=TRUE
9383     fi
9384 else
9385     ENABLE_ZENITY=FALSE
9386     AC_MSG_RESULT([no])
9388 AC_SUBST(ENABLE_ZENITY)
9391 dnl ===================================================================
9392 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
9393 dnl --enable-dependency-tracking configure option
9394 dnl ===================================================================
9395 AC_MSG_CHECKING([whether to enable dependency tracking])
9396 if test "$enable_dependency_tracking" = "no"; then
9397     nodep=TRUE
9398     AC_MSG_RESULT([no])
9399 else
9400     AC_MSG_RESULT([yes])
9402 AC_SUBST(nodep)
9404 dnl ===================================================================
9405 dnl Number of CPUs to use during the build
9406 dnl ===================================================================
9407 AC_MSG_CHECKING([for number of processors to use])
9408 if test -n "$with_num_cpus"; then
9409     BUILD_NCPUS=$with_num_cpus
9410 else
9411     case `uname -s` in
9413     Darwin|FreeBSD|NetBSD|OpenBSD)
9414         BUILD_NCPUS=`sysctl -n hw.ncpu`
9415         ;;
9417     *)
9418         BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
9419         ;;
9420     esac
9422     # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
9423     # unexpected format, 'wc -l' will have returned 0.
9424     if test "$BUILD_NCPUS" -eq 0; then
9425         BUILD_NCPUS=1
9426     fi
9428 AC_MSG_RESULT([$BUILD_NCPUS])
9429 AC_SUBST(BUILD_NCPUS)
9431 # ===================================================================
9432 # Creating bigger shared library to link against
9433 # ===================================================================
9434 AC_MSG_CHECKING([whether to create a big library for better performance])
9435 MERGELIBS=
9436 if test "$enable_mergelibs" = "yes"; then
9437     MERGELIBS="TRUE"
9438     AC_MSG_RESULT([yes])
9439 else
9440     AC_MSG_RESULT([no])
9442 AC_SUBST(MERGELIBS)
9444 dnl ===================================================================
9445 dnl Number of parallel jobs to be executed by dmake
9446 dnl ===================================================================
9447 AC_MSG_CHECKING([for maximum of jobs per processor])
9448 BUILD_MAX_JOBS="1"
9449 if test "z$with_max_jobs" != "z"; then
9450     BUILD_MAX_JOBS="$with_max_jobs"
9451 else
9452     if test "$enable_icecream" = "yes" ; then
9453         BUILD_MAX_JOBS="10"
9454     fi
9456 AC_MSG_RESULT([$BUILD_MAX_JOBS])
9457 AC_SUBST(BUILD_MAX_JOBS)
9459 # =====================================================================
9460 # determine the parallelism for gnu make
9461 # =====================================================================
9462 AC_MSG_CHECKING([for maximum parallelism for gmake])
9463 if test $BUILD_MAX_JOBS -gt $BUILD_NCPUS ; then
9464     GMAKE_PARALLELISM="$BUILD_MAX_JOBS"
9465 else
9466     GMAKE_PARALLELISM="$BUILD_NCPUS"
9468 GMAKE_MODULE_PARALLELISM="$BUILD_MAX_JOBS"
9469 if test "$no_parallelism_make" = "YES" ; then
9470     if test -z "$with_num_cpus"; then
9471         GMAKE_PARALLELISM="1";
9472         if test $GMAKE_MODULE_PARALLELISM -gt 1 ; then
9473             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
9474             if test -z "$with_num_cpus"; then
9475                 echo "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this." >> warn
9476             fi
9477             GMAKE_MODULE_PARALLELISM="1"
9478         fi
9479     else
9480         GMAKE_PARALLELISM="$BUILD_NCPUS";
9481         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
9482     fi
9485 # GMAKE_PARALLELISM is used in tail_build
9486 # GMAKE_MODULE_PARALLELISM is used when building individual gbuildified module
9487 AC_MSG_RESULT([per module:$GMAKE_MODULE_PARALLELISM, for tail_build:$GMAKE_PARALLELISM])
9488 AC_SUBST(GMAKE_PARALLELISM)
9489 AC_SUBST(GMAKE_MODULE_PARALLELISM)
9491 dnl ===================================================================
9492 dnl Setting up the environment.
9493 dnl ===================================================================
9494 echo "setting up the build environment variables..."
9496 if test -z "$COMPATH"; then
9497     AC_MSG_ERROR([No compiler found.])
9499 AC_SUBST(COMPATH)
9501 AC_MSG_CHECKING([solver path])
9502 if test -z "$with_local_solver"; then
9503     LOCAL_SOLVER="DEFAULT"
9504     AC_MSG_RESULT([default])
9505 else
9506     LOCAL_SOLVER=$with_local_solver
9507     AC_MSG_RESULT([$with_local_solver])
9509 AC_SUBST(LOCAL_SOLVER)
9511 AC_SUBST(BUILD_TYPE)
9513 if test "$WITH_MINGW" != "yes" ; then
9514     MINGW_EXTERNAL_DLLS=
9515 else
9516     for DLL in $MINGW_EXTERNAL_DLLS ; do
9517         AC_MSG_CHECKING([for $DLL])
9518         if ! test -f "/usr/i686-w64-mingw32/sys-root/mingw/bin/$DLL" ; then
9519             AC_MSG_ERROR([Could not find $DLL, install the appropriate mingw32-<package>, not only mingw32-<package>-devel.])
9520         fi
9521         AC_MSG_RESULT([/usr/i686-w64-mingw32/sys-root/mingw/bin/$DLL])
9522     done
9524 AC_SUBST(MINGW_EXTERNAL_DLLS)
9526 # make sure config.guess is +x; we execute config.guess, so it has to be so;
9527 chmod +x ./config.guess
9529 dnl Setting up the post_download check script
9530 dnl Using autoconf here, so that the migration from the previous state
9531 dnl (checks for the additional Windows downloads were directly in
9532 dnl configure.in) is as easy as possible
9533 echo "setting up the post_download check script"
9534 autoconf post_download.in > post_download
9535 chmod +x post_download
9537 # Generate a configuration timestamp we can use for deps
9538 if test -f set_soenv; then
9539     mv -f set_soenv set_soenv.last
9540 else
9541     echo > set_soenv.last
9544 AC_CONFIG_FILES([ooo.lst set_soenv Makefile bin/repo-list desktop/scripts/soffice.sh])
9545 AC_OUTPUT
9547 # make sure this is executable
9548 chmod +x desktop/scripts/soffice.sh
9550 # touch the config timestamp file set_soenv.stamp
9551 if test ! -f set_soenv.stamp; then
9552     echo > set_soenv.stamp
9553 elif diff set_soenv set_soenv.last >/dev/null 2>&1; then
9554     echo "Configuration unchanged - avoiding scp2 stamp update"
9555 else
9556     echo > set_soenv.stamp
9559 dnl Run the set_soenv script to setup the Env.Host.sh script that sets
9560 dnl environment variables for the build.
9561 chmod +x set_soenv
9563 ./set_soenv
9565 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: