xref: /aoo42x/main/configure.ac (revision c1d0fc05)
1dnl /******************************************************************
2dnl *     vi:set sw=3 ts=3 et:
3dnl *
4dnl * Name: configure.in
5dnl * Auth: Willem van Dorp, Ross Nicholson, Oisin Boydell - Sun Microsystems Ireland
6dnl * Date: $Date: 2008-09-08 07:38:40 $
7dnl *
8dnl * Desc: This file serves as input for the GNU autoconf package
9dnl *       in order to create a configure script.
10dnl *       In this stage configure just checks the pre-requisites
11dnl *       necessary to build OpenOffice.org
12dnl *
13dnl *
14dnl ******************************************************************/
15AC_REVISION( $Revision: 1.290 $ )
16AC_PREREQ(2.50)
17AC_INIT()
18echo "$@" >config.parms
19AC_ARG_WITH(gnu-patch,
20[  --with-gnu-patch        Specify location of GNU patch on Solaris or FreeBSD
21],,)
22AC_ARG_WITH(agg,
23[  --without-agg           Disable the use of agg altogether
24],,with_agg=yes)
25AC_ARG_WITH(gnu-cp,
26[  --with-gnu-cp           Specify location of GNU cp on Solaris or FreeBSD
27],,)
28AC_ARG_WITH(gperf,
29[  --with-gperf           Specify location of gperf on Solaris or FreeBSD
30],,)
31AC_ARG_ENABLE(graphite,
32[  --enable-graphite       Enables the compilation of Graphite smart font rendering
33],,)
34AC_ARG_WITH(system-graphite,
35[  --with-system-graphite    use graphite library already installed on system
36],,)
37AC_ARG_ENABLE(ldap,
38[  --disable-ldap          Disables the use of LDAP backend via Netscape/Mozilla
39                          or OpenLDAP LDAP SDK
40],,)
41AC_ARG_ENABLE(fetch-external,
42[  --disable-fetch-external Disables fetching external tarballs from web sources.
43],,)
44AC_ARG_WITH(external-tar,
45[  --with-external-tar=<TARFILE PATH>   Specify path to tarfiles manually ],
46[ TARFILE_LOCATION="$withval"
47])
48AC_ARG_WITH(openldap,
49[  --with-openldap         Enables the use of the OpenLDAP LDAP SDK instead
50                          of the Netscape/Mozilla one
51],,)
52AC_ARG_ENABLE(lockdown,
53[  --enable-lockdown       Enables the gconf integration work in OOo
54],,)
55AC_ARG_ENABLE(vba,
56[  --disable-vba           disables the vba compatibility feature
57],,)
58AC_ARG_WITH(vba-package-format,
59[  --with-vba-package-format   specify package format for vba compatibility api.
60                          Specifying  "builtin" means the api component and
61                          associated type library are  part of the installation set.
62                          Specifying "extn" creates an uno extension that is
63                          part of the installation set ( located in the program
64                          directory ) that MUST be optionly registered using
65                          either the unopkg executeable or the extension manager
66                          gui.
67
68                          Note: "builtin" is the default, "extn" can cause
69                          problems.
70                          Usage: --with-vba-package-format="builtin" or
71                                 --with-vba-package-format="extn"
72],,)
73AC_ARG_ENABLE(pch,
74[  --enable-pch            EXPERIMENTAL: Enables precompiled header support for C++.
75],,)
76AC_ARG_ENABLE(mozilla,
77[  --disable-mozilla       OO.o usually includes a strangely hacked up mozilla
78                          binary for your platform, to build without this
79                          version, use this option.
80],,enable_mozilla="yes")
81AC_ARG_WITH(fonts,
82[  --without-fonts         OOo includes some third-party fonts to provide a reliable
83                          basis for help content, templates, samples, etc.
84                          When these fonts are already known to be available on the
85                          system then you should use this option.
86],,)
87AC_ARG_WITH(ppds,
88[  --without-ppds          Removes Postscript Printer definition files from
89                          openoffice.org installation set, for people building
90                          for specific distributions where PPDs are known to be
91                          already available (every recent distro with CUPS
92                          backend)
93],,)
94AC_ARG_WITH(afms,
95[  --without-afms          Removes bitmap font files from openoffice.org
96                          installation set, for people building for specific
97                          distributions where AFM files or TrueType Fonts
98                          are known to be available.
99],,)
100AC_ARG_ENABLE(epm,
101[  --disable-epm           OO.o includes self-packaging code, that requires
102                          epm, however epm is useless for large scale
103                          package building.
104],,enable_epm="yes")
105AC_ARG_WITH(epm,
106[  --with-epm		  Decides which epm to use. Default is to use
107			  the one from the system if one is built. When
108			  either this is not there or you say =internal
109			  epm will be built.
110],,)
111AC_ARG_WITH(package-format,
112[  --with-package-format   specify package format(s) for OOo installsets.
113                          Default is "normal" one of the OS/Distribution.
114
115                          Usage: --with-package-format="foo bar"
116],,)
117AC_ARG_ENABLE(odk,
118[  --disable-odk           OO.o includes an ODK, office development kit
119                          which some packagers may with to build without
120],,enable_odk="yes")
121AC_ARG_ENABLE(mathmldtd,
122[  --disable-mathmldtd     disable mathmldtd
123                          (useful for distributions that want to avoid packaging
124                          it)
125],,enable_mathmldtd="yes")
126AC_ARG_ENABLE(evolution2,
127[  --enable-evolution2     Allows the built-in evolution 2 addressbook
128                          connectivity build to be enabled.
129],,)
130AC_ARG_WITH(system-stdlibs,
131[  --with-system-stdlibs   use libstdc++/libgcc_s already on system
132],,)
133AC_ARG_ENABLE(cups,
134[  --disable-cups          disable CUPS support (for printing on UNIX)
135],,enable_cups=yes)
136AC_ARG_ENABLE(fontconfig,
137[  --disable-fontconfig    disable support for the fontconfig library
138],,enable_fontconfig=yes)
139AC_ARG_ENABLE(directx,
140[  --disable-directx       Remove DirectX implementation for the new XCanvas
141                          interface. The DirectX support requires more stuff
142                          installed on Windows to compile.
143                          (DirectX SDK, GDI+ libs)
144],,enable_directx=yes)
145AC_ARG_ENABLE(activex,
146[  --disable-activex       Disable the use of ActiveX for windows build.
147                          This switch is mandatory when using VC++ 2005/2008 Express.
148],,)
149
150AC_ARG_ENABLE(atl,
151[  --disable-atl          Disable the use of ATL for windows build.
152                          This switch is mandatory when using VC++ 2005/2008 Express.
153],,)
154
155AC_ARG_ENABLE(symbols,
156[  --enable-symbols        Include debugging symbols in output.
157                          WARNING - a complete build needs 8 Gb of space and
158                          takes much longer. (enables -g compiler flag)
159
160                          --enable-symbols=SMALL sets the gcc -g1 setting
161                          which is smaller.
162
163                          Enabling symbols disables the stripping of the solver
164                          (--disable-strip-solver).
165],,)
166AC_ARG_ENABLE(strip-solver,
167[  --disable-strip-solver  Disable the stripping of the solver.
168                          By default the solver is stripped unless a build with
169                          debugging symbols (--enable-symbols) is requested.
170
171                          This switch allows to override this setting.
172],,)
173AC_ARG_ENABLE(werror,
174[  --enable-werror         Turn warnings to errors. (Has no effect in modules
175                          where the treating of warnings as errors is disabled
176                          explicitely)
177],,)
178AC_ARG_ENABLE(debug,
179[  --enable-debug          Include debugging symbols from --enable-symbols
180                          plus extra debugging code.  Extra large build!
181                          (enables -g compiler flag and dmake debug=true)
182],,)
183AC_ARG_ENABLE(dbgutil,
184[  --enable-dbgutil        Include additional debugging utilities, such as
185                          assertions, object counting, etc. Larger build.
186                          Independent from --enable-debug
187],,)
188AC_ARG_ENABLE(crashdump,
189[  --enable-crashdump      Enable the crashdump feature code.
190],,)
191AC_ARG_ENABLE(cl-standard,
192[  --enable-cl-standard    For Microsoft C/C++ compiler users, use non-optimizing
193                          standard compiler. ( This just disavles optimization
194                          options and therefore removes a lot of warnings when
195                          using the cheaper standard compiler. )
196],,)
197AC_ARG_ENABLE(gtk,
198[  --disable-gtk           Determines whether to use Gtk+ vclplug on platforms
199                          where Gtk+ is available.
200],,enable_gtk=yes)
201AC_ARG_ENABLE(gstreamer,
202[  --disable-gstreamer     Determines whether to use the GStreamer media
203                          backend on platforms where GStreamer is available.
204],,enable_gstreamer=yes)
205AC_ARG_ENABLE(systray,
206[  --disable-systray       Determines whether to build the systray quickstarter.
207],,enable_systray=yes)
208AC_ARG_ENABLE(cairo,
209[  --enable-cairo          Determines whether to use Cairo library on
210                          platforms where Cairo is available.
211],,enable_cairo=no)
212AC_ARG_WITH(system-cairo,
213[  --with-system-cairo      Use Cairo libraries already on system
214],,)
215AC_ARG_ENABLE(cairo-canvas,
216[  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
217                          platforms where Cairo is available.
218],,enable_cairo_canvas=yes)
219AC_ARG_ENABLE(librsvg,
220[  --enable-librsvg        Determines whether to use librsvg library on
221                          platforms where librsvg is available.
222                          (actually, it is possible to build with
223                          --disable-librsvg and to still have SVG support
224                          within a running soffice instance, since this
225                          dependency is a runtime only dependency.
226                          To have SVG suppport at runtime, the librsvg, the cairo
227                          and the gobject library - and all depending libraries
228                          as well - need to be accessible by the running soffice
229                          instance.
230                          The intention of defaulting this flag to yes is to
231                          indicate this fact to the build maintainer)
232],,enable_librsvg=yes)
233AC_ARG_ENABLE(opengl,
234[  --enable-opengl         Determines whether to build the OpenGL 3D slide
235                          transitions component
236],,enable_opengl=no)
237AC_ARG_ENABLE(dbus,
238[  --enable-dbus           Determines whether to enable presentation mode
239                          screensaver control under GNOME via DBUS
240],,enable_dbus=no)
241AC_ARG_ENABLE(gconf,
242[  --disable-gconf         Determines whether to use the GConf support
243],,enable_gconf=yes)
244AC_ARG_ENABLE(gnome-vfs,
245[  --disable-gnome-vfs     Determines whether to use the Gnome Virtual Filing
246                          System on platforms where that VFS is available
247],,enable_gnome_vfs=yes)
248AC_ARG_ENABLE(gio,
249[  --enable-gio            Determines whether to use the GIO support
250],,enable_gio=no)
251AC_ARG_ENABLE(static-gtk,
252[  --enable-static-gtk     Modules that are linked against gtk libraries use
253                          the static libraries instead of the dynamic ones.
254                          (enables -Bstatic linker flag for gtk libraries)
255],,)
256AC_ARG_ENABLE(layout,
257[  --enable-layout         Enable the compilation and use of layout dialogs
258],,)
259AC_ARG_ENABLE(build-mozilla,
260[  --disable-build-mozilla Use this option if you do not want to build the
261                          mozilla components from the mozilla source code but
262                          take precompiled zips
263],,)
264AC_ARG_WITH(mozilla-version,
265[  --with-mozilla-version  Choose which version of mozilla to use while building
266                          mozilla. Default: 1.7.5.
267                          Note that not all versions are supported.
268],,)
269AC_ARG_WITH(mozilla-toolkit,
270[  --with-mozilla-toolkit  Choose which GUI toolkit to use while building mozilla
271                          components. Default: gtk2
272],,)
273AC_ARG_ENABLE(nss_module,
274[  --disable-nss-module    Whether to use provided NSS module
275],,enable_nss_module=yes)
276AC_ARG_ENABLE(kde,
277[  --enable-kde            Determines whether to use Qt/KDE vclplug on platforms
278                          where Qt and KDE are available.
279],,)
280AC_ARG_ENABLE(kdeab,
281[  --disable-kdeab         Disable the KDE address book support
282],,if test "$enable_kde" = "yes"; then enable_kdeab=yes; fi)
283AC_ARG_ENABLE(kde4,
284[  --enable-kde4            Determines whether to use Qt4/KDE4 vclplug on platforms
285                          where Qt4 and KDE4 are available. May be used with --enable-kde
286                          if you want to support both KDE3 and KDE4.
287],,)
288AC_ARG_ENABLE(binfilter,
289[  --disable-binfilter     Disable legacy binary file formats filters
290],,if ! test -d ./binfilter; then enable_binfilter=no; fi)
291AC_ARG_ENABLE(rpath,
292[  --disable-rpath         Disable the use of relative paths in shared libraries
293],,)
294AC_ARG_ENABLE(pam,
295[  --disable-pam           Disable pam support.
296],,)
297AC_ARG_ENABLE(pam-link,
298[  --enable-pam-link       link with libpam instead of dynamically open it
299],,)
300AC_ARG_ENABLE(crypt-link,
301[  --disable-crypt-link    disable linking with libcrypt instead of dynamically
302                          open it (needed for ancient GNU/Linux distributions
303                          without crypt()/libcrypt)
304],,enable_crypt_link=yes)
305AC_ARG_ENABLE(xrender-link,
306[  --enable-xrender-link   link with libXrender instead of dynamically open it
307],,)
308AC_ARG_ENABLE(randr,
309[  --disable-randr         disable RandR support in the vcl project
310],,enable_randr=yes)
311AC_ARG_ENABLE(randr-link,
312[  --disable-randr-link    disable linking with libXrandr, instead dynamically
313                           open it at runtime
314],,enable_randr_link=yes)
315AC_ARG_WITH(myspell-dicts,
316[  --without-myspell-dicts Removes myspell dictionaries from openoffice.org
317                          installation set, for people building for specific
318                          distributions where the myspell dictionaries are
319                          installed from other sources
320],,)
321AC_ARG_WITH(system-dicts,
322[  --with-system-dicts    Use dictionaries from system paths- Specify
323                         them via --with-{dict,hyph,thes}-path=/path
324			 if you want to override the default ones
325],,)
326AC_ARG_WITH(external-dict-dir,
327[  --with-external-dict-dir Specify external dictionary dir
328],,)
329AC_ARG_WITH(external-hyph-dir,
330[  --with-external-hyph-dir Specify external hyphenation pattern dir
331],,)
332AC_ARG_WITH(external-thes-dir,
333[  --with-external-thes-dir Specify external thesaurus dir
334],,)
335AC_ARG_WITH(system-libs,
336[  --with-system-libs      Use libs already on system -- enables all
337                          --with-system-* flags except mozilla and
338                          odbc/sane/xrender-header(s)
339],,)
340AC_ARG_WITH(system-headers,
341[  --with-system-headers   Use headers already on system -- enables all
342                          --with-system-* flags for external packages
343                          whose headers are the only entities used i.e.
344                          boost/vigra/odbc/sane/xrender-header(s)
345],,)
346AC_ARG_WITH(system-jars,
347[  --without-system-jars   When building with --with-system-libs, also the
348                          needed jars are expected on the system. Use this to
349                          disable that.
350                          (except for the db case where --with-system-db
351                          *has to* imply using the db.jar from there, too)
352],,)
353AC_ARG_WITH(system-zlib,
354[  --with-system-zlib      Use zlib already on system
355],,)
356AC_ARG_WITH(system-openssl,
357[  --with-system-openssl   Use OpenSSL already on system
358],,)
359AC_ARG_WITH(system-jpeg,
360[  --with-system-jpeg      Use jpeg already on system
361],,)
362AC_ARG_WITH(system-expat,
363[  --with-system-expat     Use expat already on system
364],,)
365AC_ARG_WITH(system-libwpd,
366[  --with-system-libwpd    Use libwpd already on system
367],,)
368AC_ARG_WITH(system-libxml,
369[  --with-system-libxml    Use libxml already on system
370],,)
371AC_ARG_WITH(system-python,
372[  --with-system-python    Use python already on system
373],,)
374AC_ARG_WITH(system-icu,
375[  --with-system-icu       Use icu already on system
376],,)
377AC_ARG_WITH(system-poppler,
378[  --with-system-poppler   Use poppler already on system
379],,)
380AC_ARG_WITH(system-db,
381[  --with-system-db        Use berkeley db already on system
382],,)
383AC_ARG_WITH(system-lucene,
384[  --with-system-lucene    Use lucene already on system
385],,)
386AC_ARG_WITH(lucene-core-jar,
387[  --with-lucene-core-jar=JARFILE   Specify path to jarfile manually ],
388[ LUCENE_CORE_JAR="$withval"
389])
390AC_ARG_WITH(lucene-analyzers-jar,
391[  --with-lucene-analyzers-jar=JARFILE   Specify path to jarfile manually ],
392[ LUCENE_ANALYZERS_JAR="$withval"
393])
394AC_ARG_ENABLE(mysql-connector,
395[  --enable-mysql-connector     enables the build of the MySQL Connector/OOo extension.
396                                This requires access to the MySQL Connector/C (aka libmysql) to be given, too, with
397                                either the --with-system-mysql or --with-libmysql-path option.
398],,)
399AC_ARG_WITH(system-mysql,
400[  --with-system-mysql          Use MySQL libraries already on system, for building the MySQL Connector/OOo extension.
401                                Requires MYSQLCONFIG to point to the mysql_config executable.
402],,)
403AC_ARG_WITH(libmysql-path,
404[  --with-libmysql-path         Use Connector/C (libmysql) installation for building the MySQL Connector/OOo extension.
405
406                                Usage: --with-libmysql-path=<absolute path to your Connector/C installation>
407],,)
408AC_ARG_WITH(system-mysql-cppconn,
409[  --with-system-mysql-cppconn  Use MySQL C++ Connector libraries already on system
410],,)
411AC_ARG_WITH(system-hsqldb,
412[  --with-system-hsqldb    Use hsqldb already on system
413],,)
414AC_ARG_WITH(hsqldb-jar,
415[  --with-hsqldb-jar=JARFILE   Specify path to jarfile manually ],
416[ HSQLDB_JAR="$withval"
417])
418AC_ARG_WITH(system-beanshell,
419[  --with-system-beanshell Use beanshell already on system
420],,)
421AC_ARG_WITH(beanshell-jar,
422[  --with-beanshell-jar=JARFILE   Specify path to jarfile manually ],
423[ BSH_JAR="$withval"
424])
425AC_ARG_ENABLE(presenter-extra-ui,
426[  --enable-presenter-extra-ui   enables extra functionality during slideshow,
427                                 e.g. selecting pen color, erasing drawings etc.
428],,enable_presenter_extra_ui=no)
429AC_ARG_ENABLE(minimizer,
430[  --enable-minimizer          enables the build of the Presentation Minimizer extension
431],,)
432AC_ARG_ENABLE(presenter-console,
433[  --enable-presenter-console          enables the build of the Presenter Console extension
434],,)
435AC_ARG_ENABLE(pdfimport,
436[  --enable-pdfimport          enables the build of the PDF Import extension and xpdf
437],,)
438AC_ARG_ENABLE(wiki-publisher,
439[  --enable-wiki-publisher      enables the build of the Wiki Publisher extension
440],,)
441AC_ARG_WITH(commons-codec-jar,
442[  --with-commons-codec-jar=JARFILE   Specify path to jarfile manually ],
443[ COMMONS_CODEC_JAR="$withval"
444])
445AC_ARG_WITH(commons-lang-jar,
446[  --with-commons-lang-jar=JARFILE   Specify path to jarfile manually ],
447[ COMMONS_LANG_JAR="$withval"
448])
449AC_ARG_WITH(commons-httpclient-jar,
450[  --with-commons-httpclient-jar=JARFILE   Specify path to jarfile manually ],
451[ COMMONS_HTTPCLIENT_JAR="$withval"
452])
453AC_ARG_WITH(commons-logging-jar,
454[  --with-commons-logging-jar=JARFILE   Specify path to jarfile manually ],
455[ COMMONS_LOGGING_JAR="$withval"
456])
457AC_ARG_WITH(servlet-api-jar,
458[  --servlet-api-jar=JARFILE   Specify path to jarfile manually ],
459[ SERVLETAPI_JAR="$withval"
460])
461AC_ARG_ENABLE(report-builder,
462[  --enable-report-builder  enables the build of the Report Builder extension
463],,)
464AC_ARG_WITH(system-jfreereport,
465[  --with-system-jfreereport      Use JFreeReport already on system
466],,)
467AC_ARG_WITH(sac-jar,
468[  --with-sac-jar=JARFILE   Specify path to jarfile manually ],
469[ SAC_JAR="$withval"
470])
471AC_ARG_WITH(libxml-jar,
472[  --with-libxml-jar=JARFILE   Specify path to jarfile manually ],
473[ LIBXML_JAR="$withval"
474])
475AC_ARG_WITH(flute-jar,
476[  --with-flute-jar=JARFILE   Specify path to jarfile manually ],
477[ FLUTE_JAR="$withval"
478])
479AC_ARG_WITH(jfreereport-jar,
480[  --with-jfreereport-jar=JARFILE   Specify path to jarfile manually ],
481[ JFREEREPORT_JAR="$withval"
482])
483AC_ARG_WITH(liblayout-jar,
484[  --with-liblayout-jar=JARFILE   Specify path to jarfile manually ],
485[ LIBLAYOUT_JAR="$withval"
486])
487AC_ARG_WITH(libloader-jar,
488[  --with-libloader-jar=JARFILE   Specify path to jarfile manually ],
489[ LIBLOADER_JAR="$withval"
490])
491AC_ARG_WITH(libloader-jar,
492[  --with-libloader-jar=JARFILE   Specify path to jarfile manually ],
493[ LIBLOADER_JAR="$withval"
494])
495AC_ARG_WITH(libformula-jar,
496[  --with-libformula-jar=JARFILE   Specify path to jarfile manually ],
497[ LIBFORMULA_JAR="$withval"
498])
499AC_ARG_WITH(librepository-jar,
500[  --with-librepository-jar=JARFILE   Specify path to jarfile manually ],
501[ LIBREPOSITORY_JAR="$withval"
502])
503AC_ARG_WITH(libfonts-jar,
504[  --with-libfonts-jar=JARFILE   Specify path to jarfile manually ],
505[ LIBFONTS_JAR="$withval"
506])
507AC_ARG_WITH(libserializer-jar,
508[  --with-libserializer-jar=JARFILE   Specify path to jarfile manually ],
509[ LIBSERIALIZER_JAR="$withval"
510])
511AC_ARG_WITH(libbase-jar,
512[  --with-libbase-jar=JARFILE   Specify path to jarfile manually ],
513[ LIBBASE_JAR="$withval"
514])
515AC_ARG_WITH(system-saxon,
516[  --with-system-saxon     Use saxon already on system
517],,)
518AC_ARG_WITH(saxon-jar,
519[  --with-saxon-jar=JARFILE   Specify path to jarfile manually ],
520[ SAXON_JAR="$withval"
521])
522AC_ARG_WITH(system-libxslt,
523[  --with-system-libxslt   Use libxslt already on system
524],,)
525AC_ARG_WITH(system-odbc,
526[  --with-system-odbc-headers     Use the odbc headers already on system
527],,)
528AC_ARG_WITH(system-sane,
529[  --with-system-sane-header      Use sane.h already on system
530],,)
531AC_ARG_WITH(system-xrender,
532[  --with-system-xrender-headers  Use XRender headers already on system
533],,)
534AC_ARG_WITH(system-curl,
535[  --with-system-curl      Use curl already on system
536],,)
537AC_ARG_WITH(system-boost,
538[  --with-system-boost     Use boost already on system
539],,)
540AC_ARG_WITH(system-mdds,
541[  --with-system-mdds      Use mdds already on system
542],,)
543AC_ARG_WITH(system-vigra,
544[  --with-system-vigra     Use vigra already on system
545],,)
546AC_ARG_ENABLE(neon,
547[  --disable-neon          Disable neon and the compilation of webdav binding
548],,)
549AC_ARG_ENABLE(Xaw,
550[  --disable-Xaw           Disables the use of Xaw for the Netscape/Mozilla
551                           plugin
552],,)
553AC_ARG_WITH(system-neon,
554[  --with-system-neon      Use neon already on system
555],,)
556AC_ARG_WITH(system-agg,
557[  --with-system-agg       Use AGG already on system
558],,)
559AC_ARG_WITH(system-hunspell,
560[  --with-system-hunspell   Use libhunspell already on system
561],,)
562AC_ARG_WITH(system-mythes,
563[  --with-system-mythes    Use mythes already on system
564],,)
565AC_ARG_WITH(system-altlinuxhyph,
566[  --with-system-altlinuxhyph    Use ALTLinuxhyph already on system
567],,)
568AC_ARG_WITH(system-lpsolve,
569[  --with-system-lpsolve         Use lpsolve already on system
570],,)
571AC_ARG_WITH(system-libtextcat,
572[  --with-system-libtextcat      Use libtextcat already on system
573],,)
574AC_ARG_WITH(external-libtextcat-data,
575[  --with-system-libtextcat-data Use libtextcat data already on system
576],,)
577AC_ARG_WITH(system-cppunit,
578[  --with-system-cppunit         Use cppunit already on system
579],,)
580AC_ARG_WITH(system-redland,
581[  --with-system-redland   Use redland library already on system
582],,)
583AC_ARG_WITH(system-mozilla,
584[  --with-system-mozilla   Use mozilla already on system. Note that some
585                          components cannot be built against a contemporary
586                          mozilla. The flavour used can be specified by
587                          --with-system-mozilla=<flavour>. Supported are:
588                          libxul (default), xulrunner, firefox, seamonkey,
589                          mozilla
590], WITH_SYSTEM_MOZILLA=$withval, WITH_SYSTEM_MOZILLA=no)
591AC_ARG_WITH(stlport,
592[  --with-stlport         The location that STLport is installed in. The STL
593                          header files are assumed to be in
594                          stlport-home/stlport and the STLPort library in
595                          stlport-home/lib.
596
597                          Usage: --with-stlport=<absolute path to stlport home>
598
599                          Warning!!, disabling using --without-stlport or
600                          enabling using --with-stlport on a platform that
601                          defaults to the opposite will break ABI compatability
602], WITH_STLPORT=$withval , WITH_STLPORT=auto)
603AC_ARG_WITH(jdk-home,
604[  --with-jdk-home         if you have installed JDK 1.3 or later on your system
605                          please supply the path here.
606                          Note that this is not the location of the Java binary
607                          but the location of the entire distribution.
608
609                          Usage: --with-jdk-home=<absolute path to JDK home>
610],,)
611AC_ARG_WITH(gxx_include_path,
612[  --with-gxx-include-path if you want to override the autodetected g++ include
613                          path.
614
615                          Usage: --with-gxx-include-path=<absolute path to g++ include dir>
616],,)
617AC_ARG_WITH(java,
618[  --with-java             Build with[[out]] Java support.  If you use
619                          --without-java/--with-java=no then the build will have
620                          no support for Java components, applets, accessibility
621                          or XML filters.
622], if test "$withval" = "yes"; then WITH_JAVA=java; else WITH_JAVA=$withval; fi, WITH_JAVA=java)
623AC_ARG_ENABLE(gcjaot,
624[  --enable-gcjaot         Build with[[out]] using Ahead of Time java compilation
625                          support to speed up buildsi by compiling the jars also
626                          to native code..
627                          --enable-gcjaot is only known to work with bytecode
628                          created with gcj or ecj
629],,)
630AC_ARG_WITH(ant-home,
631[  --with-ant-home         If you have installed Jakarta Ant on your system,
632                          please supply the path here.
633                          Note that this is not the location of the Ant binary
634                          but the location of the entire distribution.
635
636                          Usage: --with-ant-home=<absolute path to Ant home>
637],,)
638AC_ARG_WITH(junit,
639[  --with-junit            Specifies the JUnit 4 jar file to use for JUnit-based
640                          tests.  --without-junit disables those tests.  Not
641                          relevant in the --without-java case.
642
643                          Usage: --with-junit=<absolute path to JUnit 4 jar>
644],,with_junit=yes)
645AC_ARG_WITH(perl-home,
646[  --with-perl-home        If you have installed the Perl 5 Distribution, on your
647                          system, please supply the path here.
648                          Note that this is not the location of the Perl binary
649                          but the location of the entire distribution.
650
651                          Usage: --with-perl-home=<absolute path to Perl 5 home>
652],,)
653AC_ARG_WITH(cl-home,
654[  --with-cl-home          For Windows NT users, please supply the path
655                          for the Microsoft C/C++ compiler.
656                          Note that this is not the location of the compiler
657                          binary but the location of the entire distribution.
658
659                          Usage: --with-cl-home=<absolute path to Microsoft C/C++ compiler home>
660],,)
661AC_ARG_WITH(mspdb-path,
662[  --with-mspdb-path       For Microsoft C/C++ compiler users, please supply the
663                          path pointing to the mspdb71.dll (.NET 2003).
664
665                          Usage: --with-mspdb-path=<absolute path to mspdb71.dll>
666],,)
667AC_ARG_WITH(midl-path,
668[  --with-midl-path        For Microsoft C/C++ .NET compiler users, please supply
669                          the path pointing to the midl.exe.
670
671                          Usage: --with-midl-path=<absolute path to midl.exe>
672],,)
673AC_ARG_WITH(csc-path,
674[  --with-csc-path         For Microsoft C/C++ .NET compiler users, please supply
675                          the path pointing to the csc.exe.
676
677                          Usage: --with-csc-path=<absolute path to csc.exe>
678],,)
679AC_ARG_WITH(nsis-path,
680[  --with-nsis-path        For Windows users, please supply the path to the
681                          "Nullsoft Scriptable Install System" (NSIS). If NSIS
682                          is found in the path or this option is supplied a self
683                          contained executable installer for OpenOffice.org will
684                          be created.
685
686                          Usage: --with-nsis-path=<absolute path to nsis.exe>
687],,)
688AC_ARG_WITH(frame-home,
689[  --with-frame-home       For Microsoft C/C++ .NET compiler users, please supply
690                          the path pointing to lib/mscoree.lib, usually
691                          something like:
692                          "/cygdrive/c/Program Files/Microsoft Visual Studio .NET/FrameworkSDK"
693
694                          MS Visual Toolkit compiler users, please supply the
695                          path pointing to lib/msvcrt.lib, usually something
696                          like:
697                          "/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Vc7"
698
699                          Usage: --with-frame-home=<absolute path to Framework SDK [[home]]>
700],,)
701AC_ARG_WITH(psdk-home,
702[  --with-psdk-home        For Windows users, please supply the path to the
703                          Microsoft Platform SDK.
704
705                          Usage: --with-psdk-home=<absolute path to Microsoft Platform SDK>
706],,)
707AC_ARG_WITH(directx-home,
708[  --with-directx-home     For Windows users, please supply the path to the
709                          Microsoft DirectX SDK.
710
711                          Usage: --with-directx-home=<absolute path to Microsoft DirectX SDK>
712],,)
713AC_ARG_WITH(mozilla-build,
714[  --with-mozilla-build    For Windows users, please supply the path to the
715                          mozilla build tools.
716
717                          Usage: --with-mozilla-build=<absolute path to mozilla build tools>
718
719						  At the moment of this writing, an installer for the mozilla build tools
720						  can be obtained from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32.
721],[MOZILLABUILD=$withval],)
722AC_ARG_WITH(local-solenv,
723[  --with-local-solenv     If you have solenv in a location other than ./solenv,
724                          please supply the path here.
725
726                          Usage: --with-local-solenv=<absolute path to solenv>
727],,)
728AC_ARG_WITH(local-solver,
729[  --with-local-solver     if you have solver in a location other than ./solver,
730                          please supply the path here.
731
732                          Usage: --with-local-solver=<absolute path to solver>
733],,)
734AC_ARG_ENABLE(check-only,
735[  --enable-check-only     Use this option option if you just want to check your
736                          environment.  This option stops the generation of an
737                          ????env.set
738
739                          Usage: --enable-check-only=yes
740],,)
741AC_ARG_ENABLE(ccache-skip,
742[[  --enable-ccache-skip    [default=auto] allow the use of --ccache-skip to
743                          escape compiler flags that would otherwise prevent
744                          caching of the result (currently used on Mac only)
745                          NOTE: requires patched version because of a bug in
746                          ccache (see issue 104567 for details and patch)
747                          explicitly enable if your version of ccache does not
748                          identify as version 2.4_OOo
749]],,enable_ccache_skip=auto)
750AC_ARG_WITH(lang,
751[  --with-lang             Use this option to build OpenOffice.org with
752                          additional language support. English (US) is always
753                          included by default. Separate multiple languages with
754                          space. For all languages, use --with-lang=ALL.
755
756                          Usage: --with-lang="es sw tu cs sk"
757],,)
758AC_ARG_WITH(poor-help-localizations,
759[  --with-poor-help-localizations
760                           Use this option to specify which languages have
761                          unusable help localizations. Separate multiple
762                          languages with space.
763
764                          Usage: --with-poor-help-localizations="af ar be-BY ca"
765],,)
766AC_ARG_WITH(dict,
767[  --with-dict             Use this option to build OpenOffice.org with
768                          dictionary support. ALL dictionaries are always
769                          included by default unless overridden with
770                          this option. Separate multiple dictionaries with
771                          commas. For all dictionaries, use --with-dict=ALL.
772
773                          Usage: --with-dict=ENGB,ENUS,ITIT
774],,)
775AC_ARG_WITH(intro-bitmaps,
776[  --with-intro-bitmaps    Prefer the specified intro bitmaps over the
777                          the default one.  Can be more than one (separated by
778                          commas), the order means priority of fallback if the
779                          first does not exist (in the installed tree).
780
781                          Usage: --with-intro-bitmaps=/path/my_ooo_intro.bmp
782],,)
783AC_ARG_WITH(about-bitmaps,
784[  --with-about-bitmaps    Similarly to --with-intro-bitmaps, this allows
785                          specification of bitmaps for the About box.
786
787                          Usage: --with-about-bitmaps=/path/my_ooo_about.bmp
788],,)
789AC_ARG_WITH(vendor,
790[  --with-vendor           Set vendor of the build.
791
792                          Usage: --with-vendor="John the Builder"
793],,)
794AC_ARG_WITH(unix-wrapper,
795[  --with-unix-wrapper    Redefines the name of the UNIX wrapper that will be used
796                          in the desktop files and in the desktop-integration RPMs.
797
798                          Usage: --with-unix-wrapper=ooffice
799],,)
800AC_ARG_WITH(asm-home,
801[  --with-asm-home         For Windows users, please supply the path for the
802                          ml.exe assembler.
803
804                          Usage: --with-asm-home=<path to ml.exe directory>
805],,)
806AC_ARG_WITH(os-version,
807[  --with-os-version       For FreeBSD users, use this option option to override
808                          the detected OSVERSION.
809
810                          Usage: --with-os-version=<OSVERSION>
811],,)
812AC_ARG_WITH(unzip-home,
813[  --with-unzip-home       Deprecated: use --with-zip-home instead],,)
814AC_ARG_WITH(zip-home,
815[  --with-zip-home         If you use a non standard zip, for example windows
816                          please supply the path for zip
817
818                          Usage: --with-zip-home=<path to zip executable>
819],,)
820AC_ARG_WITH(mingwin,
821[  --with-mingwin          For Windows users, use the mingwin32 compiler within
822                          cygwin environment
823
824                          Usage: --with-mingwin=yes
825
826                          For !Windows use, use the mingw32 C++ compiler to
827                          (re-) build unowinreg.dll. Specify the MinGW C++
828                          Compilers name.
829
830                          Usage: --with-mingwin=i586-mingw32msvc-g++
831],WITH_MINGWIN=$withval,WITH_MINGWIN=0)
832AC_ARG_WITH(build-version,
833[  --with-build-version    Allows the builder to add a custom version tag
834                          that will appear in the Help/About box for QA
835                          purposes.
836
837                          Usage: --with-build-version="Built by Jim"
838],with_build_version=$withval)
839AC_ARG_WITH(alloc,
840[  --with-alloc            Define which allocator to build with
841                          (choices are oo, system, tcmalloc, jemalloc)
842
843                          Note that on FreeBSD/NetBSD system==jemalloc
844],,)
845AC_ARG_ENABLE(verbose,
846[  --enable-verbose        Increase build verbosity.
847  --disable-verbose       Decrease build verbosity.
848],,)
849AC_ARG_ENABLE(dependency-tracking,
850[  --disable-dependency-tracking  Disables generation of dependency information.
851],,)
852AC_ARG_ENABLE(copyleft,
853[  --enable-copyleft      Whether to use copyleft components.
854],,)
855
856BUILD_TYPE="OOo"
857
858dnl ===================================================================
859dnl Message.
860dnl ===================================================================
861echo "********************************************************************"
862echo "*                                                                  *"
863echo "*   OpenOffice.org build configuration.                            *"
864echo "*                                                                  *"
865echo "*   The configure process checks your platform to see whether      *"
866echo "*   you can build OpenOffice.org on it.                            *"
867echo "*   This process checks all pre-requisites and generates a file    *"
868echo "*   containing the necessary environment variables.                *"
869echo "*   Source this file after configure has ended successfully.       *"
870echo "*                                                                  *"
871echo "*   Any warning that is generated during the configure process     *"
872echo "*   must be taken into account since it can be a reason for        *"
873echo "*   an unsuccessful build of OpenOffice.org                        *"
874echo "*                                                                  *"
875echo "********************************************************************"
876echo ""
877echo "********************************************************************"
878echo "*                                                                  *"
879echo "*   Checking the platform pre-requisites.                          *"
880echo "*                                                                  *"
881echo "********************************************************************"
882echo ""
883dnl ===================================================================
884dnl Configure pre-requisites.
885dnl ===================================================================
886cat /dev/null > warn
887AC_PROG_EGREP
888AC_PROG_AWK
889AC_PATH_PROG( AWK, $AWK)
890if test -z "$AWK"; then
891   AC_MSG_ERROR([install awk to run this script])
892fi
893
894AC_PATH_PROGS(SED, sed )
895if test -z "$SED"; then
896   AC_MSG_ERROR([install sed to run this script])
897fi
898
899AC_MSG_CHECKING([for solenv environment])
900if test -z "$with_local_solenv"; then
901   LOCAL_SOLENV="DEFAULT"
902   AC_MSG_RESULT([default])
903else
904   LOCAL_SOLENV=$with_local_solenv
905   AC_MSG_RESULT([$with_local_solenv])
906fi
907AC_SUBST(LOCAL_SOLENV)
908
909if test "$LOCAL_SOLENV" = "DEFAULT"; then
910  _solenv="./solenv"
911else
912  _solenv="$LOCAL_SOLENV"
913fi
914AC_SUBST(_solenv)
915
916if test -e $_solenv/inc/minor.mk; then
917   # Get UPD number from ./solenv/inc/minor.mk
918   UPD="`grep RSCVERSION= $_solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'`"
919   AC_SUBST(UPD)
920   SOURCEVERSION="`grep SOURCEVERSION= $_solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'`"
921   AC_SUBST(SOURCEVERSION)
922else
923   AC_MSG_ERROR([$_solenv/inc/minor.mk missing but needed for architecture/os detecion and proper environment script generation...])
924fi
925
926dnl ===================================================================
927dnl Checks for the operating system and processor.
928dnl ===================================================================
929AC_CANONICAL_SYSTEM
930if test "$build" != "$host" -o "$build" != "$target" \
931  -o "$host" != "$target"; then
932	AC_MSG_WARN([cross-compiling by any means is not supported (yet)!])
933	echo "cross-compiling by any means is not supported (yet)!" >> warn
934fi
935
936if echo "$build_os" | grep cygwin; then
937   AC_MSG_CHECKING([Cygwin version])
938   CygwinVer=`uname -r`
939   AC_MSG_RESULT([$CygwinVer])
940   if test "`echo $CygwinVer | $AWK -F . '{ print $1$2 }'`" -lt "15"; then
941      AC_MSG_ERROR([You need at least Cygwin V1.5.x])
942   fi
943else
944   CygwinVer="false"
945fi
946
947dnl ===================================================================
948dnl The following is a list of supported systems.
949dnl Sequential to keep the logic very simple
950dnl These values may be checked and reset later.
951dnl ===================================================================
952case "$build_os" in
953	solaris*)
954		test_gtk=yes
955		test_cairo=yes
956		test_librsvg=yes
957		test_kde=yes
958		test_cups=yes
959        test_randr=yes
960		test_freetype=yes
961        test_gstreamer=yes
962		_os=SunOS
963		AC_PATH_PROG( GNUTAR, gtar,,$PATH:/usr/sfw/bin)
964		if test -z "$GNUTAR"; then
965			AC_MSG_ERROR([gtar (gnu tar) not found but needed. Install it (SUN Freeware package).])
966		fi
967		AC_SUBST(GNUTAR)
968
969		dnl ===========================================================
970		dnl check whether we're using solaris 6,7,8 - sparc or intel.
971		dnl ===========================================================
972   		AC_MSG_CHECKING([the Solaris operating system release])
973   		_os_release=`echo $build_os | $SED -e s/solaris2\.//`
974		if test "$_os_release" -lt "6"; then
975      			AC_MSG_ERROR([use solaris >= 6 to build OpenOffice.org])
976   		else
977      			AC_MSG_RESULT([ok ($_os_release)])
978   		fi
979
980   		dnl check whether we're using a sparc or i386 processor
981   		AC_MSG_CHECKING([the processor type])
982   		if test "$build_cpu" = "sparc" -o "$build_cpu" = "i386"; then
983      			AC_MSG_RESULT([ok ($build_cpu)])
984   		else
985      			AC_MSG_ERROR([only sparc and i386 processors are supported])
986   		fi
987		;;
988	linux-gnu*|k*bsd*-gnu*)
989		test_gtk=yes
990		test_cairo=yes
991		test_librsvg=yes
992		test_kde=yes
993		test_kde4=yes
994		test_cups=yes
995        test_randr=yes
996		test_freetype=yes
997        test_gstreamer=yes
998        _os=Linux
999		;;
1000	gnu)
1001		test_cups=no
1002		_os=GNU
1003		;;
1004	cygwin*) # Windows
1005		test_cups=no
1006		test_cairo=yes
1007		test_librsvg=no
1008		test_freetype=no
1009        test_gstreamer=no
1010		_os=WINNT
1011		;;
1012	darwin*) # Mac OS X
1013		test_cups=yes
1014		test_gtk=yes
1015		test_cairo=yes
1016		test_librsvg=no
1017        test_randr=no
1018		test_freetype=no
1019        test_gstreamer=no
1020		_os=Darwin
1021      if test "$enable_systray" = "yes" && test "$enable_gtk" != "no"; then
1022         AC_MSG_WARN([Disabling gtk-quickstarter - not supported on Mac. Use --disable-systray])
1023         echo "Disabling gtk-quickstarter - not supported on Mac. Use --disable-systray" >>warn
1024         enable_systray=no
1025      fi
1026		;;
1027	os2*)
1028		test_x=no
1029		test_cups=no
1030        test_randr=no
1031		test_gtk=no
1032		test_librsvg=no
1033		test_freetype=no
1034        test_gstreamer=no
1035		_os=OS2
1036		;;
1037	freebsd*)
1038		test_gtk=yes
1039		test_cairo=yes
1040		test_librsvg=yes
1041		test_kde=yes
1042		test_kde4=yes
1043		test_cups=yes
1044        test_randr=yes
1045		test_freetype=yes
1046        test_gstreamer=yes
1047		AC_MSG_CHECKING([the FreeBSD operating system release])
1048		if test -n "$with_os_version"; then
1049			OSVERSION="$with_os_version"
1050		else
1051			OSVERSION=`/sbin/sysctl -n kern.osreldate`
1052		fi
1053		AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1054		AC_MSG_CHECKING([which thread library to use])
1055		if test "$OSVERSION" -lt "500016"; then
1056			PTHREAD_CFLAGS="-D_THREAD_SAFE"
1057			PTHREAD_LIBS="-pthread"
1058		elif test "$OSVERSION" -lt "502102"; then
1059			PTHREAD_CFLAGS="-D_THREAD_SAFE"
1060			PTHREAD_LIBS="-lc_r"
1061		else
1062			PTHREAD_CFLAGS=""
1063			PTHREAD_LIBS="-pthread"
1064		fi
1065		AC_MSG_RESULT([$PTHREAD_LIBS])
1066		_os=FreeBSD
1067		;;
1068	osf)
1069		test_cups=no
1070        test_randr=no
1071		_os=OSF1
1072		;;
1073	netbsd)
1074		test_gtk=yes
1075		test_cairo=yes
1076		test_librsvg=yes
1077		test_kde=yes
1078		test_kde4=yes
1079		test_cups=no
1080        test_randr=yes
1081		test_freetype=yes
1082        test_gstreamer=yes
1083		PTHREAD_CFLAGS="-pthread"
1084		PTHREAD_LIBS="-pthread -lpthread"
1085		_os=NetBSD
1086		;;
1087	aix*)
1088		test_cups=no
1089        test_randr=no
1090		test_freetype=yes
1091        test_gstreamer=yes
1092	   PTHREAD_LIBS=-pthread
1093		echo "AIX is an alpha port --- Use at own risk" >> warn
1094		_os=AIX
1095		;;
1096   *)
1097   AC_MSG_ERROR([$_os operating system is not suitable to build OpenOffice.org!])
1098   ;;
1099esac
1100
1101AC_SUBST(OSVERSION)
1102AC_SUBST(PTHREAD_CFLAGS)
1103AC_SUBST(PTHREAD_LIBS)
1104
1105
1106dnl Ensure pkg-config is initialized before any possible use
1107PKG_PROG_PKG_CONFIG
1108
1109
1110dnl ===================================================================
1111dnl Set the ENABLE_CRASHDUMP variable.
1112dnl ===================================================================
1113AC_MSG_CHECKING([whether to enable crashdump feature])
1114if test "$enable_crashdump" = "yes"; then
1115   ENABLE_CRASHDUMP="TRUE"
1116   BUILD_TYPE="$BUILD_TYPE CRASHREP"
1117   AC_MSG_RESULT([yes])
1118else
1119   ENABLE_CRASHDUMP=""
1120   AC_MSG_RESULT([no])
1121fi
1122AC_SUBST(ENABLE_CRASHDUMP)
1123
1124if test "$_os" = "WINNT"; then
1125   BUILD_TYPE="$BUILD_TYPE TWAIN"
1126fi
1127
1128if test "$_os" = "WINNT"; then
1129   dnl ===================================================================
1130   dnl Set the VC_STANDARD variable.
1131   dnl ===================================================================
1132   AC_MSG_CHECKING([whether to use the standard non-optimizing compiler])
1133   if test "$enable_cl_standard" = "" -o "$enable_cl_standard" = "no"; then
1134      VC_STANDARD=""
1135      AC_MSG_RESULT([no])
1136   else
1137      VC_STANDARD="TRUE"
1138      AC_MSG_RESULT([yes])
1139   fi
1140   AC_SUBST(VC_STANDARD)
1141fi
1142
1143dnl ===================================================================
1144dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
1145dnl ===================================================================
1146AC_MSG_CHECKING([whether to turn warnings to errors])
1147if test -n "$enable_werror" && test "$enable_werror" != "no"; then
1148   ENABLE_WERROR="TRUE"
1149   AC_MSG_RESULT([yes])
1150   AC_MSG_WARN([Turning warnings to errors has no effect in modules or])
1151   AC_MSG_WARN([on platforms where it has been disabled explicitely])
1152   echo "Turning warnings to errors has no effect in modules or on platforms where it has been disabled explicitely" >> warn
1153else
1154   ENABLE_WERROR="FALSE"
1155   AC_MSG_RESULT([no])
1156fi
1157AC_SUBST(ENABLE_WERROR)
1158
1159dnl ===================================================================
1160dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
1161dnl ===================================================================
1162AC_MSG_CHECKING([whether to do a debug build])
1163if test -n "$enable_debug" && test "$enable_debug" != "no"; then
1164   ENABLE_DEBUG="TRUE"
1165   if test -z "$enable_symbols"; then
1166      enable_symbols="yes"
1167   fi
1168   AC_MSG_RESULT([yes])
1169else
1170   ENABLE_DEBUG="FALSE"
1171   AC_MSG_RESULT([no])
1172fi
1173AC_SUBST(ENABLE_DEBUG)
1174
1175dnl ===================================================================
1176dnl Set the ENABLE_DBGUTIL variable
1177dnl ===================================================================
1178AC_MSG_CHECKING([whether to build with additional debug utilities])
1179if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
1180   PROEXT=""
1181   PRODUCT=""
1182   PROFULLSWITCH=""
1183   AC_MSG_RESULT([yes])
1184else
1185   PRODUCT="full"
1186   PROFULLSWITCH="product=full"
1187   PROEXT=".pro"
1188   AC_MSG_RESULT([no, full product build])
1189fi
1190AC_SUBST(PRODUCT)
1191AC_SUBST(PROFULLSWITCH)
1192AC_SUBST(PROEXT)
1193
1194dnl ===================================================================
1195dnl First setting is whether to include symbols into final build.
1196dnl ===================================================================
1197AC_MSG_CHECKING([whether to include symbols into final build])
1198if test -n "$enable_symbols" && test "$enable_symbols" != "no"; then
1199	if test "$enable_symbols" = "yes" -o "$enable_symbols" = "TRUE"; then
1200		ENABLE_SYMBOLS="TRUE"
1201		AC_MSG_RESULT([yes])
1202	else
1203		if test "$enable_symbols" = "SMALL" -o "$enable_symbols" = "small"; then
1204			ENABLE_SYMBOLS="SMALL"
1205			AC_MSG_RESULT([yes, small ones])
1206		else if test "$enable_symbols" != "no" ; then
1207			     echo enable symbols is: $enable_symbols
1208			     AC_MSG_ERROR([--enable-symbols only accepts yes, TRUE or SMALL as parameter.])
1209           	     else
1210              		     ENABLE_SYMBOLS=
1211		     fi
1212		fi
1213	fi
1214else
1215   ENABLE_SYMBOLS=
1216   AC_MSG_RESULT([no])
1217fi
1218AC_SUBST(ENABLE_SYMBOLS)
1219
1220dnl ===================================================================
1221dnl Determine if the solver is to be stripped or not.
1222dnl ===================================================================
1223AC_MSG_CHECKING([whether to strip the solver or not.])
1224if test -n "$enable_strip_solver"; then
1225   if test "$enable_strip_solver" = "yes"; then
1226      DISABLE_STRIP=
1227   else if test "$enable_strip_solver" = "no"; then
1228           DISABLE_STRIP="TRUE"
1229        else
1230           AC_MSG_ERROR([--disable-strip-solver only accepts yes or no as parameter.])
1231        fi
1232   fi
1233else
1234   if test -n "$ENABLE_SYMBOLS"; then
1235      DISABLE_STRIP="TRUE"
1236   else
1237      DISABLE_STRIP=
1238   fi
1239fi
1240AC_SUBST(DISABLE_STRIP)
1241
1242dnl ===================================================================
1243dnl Build options
1244dnl ===================================================================
1245
1246AC_MSG_CHECKING([whether to enable copyleft components])
1247if test "$enable_copyleft" != "yes"; then
1248
1249   enable_mozilla="no"
1250   enable_nss_module="no"
1251   enable_gstreamer="no"
1252   with_myspell_dicts="no"
1253   enable_neon="no"
1254
1255   DISABLE_HUNSPELL="TRUE"
1256   DISABLE_HYPHEN="TRUE"
1257   DISABLE_LIBWPD="TRUE"
1258   DISABLE_SAXON="TRUE"
1259   DISABLE_NEON="TRUE"
1260
1261   BUILD_EPM="NO"
1262
1263   AC_MSG_RESULT([yes])
1264
1265else
1266
1267   DISABLE_HUNSPELL=
1268   DISABLE_HYPHEN=
1269   DISABLE_LIBWPD=
1270   DISABLE_SAXON=
1271   DISABLE_NEON=
1272
1273   AC_MSG_RESULT([no])
1274
1275fi
1276AC_SUBST(DISABLE_HUNSPELL)
1277AC_SUBST(DISABLE_HYPHEN)
1278AC_SUBST(DISABLE_LIBWPD)
1279AC_SUBST(DISABLE_SAXON)
1280AC_SUBST(DISABLE_NEON)
1281AC_SUBST(BUILD_EPM)
1282
1283
1284AC_MSG_CHECKING([whether to enable native CUPS support])
1285if test "$test_cups" = "yes" -a \( "$enable_cups" = "yes" -o "$enable_cups" = "TRUE" \) ; then
1286   ENABLE_CUPS="TRUE"
1287   AC_MSG_RESULT([yes])
1288else
1289   ENABLE_CUPS=""
1290   AC_MSG_RESULT([no])
1291fi
1292AC_SUBST(ENABLE_CUPS)
1293
1294AC_MSG_CHECKING([whether to enable fontconfig support])
1295if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a \( "$enable_fontconfig" = "yes" -o "$enable_fontconfig" = "TRUE" \); then
1296   ENABLE_FONTCONFIG="TRUE"
1297   AC_MSG_RESULT([yes])
1298else
1299   ENABLE_FONTCONFIG=""
1300   AC_MSG_RESULT([no])
1301fi
1302AC_SUBST(ENABLE_FONTCONFIG)
1303
1304dnl ===================================================================
1305dnl find external tarballs.
1306dnl ===================================================================
1307if test -z $TARFILE_LOCATION; then
1308   TARFILE_LOCATION="DEFAULT"
1309fi
1310AC_SUBST(TARFILE_LOCATION)
1311
1312if test -z "$enable_fetch_external" || test "$enable_fetch_external" = "yes" \
1313   && test -z "$with_system_libs" -a "$with_system_jars" != "no"; then
1314   DO_FETCH_TARBALLS="yes"
1315fi
1316AC_SUBST(DO_FETCH_TARBALLS)
1317
1318dnl ===================================================================
1319dnl Disable legacy binary file formats filters
1320dnl ===================================================================
1321AC_MSG_CHECKING([whether to enable filters for legacy binary file formats (StarOffice 5.2)])
1322if test "$enable_binfilter" = "no"; then
1323   WITH_BINFILTER="NO"
1324   AC_MSG_RESULT([no])
1325else
1326   WITH_BINFILTER="YES"
1327   BUILD_TYPE="$BUILD_TYPE BINFILTER"
1328   AC_MSG_RESULT([yes])
1329fi
1330AC_SUBST(WITH_BINFILTER)
1331
1332if test "$_os" = "WINNT"; then
1333   AC_MSG_CHECKING([whether to use DirectX])
1334   if test "$enable_directx" = "yes" -o "$enable_directx" = "TRUE" -o "$enable_directx" = ""; then
1335      ENABLE_DIRECTX="TRUE"
1336      AC_MSG_RESULT([yes])
1337   else
1338      ENABLE_DIRECTX=""
1339      AC_MSG_RESULT([no])
1340   fi
1341   AC_SUBST(ENABLE_DIRECTX)
1342
1343   AC_MSG_CHECKING([whether to use ActiveX])
1344   if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
1345      DISABLE_ACTIVEX=""
1346      AC_MSG_RESULT([yes])
1347   else
1348      DISABLE_ACTIVEX="TRUE"
1349      AC_MSG_RESULT([no])
1350   fi
1351   AC_SUBST(DISABLE_ACTIVEX)
1352
1353   AC_MSG_CHECKING([whether to use ATL])
1354   if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE" -o "$enable_atl" = ""; then
1355      DISABLE_ATL=""
1356      AC_MSG_RESULT([yes])
1357   else
1358      DISABLE_ATL="TRUE"
1359      AC_MSG_RESULT([no])
1360   fi
1361   AC_SUBST(DISABLE_ATL)
1362
1363fi
1364
1365dnl ===================================================================
1366dnl Disable rpath in shared libraries?
1367dnl ===================================================================
1368AC_MSG_CHECKING([whether to use RPATH in shared libraries])
1369if test "$enable_rpath" = "no"; then
1370   ENABLE_RPATH="no"
1371else
1372   ENABLE_RPATH="yes"
1373fi
1374AC_MSG_RESULT([$ENABLE_RPATH])
1375AC_SUBST(ENABLE_RPATH)
1376
1377dnl Test whether to include MySpell dictionaries
1378dnl ===================================================================
1379AC_MSG_CHECKING([whether to include MySpell dictionaries])
1380if test -z "$with_myspell_dicts" || test "$with_myspell_dicts" = "yes"; then
1381  AC_MSG_RESULT([yes])
1382  WITH_MYSPELL_DICTS=YES
1383  BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
1384else
1385  AC_MSG_RESULT([no])
1386  WITH_MYSPELL_DICTS=NO
1387fi
1388AC_SUBST(WITH_MYSPELL_DICTS)
1389
1390if test "$WITH_MYSPELL_DICTS" = "NO"; then
1391  AC_MSG_CHECKING([whether to use dicts from external paths])
1392  if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
1393	AC_MSG_RESULT([yes])
1394	SYSTEM_DICTS=YES
1395	AC_MSG_CHECKING([for spelling dictionary directory])
1396	if test -n "$with_external_dict_dir"; then
1397		DICT_SYSTEM_DIR=file://$with_external_dict_dir
1398	else
1399		DICT_SYSTEM_DIR=file:///usr/share/hunspell
1400	fi
1401	AC_MSG_RESULT([$DICT_SYSTEM_DIR])
1402	AC_MSG_CHECKING([for hyphenation patterns directory])
1403	if test -n "$with_external_hyph_dir"; then
1404		HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
1405	else
1406		HYPH_SYSTEM_DIR=file:///usr/share/hyphen
1407	fi
1408	AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
1409	AC_MSG_CHECKING([for thesaurus directory])
1410	if test -n "$with_external_thes_dir"; then
1411		THES_SYSTEM_DIR=file://$with_external_thes_dir
1412	else
1413		THES_SYSTEM_DIR=file:///usr/share/mythes
1414	fi
1415	AC_MSG_RESULT([$THES_SYSTEM_DIR])
1416  else
1417  	AC_MSG_RESULT([no])
1418  	SYSTEM_DICTS=NO
1419  fi
1420fi
1421AC_SUBST(SYSTEM_DICTS)
1422AC_SUBST(DICT_SYSTEM_DIR)
1423AC_SUBST(HYPH_SYSTEM_DIR)
1424AC_SUBST(THES_SYSTEM_DIR)
1425
1426if test $_os = "WINNT"; then
1427   AC_MSG_CHECKING([Windows build environment sanity])
1428   dnl ===================================================================
1429   dnl Sanity check! Native windows programs cannot use cygwin symlinks!
1430   dnl ===================================================================
1431   dnl As long as awk instead of $AWK is used somewhere in the sources,
1432   dnl check for $AWK and awk. $AWK is pointing to gawk in cygwin.
1433      if test -L $AWK -o -L `which awk` -o -L `which tar` -o -L `which gunzip` ; then
1434         AC_MSG_ERROR([$AWK, awk, tar or gunzip is a cygwin symlink!
1435Native windows programs cannot use cygwin symlinks. Remove the symbolic
1436link, and copy the program to the name of the link.])
1437      fi
1438   dnl ===================================================================
1439   dnl Another sanity check! More a band-aid. winenv.* adds guw.exe to
1440   dnl CC and CXX but the configure checks here assume that guw.exe
1441   dnl (if needed at all) is not yet present.
1442   dnl ===================================================================
1443   CC=`echo $CC | $SED "s/^guw.exe //"`
1444   CXX=`echo $CXX | $SED "s/^guw.exe //"`
1445   dnl ===================================================================
1446   dnl If $CC is set to a MinGW compiler, e.g. "gcc -mno-cygwin" enable
1447   dnl $WITH_MINGWIN
1448   dnl ===================================================================
1449      if test -n "$CC";then
1450         if test "`$CC -dumpmachine 2>/dev/null | $SED -e 's/^.*-//'`" = "mingw32"; then
1451            WITH_MINGWIN="yes"
1452         fi
1453      fi
1454   dnl ===================================================================
1455   if test "$WITH_MINGWIN" = "yes" ; then
1456      if test -z "$CC"; then
1457         CC="gcc -mno-cygwin"
1458         CXX="g++ -mno-cygwin"
1459      fi
1460   fi
1461   AC_MSG_RESULT([ok])
1462fi
1463AC_SUBST(WITH_MINGWIN)
1464
1465dnl ===================================================================
1466dnl Extra check for Windows. cygwin builds need gcc to build dmake
1467dnl and g++ to build guw.exe although MS cl (or MinGW) is used to
1468dnl build OOo.
1469dnl ===================================================================
1470if test "$_os" = "WINNT" ; then
1471   AC_MSG_CHECKING([for cygwin gcc/g++])
1472   if which gcc > /dev/null && which g++ > /dev/null ; then
1473      AC_MSG_RESULT([found])
1474   else
1475      AC_MSG_ERROR([cygwin gcc and g++ are needed, please install them.])
1476   fi
1477fi
1478
1479
1480dnl ===================================================================
1481dnl Check whether the bash shell can be used.
1482dnl ===================================================================
1483AC_PATH_PROG(SHELLPATH, bash)
1484if test -z "$SHELLPATH"; then
1485   AC_MSG_ERROR([bash not found in \$PATH])
1486else
1487   SHELLPATH=`echo $SHELLPATH | $SED -n "s/\/bash$//p"`
1488fi
1489AC_SUBST(SHELLPATH)
1490
1491dnl ===================================================================
1492dnl  Checks for c compiler,
1493dnl  The check for the c++ compiler is later on.
1494dnl ===================================================================
1495AC_MSG_CHECKING([gcc home])
1496if test -z "$with_gcc_home"; then
1497	GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1498else
1499	GCC_HOME="$with_gcc_home"
1500fi
1501AC_MSG_RESULT($GCC_HOME)
1502AC_SUBST(GCC_HOME)
1503
1504save_CC=$CC
1505save_CXX=$CXX
1506
1507if test -n "$with_gcc_home"; then
1508   if test -z "$CC"; then
1509      CC="$with_gcc_home/bin/gcc"
1510   fi
1511fi
1512
1513dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1514if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
1515   AC_PROG_CC
1516fi
1517
1518COMPATH=`dirname "$CC"`
1519if test "$COMPATH" = "." ; then
1520    AC_PATH_PROGS(COMPATH, $CC)
1521    dnl double square bracket to get single because of M4 quote...
1522    COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1523fi
1524COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1525
1526dnl ===================================================================
1527dnl  Test the gcc version,  3 is OK
1528dnl ===================================================================
1529GCCVER=20995
1530if test \( "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes" \) -a "$GCC" = "yes"; then
1531    AC_MSG_CHECKING([the GNU gcc compiler version])
1532   _gcc_version=`$CC -dumpversion`
1533   _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
1534   GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1535
1536   if test "$_gcc_major" -lt "3"; then
1537      AC_MSG_ERROR([found version "$_gcc_version", use version 3+ of the gcc compiler])
1538   else
1539      if test "$GCCVER" -eq "030203"; then
1540	    if test "$ENABLE_SYMBOLS" = "SMALL"; then
1541           AC_MSG_ERROR([version "$_gcc_version" gives internal error with small.])
1542	    fi
1543      fi
1544   fi
1545   if test "$_os" = "Darwin" -a "$GCCVER" -ge "040100" ; then
1546      if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
1547         export CC=$GCC_HOME/bin/gcc-4.0
1548          dnl  export CC to have it available in set_soenv -> config.guess
1549         GCCVER2=`"$CC" -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1550         if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
1551            GCCVER=$GCCVER2
1552         fi
1553      fi
1554      if test "$GCCVER" -ge "040100" ; then
1555         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])
1556      else
1557         AC_MSG_RESULT([implicitly using CC=$CC])
1558      fi
1559   else
1560      AC_MSG_RESULT([checked (gcc $_gcc_version)])
1561   fi
1562   if test "$_os" = "SunOS"; then
1563      AC_MSG_CHECKING([gcc linker])
1564      if $CC -Wl,--version 2>&1 |head -n 1| grep -v GNU > /dev/null;then
1565          AC_MSG_ERROR([failed (not GNU ld). Use GNU ld instead of Sun ld on Solaris])
1566      fi
1567      AC_MSG_RESULT([ok (GNU ld)])
1568   fi
1569fi
1570AC_SUBST(GCCVER)
1571
1572HAVE_LD_BSYMBOLIC_FUNCTIONS=
1573if test "$GCC" = "yes"; then
1574   AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
1575   bsymbolic_functions_ldflags_save=$LDFLAGS
1576   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
1577   AC_LINK_IFELSE([AC_LANG_PROGRAM([
1578   #include <stdio.h>
1579   ],[
1580    printf ("hello world\n");
1581   ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
1582   if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
1583     AC_MSG_RESULT( found )
1584   else
1585     AC_MSG_RESULT( not found )
1586   fi
1587   LDFLAGS=$bsymbolic_functions_ldflags_save
1588fi
1589AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
1590
1591dnl ===================================================================
1592dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
1593dnl ===================================================================
1594AC_MSG_CHECKING([whether to enable pch feature])
1595if test -n "$enable_pch" && test "$enable_pch" != "no"; then
1596   if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
1597	   ENABLE_PCH="TRUE"
1598	   AC_MSG_RESULT([yes])
1599dnl There is no PCH support in GCC versions prior to this
1600   elif test "$GCC" = "yes" -a "$GCCVER" -gt "030400"; then
1601	   ENABLE_PCH="TRUE"
1602	   AC_MSG_RESULT([yes])
1603   else
1604	   ENABLE_PCH=""
1605	   AC_MSG_WARN([Precompiled header not yet supported for your platform/compiler])
1606   fi
1607else
1608   ENABLE_PCH=""
1609   AC_MSG_RESULT([no])
1610fi
1611AC_SUBST(ENABLE_PCH)
1612
1613dnl ===================================================================
1614dnl Search all the common names for GNU make
1615dnl ===================================================================
1616AC_MSG_CHECKING([for GNU make])
1617for a in "$MAKE" $GNUMAKE make gmake gnumake; do
1618      $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
1619      if test $? -eq 0;  then
1620           GNUMAKE=$a
1621           break
1622      fi
1623done
1624AC_MSG_RESULT($GNUMAKE)
1625if test -z "$GNUMAKE"; then
1626    AC_MSG_ERROR([not found. install GNU make.])
1627fi
1628
1629AC_MSG_CHECKING([the GNU make version])
1630_make_version=`$GNUMAKE --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
1631_make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1632if test "$_make_longver" -ge "038100" ; then
1633   AC_MSG_RESULT([$GNUMAKE $_make_version])
1634else
1635   AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
1636fi
1637AC_SUBST(GNUMAKE)
1638
1639dnl ===================================================================
1640dnl Search all the common names for GNU tar
1641dnl ===================================================================
1642AC_MSG_CHECKING([for GNU tar])
1643for a in $GNUTAR gtar gnutar tar; do
1644      $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
1645      if test $? -eq 0;  then
1646           GNUTAR=$a
1647           break
1648      fi
1649done
1650AC_MSG_RESULT($GNUTAR)
1651if test -z "$GNUTAR"; then
1652    AC_MSG_ERROR([not found. install GNU tar.])
1653fi
1654
1655AC_SUBST(GNUTAR)
1656
1657dnl ===================================================================
1658dnl  Test the solaris compiler version
1659dnl ===================================================================
1660if test "$_os" = "SunOS"; then
1661   if test "$CC" = "cc"; then
1662      AC_PATH_PROGS(_cc, cc)
1663      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
1664      AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
1665      dnl cc -V outputs to standard error!!!!
1666      _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | sed -e 's/.* C //'`
1667      _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
1668      _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
1669      if test "$_sunstudio_major" != "5"; then
1670         AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
1671      else
1672         _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" }'`
1673         if test "$_sunstudio_minor" = "false"; then
1674            AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
1675         else
1676            dnl compiler will do
1677            AC_MSG_RESULT([checked])
1678         fi
1679      fi
1680   fi
1681fi
1682
1683if test "$GCC" = "yes"; then
1684   AC_MSG_CHECKING( for --hash-style=both linker support )
1685   hash_style_ldflags_save=$LDFLAGS
1686   LDFLAGS="$LDFLAGS -Wl,--hash-style=both"
1687   AC_LINK_IFELSE([AC_LANG_PROGRAM([
1688   #include <stdio.h>
1689   ],[
1690    printf ("hello world\n");
1691   ])], HAVE_LD_HASH_STYLE=TRUE, HAVE_LD_HASH_STYLE=FALSE)
1692   if test "z$HAVE_LD_HASH_STYLE" = "zTRUE"; then
1693     AC_MSG_RESULT( found )
1694   else
1695     AC_MSG_RESULT( not found )
1696   fi
1697   LDFLAGS=$hash_style_ldflags_save
1698fi
1699AC_SUBST(HAVE_LD_HASH_STYLE)
1700
1701dnl ===================================================================
1702dnl  Test the Compaq compiler for OSF1
1703dnl ===================================================================
1704if test "$_os" = "OSF1"; then
1705   if test "$CC" = "cc"; then
1706      AC_PATH_PROGS(_cc, cc)
1707      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
1708      AC_MSG_WARN([******* $_cc , $COMPATH])
1709      AC_MSG_CHECKING([the Compaq C compiler version])
1710      dnl cc -V outputs to standard error!!!!
1711      _compaqc_version=`$CC -V 2>&1 | $AWK '{ print $3 }'`
1712      _compaqc_major=`echo $_compaqc_version | $AWK -F. '{ print $1 }'`
1713      if test "$_compaqc_major" != "T6"; then
1714         AC_MSG_ERROR([found version "$_compaqc_version", use version 6 of the Compaq C compiler])
1715      else
1716         dnl compiler will do
1717         AC_MSG_RESULT([checked])
1718      fi
1719   fi
1720fi
1721
1722dnl ===================================================================
1723dnl Check whether there's a Perl version available.
1724dnl ===================================================================
1725if test -z "$with_perl_home"; then
1726   AC_PATH_PROG(PERL, perl)
1727else
1728   if test "$_os" = "WINNT"; then
1729      with_perl_home=`cygpath -u "$with_perl_home"`
1730   fi
1731   _perl_path="$with_perl_home/bin/perl"
1732   if test -x "$_perl_path"; then
1733      PERL=$_perl_path
1734   else
1735      AC_MSG_ERROR([$_perl_path not found])
1736   fi
1737fi
1738
1739dnl ===================================================================
1740dnl Testing for Perl version 5 or greater.
1741dnl $] is the perl version variable, it is returned as an integer
1742dnl ===================================================================
1743if test "$PERL"; then
1744   AC_MSG_CHECKING([the Perl version])
1745   ${PERL} -e "exit($]);"
1746   _perl_version=$?
1747   if test "$_perl_version" -lt 5; then
1748      AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
1749   fi
1750   AC_MSG_RESULT([checked (perl $_perl_version)])
1751else
1752   AC_MSG_ERROR([Perl not found, install version 5 of Perl])
1753fi
1754AC_SUBST(PERL)
1755
1756dnl ===================================================================
1757dnl Testing for required Perl modules
1758dnl ===================================================================
1759AC_MSG_CHECKING([for required Perl modules])
1760if `$PERL -e 'use Archive::Zip;'`; then
1761	AC_MSG_RESULT([all modules found])
1762else
1763	AC_MSG_ERROR([Failed to find some modules])
1764fi
1765
1766dnl ===================================================================
1767dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
1768dnl ===================================================================
1769if test "$_os" = "WINNT"; then
1770	if test "$WITH_MINGWIN" != "yes"; then
1771		AC_MSG_CHECKING([for friendly registry keys])
1772		# VS.Net 2003, VS.Net 2005
1773		if test -z "$with_cl_home"; then
1774			vctest=`./oowintool --msvc-productdir`;
1775			if test -x "$vctest/bin/cl.exe"; then
1776				with_cl_home=$vctest;
1777			fi
1778		else
1779			with_cl_home=`cygpath -u "$with_cl_home"`
1780		fi
1781		AC_MSG_RESULT([done])
1782
1783		dnl ===========================================================
1784		dnl  Check for mspdb71.dll/mspdb80.dll
1785		dnl ===========================================================
1786		dnl  .NET 2003/5/8 Compiler
1787		if test -n "$with_mspdb_path";then
1788			with_mspdb_path=`cygpath -u "$with_mspdb_path"`
1789		fi
1790		if test -e "$with_mspdb_path/mspdb71.dll" -o -e "$with_mspdb_path/mspdb80.dll"; then
1791			MSPDB_PATH="$with_mspdb_path"
1792		fi
1793		dnl .NET 2003 case
1794		if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb71.dll"; then
1795			MSPDB_PATH="$with_cl_home/../Common7/IDE"
1796		fi
1797		dnl .NET 2005/2008 case
1798		if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
1799			MSPDB_PATH="$with_cl_home/../Common7/IDE"
1800		fi
1801		dnl Windows SDK 6.0 case
1802		if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
1803			MSPDB_PATH="$with_cl_home/bin"
1804		fi
1805
1806		if test -z "$MSPDB_PATH";then
1807			dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
1808			AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
1809			AC_PATH_PROG(MSPDB_PATH, mspdb71.dll)
1810			MSPDB_PATH=`dirname "$MSPDB_PATH"`
1811		fi
1812
1813		if test -z "$MSPDB_PATH"; then
1814			AC_MSG_ERROR([You need a mspdb71.dll/mspdb80.dll, make sure it's in the path or use --with-mspdb-path])
1815		fi
1816		MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
1817		MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
1818		dnl The path needs to be added before cl is called
1819		PATH="$MSPDB_PATH:$PATH"
1820
1821		AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
1822   		if test -x "$with_cl_home/bin/cl.exe"; then
1823   			CC="$with_cl_home/bin/cl.exe"
1824   		else
1825   			AC_PATH_PROG(CC, cl.exe)
1826   		fi
1827  		if test -e "$CC"; then
1828			# This gives us a posix path with 8.3 filename restrictions
1829			CC=`cygpath -d "$CC"`
1830			CC=`cygpath -u "$CC"`
1831			# Remove /cl.exe from CC case insensitive
1832			AC_MSG_RESULT([found ($CC)])
1833			COMPATH=`echo $CC | $SED 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]]@@'`
1834			export INCLUDE=`cygpath -d "$COMPATH/Include"`
1835			dnl  Check which Microsoft C/C++ compiler is found
1836			AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
1837dnl      The following find microsoft, matches nn.nn.nnnn then pulls numbers out.
1838			CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft/ && /..\\...\\...../ {
1839							x = match( \\\$0, /..\\...\\...../ )
1840							CCversion = substr( \\\$0, RSTART, RLENGTH)
1841							tokencount = split (CCversion,vertoken,\".\")
1842							for ( i = 1 ; i <= tokencount ; i++ ) {
1843								printf (\"%04d\",vertoken[[i]] )
1844							}
1845							}"`
1846			AC_MSG_RESULT([found Compiler version $CCNUMVER.])
1847			if test "$CCNUMVER" -ge "001500000000"; then
1848				COMEX=12
1849				MSVSVER=2008
1850				AC_MSG_RESULT([found .NET 2008 / VS 9.0.])
1851			elif test "$CCNUMVER" -ge "001400000000"; then
1852				COMEX=11
1853				MSVSVER=2005
1854				AC_MSG_RESULT([found .NET 2005.])
1855			elif test "$CCNUMVER" -ge "001300102240"; then
1856				COMEX=10
1857				MSVSVER=2003
1858				AC_MSG_RESULT([found .NET 2003.])
1859			else
1860				AC_MSG_ERROR([Compiler too old. Use Microsoft C/C++ .NET 2003/2005 compiler.])
1861			fi
1862		else
1863			AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
1864		fi
1865	else
1866		AC_MSG_CHECKING([the Mingwin32 C++ Compiler])
1867		if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then
1868			AC_MSG_RESULT([found.])
1869			if $CC -dumpspecs | grep -q "mno-cygwin"; then
1870				USE_MINGW="cygwin"
1871			else
1872				USE_MINGW="pure-mingw"
1873			fi
1874		else
1875			AC_MSG_ERROR([Mingwin32 C++ Compiler not found.])
1876		fi
1877	fi
1878fi
1879AC_SUBST(COMEX)
1880AC_SUBST(MSPDB_PATH)
1881AC_SUBST(USE_MINGW)
1882
1883dnl ===================================================================
1884dnl  .NET needs special treatment
1885dnl ===================================================================
1886if test "$_os" = "WINNT"; then
1887if test "$WITH_MINGWIN" = "yes" || test "$COMEX" -ge "10"; then
1888	dnl Check midl.exe
1889	AC_PATH_PROG(MIDL_PATH, midl.exe)
1890	if test -n "$MIDL_PATH";then
1891		MIDL_PATH=`dirname "$MIDL_PATH"`
1892	fi
1893	if test -n "$with_midl_path";then
1894		with_midl_path=`cygpath -u "$with_midl_path"`
1895	fi
1896	if test -x "$with_midl_path/midl.exe"; then
1897		MIDL_PATH="$with_midl_path"
1898	fi
1899	if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
1900		MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
1901	fi
1902	if test -z "$MIDL_PATH" ; then
1903      vstest=`./oowintool --msvs-productdir`;
1904      if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
1905		  MIDL_PATH="$vstest/Common7/Tools/Bin"
1906      fi
1907	fi
1908	if test -z "$MIDL_PATH" ; then
1909		psdktest=`./oowintool --psdk-home`
1910		if test -x "$psdktest/Bin/midl.exe" ; then
1911			MIDL_PATH="$psdktest/Bin"
1912		fi
1913	fi
1914	if test ! -x "$MIDL_PATH/midl.exe"; then
1915		AC_MSG_ERROR([midl.exe not found. Make sure it's in the path or use --with-midl-path])
1916	fi
1917	# Convert to posix path with 8.3 filename restrictions ( No spaces )
1918	MIDL_PATH=`cygpath -d "$MIDL_PATH"`
1919	MIDL_PATH=`cygpath -u "$MIDL_PATH"`
1920
1921	dnl Check csc.exe
1922	AC_PATH_PROG(CSC_PATH, csc.exe)
1923	if test -n "$CSC_PATH";then
1924		CSC_PATH=`dirname "$CSC_PATH"`
1925	fi
1926	if test -n "$with_csc_path";then
1927		with_csc_path=`cygpath -u "$with_csc_path"`
1928	fi
1929	if test -x "$with_csc_path/csc.exe"; then
1930		CSC_PATH="$with_csc_path"
1931	else
1932	   csctest=`./oowintool --csc-compilerdir`;
1933	   if test -x "$csctest/csc.exe"; then
1934	      CSC_PATH="$csctest"
1935	   fi
1936	fi
1937	if test ! -x "$CSC_PATH/csc.exe"; then
1938		AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
1939	fi
1940	# Convert to posix path with 8.3 filename restrictions ( No spaces )
1941	CSC_PATH=`cygpath -d "$CSC_PATH"`
1942	CSC_PATH=`cygpath -u "$CSC_PATH"`
1943
1944    dnl Check mscoree.lib / .NET Frameworks dir
1945    dnl For VS2003/2005 $with_frame_home has to point to the directory with lib/mscoree.lib.
1946       AC_MSG_CHECKING(.NET Framework)
1947	    if test -n "$with_frame_home"; then
1948		with_frame_home=`cygpath -u "$with_frame_home"`
1949	    fi
1950	    if test -f "$with_frame_home/lib/mscoree.lib"; then
1951		    FRAME_HOME="$with_frame_home"
1952	    fi
1953	    if test -z "$FRAME_HOME" -a -e "$with_cl_home/../SDK/v1.1/lib/mscoree.lib"; then
1954		    FRAME_HOME="$with_cl_home/../SDK/v1.1"
1955	    fi
1956	    if test -z "$FRAME_HOME" ; then
1957          frametest=`./oowintool --dotnetsdk-dir`
1958          if test -f "$frametest/lib/mscoree.lib"; then
1959             FRAME_HOME="$frametest"
1960          else
1961             frametest=`./oowintool --psdk-home`
1962             if test -f "$frametest/lib/mscoree.lib"; then
1963                FRAME_HOME="$frametest"
1964             fi
1965          fi
1966	    fi
1967	    if test ! -f "$FRAME_HOME/lib/mscoree.lib"; then
1968		AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-frame-home])
1969	    fi
1970	    AC_MSG_RESULT(found)
1971	# Convert to posix path with 8.3 filename restrictions ( No spaces )
1972	FRAME_HOME=`cygpath -d "$FRAME_HOME"`
1973	FRAME_HOME=`cygpath -u "$FRAME_HOME"`
1974fi
1975AC_SUBST(MIDL_PATH)
1976AC_SUBST(CSC_PATH)
1977AC_SUBST(FRAME_HOME)
1978fi
1979
1980dnl ===================================================================
1981dnl Check if stdc headers are available excluding windows.
1982dnl ===================================================================
1983if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
1984   AC_HEADER_STDC
1985fi
1986
1987dnl ===================================================================
1988dnl Find pre-processors.
1989dnl ===================================================================
1990if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
1991   AC_PROG_CXXCPP
1992
1993dnl Check whether there's a C pre-processor.
1994dnl ===================================================================
1995dnl When using SunStudio compiler, there is a bug with the cc
1996dnl preprocessor, so use CC preprocessor as the cc preprocessor
1997dnl See Issuezilla #445.
1998dnl ===================================================================
1999   if test "$_os" = "SunOS"; then
2000      CPP=$CXXCPP
2001   else
2002      AC_PROG_CPP
2003   fi
2004fi
2005
2006AC_CHECK_SIZEOF(long)
2007SIZEOF_LONG=$ac_cv_sizeof_long
2008AC_SUBST(SIZEOF_LONG)
2009AC_C_BIGENDIAN
2010WORDS_BIGENDIAN=$ac_cv_c_bigendian
2011AC_SUBST(WORDS_BIGENDIAN)
2012
2013dnl Check for large file support
2014AC_SYS_LARGEFILE
2015if test -n "$ac_cv_sys_file_offset_bits"; then
2016   LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
2017fi
2018if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
2019   LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
2020fi
2021AC_SUBST(LFS_CFLAGS)
2022
2023dnl ===================================================================
2024dnl Check if valgrind.h is available
2025dnl ===================================================================
2026if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2027   dnl Test $prefix (currently only testing for /usr and /usr/local)
2028   dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
2029   VALGRIND_CFLAGS=""
2030   prev_cppflags=$CPPFLAGS
2031   if test -z "$VALGRIND_CFLAGS"; then
2032      CPPFLAGS="-I/usr/include/valgrind"
2033      AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
2034   fi
2035   if test -z "$VALGRIND_CFLAGS"; then
2036      CPPFLAGS="-I/usr/local/include/valgrind"
2037      AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
2038   fi
2039   if test -n "$VALGRIND_CFLAGS"; then
2040      CPPFLAGS=$VALGRIND_CFLAGS
2041      AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
2042   fi
2043   CPPFLAGS=$prev_cppflags
2044fi
2045AC_SUBST([VALGRIND_CFLAGS])
2046
2047dnl ===================================================================
2048dnl Check if cups/cups.h is available
2049dnl ===================================================================
2050if test "$test_cups" = "yes" -a "$ENABLE_CUPS" = "TRUE" ; then
2051    AC_CHECK_HEADER(cups/cups.h, [],
2052                    [AC_MSG_ERROR([cups/cups.h could not be found. libcupsys2-dev or cups???-devel missing?])], [])
2053fi
2054
2055dnl ===================================================================
2056dnl Check if PAM/pam_appl.h is available on Linux or FreeBSD
2057dnl ===================================================================
2058if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "GNU"; then
2059  AC_MSG_CHECKING([whether to enable pam support])
2060  if test -z "$enable_pam" || test "$enable_pam" != "no"; then
2061    AC_MSG_RESULT([yes])
2062    PAM=YES
2063    AC_CHECK_HEADER(security/pam_appl.h, [],
2064                    [AC_MSG_ERROR([pam_appl.h could not be found. libpam-dev or pam-devel missing?])], [])
2065    AC_MSG_CHECKING([whether to link to libpam])
2066    if test -n "$enable_pam_link" -a "$enable_pam_link" != "no"; then
2067      AC_MSG_RESULT([yes])
2068      PAM_LINK=YES
2069      AC_CHECK_LIB(pam, pam_start, [],
2070          [AC_MSG_ERROR(libpam not found or functional)], [])
2071    else
2072      AC_MSG_RESULT([no, dynamically open it])
2073      PAM_LINK=NO
2074    fi
2075  else
2076    AC_MSG_RESULT([no])
2077    PAM=NO
2078    PAM_LINK=NO
2079    dnl check getspnam_r for needed args (4 or 5)
2080    AX_FUNC_WHICH_GETSPNAM_R
2081  fi
2082fi
2083AC_SUBST(PAM)
2084AC_SUBST(NEW_SHADOW_API)
2085AC_SUBST(PAM_LINK)
2086
2087if test "$_os" = "Linux"; then
2088    AC_MSG_CHECKING([whether to link to libcrypt])
2089    if test -n "$enable_crypt_link" -a "$enable_crypt_link" != "no"; then
2090        AC_MSG_RESULT([yes])
2091        CRYPT_LINK=YES
2092        AC_CHECK_LIB(crypt, crypt, [],
2093            [AC_MSG_ERROR(libcrypt not found or functional)], [])
2094    else
2095        AC_MSG_RESULT([no, dynamically open it])
2096        CRYPT_LINK=NO
2097    fi
2098fi
2099AC_SUBST(CRYPT_LINK)
2100
2101dnl ===================================================================
2102dnl Testing for c++ compiler and version...
2103dnl ===================================================================
2104if test -n "$with_gcc_home"; then
2105   if test -z "$CXX"; then
2106      CXX="$with_gcc_home/bin/g++"
2107   fi
2108fi
2109
2110if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
2111   if test -e "$CC"; then
2112      CXX="$CC"
2113   fi
2114fi
2115
2116dnl Autoconf 2.53 can do this test for cl.exe, 2.13 can't!
2117if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2118   AC_PROG_CXX
2119fi
2120
2121dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
2122if test "$GXX" = "yes"; then
2123   AC_MSG_CHECKING([the GNU C++ compiler version])
2124
2125   _gpp_version=`$CXX -dumpversion`
2126   _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
2127
2128   if test "$_os" = "Darwin" -a "$_gpp_majmin" -ge "401" ; then
2129      if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
2130         CXX=$GCC_HOME/bin/g++-4.0
2131         _gpp_majmin_2=`"$CXX" -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
2132         if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
2133            _gpp_majmin=$_gpp_majmin_2
2134         fi
2135      fi
2136      if test "$_gpp_majmin" -ge "401" ; then
2137         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])
2138      else
2139         AC_MSG_RESULT([implicitly using CXX=$CXX])
2140      fi
2141   else
2142      AC_MSG_RESULT([checked (g++ $_gpp_version)])
2143   fi
2144
2145   if test "$_gpp_majmin" = "304"; then
2146      AC_MSG_CHECKING([whether $CXX has the enum bug])
2147AC_TRY_RUN([
2148extern "C" void abort (void);
2149extern "C" void exit (int status);
2150
2151enum E { E0, E1, E2, E3, E4, E5 };
2152
2153void
2154test (enum E e)
2155{
2156  if (e == E2 || e == E3 || e == E1)
2157  exit (1);
2158}
2159
2160int
2161main (void)
2162{
2163  test (E4);
2164  test (E5);
2165  test (E0);
2166  return 0;
2167}
2168],[AC_MSG_ERROR([your version of the GNU C++ compile has a bug which prevents OpenOffice.org from being compiled correctly - please check http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00968.html for details.])], [AC_MSG_RESULT([no])])
2169   fi
2170fi
2171
2172dnl ===================================================================
2173dnl Set the gcc/gxx include directories
2174dnl ===================================================================
2175# Removed the special FreeBSD treatment. The problem was that with_gxx_include_path
2176# often contains an i386 which is expanded as a macro. Solved in stlport.
2177if test "$GXX" = "yes"; then
2178   AC_MSG_CHECKING([for g++ include path])
2179   if test -z "$with_gxx_include_path"; then
2180      with_gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
2181      if test "$with_gxx_include_path" = "/usr/libexec/(null)/include"; then
2182          with_gxx_include_path="/usr/include"
2183      fi
2184      if test "$WITH_MINGWIN" = "yes"; then
2185         with_gxx_include_path=`cygpath -d "$with_gxx_include_path"`
2186         with_gxx_include_path=`cygpath -u "$with_gxx_include_path"`
2187      fi
2188      if echo $with_gxx_include_path | grep -q linux; then
2189         # workaround for Mandriva - issue 100049
2190         with_gxx_include_path=`cd $with_gxx_include_path && pwd`
2191      fi
2192   fi
2193fi
2194dnl This is the original code...
2195dnl with_gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include
2196if test -z "$with_gxx_include_path"; then
2197   with_gxx_include_path="NO_GXX_INCLUDE"
2198   AC_MSG_RESULT([no g++ includes])
2199else
2200   AC_MSG_RESULT([$with_gxx_include_path])
2201fi
2202GXX_INCLUDE_PATH="$with_gxx_include_path"
2203AC_SUBST(GXX_INCLUDE_PATH)
2204
2205dnl ===================================================================
2206dnl Set the mingw runtime library include directories
2207dnl ===================================================================
2208if test "$WITH_MINGWIN" = "yes"; then
2209   AC_MSG_CHECKING([for mingwin runtime include path])
2210   cat >conftest.$ac_ext <<_ACEOF
2211#include <stddef.h>
2212#include <bits/c++config.h>
2213_ACEOF
2214   _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`
2215   rm conftest.$ac_ext
2216   if test -n "$_mingw_lib_include_path"; then
2217      _temp=""
2218      for a in $_mingw_lib_include_path
2219         do
2220            a=`cygpath -d "$a"`
2221            _temp="$_temp "`cygpath -u "$a"`
2222         done
2223      _mingw_lib_include_path=$_temp
2224   fi
2225   if test -z "$_mingw_lib_include_path"; then
2226      _mingw_lib_include_path="NO_LIB_INCLUDE"
2227      AC_MSG_RESULT([no mingwin runtime includes])
2228   else
2229      AC_MSG_RESULT([$_mingw_lib_include_path])
2230   fi
2231  MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
2232  AC_SUBST(MINGW_LIB_INCLUDE_PATH)
2233dnl mingw gcc 4.4.0 needs backward in include path to use hash_set/hash_map
2234   AC_MSG_CHECKING([for mingwin c++ backward include path])
2235   cat >conftest.$ac_ext <<_ACEOF
2236#include <hash_set>
2237_ACEOF
2238   _mingw_backward_include_path=`$CXX -E -xc++ -Wno-deprecated conftest.$ac_ext 2>&5| $SED -n -e '/.*1*"\(.*\)\/hash_set".*/s//\1/p' | sort -u | xargs echo`
2239   rm conftest.$ac_ext
2240   if test -n "$_mingw_backward_include_path"; then
2241      _mingw_backward_include_path=`cygpath -d $_mingw_backward_include_path`
2242      _mingw_backward_include_path=`cygpath -u $_mingw_backward_include_path`
2243      AC_MSG_RESULT([$_mingw_backward_include_path])
2244   else
2245      _mingw_backward_include_path="NO_BACKWARD_INCLUDE"
2246      AC_MSG_RESULT([no mingwin c++ backward includes])
2247   fi
2248  MINGW_BACKWARD_INCLUDE_PATH="$_mingw_backward_include_path"
2249  AC_SUBST(MINGW_BACKWARD_INCLUDE_PATH)
2250  mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
2251  MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
2252  AC_MSG_CHECKING([whether to use dynamic libgcc])
2253  if test -e "$MINGW_CLIB_DIR/libgcc_s.a"; then
2254    AC_MSG_CHECKING([dynamic libgcc name])
2255    MINGW_GCCDLL_pattern=`nm $MINGW_CLIB_DIR/libgcc_s.a | sed -ne 's@.* _libgcc\(.*\)_dll_iname@libgcc\1.dll@p' | uniq | sed -e 's@_@?@g'`
2256    MINGW_GCCDLL=`cd $COMPATH/bin && ls $MINGW_GCCDLL_pattern 2>/dev/null`
2257    if test -n "$MINGW_GCCDLL"; then
2258        MINGW_SHARED_GCCLIB=YES
2259        AC_MSG_RESULT([use $MINGW_GCCDLL])
2260    else
2261        AC_MSG_RESULT([no])
2262    fi
2263  else
2264    AC_MSG_RESULT([no])
2265  fi
2266  if test -e "$MINGW_CLIB_DIR/libgcc_eh.a"; then
2267      MINGW_GCCLIB_EH=YES
2268  fi
2269  AC_MSG_CHECKING([whether to use dynamic libstdc++])
2270  MINGW_SHARED_LIBSTDCPP=
2271  if test -e "$MINGW_CLIB_DIR/libstdc++_s.a" ; then
2272    MINGW_SHARED_LIBSTDCPP=stdc++_s
2273  fi
2274  if test -e "$MINGW_CLIB_DIR/libstdc++.dll.a" ; then
2275    MINGW_SHARED_LIBSTDCPP=stdc++.dll
2276  fi
2277  if test -n "$MINGW_SHARED_LIBSTDCPP" ; then
2278    AC_MSG_CHECKING([dynamic libstdc++ name])
2279    MINGW_GXXDLL_pattern=`nm $MINGW_CLIB_DIR/lib$MINGW_SHARED_LIBSTDCPP.a | sed -ne 's@.* _libstdc__\(.*\)_dll_iname@libstdc++\1.dll@p' | uniq | sed -e 's@_@?@g'`
2280    MINGW_GXXDLL=`cd $COMPATH/bin && ls $MINGW_GXXDLL_pattern 2>/dev/null`
2281    if test -n "$MINGW_GXXDLL"; then
2282        MINGW_SHARED_LIBSTDCPP=-l$MINGW_SHARED_LIBSTDCPP
2283        MINGW_SHARED_GXXLIB=YES
2284        AC_MSG_RESULT([use $MINGW_GXXDLL])
2285    else
2286        MINGW_SHARED_LIBSTDCPP=
2287        AC_MSG_RESULT([no])
2288    fi
2289  else
2290    AC_MSG_RESULT([no])
2291  fi
2292  MINGW_CLIB_DIR=`cygpath $MINGW_CLIB_DIR`
2293  AC_SUBST(MINGW_CLIB_DIR)
2294  AC_SUBST(MINGW_SHARED_GCCLIB)
2295  AC_SUBST(MINGW_GCCLIB_EH)
2296  AC_SUBST(MINGW_SHARED_GXXLIB)
2297  AC_SUBST(MINGW_SHARED_LIBSTDCPP)
2298  AC_SUBST(MINGW_GCCDLL)
2299  AC_SUBST(MINGW_GXXDLL)
2300fi
2301
2302dnl ===================================================================
2303dnl Extra checking for the SUN OS compiler
2304dnl ===================================================================
2305if test "$_os" = "SunOS"; then
2306   dnl SunStudio C++ compiler packaged with SunStudio C compiler
2307   if test "$CC" = "cc"; then
2308   AC_MSG_CHECKING([SunStudio C++ Compiler])
2309      if test "$CXX" != "CC"; then
2310         AC_MSG_WARN([SunStudio C++ was not found])
2311         echo "SunStudio C++ was not found" >> warn
2312      else
2313         AC_MSG_RESULT([checked])
2314      fi
2315   fi
2316fi
2317dnl ===================================================================
2318dnl Extra checking for the OSF compiler
2319dnl ===================================================================
2320if test "$_os" = "OSF1"; then
2321   AC_MSG_CHECKING([Compaq C++ compiler version])
2322   dnl cxx -V outputs to standard error!!!!
2323   _compaqcxx_version=`$CXX -V 2>&1 | $AWK '{ print $3 }'`
2324   _compaqcxx_major=`echo $_compaqcxx_version | $AWK -F. '{ print $1 }'`
2325   if test "$_compaqcxx_major" != "V6"; then
2326      AC_MSG_WARN([found version "$_compaqc_version", use version 6 of the Compaq C++ compiler])
2327      echo "found version $_compaqc_version, use version 6 of the Compaq C++ compiler" >> warn
2328   else
2329      dnl compiler will do
2330      AC_MSG_RESULT([checked])
2331   fi
2332fi
2333
2334dnl *************************************************************
2335dnl Testing for exception handling - dwarf2 or sjlj exceptions...
2336dnl *************************************************************
2337AC_MSG_CHECKING([exception type])
2338AC_LANG_PUSH([C++])
2339if test "$WITH_MINGWIN" = "yes"; then
2340  AC_TRY_LINK(
2341	[#include <iostream>
2342
2343extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
2344
2345	],
2346	[_Unwind_SjLj_RaiseException() ],
2347	[exceptions_type="sjlj"],
2348	[exceptions_type="dwarf2"]
2349  )
2350fi
2351
2352AC_MSG_RESULT($exceptions_type)
2353AC_LANG_POP([C++])
2354EXCEPTIONS="$exceptions_type"
2355AC_SUBST(EXCEPTIONS)
2356
2357dnl **************************************************************
2358dnl Testing for required  Solaris and SunStudio compiler patches...
2359dnl **************************************************************
2360dnl Check whether the OS is SunOS.
2361if test "$_os" = "SunOS"; then
2362   _temp=`showrev -p | $AWK -F" " '{ print $2 }'`
2363   if test "$_os_release" = "7"; then
2364      dnl ***************
2365      dnl patch 106327-06
2366      dnl ***************
2367      AC_MSG_CHECKING([for patch 106327-06 or greater])
2368      _patch=`echo $_temp | $AWK '/106327-06/ { print "found" }'`
2369      _patch="false"
2370      for i in $_temp
2371      do
2372         _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
2373         if test "$_patch_major" = "106327"; then
2374            _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
2375            if test "$_patch_rev" -ge "6"; then
2376               _patch="found"
2377            fi
2378        fi
2379      done
2380      if test "$_patch" = "found"; then
2381         AC_MSG_RESULT([found])
2382      else
2383         AC_MSG_WARN([patch 106327-06 not found, please install compiler patch 106327-06 or greater])
2384         echo "patch 106327-06 not found, please install compiler patch 106327-06 or greater" >> warn
2385      fi
2386      dnl ***************
2387      dnl patch 106950-11
2388      dnl ***************
2389      AC_MSG_CHECKING([for patch 106950-11 or greater])
2390      _patch=`echo $_temp | $AWK '/106950-11/ { print "found" }'`
2391      _patch="false"
2392      for i in $_temp
2393      do
2394         _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
2395         if test "$_patch_major" = "106950"; then
2396            _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
2397            if test "$_patch_rev" -ge "11"; then
2398               _patch="found"
2399            fi
2400         fi
2401      done
2402      if test "$_patch" = "found"; then
2403         AC_MSG_RESULT([found])
2404      else
2405         AC_MSG_WARN([patch 106950-11 not found, please install linker patch 106950-11 or greater])
2406         echo "patch 106950-11 not found, please install linker patch 106950-11 or greater" >> warn
2407      fi
2408   else
2409      if test "$_os_release" = "6"; then
2410         dnl ***************
2411         dnl patch 105591-09
2412         dnl ***************
2413         AC_MSG_CHECKING([for patch 105591-09 or greater])
2414         _patch=`echo $_temp | $AWK '/105591-09/ { print "found" }'`
2415         _patch="false"
2416         for i in $_temp
2417         do
2418            _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
2419            if test "$_patch_major" = "105591"; then
2420               _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
2421               if test "$_patch_rev" -ge "9"; then
2422                  _patch="found"
2423               fi
2424           fi
2425         done
2426         if test "$_patch" = "found"; then
2427            AC_MSG_RESULT([found])
2428         else
2429            AC_MSG_WARN([patch 105591-09 not found, please install compiler patch 105591-09 or greater])
2430            echo "patch 105591-09 not found, please install compiler patch 105591-09 or greater" >> warn
2431         fi
2432         dnl ***************
2433         dnl patch 107733-08
2434         dnl ***************
2435         AC_MSG_CHECKING([for patch 107733-08 or greater])
2436         _patch=`echo $_temp | $AWK '/107733-08/ { print "found" }'`
2437         _patch="false"
2438         for i in $_temp
2439         do
2440            _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
2441            if test "$_patch_major" = "107733"; then
2442               _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
2443               if test "$_patch_rev" -ge "8"; then
2444                  _patch="found"
2445               fi
2446           fi
2447         done
2448         if test "$_patch" = "found"; then
2449            AC_MSG_RESULT([found])
2450         else
2451            AC_MSG_WARN([patch 107733-06 not found, please install linker patch 107733-08 or greater])
2452            echo "patch 107733-06 not found, please install linker patch 107733-08 or greater" >> warn
2453         fi
2454      fi
2455   fi
2456fi
2457
2458dnl ===================================================================
2459dnl Checks for what the default STL should be
2460dnl ===================================================================
2461   AC_MSG_CHECKING([what the default STL should be])
2462   DEFAULT_TO_STLPORT="no"
2463   if test "$_os" = "Linux"; then
2464     case "$build_cpu" in
2465       i?86)
2466	 case "$build_os" in k*bsd*-gnu*)
2467	 	DEFAULT_TO_STLPORT="no"
2468		;;
2469	 *)
2470         	DEFAULT_TO_STLPORT="yes"
2471		;;
2472	  esac
2473         ;;
2474       *)
2475         DEFAULT_TO_STLPORT="no"
2476         ;;
2477     esac
2478   elif test "$_os" = "SunOS"; then
2479      DEFAULT_TO_STLPORT="yes"
2480   elif test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
2481      DEFAULT_TO_STLPORT="yes"
2482   elif test "$_os" = "OS2"; then
2483      DEFAULT_TO_STLPORT="yes"
2484   elif test "$_os" = "FreeBSD"; then
2485      DEFAULT_TO_STLPORT="yes"
2486   fi
2487   if test "$DEFAULT_TO_STLPORT" = "yes"; then
2488      AC_MSG_RESULT([stlport])
2489   else
2490      AC_MSG_RESULT([system])
2491   fi
2492   if test "$WITH_STLPORT" = "auto"; then
2493      WITH_STLPORT=$DEFAULT_TO_STLPORT
2494   fi
2495
2496dnl ===================================================================
2497dnl Checks for STLPORT
2498dnl ===================================================================
2499   AC_MSG_CHECKING([for STL providing headers])
2500   STLPORT4=""
2501   USE_SYSTEM_STL=""
2502   if test "$WITH_STLPORT" = "yes"; then
2503      AC_MSG_RESULT([using internal stlport.])
2504      if test "$DEFAULT_TO_STLPORT" != "yes"; then
2505         AC_MSG_WARN([using stlport. Warning, breaks your ABI compatability!])
2506         echo "using stlport. Warning, breaks your ABI compatability!" >>warn
2507      fi
2508   elif test "$WITH_STLPORT" = "no"; then
2509      AC_MSG_RESULT([using system STL])
2510      USE_SYSTEM_STL="YES"
2511      if test "$DEFAULT_TO_STLPORT" != "no"; then
2512         AC_MSG_WARN([using system STL. Warning, breaks your ABI compatability!])
2513         echo "using system STL. Warning, breaks your ABI compatability!" >>warn
2514      fi
2515   else
2516      STLPORT4=$WITH_STLPORT
2517      if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2518         AC_TRY_CPP($STLPORT4/stlport/hash_map, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([STLport headers not found.]))
2519      else
2520         dnl AC_TRY_CPP doesn't work for MSVC because C++ preprocessor is not found by autoconf.
2521         if test -f "$STLPORT4/stlport/hash_map"; then
2522            AC_MSG_RESULT([checked.])
2523         else
2524            AC_MSG_ERROR([STLport headers not found.])
2525         fi
2526      fi
2527      if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2528         AC_MSG_CHECKING([for STLport libraries])
2529         if test "$_os" = "SunOS"; then
2530		      if test -f "$STLPORT4/lib/libstlport_sunpro.so"; then
2531			      AC_MSG_RESULT([checked])
2532		      elif test -f "$STLPORT4/lib/libstlport.so"; then
2533			      AC_MSG_RESULT([checked])
2534			      STLPORT_VER=500
2535		      else
2536			      AC_MSG_ERROR([STLport libraries not found])
2537		      fi
2538	      elif test "$_os" = "Darwin"; then
2539		      if test -f "$STLPORT4/lib/libstlport_gcc.dylib"; then
2540			      AC_MSG_RESULT([checked])
2541		      elif test -f "$STLPORT4/lib/libstlport.dylib"; then
2542			      AC_MSG_RESULT([checked])
2543			      STLPORT_VER=500
2544		      else
2545			      AC_MSG_ERROR([STLport libraries not found])
2546		      fi
2547		   else
2548			   if test -f "$STLPORT4/lib/libstlport_gcc.so"; then
2549				   AC_MSG_RESULT([checked])
2550			   elif test -f "$STLPORT4/lib/libstlport.so"; then
2551				   AC_MSG_RESULT([checked])
2552				   STLPORT_VER=500
2553			   else
2554				   AC_MSG_ERROR([STLport libraries not found])
2555			   fi
2556		   fi
2557	   fi
2558      if test "$DEFAULT_TO_STLPORT" != "yes"; then
2559         AC_MSG_WARN([using stlport. Warning, breaks your ABI compatability!])
2560         echo "using stlport. Warning, breaks your ABI compatability!" >>warn
2561      fi
2562   fi
2563
2564if test -z "$STLPORT4"; then
2565  STLPORT4="NO_STLPORT4"
2566fi
2567if test -z "$STLPORT_VER"; then
2568  STLPORT_VER=400
2569fi
2570AC_SUBST(STLPORT4)
2571AC_SUBST(STLPORT_VER)
2572AC_SUBST(USE_SYSTEM_STL)
2573
2574dnl ===================================================================
2575dnl visibility feature
2576dnl ===================================================================
2577if test "$GCC" = "yes"; then
2578   AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
2579   save_CFLAGS=$CFLAGS
2580   CFLAGS="$CFLAGS -fvisibility=hidden"
2581   AC_TRY_LINK([], [ return 0; ], [ HAVE_GCC_VISIBILITY_FEATURE=TRUE ], [])
2582   CFLAGS=$save_CFLAGS
2583   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2584      AC_MSG_RESULT([yes])
2585   else
2586      AC_MSG_RESULT([no])
2587   fi
2588fi
2589
2590# ===================================================================
2591# use --ccache-skip?
2592# ===================================================================
2593dnl used to escape compiler options for ccache that otherwise prevent
2594dnl caching of the results (like "-x objective-c++" for Mac)
2595AC_MSG_CHECKING([whether we are allowed and able to use --ccache-skip])
2596if test "$_os" != "Darwin" ; then
2597   AC_MSG_RESULT([only used on Mac currently, skipping])
2598elif test "$enable_ccache_skip" = "no" ; then
2599   AC_MSG_RESULT([no - diabled explicitly])
2600elif test "$enable_ccache_skip" = "yes" ; then
2601   AC_MSG_RESULT([yes - enabled explicitly, skipping checks])
2602   AC_SUBST([USE_CCACHE], [YES])
2603elif test "$enable_ccache_skip" = "auto" ; then
2604   # checking for ccache presence/version
2605   AC_MSG_RESULT([probing...])
2606   AC_PATH_PROG([CCACHE],[ccache],[not_found])
2607   if test "$CCACHE" = "not_found" ; then
2608      AC_MSG_NOTICE([not enabling --ccache-skip (ccache not found)])
2609   else
2610      # check ccache version
2611      AC_MSG_CHECKING([whether version of ccache is suitable])
2612      CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2613      if test "$CCACHE_VERSION" = "2.4_OOo"; then
2614         AC_MSG_RESULT([yes])
2615         AC_MSG_CHECKING([whether ccache is actually used for the build])
2616         AC_LANG_PUSH([C++])
2617         save_CXXFLAGS=$CXXFLAGS
2618         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
2619         dnl an empty program will do, we're checking the compiler flags
2620         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2621            [use_ccache=yes], [use_ccache=no])
2622         if test $use_ccache = yes ; then
2623            AC_MSG_RESULT([yes, will enable --ccache-skip])
2624            AC_SUBST([USE_CCACHE], [YES])
2625         else
2626            AC_MSG_RESULT([no, will not enable --ccache-skip])
2627         fi
2628         CXXFLAGS=$save_CXXFLAGS
2629         AC_LANG_POP([C++])
2630      else
2631         AC_MSG_RESULT([no])
2632         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. See description for --enable-ccache-skip])
2633      fi
2634   fi
2635else
2636   AC_MSG_ERROR([invalid option to --enable-ccache-skip. Valid values are "auto", "yes" and "no"])
2637fi
2638
2639dnl ===================================================================
2640dnl system stl sanity tests
2641dnl ===================================================================
2642if test "$USE_SYSTEM_STL" = "YES"; then
2643   AC_MSG_CHECKING([if hash_map will be in __gnu_cxx namespace])
2644   AC_LANG_PUSH([C++])
2645
2646   AC_TRY_COMPILE([#include <ext/hash_map>
2647using namespace __gnu_cxx;
2648],[hash_map<int, int> t; return 0;],
2649  ac_cv_cxx_have_ext_hash_map=yes, ac_cv_cxx_have_ext_hash_map=no)
2650
2651   if test "$ac_cv_cxx_have_ext_hash_map" = "no"; then
2652      AC_MSG_ERROR([Can't find hash_map. Try with --with-stlport])
2653   else
2654      AC_MSG_RESULT([$ac_cv_cxx_have_ext_hash_map])
2655   fi
2656
2657   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2658      AC_MSG_CHECKING([if STL headers are visibility safe])
2659      AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
2660      AC_MSG_RESULT([$stlvisok])
2661      if test "$stlvisok" = "no"; then
2662         AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
2663         echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
2664         unset HAVE_GCC_VISIBILITY_FEATURE
2665      fi
2666   fi
2667
2668   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2669      sharedlink_ldflags_save=$LDFLAGS
2670      LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
2671
2672      AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
2673      AC_TRY_LINK([#include <sstream>
2674using namespace std;
2675],[istringstream strm( "test" ); return 0;],
2676      $EGREP -q  unresolvable conftest.err;
2677      if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi,
2678      gccvisok=no)
2679      AC_MSG_RESULT([$gccvisok])
2680      if test "$gccvisok" = "no"; then
2681         AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility])
2682         echo "Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility" >> warn
2683         unset HAVE_GCC_VISIBILITY_FEATURE
2684      fi
2685
2686      LDFLAGS=$sharedlink_ldflags_save
2687   fi
2688
2689   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2690      AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
2691      cat >visibility.cxx <<_ACEOF
2692#pragma GCC visibility push(hidden)
2693struct __attribute__ ((visibility ("default"))) TestStruct {
2694  static void Init();
2695};
2696__attribute__ ((visibility ("default"))) void TestFunc() {
2697  TestStruct::Init();
2698}
2699_ACEOF
2700      if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
2701         gccvisbroken=yes
2702      else
2703         case "$build_cpu" in
2704            i?86|x86_64)
2705               if $EGREP -q '@PLT' visibility.s; then
2706                  gccvisbroken=no
2707               else
2708                  gccvisbroken=yes
2709               fi
2710               ;;
2711            *)
2712               gccvisbroken=no
2713               ;;
2714         esac
2715      fi
2716      rm -f visibility.s visibility.cxx
2717
2718      AC_MSG_RESULT([$gccvisbroken])
2719      if test "$gccvisbroken" = "yes"; then
2720         AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
2721         echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
2722         unset HAVE_GCC_VISIBILITY_FEATURE
2723      fi
2724   fi
2725
2726   AC_LANG_POP([C++])
2727fi
2728
2729AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
2730
2731dnl ===================================================================
2732dnl allocator
2733dnl ===================================================================
2734AC_MSG_CHECKING([which memory allocator to use])
2735if test "$with_alloc" = "system"; then
2736    AC_MSG_RESULT([system])
2737    ALLOC="SYS_ALLOC";
2738    AC_CHECK_FUNCS([malloc realloc calloc free])
2739fi
2740if test "$with_alloc" = "tcmalloc"; then
2741    AC_MSG_RESULT(tcmalloc)
2742    if ! echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
2743        AC_MSG_ERROR([tcmalloc only available/usable on ix86])
2744    fi
2745    AC_CHECK_LIB(tcmalloc, malloc, [],
2746        [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
2747    ALLOC="TCMALLOC";
2748fi
2749if test "$with_alloc" = "jemalloc"; then
2750  if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
2751    AC_MSG_RESULT(jemalloc)
2752    save_CFLAGS=$CFLAGS
2753    CFLAGS="$CFLAGS -pthread"
2754    AC_CHECK_LIB(jemalloc, malloc, [],
2755        [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
2756    ALLOC="JEMALLOC";
2757    CFLAGS=$save_CFLAGS
2758  else
2759    AC_MSG_RESULT([system])
2760    ALLOC="SYS_ALLOC";
2761    AC_CHECK_FUNCS([malloc realloc calloc free])
2762  fi
2763fi
2764if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
2765   AC_MSG_RESULT([internal])
2766fi
2767AC_SUBST(ALLOC)
2768
2769dnl ===================================================================
2770dnl Custom build version
2771dnl ===================================================================
2772
2773AC_MSG_CHECKING([whether to add custom build version])
2774if test "z$with_build_version" != "z"; then
2775   BUILD_VER_STRING=$with_build_version
2776   AC_MSG_RESULT([yes, $BUILD_VER_STRING])
2777else
2778   BUILD_VER_STRING=
2779   AC_MSG_RESULT([no])
2780fi
2781AC_SUBST(BUILD_VER_STRING)
2782
2783dnl ===================================================================
2784dnl Java support enable
2785dnl ===================================================================
2786AC_MSG_CHECKING([whether to build with Java support])
2787if test "$WITH_JAVA" != "no"; then
2788   AC_MSG_RESULT([yes])
2789   SOLAR_JAVA="TRUE"
2790else
2791   AC_MSG_RESULT([no])
2792   SOLAR_JAVA=""
2793
2794   AC_MSG_WARN([building without java will mean some features will not be available])
2795   echo "building without java will mean some features will not be available" >>warn
2796fi
2797AC_SUBST(SOLAR_JAVA)
2798
2799if test "$_os" = "Linux" && test "$build_cpu" = "powerpc"; then
2800   # IBMs JDK needs this...
2801   JITC_PROCESSOR_TYPE=6
2802   export JITC_PROCESSOR_TYPE
2803fi
2804
2805if test "$_os" = "WINNT"; then
2806   if test -z "$with_jdk_home"; then
2807      _jdk_home=`./oowintool --jdk-home`
2808       if test -d "$_jdk_home"; then
2809          with_jdk_home="$_jdk_home"
2810       fi
2811   else
2812      with_jdk_home=`cygpath -u "$with_jdk_home"`
2813   fi
2814fi
2815
2816dnl ===================================================================
2817dnl Checks for java
2818dnl ===================================================================
2819if test "$SOLAR_JAVA" != ""; then
2820   JAVA_HOME=; export JAVA_HOME
2821   if test -z "$with_jdk_home"; then
2822      AC_PATH_PROG(JAVAINTERPRETER, $WITH_JAVA)
2823   else
2824      _java_path="$with_jdk_home/bin/$WITH_JAVA"
2825      dnl Check if there is a java interpreter at all.
2826      if test -x "$_java_path"; then
2827         JAVAINTERPRETER=$_java_path
2828      else
2829         AC_MSG_ERROR([$_java_path not found, please use --with_jdk_home])
2830      fi
2831   fi
2832   if test "$_os" = "WINNT"; then
2833      if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
2834          JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
2835      fi
2836      JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
2837      JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
2838   elif test "$_os" = "Darwin"; then
2839      dnl HACK:  There currently is only a 32 bit version of OOo for Mac OS X,
2840      dnl and Tiger java complains about -d32 while Snow Leopard java needs it
2841      dnl to run in 32 bit mode and be able to load OOo jnilibs:
2842      AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
2843      if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
2844         AC_MSG_RESULT([yes])
2845         JAVAIFLAGS=-d32
2846      else
2847         AC_MSG_RESULT([no])
2848      fi
2849   fi
2850fi
2851
2852dnl ===================================================================
2853dnl Checks for JDK.
2854dnl ===================================================================
2855if test "$SOLAR_JAVA" != ""; then
2856   _gij_longver=0
2857   AC_MSG_CHECKING([the installed JDK])
2858   if test -n "$JAVAINTERPRETER"; then
2859      dnl java -version sends output to stderr!
2860      if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
2861         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
2862#        dnl Kaffe specific tests
2863#        KAFFE_VER=`$JAVAINTERPRETER -version 2>&1 | $EGREP "  Version:" | $SED -r "s/.*  Version: ([[0-9\.]]*).*/\1/"`
2864#        if test -z "$KAFFE_VER"; then
2865#          AC_MSG_ERROR([looks like Kaffe but version detection failed])
2866#        fi
2867#        _kaffe_ver=`echo "$KAFFE_VER" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
2868#        if test "$_kaffe_ver" -lt 10100; then
2869#           AC_MSG_ERROR([Kaffe is too old ($KAFFE_VER - $_kaffe_ver), you need at least 1.1.0])
2870#        fi
2871#        JDK=kaffe
2872#
2873#        dnl TODO: define some project exclusion variables
2874#
2875#        AC_MSG_RESULT([checked (Kaffe $KAFFE_VER)])
2876#        AC_MSG_WARN([EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile])
2877#        echo "EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile" >>warn
2878#        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
2879      elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
2880        JDK=gcj
2881        AC_MSG_RESULT([checked (gcj)])
2882        _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
2883        _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2884
2885      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | grep -c "BEA"` -gt 0; then
2886         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
2887#        JDK=bea
2888#
2889#        dnl BEA JDK specific tests
2890#        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
2891#        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
2892#
2893#        if test "$_jdk_ver" -lt 10500; then
2894#          AC_MSG_ERROR([JDK is too old, you need at least BEA JDK 1.5.0])
2895#        fi
2896#
2897#        AC_MSG_RESULT([checked (BEA JDK $_jdk)])
2898#
2899#        if test "$with_jdk_home" = ""; then
2900#             AC_MSG_ERROR([In order to successfully build OpenOffice.org using the BEA JDK,
2901#you must use the "--with-jdk-home" configure option explicitly])
2902#        fi
2903#
2904#        AC_MSG_WARN([A bug in certain BEA JREs can prevent you from successfully compiling some modules])
2905#        echo "A bug in certain BEA JREs can prevent you from successfully compiling some modules" >>warn
2906#
2907#        JAVA_HOME=$with_jdk_home
2908#
2909      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | grep -c "IBM"` -gt 0; then
2910        JDK=ibm
2911
2912        dnl IBM JDK specific tests
2913        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
2914        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
2915
2916        if test "$_jdk_ver" -lt 10500; then
2917             AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
2918        fi
2919
2920        AC_MSG_RESULT([checked (IBM JDK $_jdk)])
2921
2922        if test "$with_jdk_home" = ""; then
2923             AC_MSG_ERROR([In order to successfully build OpenOffice.org using the IBM JDK,
2924you must use the "--with-jdk-home" configure option explicitly])
2925        fi
2926
2927        JAVA_HOME=$with_jdk_home
2928
2929      else
2930        JDK=sun
2931
2932        dnl SUN JDK specific tests
2933        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
2934        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
2935
2936        if test "$_jdk_ver" -lt 10500; then
2937             AC_MSG_ERROR([JDK is too old, you need at least 1.5])
2938        fi
2939        AC_MSG_RESULT([checked (JDK $_jdk)])
2940        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
2941        if test "$_os" = "WINNT"; then
2942          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
2943        fi
2944        if test "$_os" = "OS2"; then
2945          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
2946        fi
2947      fi
2948   else
2949      AC_MSG_ERROR([JAVA not found. You need at least jdk-1.5, or gcj-4])
2950   fi
2951else
2952   dnl Java disabled
2953   JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
2954fi
2955
2956dnl ===================================================================
2957dnl Checks for javac
2958dnl ===================================================================
2959if test "$SOLAR_JAVA" != ""; then
2960    if test "$JDK" = "gcj"; then
2961        javacompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
2962    else
2963        javacompiler="javac"
2964    fi
2965    if test "$_os" = "OS2"; then
2966      if test x`echo "$javacompiler" | grep -i '\.exe$'` = x; then
2967          javacompiler="${javacompiler}.exe"
2968      fi
2969    fi
2970    if test -z "$with_jdk_home"; then
2971        AC_PATH_PROG(JAVACOMPILER, $javacompiler)
2972    else
2973        _javac_path="$with_jdk_home/bin/$javacompiler"
2974        dnl Check if there is a java compiler at all.
2975        if test -x "$_javac_path"; then
2976            JAVACOMPILER=$_javac_path
2977        fi
2978    fi
2979    if test -z "$JAVACOMPILER"; then
2980      AC_MSG_ERROR([$javacompiler not found, please use --with_jdk_home])
2981    fi
2982    if test "$_os" = "WINNT"; then
2983       if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
2984          JAVACOMPILER="${JAVACOMPILER}.exe"
2985       fi
2986       JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
2987       JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
2988    fi
2989    if test "$_os" = "OS2"; then
2990       if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
2991          JAVACOMPILER="${JAVACOMPILER}.exe"
2992       fi
2993    fi
2994
2995    if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
2996        AC_MSG_CHECKING([re-checking JDK])
2997        JDK=gcj
2998        AC_MSG_RESULT([checked (ecj)])
2999        #TODO: what's to do here? some switch to do 1.5 compiling?
3000        JAVAFLAGS="-source 1.5 -target 1.5"
3001        _gij_longver="40200"
3002    fi
3003fi
3004
3005JAVACISGCJ=""
3006dnl ===================================================================
3007dnl Checks that javac is gcj
3008dnl ===================================================================
3009if test "$SOLAR_JAVA" != ""; then
3010    if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
3011        JAVACISGCJ="yes"
3012    fi
3013fi
3014AC_SUBST(JAVACISGCJ)
3015
3016dnl ===================================================================
3017dnl Checks for javadoc
3018dnl ===================================================================
3019if test "$SOLAR_JAVA" != ""; then
3020    if test -z "$with_jdk_home"; then
3021        AC_PATH_PROG(JAVADOC, javadoc)
3022    else
3023        _javadoc_path="$with_jdk_home/bin/javadoc"
3024        if test "$_os" = "OS2"; then
3025          if test x`echo "$_javadoc_path" | grep -i '\.exe$'` = x; then
3026              _javadoc_path="${_javadoc_path}.exe"
3027          fi
3028        fi
3029        dnl Check if there is a javadoc at all.
3030        if test -x "$_javadoc_path"; then
3031            JAVADOC=$_javadoc_path
3032        else
3033            AC_PATH_PROG(JAVADOC, javadoc)
3034        fi
3035    fi
3036    if test -z "$JAVADOC"; then
3037      AC_MSG_ERROR([$_javadoc_path not found, please use --with_jdk_home])
3038    fi
3039    if test "$_os" = "WINNT"; then
3040        if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3041            JAVADOC="${JAVADOC}.exe"
3042        fi
3043        JAVADOC=`cygpath -d "$JAVADOC"`
3044        JAVADOC=`cygpath -u "$JAVADOC"`
3045    fi
3046    if test "$_os" = "OS2"; then
3047        if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3048            JAVADOC="${JAVADOC}.exe"
3049        fi
3050    fi
3051fi
3052
3053if test "$SOLAR_JAVA" != ""; then
3054    dnl first check if we have been asked to autodetect JAVA_HOME with a recent gij
3055    if test "$JDK" = "gcj" -a -z "$JAVA_HOME"; then
3056      if test "x$with_jdk_home" = "x" -a "$_gij_longver" -ge "40200"; then
3057        cat > findhome.java <<_ACEOF
3058[import java.io.File;
3059
3060class findhome
3061{
3062    public static void main(String args[])
3063    {
3064        String jrelocation = System.getProperty("java.home");
3065        File jre = new File(jrelocation);
3066        System.out.println(jre.getParent());
3067    }
3068}]
3069_ACEOF
3070        AC_MSG_CHECKING([if javac works])
3071        javac_cmd="$JAVACOMPILER findhome.java 1>&2"
3072        AC_TRY_EVAL(javac_cmd)
3073        if test $? = 0 && test -f ./findhome.class ; then
3074          AC_MSG_RESULT([javac works])
3075        else
3076          echo "configure: javac test failed" >&5
3077          cat findhome.java >&5
3078          AC_MSG_ERROR([javac does not work - java projects will not build!])
3079        fi
3080
3081        AC_MSG_CHECKING([if gij knows its java.home])
3082        JAVA_HOME=`$JAVAINTERPRETER findhome`
3083        if test $? = 0 && test "$JAVA_HOME" != "" ; then
3084          AC_MSG_RESULT([$JAVA_HOME])
3085        else
3086          echo "configure: java test failed" >&5
3087          cat findhome.java >&5
3088          AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
3089        fi
3090      else
3091        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
3092      fi
3093    fi
3094
3095    dnl second sanity check JAVA_HOME if possible
3096    if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
3097      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
3098      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
3099         javac_link_f=`readlink -f "$JAVACOMPILER" 2>/dev/null`
3100         if test $? == 0 && test "$JAVACOMPILER" != "$javac_link_f"; then
3101          # try to recover first by looking whether we have a alternatives
3102          # system as in Debian or newer SuSEs where following /usr/bin/javac
3103          # over /etc/alternatives/javac leads to the right bindir where we
3104          # just need to strip a bit away to get a valid JAVA_HOME
3105          # Solaris 11 is even worse, because target is relative, so use -f
3106            JAVA_HOME="$javac_link_f"
3107         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
3108          # Darwin readlink(1) is so primitive it doesn't even support -f
3109          # maybe only one level of symlink (e.g. on Mac)
3110            JAVA_HOME=`readlink $JAVACOMPILER`
3111         else
3112          # else warn
3113          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
3114          AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
3115          echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
3116          echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
3117          fi
3118         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
3119         if test "$JAVA_HOME" != "/usr"; then
3120            if test "$_os" = "Darwin"; then
3121               dnl Leopard returns a non-suitable path with readlink - points to "Current" only
3122               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
3123               dnl Tiger already returns a JDK path..
3124               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
3125            else
3126               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
3127            fi
3128         fi
3129      fi
3130      # now check if $JAVA_HOME is really valid
3131      if test "$_os" = "Darwin"; then
3132         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
3133            JAVA_HOME_OK="NO"
3134         fi
3135      elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
3136         JAVA_HOME_OK="NO"
3137      fi
3138      if test "$JAVA_HOME_OK" = "NO"; then
3139         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
3140         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
3141         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
3142         echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
3143         echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
3144         echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
3145#         if test "$JDK" = "gcj"; then
3146#             echo "e.g. install java-1.4.2-gcj-compat-devel and use --with-jdk-home=/usr/lib/jvm/java-1.4.2-gcj" >> warn
3147#         fi
3148      fi
3149    fi
3150fi
3151
3152AWTLIB=
3153if test "$SOLAR_JAVA" != ""; then
3154   AC_MSG_CHECKING([for jawt lib name])
3155   if test "$JDK" = "gcj"; then
3156      save_CFLAGS=$CFLAGS
3157      save_LDFLAGS=$LDFLAGS
3158      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3159      LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
3160      exec 6>/dev/null # no output
3161      AC_CHECK_HEADER(jni.h, [],
3162                    [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
3163      AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
3164      exec 6>&1 # output on again
3165      CFLAGS=$save_CFLAGS
3166      LDFLAGS=$save_LDFLAGS
3167   fi
3168   # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
3169   # A workaround is to link also against libpmawt.so
3170   if test "$JDK" = "ibm" ; then
3171      save_CFLAGS=$CFLAGS
3172      save_LDFLAGS=$LDFLAGS
3173      save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
3174      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3175      LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
3176      LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
3177      export LD_LIBRARY_PATH
3178      exec 6>/dev/null # no output
3179      AC_CHECK_HEADER(jni.h, [],
3180                    [AC_MSG_ERROR([jni.h could not be found.])], [])
3181      AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
3182      if test -z "$AWTLIB"; then
3183         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
3184         AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
3185      fi
3186      exec 6>&1 # output on again
3187      CFLAGS=$save_CFLAGS
3188      LDFLAGS=$save_LDFLAGS
3189      LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
3190   fi
3191   if test -z "$AWTLIB"; then
3192      AWTLIB=-ljawt
3193   fi
3194   AC_MSG_RESULT([$AWTLIB])
3195   AC_SUBST(AWTLIB)
3196fi
3197
3198dnl ===================================================================
3199dnl Check for optional gcj for AOT
3200dnl ===================================================================
3201if test "$SOLAR_JAVA" != ""; then
3202  AC_MSG_CHECKING([whether to enable gcj aot compilation])
3203  if test -n "$enable_gcjaot" && test "$enable_gcjaot" != "no"; then
3204     AC_MSG_RESULT([yes])
3205     if test `echo $WITH_JAVA | grep -c "gij"` -eq 0; then
3206        gcjaot="gcj"
3207     else
3208        gcjaot=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g"`
3209     fi
3210     AC_MSG_RESULT([$gcjaot])
3211     if test -n "$with_jdk_home"; then
3212        _javac_path="$with_jdk_home/bin/$gcjaot"
3213        dnl Check if there is a gcj at all.
3214        if test -x "$_javac_path"; then
3215           JAVAAOTCOMPILER=$_javac_path
3216        fi
3217     fi
3218     if test -z "$JAVAAOTCOMPILER"; then
3219        AC_PATH_PROG(JAVAAOTCOMPILER, $gcjaot)
3220     fi
3221     if test -z "$JAVAAOTCOMPILER"; then
3222        AC_MSG_WARN([$gcjaot not found, please use --with_jdk_home])
3223     fi
3224  else
3225     AC_MSG_RESULT([no])
3226  fi
3227fi
3228
3229AC_SUBST(JAVA_HOME)
3230AC_SUBST(JDK)
3231AC_SUBST(JAVAFLAGS)
3232AC_SUBST(JAVAINTERPRETER)
3233AC_SUBST(JAVAIFLAGS)
3234AC_SUBST(JAVACOMPILER)
3235AC_SUBST(JAVAAOTCOMPILER)
3236AC_SUBST(JAVADOC)
3237
3238dnl ===================================================================
3239dnl Checks for specific files.
3240dnl ===================================================================
3241
3242dnl ===================================================================
3243dnl Checks for programs.
3244dnl ===================================================================
3245
3246dnl ===================================================================
3247dnl Check whether we already have dmake
3248dnl ===================================================================
3249AC_PATH_PROG(DMAKE, dmake, no)
3250if test "$DMAKE" = "no"; then
3251    BUILD_DMAKE=YES
3252    echo "dmake will be built on ./bootstrap"
3253else
3254    AC_MSG_CHECKING([whether the found dmake is the right dmake])
3255    # we need to find out whether that dmake we found is "our" dmake
3256    # or the dmake from Sun's SunStudio Compiler which is something
3257    # different
3258    # This test _should_ work because the one accepts -V (ours) and one
3259    # (the other) not...
3260    $DMAKE -V 2>/dev/null | grep 'dmake .* Version .*' >/dev/null
3261    if test $? -eq 0; then
3262       BUILD_DMAKE=NO
3263       AC_MSG_RESULT([yes])
3264       AC_MSG_CHECKING([the dmake version])
3265       DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
3266       if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
3267	 AC_MSG_RESULT([OK, >= 4.11])
3268       elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
3269	    test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
3270	 AC_MSG_RESULT([OK, >= 4.11])
3271       else
3272	 AC_MSG_RESULT([too old. >= 4.11 is needed])
3273	 echo "A newer dmake will be built on ./bootstrap"
3274	 BUILD_DMAKE=YES
3275       fi
3276    else
3277       AC_MSG_RESULT([no])
3278       echo "dmake will be built on ./bootstrap"
3279       BUILD_DMAKE=YES
3280    fi
3281fi
3282AC_SUBST(BUILD_DMAKE)
3283
3284AC_MSG_CHECKING([whether to enable EPM for packing])
3285if test "$enable_epm" = "yes"; then
3286   AC_MSG_RESULT([yes])
3287   dnl ===================================================================
3288   dnl Check for epm - not needed for windows
3289   dnl ===================================================================
3290   if test "$_os" != "WINNT"; then
3291      if test -n "$with_epm"; then
3292	      EPM=$with_epm
3293      else
3294         AC_PATH_PROG(EPM, epm, no)
3295      fi
3296      if test "$EPM" = "no" || test "$EPM" = "internal"; then
3297         echo "EPM will be built."
3298         BUILD_EPM=YES
3299         BUILD_TYPE="$BUILD_TYPE EPM"
3300      else
3301         # Gentoo has some epm which is something different...
3302         AC_MSG_CHECKING([whether the found epm is the right epm])
3303         if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
3304            AC_MSG_RESULT([yes])
3305         else
3306            AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
3307         fi
3308         AC_MSG_CHECKING([epm version])
3309         EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
3310	 if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
3311	       test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
3312           AC_MSG_RESULT([OK, >= 3.7])
3313           BUILD_EPM=NO
3314	        if test "$_os" = "Darwin"; then
3315               AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
3316        	      _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
3317        	      if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
3318          		      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)])
3319        	      elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
3320          		    AC_MSG_RESULT([$_pm, ok])
3321        	      else # we never should get here, but go safe
3322			          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)])
3323		          fi
3324	       fi
3325	 else
3326           AC_MSG_RESULT([too old. epm >= 3.7 is required.])
3327           echo "EPM will be built."
3328           BUILD_EPM=YES
3329           BUILD_TYPE="$BUILD_TYPE EPM"
3330	 fi
3331      fi
3332   fi
3333
3334   # test which package format to use
3335   AC_MSG_CHECKING([which package format to use])
3336
3337   # defaults
3338   case "$_os" in
3339	OS2)
3340		PKGFORMAT=native
3341		;;
3342	Darwin)
3343		PKGFORMAT=dmg
3344		;;
3345	SunOS)
3346		PKGFORMAT=pkg
3347		;;
3348	Linux)
3349      # if building on Debian, default should be deb...
3350      if test -e /etc/debian_version; then
3351         PKGFORMAT=deb
3352      else
3353         PKGFORMAT=rpm
3354      fi
3355		;;
3356	AIX)
3357		PKGFORMAT=aix
3358		;;
3359	*BSD)
3360		PKGFORMAT=bsd
3361		;;
3362	OSF1)
3363		PKGFORMAT=setld
3364		;;
3365    WINNT)
3366        PKGFORMAT=msi
3367        ;;
3368	# we never should get here since we check the arciecture/os at the beginning,
3369	# but go sure...
3370	*)
3371		AC_MSG_ERROR([unknown system])
3372   esac
3373   if test -n "$with_package_format"; then
3374	for i in $with_package_format; do
3375		case "$i" in
3376			aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
3377			;;
3378		*)
3379			AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
3380aix - AIX software distribution
3381bsd - FreeBSD, NetBSD, or OpenBSD software distribution
3382depot or swinstall - HP-UX software distribution
3383deb - Debian software distribution
3384inst or tardist - IRIX software distribution
3385osx - MacOS X software distribution
3386pkg - Solaris software distribution
3387rpm - RedHat software distribution
3388setld - Tru64 (setld) software distribution
3389native - "Native" software distribution for the platform
3390portable - Portable software distribution
3391OOo additionally supports:
3392archive - .tar.gz or .zip
3393dmg - Mac OS X .dmg
3394installed - installation tree
3395msi - Windows .msi
3396			])
3397			;;
3398		esac
3399	done
3400	PKGFORMAT="$with_package_format"
3401   fi
3402   AC_MSG_RESULT([$PKGFORMAT])
3403   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
3404      AC_MSG_CHECKING([for rpm])
3405      for a in "$RPM" rpmbuild rpm; do
3406         $a --usage >/dev/null 2> /dev/null
3407         if test $? -eq 0; then
3408            RPM=$a
3409            break
3410         else
3411            $a --version >/dev/null 2> /dev/null
3412            if test $? -eq 0; then
3413               RPM=$a
3414               break
3415            fi
3416         fi
3417       done
3418       if test -z "$RPM" ; then
3419          AC_MSG_ERROR([not found])
3420       elif "$RPM" --usage 2>&1 | $EGREP -- -bb >/dev/null; then
3421          RPM_PATH=`which $RPM`
3422          AC_MSG_RESULT([$RPM_PATH])
3423       else
3424          AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
3425       fi
3426   fi
3427   if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
3428      AC_PATH_PROG(DPKG, dpkg, no)
3429      if test "$DPKG" = "no"; then
3430         AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
3431      fi
3432   fi
3433   if echo "PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
3434      if test "$_os" = "Darwin"; then
3435         AC_MSG_CHECKING([for PackageMaker availability])
3436         if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
3437            AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
3438         else
3439            AC_MSG_RESULT([ok])
3440         fi
3441      else
3442         AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
3443       fi
3444   fi
3445   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
3446      echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3447      	if test "$EPM" != "no" && test "$EPM" != "internal"; then
3448           if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
3449               AC_MSG_CHECKING([whether epm is patched for OOos needs])
3450               if grep "Patched for OpenOffice.org" $EPM >/dev/null 2>/dev/null; then
3451                  AC_MSG_RESULT([yes])
3452               else
3453                  AC_MSG_RESULT([no])
3454                  if echo "$PKGFORMAT" | grep -q rpm; then
3455                      _pt="rpm"
3456                      AC_MSG_WARN([the rpms will need to be installed with --nodeps])
3457                      echo "the rpms will need to be installed with --nodeps" >> warn
3458                  else
3459                      _pt="pkg"
3460                  fi
3461                  AC_MSG_WARN([the ${_pt}s will not be relocateable])
3462                  echo "the ${_pt}s will not be relocateable" >> warn
3463                  AC_MSG_WARN([if you want to make sure installation without --nodeps and
3464                  relocation will work, you need to patch your epm with the
3465                  patch in epm/epm-3.7.patch or build with
3466                  --with-epm=internal which will build a suitable epm])
3467               fi
3468           fi
3469        fi
3470   fi
3471   if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3472      AC_PATH_PROG(PKGMK, pkgmk, no)
3473      if test "$PKGMK" = "no"; then
3474         AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
3475      fi
3476   fi
3477   AC_SUBST(BUILD_EPM)
3478   AC_SUBST(RPM)
3479   AC_SUBST(DPKG)
3480   AC_SUBST(PKGMK)
3481else
3482   AC_MSG_RESULT([no])
3483   EPM=NO
3484   PKGFORMAT=native
3485fi
3486AC_SUBST(EPM)
3487AC_SUBST(PKGFORMAT)
3488
3489dnl ===================================================================
3490dnl Check for gperf
3491dnl ===================================================================
3492AC_PATH_PROG(GPERF, gperf)
3493if test -z "$with_gperf"; then
3494    AC_PATH_PROG(GPERF, gperf)
3495    if test -z "$GPERF"; then
3496       AC_MSG_ERROR([gperf not found but needed. Install it and/or specify --with-gperf=/path/to/it.])
3497    fi
3498else
3499  if test -x "$with_gperf"; then
3500    GPERF=$with_gperf
3501  else
3502    AC_MSG_ERROR([--with-gperf did not point to an executable])
3503  fi
3504fi
3505AC_MSG_CHECKING([gperf version])
3506if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
3507	AC_MSG_RESULT([OK])
3508   GPERF=$GPERF
3509else
3510	AC_MSG_ERROR([too old, you need at least 3.0.0])
3511fi
3512AC_SUBST(GPERF)
3513
3514dnl ===================================================================
3515dnl Check for building stax
3516dnl ===================================================================
3517AC_MSG_CHECKING([whether to build the stax])
3518if test -f "./stax/download/jsr173_1.0_api.jar"; then
3519   BUILD_STAX=NO
3520   AC_MSG_RESULT([no, will use the prebuilt stax/download/jsr173_1.0_api.jar])
3521else
3522   BUILD_STAX=YES
3523   AC_MSG_RESULT([yes])
3524fi
3525AC_SUBST(BUILD_STAX)
3526
3527dnl ===================================================================
3528dnl Check for building ODK
3529dnl ===================================================================
3530AC_MSG_CHECKING([whether to build the ODK])
3531if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
3532   AC_MSG_RESULT([yes])
3533   if test "$WITH_JAVA" != "no"; then
3534   AC_MSG_CHECKING([for external/unowinreg/unowinreg.dll])
3535   if ! test -f "./external/unowinreg/unowinreg.dll"; then
3536      HAVE_UNOWINREG_DLL=no
3537   else
3538      HAVE_UNOWINREG_DLL=yes
3539   fi
3540   if test "$HAVE_UNOWINREG_DLL" = "yes"; then
3541      AC_MSG_RESULT([found])
3542      BUILD_UNOWINREG=NO
3543   else
3544      if test "$_os" = "WINNT"; then
3545         AC_MSG_RESULT([not found, will be built])
3546      else
3547         AC_MSG_WARN([not found, will be cross-built using mingw32])
3548      fi
3549      BUILD_UNOWINREG=YES
3550   fi
3551   if test "$_os" != "WINNT" && test "$BUILD_UNOWINREG" = "YES"; then
3552      if test -z "$WITH_MINGWIN" || test "$WITH_MINGWIN" = "0"; then
3553         AC_MSG_ERROR([for rebuilding unowinreg.dll you need the mingw32 C++ compiler.
3554         Specify mingw32 g++ executable name with --with-mingwin.
3555         Or use prebuilt one from http://tools.openoffice.org/unowinreg_prebuild/680/ and
3556         put it into external/unowinreg])
3557      fi
3558      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3559         if ! test -x "$WITH_MINGWIN"; then MINGWCXX=false; else MINGWCXX=`basename $WITH_MINGWIN`; fi
3560      else
3561         AC_CHECK_TOOL(MINGWCXX, $WITH_MINGWIN, false)
3562      fi
3563      if test "$MINGWCXX" = "false"; then
3564         AC_MSG_ERROR(specified MinGW32 C++ cross-compiler not found. Install it or correct name.)
3565      fi
3566      AC_MSG_CHECKING(whether we are using the MinGW32 cross C++ compiler)
3567      if ! echo "`$MINGWCXX -dumpmachine`" | grep -q mingw32; then
3568         AC_MSG_ERROR(no)
3569      else
3570         AC_MSG_RESULT(yes)
3571      fi
3572      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3573         if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/)); fi
3574      else
3575         AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`, false)
3576      fi
3577      if test "$MINGWSTRIP" = "false"; then
3578         AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
3579      fi
3580      AC_LANG_PUSH([C++])
3581      save_CXX=$CXX
3582      save_CXXCPP=$CXXCPP
3583      CXX=$MINGWCXX
3584      CXXCPP="$MINGWCXX -E"
3585      save_CXXFLAGS=$CXXFLAGS
3586      save_CPPFLAGS=$CPPFLAGS
3587      CXXFLAGS="$CXXFLAGS -I$JAVA_HOME/include"
3588      CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include"
3589      # LIBS contains -lcrypt etc due to teh AC_CHECK_LIBS which obviously
3590      # do not make sense here (and 'd make the check fail)
3591      save_LIBS=$LIBS
3592      LIBS=""
3593      AC_HAVE_LIBRARY(kernel32)
3594      AC_HAVE_LIBRARY(advapi32)
3595      AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR([windows.h missing])])
3596      CXXFLAGS=$save_CXXFLAGS
3597      CPPFLAGS=$save_CPPFLAGS
3598      CXX=$save_CXX
3599      CXXCPP=$save_CXXCPP
3600      LIBS=$save_LIBS
3601      AC_LANG_POP([C++])
3602      fi
3603   fi
3604   BUILD_TYPE="$BUILD_TYPE ODK"
3605else
3606   AC_MSG_RESULT([no])
3607   BUILD_UNOWINREG=NO
3608fi
3609AC_SUBST(BUILD_UNOWINREG)
3610AC_SUBST(MINGWCXX)
3611AC_SUBST(MINGWSTRIP)
3612
3613dnl ===================================================================
3614dnl Check for system stdlibs
3615dnl ===================================================================
3616AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
3617if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
3618   test "$with_system_stdlibs" != "no"; then
3619   AC_MSG_RESULT([no])
3620   SYSTEM_STDLIBS=YES
3621else
3622   AC_MSG_RESULT([yes])
3623   SYSTEM_STDLIBS=NO
3624fi
3625AC_SUBST(SYSTEM_STDLIBS)
3626
3627dnl ===================================================================
3628dnl Check for system zlib
3629dnl ===================================================================
3630if test "$_os" = "Darwin" && test "$with_system_zlib" != "no"; then
3631   with_system_zlib=yes
3632fi
3633AC_MSG_CHECKING([which zlib to use])
3634if test -n "$with_system_zlib" -o -n "$with_system_libs" && \
3635	test "$with_system_zlib" != "no"; then
3636    AC_MSG_RESULT([external])
3637    SYSTEM_ZLIB=YES
3638    AC_CHECK_HEADER(zlib.h, [],
3639        [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
3640    AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
3641        [AC_MSG_ERROR(zlib not found or functional)], [])
3642else
3643    AC_MSG_RESULT([internal])
3644    SYSTEM_ZLIB=NO
3645    BUILD_TYPE="$BUILD_TYPE ZLIB"
3646fi
3647AC_SUBST(SYSTEM_ZLIB)
3648
3649dnl ===================================================================
3650dnl Check for system jpeg
3651dnl ===================================================================
3652AC_MSG_CHECKING([which jpeg to use])
3653if test -n "$with_system_jpeg" -o -n "$with_system_libs" && \
3654	test "$with_system_jpeg" != "no"; then
3655    AC_MSG_RESULT([external])
3656    SYSTEM_JPEG=YES
3657    AC_CHECK_HEADER(jpeglib.h, [],
3658        [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
3659    AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
3660	[AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
3661else
3662    AC_MSG_RESULT([internal])
3663    SYSTEM_JPEG=NO
3664    BUILD_TYPE="$BUILD_TYPE JPEG"
3665fi
3666AC_SUBST(SYSTEM_JPEG)
3667
3668dnl ===================================================================
3669dnl Check for system expat
3670dnl ===================================================================
3671AC_MSG_CHECKING([which expat to use])
3672if test -n "$with_system_expat" -o -n "$with_system_libs" && \
3673	test "$with_system_expat" != "no"; then
3674    AC_MSG_RESULT([external])
3675    SYSTEM_EXPAT=YES
3676    AC_CHECK_HEADER(expat.h, [],
3677        [AC_MSG_ERROR(expat.h not found. install expat)], [])
3678    AC_CHECK_LIB(expat, XML_ParserCreate, [],
3679	[AC_MSG_RESULT(expat library not found or functional.)], [])
3680else
3681    AC_MSG_RESULT([internal])
3682    SYSTEM_EXPAT=NO
3683    BUILD_TYPE="$BUILD_TYPE EXPAT"
3684fi
3685AC_SUBST(SYSTEM_EXPAT)
3686
3687dnl ===================================================================
3688dnl Check for system libwpd
3689dnl ===================================================================
3690if test -n "$enable_copyleft" -a "$enable_copyleft" != "no"; then
3691AC_MSG_CHECKING([which libwpd to use])
3692if test -n "$with_system_libwpd" -o -n "$with_system_libs" && \
3693        test "$with_system_libwpd" != "no"; then
3694    AC_MSG_RESULT([external])
3695    SYSTEM_LIBWPD=YES
3696    PKG_CHECK_MODULES( LIBWPD, libwpd-0.8 )
3697else
3698    AC_MSG_RESULT([internal])
3699    SYSTEM_LIBWPD=NO
3700    BUILD_TYPE="$BUILD_TYPE LIBWPD"
3701fi
3702AC_SUBST(SYSTEM_LIBWPD)
3703AC_SUBST(LIBWPD_CFLAGS)
3704AC_SUBST(LIBWPD_LIBS)
3705fi
3706
3707dnl ===================================================================
3708dnl Check for system cppunit
3709dnl ===================================================================
3710AC_MSG_CHECKING([which cppunit to use])
3711if test -n "$with_system_cppunit" -o -n "$with_system_libs" && \
3712        test "$with_system_cppunit" != "no"; then
3713    AC_MSG_RESULT([external])
3714    SYSTEM_CPPUNIT=YES
3715    # might work for earlier, too but go sure:
3716    PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
3717else
3718    AC_MSG_RESULT([internal])
3719    SYSTEM_CPPUNIT=NO
3720    BUILD_TYPE="$BUILD_TYPE CPPUNIT"
3721fi
3722AC_SUBST(SYSTEM_CPPUNIT)
3723AC_SUBST(CPPUNIT_CFLAGS)
3724AC_SUBST(CPPUNIT_LIBS)
3725
3726dnl ===================================================================
3727dnl Check whether freetype is available
3728dnl ===================================================================
3729if test  "$test_freetype" = "yes"; then
3730   AC_MSG_CHECKING([whether freetype is available])
3731	PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
3732fi
3733AC_SUBST(FREETYPE_CFLAGS)
3734AC_SUBST(FREETYPE_LIBS)
3735
3736dnl ===================================================================
3737dnl Check whether freetype2 supports emboldening
3738dnl ===================================================================
3739if test  "$test_freetype" = "yes"; then
3740    save_CPPFLAGS="$CPPFLAGS"
3741    save_LDFLAGS="$LDFLAGS"
3742    save_LIBS="$LIBS"
3743    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
3744    LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
3745    AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
3746                 [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
3747    LDFLAGS="$save_LDFLAGS"
3748    CPPFLAGS="$save_CPPFLAGS"
3749    LIBS="$save_LIBS"
3750fi
3751AC_SUBST(USE_FT_EMBOLDEN)
3752
3753if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
3754   test "$with_system_libxslt" != "no"; then
3755    if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
3756      test "$with_system_libxml" = "no"; then
3757      # somehow AC_MSG_WARN won't work...
3758       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
3759       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
3760       with_system_libxml=yes
3761    fi
3762fi
3763if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
3764   test "$with_system_libxml" != "no"; then
3765    if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
3766      test "$with_system_libxslt" = "no"; then
3767      # somehow AC_MSG_WARN won't work...
3768       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
3769       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
3770       with_system_libxslt=yes
3771    fi
3772fi
3773
3774dnl ===================================================================
3775dnl Check for system libxslt
3776dnl ===================================================================
3777AC_MSG_CHECKING([which libxslt to use])
3778if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
3779       "$_os" = "Darwin" && \
3780   test "$with_system_libxslt" != "no"; then
3781   AC_MSG_RESULT([external])
3782   SYSTEM_LIBXSLT=YES
3783
3784   PKG_CHECK_MODULES_MACHACK(LIBXSLT, xslt-config, libxslt)
3785
3786   dnl Check for xsltproc
3787   AC_PATH_PROG(XSLTPROC, xsltproc, no)
3788   if test "$XSLTPROC" = "no"; then
3789      AC_MSG_ERROR([xsltproc is required])
3790   fi
3791else
3792   AC_MSG_RESULT([internal])
3793   SYSTEM_LIBXSLT=NO
3794   BUILD_TYPE="$BUILD_TYPE LIBXSLT"
3795fi
3796AC_SUBST(SYSTEM_LIBXSLT)
3797AC_SUBST(LIBXSLT_CFLAGS)
3798AC_SUBST(LIBXSLT_LIBS)
3799
3800
3801dnl ===================================================================
3802dnl Check for system libxml
3803dnl ===================================================================
3804AC_MSG_CHECKING([which libxml to use])
3805if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
3806            "$_os" = "Darwin" && \
3807	test "$with_system_libxml" != "no"; then
3808    AC_MSG_RESULT([external])
3809    SYSTEM_LIBXML=YES
3810    PKG_CHECK_MODULES_MACHACK(LIBXML, xml2-config, libxml-2.0 >= 2.0)
3811    BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
3812else
3813    AC_MSG_RESULT([internal])
3814    SYSTEM_LIBXML=NO
3815    BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
3816fi
3817AC_SUBST(SYSTEM_LIBXML)
3818AC_SUBST(LIBXML_CFLAGS)
3819AC_SUBST(LIBXML_LIBS)
3820
3821dnl ===================================================================
3822dnl Check for system python
3823dnl ===================================================================
3824AC_MSG_CHECKING([which python to use])
3825if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
3826   with_system_python=yes
3827   AC_MSG_RESULT([compiling against MacOSX10.4u.sdk (python version 2.3)])
3828   PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3"
3829   PYTHON_LIBS="-framework Python"
3830elif test -n "$with_system_python" -o -n "$with_system_libs" && \
3831	test "$with_system_python" != "no"; then
3832   with_system_python=yes
3833   AC_MSG_RESULT([external])
3834   AM_PATH_PYTHON([2.2])
3835
3836   python_include=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('INCLUDEPY');"`
3837   python_version=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('VERSION');"`
3838   PYTHON_CFLAGS="-I$python_include"
3839   PYTHON_LIBS="-lpython$python_version"
3840fi
3841if test "$with_system_python" = "yes" ; then
3842   SYSTEM_PYTHON=YES
3843   dnl check if the headers really work:
3844   save_CPPFLAGS="$CPPFLAGS"
3845   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
3846   AC_CHECK_HEADER(Python.h, [],
3847       [AC_MSG_ERROR(Python headers not found)], [])
3848   CPPFLAGS="$save_CPPFLAGS"
3849else
3850   SYSTEM_PYTHON=NO
3851   BUILD_TYPE="$BUILD_TYPE PYTHON"
3852   AC_MSG_RESULT([internal])
3853   # Embedded python dies without Home set
3854   if test "z$HOME" = "z"; then
3855      export HOME="";
3856   fi
3857   # bz2 tarball and bzip2 is not standard
3858   if test -z "$BZIP2"; then
3859	AC_PATH_PROG( BZIP2, bzip2)
3860	if test -z "$BZIP2"; then
3861   		AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
3862   	fi
3863   fi
3864fi
3865AC_SUBST(SYSTEM_PYTHON)
3866AC_SUBST(PYTHON_CFLAGS)
3867AC_SUBST(PYTHON_LIBS)
3868HOME=`echo $HOME | sed 's:\\\\:/:g'`
3869AC_SUBST(HOME)
3870
3871dnl ===================================================================
3872dnl Check for system berkley db
3873dnl ===================================================================
3874AC_MSG_CHECKING([which db to use])
3875if test -n "$with_system_db" -o -n "$with_system_libs" && \
3876	test "$with_system_db" != "no"; then
3877    SYSTEM_DB=YES
3878    AC_MSG_RESULT([external])
3879    AC_CHECK_HEADER(db.h, [ DB_INCLUDES=/usr/include ],
3880        [
3881             CFLAGS=-I/usr/include/db4
3882             AC_CHECK_HEADER(db4/db.h,
3883             [ DB_INCLUDES=/usr/include/db4 ],
3884             [ AC_MSG_ERROR(no. install the db4 libraries) ], []+             )
3885        ], []
3886    )
3887    AC_MSG_CHECKING([whether db is at least 4.1])
3888    AC_TRY_RUN([
3889#include <db.h>
3890
3891int main(int argc, char **argv) {
3892       if(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)) return 0;
3893       else return 1;
3894}
3895    ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no. you need at least db 4.1])])
3896    AC_HAVE_LIBRARY(db, [],
3897      [AC_MSG_ERROR([db not installed or functional])], [])
3898    SCPDEFS="$SCPDEFS -DSYSTEM_DB"
3899else
3900    AC_MSG_RESULT([internal])
3901    SYSTEM_DB=NO
3902    BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
3903fi
3904AC_SUBST(SYSTEM_DB)
3905AC_SUBST(DB_VERSION)
3906AC_SUBST(DB_INCLUDES)
3907AC_SUBST(DB_JAR)
3908
3909dnl ===================================================================
3910dnl Check for system lucene
3911dnl ===================================================================
3912AC_MSG_CHECKING([which lucene to use])
3913if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
3914       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
3915        AC_MSG_RESULT([external])
3916        SYSTEM_LUCENE=YES
3917        if test -z $LUCENE_CORE_JAR; then
3918          AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
3919            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
3920            [
3921              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
3922                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
3923                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
3924                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
3925                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
3926                  )
3927                ]
3928              )
3929            ]
3930          )
3931        else
3932          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
3933               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
3934        fi
3935
3936        if test -z $LUCENE_ANALYZERS_JAR; then
3937          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
3938            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
3939            [
3940              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
3941                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
3942                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
3943              )
3944            ]
3945          )
3946        else
3947          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
3948               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
3949        fi
3950        AC_MSG_CHECKING([whether lucene is version 2.x])
3951        export LUCENE_CORE_JAR
3952        if $PERL -e 'use Archive::Zip;
3953            my $file = "$ENV{'LUCENE_CORE_JAR'}";
3954            my $zip = Archive::Zip->new( $file );
3955            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
3956            if ( $mf =~ m/Specification-Version: 2.*/ ) {
3957                exit 0;
3958            } else {
3959                exit 1;
3960            }'; then
3961            AC_MSG_RESULT([yes])
3962         else
3963            AC_MSG_ERROR([no, you need lucene 2])
3964         fi
3965
3966else
3967    AC_MSG_RESULT([internal])
3968    SYSTEM_LUCENE=NO
3969    BUILD_TYPE="$BUILD_TYPE LUCENE"
3970fi
3971AC_SUBST(SYSTEM_LUCENE)
3972AC_SUBST(LUCENE_CORE_JAR)
3973AC_SUBST(LUCENE_ANALYZERS_JAR)
3974
3975AC_MSG_CHECKING([whether to build the MySQL Connector extension])
3976if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
3977  AC_MSG_RESULT([yes])
3978  ENABLE_MYSQLC=YES
3979  AC_MSG_CHECKING([for mysqlc module])
3980  if test -d mysqlc; then
3981   AC_MSG_RESULT([OK])
3982  else
3983   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
3984  fi
3985  BUILD_TYPE="$BUILD_TYPE MYSQLC"
3986else
3987  AC_MSG_RESULT([no])
3988  ENABLE_MYSQLC=NO
3989fi
3990AC_SUBST(ENABLE_MYSQLC)
3991
3992if test "$ENABLE_MYSQLC" = "YES"; then
3993dnl ===================================================================
3994dnl Check for system MySQL
3995dnl ===================================================================
3996AC_MSG_CHECKING([for mysql pre-requisites])
3997if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
3998       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
3999	AC_MSG_RESULT([external MySQL])
4000	SYSTEM_MYSQL=YES
4001	AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4002	AC_MSG_CHECKING([MySQL version])
4003	MYSQL_VERSION=`$MYSQLCONFIG --version`
4004	MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4005	if test "$MYSQL_MAJOR" -ge "5"; then
4006		AC_MSG_RESULT([OK])
4007	else
4008		AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4009	fi
4010	AC_MSG_CHECKING([for MySQL Client library])
4011	MYSQL_INC=`$MYSQLCONFIG --include`
4012	MYSQL_LIB=`$MYSQLCONFIG --libs`
4013	MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4014	AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4015else
4016    SYSTEM_MYSQL=NO
4017    if test -n "$with_libmysql_path"; then
4018        AC_MSG_RESULT([external Connector/C (libmysql)])
4019        LIBMYSQL=libmysql.so
4020        if test "$_os" = "Darwin"; then
4021            LIBMYSQL=libmysql.dylib
4022        elif test "$_os" = "WINNT"; then
4023            LIBMYSQL=libmysql.dll
4024        fi
4025        AC_MSG_CHECKING([for $LIBMYSQL])
4026        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4027            AC_MSG_RESULT([found.])
4028            LIBMYSQL_PATH=$with_libmysql_path
4029        else
4030            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4031        fi
4032    else
4033        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4034    fi
4035fi
4036AC_SUBST(SYSTEM_MYSQL)
4037AC_SUBST(MYSQL_INC)
4038AC_SUBST(MYSQL_LIB)
4039AC_SUBST(MYSQL_DEFINES)
4040AC_SUBST(LIBMYSQL_PATH)
4041
4042AC_LANG_PUSH([C++])
4043dnl ===================================================================
4044dnl Check for system MySQL C++ Connector
4045dnl ===================================================================
4046# FIXME!
4047# who thought this too-generic cppconn dir was a good idea?
4048AC_MSG_CHECKING([MySQL Connector/C++])
4049if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4050		test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4051	AC_MSG_RESULT([external])
4052	SYSTEM_MYSQL_CPPCONN=YES
4053        AC_LANG_PUSH([C++])
4054	AC_CHECK_HEADER(mysql_driver.h, [],
4055					[AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4056	AC_CHECK_LIB(mysqlcppconn, main, [],
4057					[AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4058   AC_MSG_CHECKING([version])
4059      AC_TRY_RUN([
4060#include <mysql_driver.h>
4061
4062int main(int argc, char **argv) {
4063	sql::Driver *driver;
4064	driver = get_driver_instance();
4065	if (driver->getMajorVersion() > 1 || \
4066	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4067	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4068        return 0;
4069      else
4070        return 1;
4071}
4072      ], [AC_MSG_RESULT(OK)], [AC_MSG_ERROR([not suitable, we need >= 1.0.6])])
4073        AC_LANG_POP([C++])
4074
4075else
4076	AC_MSG_RESULT([internal])
4077        AC_MSG_CHECKING([for mysqlcppconn module])
4078        if test -d mysqlcppconn; then
4079          AC_MSG_RESULT([OK])
4080        else
4081          AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4082        fi
4083	BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
4084	SYSTEM_MYSQL_CPPCONN=NO
4085fi
4086AC_LANG_POP([C++])
4087AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4088fi
4089
4090dnl ===================================================================
4091dnl Check for system hsqldb
4092dnl ===================================================================
4093AC_MSG_CHECKING([which hsqldb to use])
4094if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4095       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4096        AC_MSG_RESULT([external])
4097        SYSTEM_HSQLDB=YES
4098        if test -z $HSQLDB_JAR; then
4099               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4100        fi
4101        AC_CHECK_FILE($HSQLDB_JAR, [],
4102               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4103        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4104        export HSQLDB_JAR
4105        if $PERL -e 'use Archive::Zip;
4106            my $file = "$ENV{'HSQLDB_JAR'}";
4107            my $zip = Archive::Zip->new( $file );
4108            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4109            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4110               push @l, split(/\n/, $mf);
4111               foreach my $line (@l) {
4112                  if ($line =~ m/Specification-Version:/) {
4113                      ($t, $version) = split (/:/,$line);
4114                      $version =~ s/^\s//;
4115                      ($a, $b, $c, $d) = split (/\./,$version);
4116                      if ($c == "0" && $d > "8")  {
4117                          exit 0;
4118                      } else {
4119                          exit 1;
4120                      }
4121                  }
4122               }
4123            } else {
4124                exit 1;
4125            }'; then
4126            AC_MSG_RESULT([yes])
4127         else
4128            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
4129         fi
4130else
4131    AC_MSG_RESULT([internal])
4132    SYSTEM_HSQLDB=NO
4133    BUILD_TYPE="$BUILD_TYPE HSQLDB"
4134fi
4135AC_SUBST(SYSTEM_HSQLDB)
4136AC_SUBST(HSQLDB_JAR)
4137
4138dnl ===================================================================
4139dnl Check for system beanshell
4140dnl ===================================================================
4141AC_MSG_CHECKING([which beanshell to use])
4142if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
4143       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
4144        AC_MSG_RESULT([external])
4145        SYSTEM_BSH=YES
4146        if test -z $BSH_JAR; then
4147               BSH_JAR=/usr/share/java/bsh.jar
4148        fi
4149        AC_CHECK_FILE($BSH_JAR, [],
4150               [AC_MSG_ERROR(bsh.jar not found.)], [])
4151else
4152    AC_MSG_RESULT([internal])
4153    SYSTEM_BSH=NO
4154    BUILD_TYPE="$BUILD_TYPE BSH"
4155fi
4156AC_SUBST(SYSTEM_BSH)
4157AC_SUBST(BSH_JAR)
4158
4159
4160dnl ===================================================================
4161dnl Check for system saxon
4162dnl ===================================================================
4163if test -n "$enable_copyleft" -a "$enable_copyleft" != "no"; then
4164AC_MSG_CHECKING([which saxon to use])
4165if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
4166       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
4167        AC_MSG_RESULT([external])
4168        SYSTEM_SAXON=YES
4169        if test -z $SAXON_JAR; then
4170          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4171            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4172            [
4173              AC_CHECK_FILE(/usr/share/java/saxon.jar,
4174                [ SAXON_JAR=/usr/share/java/saxon.jar ],
4175                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4176                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4177                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
4178                  )
4179                ]
4180              )
4181            ]
4182          )
4183        else
4184          AC_CHECK_FILE($SAXON_JAR, [],
4185               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
4186        fi
4187        if test -n "$SERIALIZER_JAR"; then
4188          AC_CHECK_FILE($SERIALIZER_JAR, [],
4189               [AC_MSG_ERROR(serializer.jar not found.)], [])
4190          AC_SUBST(SERIALIZER_JAR)
4191        fi
4192
4193dnl Saxon comes in two practically available versions, the out-of-date saxonb which
4194dnl supports the java extensions that OOo uses, and the up-to-date saxon he
4195dnl "home edition" version, which is crippled to not support those java extensions.
4196dnl And as an aside the he one also needs to be tweaked to include
4197dnl a META-INF/services to broadcast that it supports the jaxp transform factory
4198
4199        AC_MSG_CHECKING([if saxon works])
4200        cat > saxontest.java <<_ACEOF
4201[import javax.xml.transform.TransformerFactory;
4202import javax.xml.transform.Transformer;
4203import javax.xml.transform.stream.StreamSource;
4204import java.io.*;
4205
4206import net.sf.saxon.FeatureKeys;
4207
4208class saxontest {
4209    public static void main(String[] args) {
4210      System.setProperty("javax.xml.transform.TransformerFactory",
4211        "net.sf.saxon.TransformerFactoryImpl");
4212      try {
4213        TransformerFactory tfactory = TransformerFactory.newInstance();
4214	// some external saxons (Debian, Ubuntu, ...) have this disabled
4215	// per default
4216	tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
4217        System.out.println("TransformerFactory is" +
4218          tfactory.getClass().getName());
4219        Transformer transformer = tfactory.newTransformer(
4220          new StreamSource(new File(args[0])));
4221      } catch(Exception e){
4222        e.printStackTrace(System.err);
4223        System.exit(-1);
4224      }
4225      System.exit(0);
4226    }
4227}
4228]
4229_ACEOF
4230        cat > saxontest.xsl<<_ACEOF
4231[<?xml version="1.0" encoding="UTF-8"?>
4232<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4233 <xsl:template match="/">
4234  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
4235 </xsl:template>
4236</xsl:stylesheet>
4237]
4238_ACEOF
4239        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
4240        AC_TRY_EVAL(javac_cmd)
4241        if test $? = 0 && test -f ./saxontest.class ; then
4242            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
4243            AC_TRY_EVAL(java_cmd)
4244            if test $? = 0; then
4245              AC_MSG_RESULT([yes])
4246            else
4247              cat saxontest.java >&5
4248              AC_MSG_RESULT([no])
4249              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
4250            fi
4251        else
4252          AC_MSG_RESULT([no])
4253          cat saxontest.java >&5
4254          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
4255        fi
4256else
4257    AC_MSG_RESULT([internal])
4258    SYSTEM_SAXON=NO
4259    NEED_SAXON=TRUE
4260fi
4261AC_SUBST(SYSTEM_SAXON)
4262AC_SUBST(SAXON_JAR)
4263
4264if test -n "$NEED_SAXON"; then
4265   BUILD_TYPE="$BUILD_TYPE SAXON"
4266fi
4267fi
4268
4269dnl ===================================================================
4270dnl Check for system curl
4271dnl ===================================================================
4272if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
4273   with_system_curl=yes
4274fi
4275AC_MSG_CHECKING([which curl to use])
4276if test -n "$with_system_curl" -o -n "$with_system_libs" && \
4277	test "$with_system_curl" != "no"; then
4278   AC_MSG_RESULT([external])
4279   SYSTEM_CURL=YES
4280
4281   AC_PATH_PROG( CURLCONFIG, curl-config)
4282   if test -z "$CURLCONFIG"; then
4283      AC_MSG_ERROR([install curl to run this script])
4284   fi
4285
4286   # check curl version
4287   AC_MSG_CHECKING([whether curl is >= 7.13.1])
4288   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
4289	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
4290	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
4291      AC_MSG_ERROR([no, you need at least curl 7.13,1])
4292   else
4293      AC_MSG_RESULT([yes])
4294   fi
4295   CURL_LIBS=`$CURLCONFIG --libs`
4296   CURL_CFLAGS=`$CURLCONFIG --cflags`
4297else
4298   AC_MSG_RESULT([internal])
4299   SYSTEM_CURL=NO
4300   BUILD_TYPE="$BUILD_TYPE CURL"
4301fi
4302AC_SUBST(SYSTEM_CURL)
4303AC_SUBST(CURL_CFLAGS)
4304AC_SUBST(CURL_LIBS)
4305
4306dnl ===================================================================
4307dnl Check for system mdds
4308dnl ===================================================================
4309AC_MSG_CHECKING([which mdds to use])
4310if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
4311	test "$with_system_mdds" != "no"; then
4312    AC_MSG_RESULT([external])
4313    SYSTEM_MDDS=YES
4314    AC_LANG_PUSH([C++])
4315    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
4316        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
4317    AC_LANG_POP([C++])
4318else
4319   AC_MSG_RESULT([internal])
4320   BUILD_TYPE="$BUILD_TYPE MDDS"
4321   SYSTEM_MDDS=NO
4322fi
4323AC_SUBST(SYSTEM_MDDS)
4324
4325dnl ===================================================================
4326dnl Check for system boost
4327dnl ===================================================================
4328AC_MSG_CHECKING([which boost to use])
4329if test -n "$with_system_boost" -o -n "$with_system_headers" && \
4330	test "$with_system_boost" != "no"; then
4331   AC_MSG_RESULT([external])
4332   SYSTEM_BOOST=YES
4333   AC_LANG_PUSH([C++])
4334   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
4335       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
4336   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
4337       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
4338   AC_CHECK_HEADER(boost/function.hpp, [],
4339       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
4340
4341   save_CXXFLAGS=$CXXFLAGS
4342   CXXFLAGS="$CXXFLAGS -fno-exceptions"
4343   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
4344   AC_TRY_COMPILE([#include <boost/function.hpp>
4345], [],
4346   ac_cv_cxx_boost_no_exceptons_broken=no, ac_cv_cxx_boost_no_exceptons_broken=yes)
4347
4348   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
4349	AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
4350   else
4351  	AC_MSG_RESULT([yes])
4352   fi
4353   CXXFLAGS=$save_CXXFLAGS
4354   AC_LANG_POP([C++])
4355else
4356   AC_MSG_RESULT([internal])
4357   BUILD_TYPE="$BUILD_TYPE BOOST"
4358   SYSTEM_BOOST=NO
4359fi
4360AC_SUBST(SYSTEM_BOOST)
4361
4362dnl ===================================================================
4363dnl Check for system vigra
4364dnl ===================================================================
4365AC_MSG_CHECKING([which vigra to use])
4366if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
4367	test "$with_system_vigra" != "no"; then
4368   AC_MSG_RESULT([external])
4369   SYSTEM_VIGRA=YES
4370   AC_LANG_PUSH([C++])
4371   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
4372       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
4373   AC_LANG_POP([C++])
4374else
4375   AC_MSG_RESULT([internal])
4376   BUILD_TYPE="$BUILD_TYPE VIGRA"
4377   SYSTEM_VIGRA=NO
4378fi
4379AC_SUBST(SYSTEM_VIGRA)
4380
4381dnl ===================================================================
4382dnl Check for system odbc
4383dnl ===================================================================
4384AC_MSG_CHECKING([which odbc headers to use])
4385if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
4386	test "$with_system_odbc_headers" != "no"; then
4387   AC_MSG_RESULT([external])
4388   SYSTEM_ODBC_HEADERS=YES
4389
4390   AC_CHECK_HEADER(sqlext.h, [],
4391      [AC_MSG_ERROR(odbc not found. install odbc)], [])
4392else
4393   AC_MSG_RESULT([internal])
4394   SYSTEM_ODBC_HEADERS=NO
4395   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
4396fi
4397AC_SUBST(SYSTEM_ODBC_HEADERS)
4398
4399AC_MSG_CHECKING([whether to enable build of Mozilla/Mozilla NSS-using components])
4400if test "$enable_mozilla" = "no"; then
4401   AC_MSG_RESULT([no])
4402   WITH_MOZILLA=NO
4403   ENABLE_NSS_MODULE=NO
4404else
4405   AC_MSG_RESULT([yes])
4406   WITH_MOZILLA=YES
4407fi
4408AC_SUBST(WITH_MOZILLA)
4409
4410AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
4411if test "$enable_mozilla" = "no"; then
4412   AC_MSG_RESULT([no])
4413elif test "$with_system_mozilla" = "yes"; then
4414   AC_MSG_RESULT([no, not possible with system-mozilla])
4415else
4416   AC_MSG_RESULT([yes])
4417fi
4418
4419AC_MSG_CHECKING([whether to build XML Security support])
4420if test "$enable_mozilla" = "no"; then
4421   AC_MSG_RESULT([no, since Mozilla (NSS) disabled but needed])
4422else
4423   AC_MSG_RESULT([yes])
4424fi
4425
4426AC_MSG_CHECKING([whether to build LDAP configuration backend])
4427if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
4428   if test "$enable_mozilla" = "yes" || test "$with_openldap" = "yes"; then
4429      AC_MSG_RESULT([yes])
4430      WITH_LDAP=YES
4431   else
4432      AC_MSG_RESULT([no. Either Mozilla or OpenLDAP needed])
4433      WITH_LDAP=NO
4434   fi
4435else
4436   AC_MSG_RESULT([no])
4437   WITH_LDAP=NO
4438fi
4439
4440if test "$WITH_LDAP" = "YES"; then
4441   dnl ===================================================================
4442   dnl Test whether we want to use the Mozilla or the OpenLDAP LDAP SDK
4443   dnl ===================================================================
4444   AC_MSG_CHECKING([which LDAP SDK to use])
4445   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
4446  	   AC_MSG_RESULT([OpenLDAP])
4447	   WITH_OPENLDAP=YES
4448	   AC_CHECK_HEADERS(ldap.h, [],
4449		   [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
4450	   AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
4451		   [AC_MSG_ERROR(openldap lib not found or functional)], [])
4452	   # rumours say that OpenLDAP doesn't have that function. I looked and
4453	   # it has it. Test for it to be sure
4454         AC_CHECK_LIB(ldap, ldap_set_option, [],
4455                [AC_MSG_ERROR(openldap lib not found or functional)], [])
4456   else
4457	   AC_MSG_RESULT([Netscape/Mozilla])
4458	   # TODO. Actually do a sanity check and check for
4459	   # LDAP_OPT_SIZELIMIT and LDAP_X_OPT_CONNECT_TIMEOUT
4460	   WITH_OPENLDAP=NO
4461   fi
4462fi
4463AC_SUBST(WITH_LDAP)
4464AC_SUBST(WITH_OPENLDAP)
4465
4466dnl ===================================================================
4467dnl Check for system mozilla
4468dnl ===================================================================
4469AC_MSG_CHECKING([which mozilla to use])
4470if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
4471    AC_MSG_RESULT([external])
4472    SYSTEM_MOZILLA=YES
4473    ENABLE_NSS_MODULE=NO
4474    enable_nss_module=no
4475    AC_MSG_CHECKING([which Mozilla flavour to use])
4476    if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
4477      MOZ_FLAVOUR=libxul
4478    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
4479      MOZ_FLAVOUR=xulrunner
4480    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
4481      MOZ_FLAVOUR=seamonkey
4482    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
4483      MOZ_FLAVOUR=firefox
4484    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
4485      MOZ_FLAVOUR=mozilla
4486    else
4487      MOZ_FLAVOUR=libxul
4488    fi
4489    tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
4490    AC_MSG_RESULT($tmp)
4491
4492    PKG_CHECK_MODULES( MOZ_NSS, nss, STANDALONENSS="TRUE", STANDALONENSS="" )
4493    if test -z "$STANDALONENSS"; then
4494        PKG_CHECK_MODULES( MOZ_NSS, $MOZ_FLAVOUR-nss )
4495    else
4496        NSS_LIB="-L`$PKG_CONFIG --variable=libdir nss`"
4497        AC_SUBST(NSS_LIB)
4498    fi
4499
4500    if $PKG_CONFIG --exists nspr ; then
4501      PKG_CHECK_MODULES( MOZ_NSPR, nspr )
4502      NSPR_LIB="-L`$PKG_CONFIG --variable=libdir nspr`"
4503      AC_SUBST(NSPR_LIB)
4504    else
4505      PKG_CHECK_MODULES( MOZ_NSPR, $MOZ_FLAVOUR-nspr )
4506    fi
4507
4508    if test "$MOZ_FLAVOUR" != "libxul"; then
4509      PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
4510      MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
4511      MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
4512    fi
4513
4514    if test -z "$HASXPCOM"; then
4515      PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
4516      MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
4517      MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
4518      if ! test -e "$MOZ_LIB/libxul.so"; then
4519         MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
4520         if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
4521            MOZ_LIB="$MOZ_LIB/sdk/lib"
4522         fi
4523      fi
4524    fi
4525
4526    save_CPPFLAGS="$CPPFLAGS"
4527    save_LDFLAGS="$LDFLAGS"
4528    save_LIBS="$LIBS"
4529    CPPFLAGS="$CPPFLAGS $MOZ_NSS_CFLAGS"
4530    LDFLAGS="$LDFLAGS $MOZ_NSS_LIBS"
4531    AC_CHECK_LIB(nss3, PK11_GetCertFromPrivateKey, [],
4532      [AC_MSG_ERROR(PK11_GetCertFromPrivateKey missing but needed.
4533See https://bugzilla.mozilla.org/show_bug.cgi?id=262274.
4534Fixed since nss 3.9.3 (contained by e.g. mozilla >= 1.7.5))], [])
4535    LDFLAGS="$save_LDFLAGS"
4536    CPPFLAGS="$save_CPPFLAGS"
4537    LIBS="$save_LIBS"
4538
4539    MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
4540    if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
4541      AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
4542      if test -d "$MOZ_INC/ldap"; then
4543         AC_MSG_RESULT([yes])
4544         MOZ_LDAP_CFLAGS="-I$MOZ_INC"
4545      else
4546        AC_MSG_ERROR([no.
4547Could not find LDAP header include files in $MOZ_INC/ldap.
4548Please recompile $tmp with --enable-ldap or use --with-openldap.])
4549      fi
4550    fi
4551
4552    #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
4553    #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
4554    if test "$MOZ_FLAVOUR" = "libxul"; then
4555        MOZ_FLAVOUR="mozilla"
4556    fi
4557
4558elif test "$enable_mozilla" = "no"; then
4559    AC_MSG_RESULT([none])
4560    WITH_MOZILLA=NO
4561    ENABLE_NSS_MODULE=NO
4562    enable_nss_module=no
4563else
4564    AC_MSG_RESULT([internal])
4565    SYSTEM_MOZILLA=NO
4566    BUILD_TYPE="$BUILD_TYPE MOZ"
4567if test -z "$with_mozilla_version"; then
4568   MOZILLA_VERSION=
4569else
4570   AC_MSG_CHECKING([which mozilla version to build])
4571   MOZILLA_VERSION=$with_mozilla_version
4572   enable_build_mozilla=1
4573   AC_MSG_RESULT([$MOZILLA_VERSION])
4574fi
4575
4576AC_SUBST(MOZILLA_VERSION)
4577
4578AC_MSG_CHECKING([for toolkit mozilla should use])
4579if test -z "$with_mozilla_toolkit"; then
4580   if test "$_os" != "WINNT" ; then
4581      if test "$_os" = "Darwin" ; then
4582         MOZILLA_TOOLKIT=mac
4583         AC_MSG_RESULT([mac])
4584      else
4585         MOZILLA_TOOLKIT=gtk2
4586         AC_MSG_RESULT([gtk2])
4587      fi
4588   fi
4589else
4590   MOZILLA_TOOLKIT=$with_mozilla_toolkit
4591   enable_build_mozilla=1
4592   AC_MSG_RESULT([$MOZILLA_TOOLKIT])
4593fi
4594#if test "$_os" = "Darwin" && test "$MOZILLA_TOOLKIT" != "gtk2"; then
4595#   #only gtk2 toolkit supported - xlib or cocoa nees glib1 and libIDL1 - the latter is not
4596#   #available using fink, mac (carbon) doesn't work because xcode installs conflicting headers
4597#   AC_MSG_ERROR([Only gtk2 toolkit supported on Mac, sorry.])
4598#fi
4599
4600AC_SUBST(MOZILLA_TOOLKIT)
4601
4602# default to enabling build mozilla
4603if test "$enable_build_mozilla" != "no"; then
4604      enable_build_mozilla=yes
4605else
4606      enable_build_mozilla=
4607fi
4608
4609AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
4610if test -n "$enable_build_mozilla"; then
4611   BUILD_MOZAB="TRUE"
4612   AC_MSG_RESULT([yes])
4613else
4614   BUILD_MOZAB=""
4615   AC_MSG_RESULT([no])
4616fi
4617
4618AC_MSG_CHECKING([whether to build provided NSS module])
4619if test "$enable_nss_module" != "no"; then
4620   ENABLE_NSS_MODULE="YES"
4621   BUILD_TYPE="$BUILD_TYPE NSS"
4622   AC_MSG_RESULT([yes])
4623   if test "$_os" = "WINNT"; then
4624      AC_MSG_CHECKING([for Mozilla build tooling])
4625      if test -z "$MOZILLABUILD" ; then
4626AC_MSG_ERROR([Mozilla build tooling not found.
4627Use the --with-mozilla-build option after installling the tools obtained
4628from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
4629      else
4630         if test \( "$WITH_MINGWIN" = "yes" \) ; then
4631            if test ! -d "$MOZILLABUILD" ; then
4632AC_MSG_ERROR([Mozilla build tooling incomplete!])
4633            else
4634               AC_MSG_RESULT([ok])
4635            fi
4636         else
4637            if test ! -d "$MOZILLABUILD/moztools" \
4638               -o ! -d "$MOZILLABUILD/msys" ; then
4639AC_MSG_ERROR([Mozilla build tooling incomplete!])
4640            else
4641               AC_MSG_RESULT([ok])
4642            fi
4643         fi
4644      fi
4645   fi
4646else
4647   ENABLE_NSS_MODULE="NO"
4648   AC_MSG_RESULT([no])
4649fi
4650
4651if test "$BUILD_MOZAB" = "TRUE"; then
4652  if test "$_os" = "WINNT"; then
4653    if test "$WITH_MINGWIN" != "yes"; then
4654      # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
4655      if test "$MSVSVER" != "2005"; then
4656        AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio .NET 2005 only.])
4657      fi
4658    else
4659      AC_MSG_WARN([Building SeaMonkey with mingwin is not tested, and likely to break.])
4660      echo "Building SeaMonkey with mingwin is not tested, and likely to break." >> warn
4661    fi
4662  fi
4663
4664   if test -z "$MOZILLA_VERSION"; then
4665      MOZILLA_VERSION=1.1.14
4666   fi
4667   MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
4668   MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst`
4669   AC_MSG_CHECKING([for mozilla sources])
4670   if test -z "$MOZILLA_FETCH_FILE"; then
4671      AC_MSG_RESULT([not found])
4672      HAVE_MOZILLA_TARBALL=n
4673   else
4674      AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
4675      if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
4676         if test -z "$DO_FETCH"; then
4677            AC_MSG_RESULT([will be fetched])
4678            HAVE_MOZILLA_TARBALL=y
4679         else
4680            AC_MSG_RESULT([not found])
4681            HAVE_MOZILLA_TARBALL=n
4682         fi
4683      else
4684         AC_MSG_RESULT([found])
4685         HAVE_MOZILLA_TARBALL=y
4686      fi
4687   fi
4688   if test "$HAVE_MOZILLA_TARBALL" != "y"; then
4689      AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
4690Use "./fetch_tarballs.sh ooo.lst" to download.])
4691   fi
4692   if test "$_os" = "WINNT"; then
4693      AC_MSG_CHECKING([for moztools binaries])
4694      if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
4695        AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
4696(from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
4697      else
4698         AC_MSG_RESULT([ok])
4699      fi
4700   elif test "$_os" = "Darwin"; then
4701      if test "$MOZILLA_TOOLKIT" = "gtk2"; then
4702         AC_MSG_NOTICE([checking whether mozilla can be built...])
4703         PKG_CHECK_MODULES(MOZGTK2, gtk+-2.0 >= 2.4 libIDL-2.0 >= 0.8, AC_MSG_NOTICE([OK - can build mozilla]), AC_MSG_ERROR([Prerequisites to build mozilla not met. Either use the precompiled mozilla binaries or install the missing packages]))
4704      else
4705         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
4706         if test -z "$MOZIDL"; then
4707            AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build mozilla with mac toolkit.])
4708         fi
4709      fi
4710   else
4711      # Generic Unix/Linux section
4712      if test "$MOZILLA_TOOLKIT" = "gtk2"; then
4713         PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
4714         if test -z "$MOZGTK"; then
4715            AC_MSG_ERROR([GTK2 is needed to build mozilla.])
4716         fi
4717         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
4718         if test -z "$MOZIDL"; then
4719            AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build mozilla.])
4720         fi
4721      else
4722         PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
4723         if test -z "$MOZGTK"; then
4724            AC_MSG_ERROR([gtk 1.2 is needed when not using GTK2 to build mozilla.])
4725         fi
4726         PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
4727         if test -z "$MOZIDL"; then
4728            AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build mozilla.])
4729         fi
4730      fi
4731   fi
4732fi
4733
4734AC_SUBST(BUILD_MOZAB)
4735
4736fi
4737AC_SUBST(ENABLE_NSS_MODULE)
4738AC_SUBST(MOZILLABUILD)
4739AC_SUBST(SYSTEM_MOZILLA)
4740AC_SUBST(MOZ_FLAVOUR)
4741AC_SUBST(MOZ_INC)
4742AC_SUBST(MOZ_LIB)
4743AC_SUBST(MOZ_LIB_XPCOM)
4744AC_SUBST(MOZ_NSPR_CFLAGS)
4745AC_SUBST(MOZ_NSS_CFLAGS)
4746AC_SUBST(MOZ_LDAP_CFLAGS)
4747
4748dnl ===================================================================
4749dnl Check for system sane
4750dnl ===================================================================
4751AC_MSG_CHECKING([which sane header to use])
4752if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
4753	test "$with_system_sane_header" != "no"; then
4754   AC_MSG_RESULT([external])
4755   SYSTEM_SANE_HEADER=YES
4756   AC_CHECK_HEADER(sane/sane.h, [],
4757      [AC_MSG_ERROR(sane not found. install sane)], [])
4758else
4759   AC_MSG_RESULT([internal])
4760   SYSTEM_SANE_HEADER=NO
4761   BUILD_TYPE="$BUILD_TYPE SANE"
4762fi
4763AC_SUBST(SYSTEM_SANE_HEADER)
4764
4765dnl ===================================================================
4766dnl Check for system icu
4767dnl ===================================================================
4768AC_MSG_CHECKING([which icu to use])
4769if test -n "$with_system_icu" -o -n "$with_system_libs" && \
4770	test "$with_system_icu" != "no"; then
4771   AC_MSG_RESULT([external])
4772   SYSTEM_ICU=YES
4773   AC_LANG_PUSH([C++])
4774   AC_MSG_CHECKING([for unicode/rbbi.h])
4775   AC_TRY_CPP(unicode/rbbi.h, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([icu headers not found.]))
4776   AC_LANG_POP([C++])
4777   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
4778   if test -z "$SYSTEM_GENBRK"; then
4779      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
4780   fi
4781   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
4782   if test -z "$SYSTEM_GENCCODE"; then
4783      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
4784   fi
4785   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
4786   if test -z "$SYSTEM_GENCMN"; then
4787      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
4788   fi
4789
4790   AC_PATH_PROG( ICUCONFIG, icu-config)
4791   AC_MSG_CHECKING([ICU version])
4792   ICU_VERSION=`$ICUCONFIG --version`
4793   ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
4794   ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
4795   ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
4796
4797   if test "$ICU_MAJOR" -ge "4"; then
4798      AC_MSG_RESULT([OK])
4799   else
4800      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
4801   fi
4802
4803else
4804    AC_MSG_RESULT([internal])
4805    SYSTEM_ICU=NO
4806    BUILD_TYPE="$BUILD_TYPE ICU"
4807fi
4808AC_SUBST(SYSTEM_ICU)
4809AC_SUBST(SYSTEM_GENBRK)
4810AC_SUBST(SYSTEM_GENCCODE)
4811AC_SUBST(SYSTEM_GENCMN)
4812AC_SUBST(ICU_MAJOR)
4813AC_SUBST(ICU_MINOR)
4814AC_SUBST(ICU_MICRO)
4815
4816dnl ===================================================================
4817dnl Graphite
4818dnl ===================================================================
4819
4820AC_MSG_CHECKING([whether to enable graphite support])
4821if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
4822    AC_MSG_RESULT([yes])
4823    ENABLE_GRAPHITE="TRUE"
4824    AC_MSG_CHECKING([which graphite to use])
4825    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
4826        test "$with_system_graphite" != "no"; then
4827        AC_MSG_RESULT([external])
4828        SYSTEM_GRAPHITE=YES
4829        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
4830    else
4831        AC_MSG_RESULT([internal])
4832        SYSTEM_GRAPHITE=NO
4833        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
4834    fi
4835else
4836   AC_MSG_RESULT([no])
4837fi
4838AC_SUBST(ENABLE_GRAPHITE)
4839AC_SUBST(SYSTEM_GRAPHITE)
4840AC_SUBST(GRAPHITE_LIBS)
4841AC_SUBST(GRAPHITE_CFLAGS)
4842
4843dnl ===================================================================
4844dnl Checks for libraries.
4845dnl ===================================================================
4846dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
4847dnl See if we have the AppKit framework for building with Quartz graphics.
4848
4849if test  "$_os" = "Darwin"; then
4850   if test "x$with_x" = "xyes"; then
4851      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
4852   else
4853      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
4854      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
4855         AC_MSG_RESULT([yes])
4856         x_includes="no_x_includes"
4857         x_libraries="no_x_libraries"
4858         dnl disable some things used on other Unix versions but not on the aqua build
4859         enable_gtk=no
4860         enable_cups=no
4861         ENABLE_CUPS=""
4862         AC_SUBST(ENABLE_CUPS)
4863      else
4864         AC_MSG_ERROR([No AppKit.framewrok found])
4865      fi
4866   fi
4867fi
4868
4869dnl ***************************************
4870dnl testing for X libraries and includes...
4871dnl ***************************************
4872if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
4873   echo "Do Nothing for _os = Darwin"
4874   dnl Mac OS X using Aqua graphics. Don't check for X11.
4875   :
4876elif test "$_os" = "OS2" ; then
4877   echo "Do Nothing for _os = OS2. Don't check for X11."
4878   dnl OS/2 uses native graphics. Don't check for X11.
4879   :
4880elif test "$_os" != "WINNT" ; then
4881   AC_PATH_X
4882   AC_PATH_XTRA
4883   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
4884
4885   if test "x$x_includes" = "x"; then
4886     x_includes="default_x_includes"
4887   fi
4888   if test "x$x_libraries" = "x"; then
4889     x_libraries="default_x_libraries"
4890   fi
4891   dnl The variables $x_libraries and $x_includes are set.
4892   if test -z "$x_libraries"; then
4893      AC_MSG_ERROR([No X libraries found]) # Exit
4894   fi
4895   if test -z "$x_includes"; then
4896      AC_MSG_ERROR([No X includes found]) # Exit
4897   fi
4898   CFLAGS=$X_CFLAGS
4899   LDFLAGS="$X_LDFLAGS $X_LIBS"
4900   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
4901   dnl Check if the XauDisposeAuth symbol is provided by libXau.
4902   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
4903else
4904   x_includes="no_x_includes"
4905   x_libraries="no_x_libraries"
4906fi
4907if test -z "$x_includes"; then
4908   x_includes="no_x_includes"
4909fi
4910if test -z "$x_libraries"; then
4911   x_libraries="no_x_libraries"
4912fi
4913if test "$x_includes" = "default_x_includes"; then
4914   XINC="/usr/include"
4915else
4916   XINC="$x_includes"
4917fi
4918AC_SUBST(XINC)
4919if test "$x_libraries" = "default_x_libraries"; then
4920   XLIB=`$PKG_CONFIG --variable=libdir x11`
4921   if test "x$XLIB" = x; then
4922         XLIB="/usr/lib"
4923   fi
4924else
4925   XLIB="$x_libraries"
4926fi
4927AC_SUBST(XLIB)
4928AC_SUBST(XAU_LIBS)
4929
4930if test "$_os" != "WINNT" -a "$_os" != "OS2" -a "$_os" != "Darwin"; then
4931   dnl ===================================================================
4932   dnl Check for using Xaw
4933   dnl ===================================================================
4934   AC_MSG_CHECKING([whether to use Xaw])
4935   if test "$enable_Xaw" = "no"; then
4936       DISABLE_XAW=TRUE
4937       AC_MSG_RESULT([no])
4938       AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt include headers not found])],
4939         [#include <X11/Intrinsic.h>])
4940   else
4941       AC_MSG_RESULT([yes])
4942       AC_CHECK_HEADERS(X11/Xaw/Label.h,[],[AC_MSG_ERROR([Xaw include headers not found])],
4943         [#include <X11/Intrinsic.h>])
4944       AC_CHECK_LIB(Xaw, main, [],
4945           [AC_MSG_ERROR(Xaw library not found or functional)], [])
4946   fi
4947fi
4948AC_SUBST(DISABLE_XAW)
4949
4950
4951
4952dnl ===================================================================
4953dnl Check if fontconfig/fontconfig.h is available
4954dnl ===================================================================
4955if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
4956    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
4957                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
4958    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
4959    AC_TRY_RUN([
4960#include <fontconfig/fontconfig.h>
4961
4962int main(int argc, char **argv) {
4963	if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
4964	else return 1;
4965}
4966], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])])
4967fi
4968
4969dnl ===================================================================
4970dnl Check for system Xrender
4971dnl ===================================================================
4972AC_MSG_CHECKING([whether to link to Xrender])
4973if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
4974   AC_MSG_RESULT([yes])
4975   XRENDER_LINK=YES
4976   with_system_xrender_headers=yes
4977else
4978   AC_MSG_RESULT([no, dynamically open it])
4979   XRENDER_LINK=NO
4980fi
4981AC_MSG_CHECKING([which Xrender headers to use])
4982if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
4983	test "$with_system_xrender_headers" != "no"; then
4984   AC_MSG_RESULT([external])
4985   SYSTEM_XRENDER_HEADERS=YES
4986   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
4987      [AC_MSG_ERROR(Xrender not found. install X)], [])
4988else
4989   AC_MSG_RESULT([internal])
4990   SYSTEM_XRENDER_HEADERS=NO
4991   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
4992fi
4993if test "$XRENDER_LINK" = "YES"; then
4994   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
4995      [AC_MSG_ERROR(libXrender not found or functional)], [])
4996fi
4997AC_SUBST(SYSTEM_XRENDER_HEADERS)
4998AC_SUBST(XRENDER_LINK)
4999
5000dnl ===================================================================
5001dnl Check for XRandr
5002dnl ===================================================================
5003AC_MSG_CHECKING([whether to enable RandR support])
5004if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5005   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5006	  XRANDR_DLOPEN="TRUE"
5007	  AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5008   else
5009	  XRANDR_DLOPEN="FALSE"
5010      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5011      if test "$ENABLE_RANDR" != "TRUE"; then
5012         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5013                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5014         XRANDR_CFLAGS=" "
5015         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5016              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5017         XRANDR_LIBS="-lXrandr "
5018         ENABLE_RANDR="TRUE"
5019	     AC_MSG_RESULT([enabling RandR support])
5020      fi
5021   fi
5022else
5023   ENABLE_RANDR=""
5024   AC_MSG_RESULT([no])
5025fi
5026AC_SUBST(XRANDR_DLOPEN)
5027AC_SUBST(XRANDR_CFLAGS)
5028AC_SUBST(XRANDR_LIBS)
5029AC_SUBST(ENABLE_RANDR)
5030
5031dnl ===================================================================
5032dnl Check for building neon
5033dnl ===================================================================
5034AC_MSG_CHECKING([whether to use neon])
5035if test "$enable_neon" = "no"; then
5036    AC_MSG_RESULT([no])
5037    DISABLE_NEON=TRUE
5038    AC_SUBST(DISABLE_NEON)
5039else
5040    AC_MSG_RESULT([yes])
5041dnl ===================================================================
5042dnl Check for system neon
5043dnl ===================================================================
5044AC_MSG_CHECKING([which neon to use])
5045if test -n "$with_system_neon" -o -n "$with_system_libs" && \
5046	test "$with_system_neon" != "no"; then
5047        AC_MSG_RESULT([external])
5048        PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
5049        NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
5050        NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
5051        SYSTEM_NEON=YES
5052else
5053    AC_MSG_RESULT([internal])
5054    SYSTEM_NEON=NO
5055    NEON_LIBS=-lneon
5056    NEON_CFLAGS=
5057    BUILD_TYPE="$BUILD_TYPE NEON"
5058fi
5059AC_SUBST(SYSTEM_NEON)
5060AC_SUBST(NEON_VERSION)
5061AC_SUBST(NEON_LIBS)
5062AC_SUBST(NEON_CFLAGS)
5063fi
5064
5065dnl ===================================================================
5066dnl Check for system openssl
5067dnl ===================================================================
5068if test "$_os" = "Darwin" && test "$with_system_openssl" != "no"; then
5069   with_system_openssl=yes
5070fi
5071AC_MSG_CHECKING([which libssl to use])
5072if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5073        test "$with_system_openssl" != "no"; then
5074    AC_MSG_RESULT([external])
5075    # Mac OS builds should get out without extra stuff is the Mac porters'
5076    # wish. And pkg-config is although Xcode ships a .pc for openssl
5077    if test "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
5078        OPENSSL_CFLAGS=
5079        OPENSSL_LIBS="-lssl -lcrypto"
5080    else
5081    	PKG_CHECK_MODULES( OPENSSL, openssl )
5082    fi
5083    SYSTEM_OPENSSL=YES
5084else
5085    AC_MSG_RESULT([internal])
5086    SYSTEM_OPENSSL=NO
5087    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5088fi
5089AC_SUBST(SYSTEM_OPENSSL)
5090AC_SUBST(OPENSSL_CFLAGS)
5091AC_SUBST(OPENSSL_LIBS)
5092
5093dnl ===================================================================
5094dnl Test for disabling agg
5095dnl ===================================================================
5096AC_MSG_CHECKING([whether to enable agg])
5097if test "$with_agg" = "no"; then
5098  AC_MSG_RESULT([no])
5099else
5100  AC_MSG_RESULT([yes])
5101  ENABLE_AGG=YES
5102  AC_SUBST(ENABLE_AGG)
5103
5104  dnl ===================================================================
5105  dnl Check for system AGG
5106  dnl ===================================================================
5107  AC_MSG_CHECKING([which AGG to use])
5108  if test -n "$with_system_agg" -o -n "$with_system_libs" && \
5109     test "$with_system_agg" != "no"; then
5110         AC_MSG_RESULT([external])
5111         PKG_CHECK_MODULES(AGG, libagg >= 2.3)
5112         AC_MSG_CHECKING([agg version])
5113         # workaround; if AGG_CFLAGS is empty (broken libagg.pc in 2.3), add /usr/include/agg2 anyway
5114         # (/usr/include gets stripped from pkg-config output)
5115         if test -z "$AGG_CFLAGS" || test "$AGG_CFLAGS" = " "; then
5116            AGG_INCDIR="`$PKG_CONFIG --variable includedir libagg`/agg2"
5117         else
5118            AGG_INCDIR="`echo $AGG_CFLAGS | $SED -e s/-I//`"
5119         fi
5120	 if $PKG_CONFIG --modversion libagg | grep -q 2.3 || \
5121	 	$PKG_CONFIG --modversion libagg | grep -q 2.4; then
5122            # 2.4's libagg.pc.in still contains 2.3 :/
5123            if $EGREP -q "Version 2.4" `echo $AGG_INCDIR`/agg_basics.h; then
5124               AC_MSG_RESULT([2.4])
5125               AGG_VERSION=2400
5126            else
5127               AC_MSG_RESULT([2.3])
5128               AGG_VERSION=2300
5129            fi
5130            SYSTEM_AGG=YES
5131	 else
5132	    AC_MSG_ERROR([only agg 2.3 and 2.4 are supported])
5133	 fi
5134  else
5135         AC_MSG_RESULT([internal])
5136         SYSTEM_AGG=NO
5137         AGG_VERSION=2300
5138         BUILD_TYPE="$BUILD_TYPE AGG"
5139  fi
5140  AC_SUBST(SYSTEM_AGG)
5141  AC_SUBST(AGG_VERSION)
5142fi
5143
5144dnl ===================================================================
5145dnl Check for system redland
5146dnl ===================================================================
5147AC_MSG_CHECKING([which redland library to use])
5148if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5149	test "$with_system_redland" != "no"; then
5150	AC_MSG_RESULT([external])
5151	SYSTEM_REDLAND=YES
5152   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5153   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5154else
5155	AC_MSG_RESULT([internal])
5156	BUILD_TYPE="$BUILD_TYPE REDLAND"
5157	SYSTEM_REDLAND=NO
5158fi
5159AC_SUBST(SYSTEM_REDLAND)
5160AC_SUBST(REDLAND_CFLAGS)
5161AC_SUBST(REDLAND_LIBS)
5162
5163dnl ===================================================================
5164dnl Check for system hunspell
5165dnl ===================================================================
5166
5167if test -n "$enable_copyleft" -a "$enable_copyleft" != "no"; then
5168
5169AC_MSG_CHECKING([which libhunspell to use])
5170if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5171	test "$with_system_hunspell" != "no"; then
5172    AC_MSG_RESULT([external])
5173    SYSTEM_HUNSPELL=YES
5174    AC_LANG_PUSH([C++])
5175    PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5176    if test "$HUNSPELL_PC" != "TRUE"; then
5177      AC_CHECK_HEADER(hunspell.hxx, [],
5178      [
5179      AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5180           [AC_MSG_ERROR(hunspell headers not found.)], [])
5181         ], [])
5182      AC_CHECK_LIB(hunspell, main, [],
5183           [ AC_MSG_ERROR(hunspell library not found.) ], [])
5184      HUNSPELL_LIBS=-lhunspell
5185     fi
5186    AC_LANG_POP([C++])
5187else
5188    AC_MSG_RESULT([internal])
5189    SYSTEM_HUNSPELL=NO
5190    BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5191fi
5192AC_SUBST(SYSTEM_HUNSPELL)
5193AC_SUBST(HUNSPELL_CFLAGS)
5194AC_SUBST(HUNSPELL_LIBS)
5195
5196dnl ===================================================================
5197dnl Checking for altlinuxhyph
5198dnl ===================================================================
5199AC_MSG_CHECKING([which altlinuxhyph to use])
5200if test -n "$with_system_altlinuxhyph" -o -n "$with_system_libs" && \
5201	test "$with_system_altlinuxhyph" != "no"; then
5202    AC_MSG_RESULT([external])
5203    SYSTEM_HYPH=YES
5204    AC_CHECK_HEADER(hyphen.h, [],
5205       [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
5206    AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5207       [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
5208       [#include <hyphen.h>])
5209    AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5210        [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
5211    if test -z "$HYPHEN_LIB"; then
5212       AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5213           [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
5214    fi
5215    if test -z "$HYPHEN_LIB"; then
5216       AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5217           [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
5218    fi
5219else
5220    AC_MSG_RESULT([internal])
5221    SYSTEM_HYPH=NO
5222    BUILD_TYPE="$BUILD_TYPE HYPHEN"
5223fi
5224AC_SUBST(SYSTEM_HYPH)
5225AC_SUBST(HYPHEN_LIB)
5226
5227dnl ===================================================================
5228dnl Checking for mythes
5229dnl ===================================================================
5230AC_MSG_CHECKING([which mythes to use])
5231if test -n "$with_system_mythes" && test "$with_system_mythes" != "no"; then
5232    AC_MSG_RESULT([external])
5233    SYSTEM_MYTHES=YES
5234    AC_LANG_PUSH([C++])
5235    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5236    if test "$MYTHES_PKGCONFIG" = "no"; then
5237        AC_CHECK_HEADER(mythes.hxx, [],
5238            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5239        AC_CHECK_LIB(mythes-1.2, main, [],
5240            [ MYTHES_FOUND=no], [])
5241 	if test "$MYTHES_FOUND" = "no"; then
5242            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5243                [ MYTHES_FOUND=no], [])
5244	fi
5245	if test "$MYTHES_FOUND" = "no"; then
5246		AC_MSG_ERROR([mythes library not found!.])
5247	fi
5248    fi
5249    AC_LANG_POP([C++])
5250else
5251    AC_MSG_RESULT([internal])
5252    SYSTEM_MYTHES=NO
5253    BUILD_TYPE="$BUILD_TYPE MYTHES"
5254fi
5255AC_SUBST(SYSTEM_MYTHES)
5256AC_SUBST(MYTHES_CFLAGS)
5257AC_SUBST(MYTHES_LIBS)
5258
5259fi
5260
5261dnl ===================================================================
5262dnl Checking for lpsolve
5263dnl ===================================================================
5264AC_MSG_CHECKING([which lpsolve to use])
5265if test -n "$with_system_lpsolve" -o -n "$with_system_libs" && \
5266	test "$with_system_lpsolve" != "no"; then
5267    AC_MSG_RESULT([external])
5268    SYSTEM_LPSOLVE=YES
5269    AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
5270       [ AC_MSG_ERROR(lpsolve headers not found.)], [])
5271    # some systems need this. Like Ubuntu....
5272    AC_CHECK_LIB(m, floor)
5273    AC_CHECK_LIB(dl, dlopen)
5274    AC_CHECK_LIB(lpsolve55, make_lp, ,
5275        [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
5276else
5277    AC_MSG_RESULT([internal])
5278    SYSTEM_LPSOLVE=NO
5279    BUILD_TYPE="$BUILD_TYPE LPSOLVE"
5280fi
5281AC_SUBST(SYSTEM_LPSOLVE)
5282
5283dnl ===================================================================
5284dnl Checking for libtextcat
5285dnl ===================================================================
5286AC_MSG_CHECKING([which libtextcat to use])
5287if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5288    AC_MSG_RESULT([external])
5289    SYSTEM_LIBTEXTCAT=YES
5290    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5291       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5292    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5293        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5294else
5295    AC_MSG_RESULT([internal])
5296    SYSTEM_LIBTEXTCAT=NO
5297    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5298fi
5299AC_SUBST(SYSTEM_LIBTEXTCAT)
5300
5301AC_MSG_CHECKING([which libtextcat data directory to use])
5302if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5303    if test "$with_system_libtextcat_data" = "yes"; then
5304        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5305    else
5306        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5307    fi
5308    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5309else
5310    AC_MSG_RESULT([internal])
5311    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5312fi
5313AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5314
5315dnl ***************************************
5316dnl testing libc version for Linux...
5317dnl ***************************************
5318if test "$_os" = "Linux"; then
5319   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5320   exec 6>/dev/null # no output
5321   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5322   exec 6>&1 # output on again
5323   if test "$HAVE_LIBC"; then
5324      AC_MSG_RESULT([yes])
5325   else
5326      AC_MSG_ERROR([no, upgrade libc])
5327   fi
5328fi
5329
5330if test "$_os" != "WNT"; then
5331  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5332  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5333  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5334	SYSTEM_LIBC=YES
5335  fi
5336else
5337  HAVE_GETOPT=NO
5338  HAVE_READDIR_R=NO
5339  SYSTEM_LIBC=YES
5340fi
5341AC_SUBST(HAVE_GETOPT)
5342AC_SUBST(HAVE_READDIR_R)
5343AC_SUBST(SYSTEM_LIBC)
5344
5345dnl =========================================
5346dnl Check for the Microsoft Platform SDK.
5347dnl =========================================
5348dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5349dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5350if test \( "$_os" = "WINNT" \) ; then
5351	AC_MSG_CHECKING([for PSDK files])
5352	if test -z "$with_psdk_home"; then
5353		# This first line will detect a February 2003 Microsoft Platform SDK
5354		PSDK_HOME=`./oowintool --psdk-home`
5355        # But there might be also an April 2005 PSDK, unfortunately MS changed
5356        # the registry entry. (we prefer the old version!?)
5357        if test -z "$PSDK_HOME"; then
5358          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5359        fi
5360            # normalize if found
5361            if test -n "$PSDK_HOME"; then
5362              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5363              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5364           fi
5365	else
5366           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5367	fi
5368        # Remove a possible trailing backslash
5369        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5370    # Problem with current PSDK (iz 49865)
5371    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5372        AC_MSG_ERROR([
5373
5374Some modules do not build correctly with MS Platform SDK - April 2005
5375Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5376Remove/rename/backup that file and restart configure. Details about this
5377problem can be found in issue 49856.])
5378    fi
5379# WIndows SDK has different headers
5380	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5381		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5382		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5383		HAVE_PSDK_H="yes"
5384	else
5385		HAVE_PSDK_H="no"
5386	fi
5387	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5388		HAVE_PSDK_LIB="yes"
5389	else
5390		HAVE_PSDK_LIB="no"
5391	fi
5392    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5393        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5394are installed or use --with-psdk-home .])
5395    fi
5396    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5397         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5398         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5399         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5400        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5401    fi
5402    AC_MSG_RESULT([SDK files found ...)])
5403dnl Check if this is the right SDK.
5404    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5405        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5406        WINDOWS_VISTA_PSDK=TRUE
5407    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5408        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5409        WINDOWS_VISTA_PSDK=TRUE
5410    else
5411        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5412    fi
5413fi
5414AC_SUBST(PSDK_HOME)
5415AC_SUBST(WINDOWS_VISTA_PSDK)
5416
5417dnl =========================================
5418dnl Check for the Microsoft DirectX SDK.
5419dnl =========================================
5420if test \( "$_os" = "WINNT" \) ; then
5421    AC_MSG_CHECKING([for DirectX SDK files])
5422    if test -z "$with_directx_home"; then
5423        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5424        if test -n "$DXSDK_DIR"; then
5425            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5426            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5427        fi
5428        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5429        # the "DirectX SDK files not found" error later
5430    else
5431	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5432    fi
5433    # Remove a possible trailing backslash
5434    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5435
5436    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5437        HAVE_DIRECTXSDK_H="yes"
5438    else
5439        HAVE_DIRECTXSDK_H="no"
5440    fi
5441    # MS changed the location of the libraries with dec 2004 directx sdk
5442    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5443        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5444    else
5445        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5446    fi
5447    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5448        HAVE_DIRECTXSDK_LIB="yes"
5449    else
5450        HAVE_DIRECTXSDK_LIB="no"
5451    fi
5452    if test -n "$ENABLE_DIRECTX"; then
5453	    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
5454		    AC_MSG_RESULT([found])
5455	    else
5456		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5457	    fi
5458    else
5459		DIRECTXSDK_HOME=""
5460		AC_MSG_RESULT([disabled])
5461    fi
5462fi
5463AC_SUBST(DIRECTXSDK_HOME)
5464AC_SUBST(DIRECTXSDK_LIB)
5465
5466dnl ============================================
5467dnl Check for Nullsoft Scriptable Install System
5468dnl ============================================
5469NSIS_PATH=""
5470if test "$_os" = "WINNT" ; then
5471    AC_MSG_CHECKING([for NSIS])
5472    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5473    if test -n "$NSIS_PATH"; then
5474        NSIS_PATH=`dirname "$NSIS_PATH"`
5475    fi
5476    if test -n "$with_nsis_path"; then
5477        with_nsis_path=`cygpath -u "$with_nsis_path"`
5478    fi
5479    if test -e "$with_nsis_path/nsis.exe"; then
5480        NSIS_PATH="$with_nsis_path"
5481    fi
5482    nsistest=`./oowintool --nsis-dir`;
5483    if test -x "$nsistest/nsis.exe"; then
5484        NSIS_PATH="$nsistest"
5485    fi
5486    if test -z "$NSIS_PATH"; then
5487        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5488        echo "NSIS not found, no self contained installer will be build." >> warn
5489    else
5490        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5491        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5492        AC_MSG_RESULT([found ($NSIS_PATH)])
5493    fi
5494fi
5495AC_SUBST(NSIS_PATH)
5496
5497dnl ***************************************
5498dnl testing bison and flex exist
5499dnl ***************************************
5500AC_PATH_PROG(BISON, bison)
5501if test -z "$BISON"; then
5502   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5503else
5504   AC_MSG_CHECKING([the bison version])
5505   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5506    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5507    # Accept newer than 1.875 or older(equal) than 1.75
5508    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5509       if test "$_bison_version" = "1.875" ; then
5510          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5511          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5512       else
5513          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5514       fi
5515    else
5516       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5517    fi
5518fi
5519AC_PATH_PROG(FLEX, flex)
5520if test -z "$FLEX"; then
5521   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5522fi
5523dnl ***************************************
5524dnl testing that patch exists
5525dnl ***************************************
5526AC_PATH_PROG(PATCH, patch)
5527if test -z "$PATCH"; then
5528   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5529fi
5530
5531dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5532if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5533   if test -z "$with_gnu_patch"; then
5534      GNUPATCH=$PATCH
5535   else
5536      if test -x "$with_gnu_patch"; then
5537	      GNUPATCH=$with_gnu_patch
5538      else
5539         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5540      fi
5541   fi
5542
5543   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5544   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5545	   AC_MSG_RESULT([yes])
5546   else
5547      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5548   fi
5549fi
5550
5551dnl We also need to check for --with-gnu-cp
5552
5553if test -z "$with_gnu_cp"; then
5554   # check the place where the good stuff is hidden on Solaris...
5555   if test -x /usr/gnu/bin/cp; then
5556      GNUCP=/usr/gnu/bin/cp
5557   else
5558      AC_PATH_PROGS(GNUCP, gnucp cp)
5559   fi
5560   if test -z $GNUCP; then
5561      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5562   fi
5563else
5564   if test -x "$with_gnu_cp"; then
5565      GNUCP=$with_gnu_cp
5566   else
5567      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5568   fi
5569fi
5570
5571AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5572if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5573   AC_MSG_RESULT([yes])
5574else
5575   AC_MSG_RESULT([no])
5576   GNUCP=''
5577fi
5578
5579if test -z "$GNUCP"; then
5580   if test "$_os" = "SunOS" -o "$_os" = "FreeBSD"; then
5581      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5582   else
5583      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5584   fi
5585fi
5586
5587AC_SUBST(GNUPATCH)
5588AC_SUBST(GNUCP)
5589
5590dnl ***************************************
5591dnl testing bash tools path on Windows
5592dnl ***************************************
5593if test "$_os" = "WINNT"; then
5594    CYGWIN_PATH=""
5595    AC_PATH_PROG(CYGWIN_PATH, bash)
5596    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5597fi
5598if test -z "$CYGWIN_PATH"; then
5599   CYGWIN_PATH="NO_CYGWIN"
5600fi
5601AC_SUBST(CYGWIN_PATH)
5602
5603dnl ***************************************
5604dnl testing ml.exe assembler path
5605dnl ***************************************
5606if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5607  AC_MSG_CHECKING([ml.exe assembler path])
5608  if test -n "$with_asm_home"; then
5609    with_asm_home=`cygpath -u "$with_asm_home"`
5610  fi
5611  if test ! -x "$with_asm_home/ml.exe"; then
5612    AC_PATH_PROG(ML_EXE, ml.exe)
5613    if test -z "$ML_EXE"; then
5614      if test -x "$with_cl_home/bin/ml.exe"; then
5615        with_asm_home=$with_cl_home/bin
5616        AC_MSG_RESULT([found ($with_asm_home)])
5617      else
5618        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5619      fi
5620    else
5621       with_asm_home="ASM_IN_PATH"
5622    fi
5623  fi
5624  AC_MSG_RESULT([$ASM_HOME])
5625else
5626  with_asm_home="NO_ASM_HOME"
5627fi
5628ASM_HOME="$with_asm_home"
5629AC_SUBST(ASM_HOME)
5630
5631dnl ===================================================================
5632dnl testing handle deprecated unzip switch
5633dnl ===================================================================
5634if test -z "$with_zip_home"; then
5635	with_zip_home="$with_unzip_home"
5636fi
5637dnl ===================================================================
5638dnl Zip will be found where you tell me to find it
5639dnl ===================================================================
5640if test -n "$with_zip_home" ; then
5641    if test "$_os" = "WINNT"; then
5642        with_zip_home=`cygpath -u "$with_zip_home"`
5643    fi
5644    ZIP="$with_zip_home/zip"
5645    UNZIP="$with_zip_home/unzip"
5646    ZIP_HOME="$with_zip_home"
5647else
5648    AC_PATH_PROG(ZIP, zip)
5649    AC_PATH_PROG(UNZIP, unzip)
5650    ZIP_HOME=`dirname "$ZIP"`
5651fi
5652dnl ===================================================================
5653dnl Zip must be available or else it is an error, all platforms
5654dnl ===================================================================
5655if test -z "$ZIP" -o -z "$UNZIP"; then
5656    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5657fi
5658
5659dnl ===================================================================
5660dnl Zip must be a specific type for different build types.
5661dnl ===================================================================
5662if test "$_os" = "WINNT"; then
5663    if test -n "`$ZIP -h | grep -i WinNT`" ; then
5664AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5665    fi
5666fi
5667AC_SUBST(ZIP_HOME)
5668
5669dnl ===================================================================
5670dnl Windows builds need dbghelp.dll in external/dbghelp/
5671dnl ===================================================================
5672if test "$_os" = "WINNT"; then
5673   AC_MSG_CHECKING([for dbghelp.dll])
5674   if test -x ./external/dbghelp/dbghelp.dll; then
5675      AC_MSG_RESULT([found and executable])
5676   else
5677      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5678Get it from the Microsoft site and put it into external/dbghelp.
5679(Note: Microsoft seems to enjoy changing the exact location of this file. You
5680may have to search Microsoft's website.) Last time it was seen at:
5681<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5682   fi
5683fi
5684
5685dnl ===================================================================
5686dnl Windows builds - use oowintool to copy CRT dlls and manifest
5687dnl ===================================================================
5688if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5689       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5690          :
5691       else
5692          AC_MSG_ERROR([oowintool failed to copy CRT])
5693       fi
5694fi
5695
5696dnl ===================================================================
5697dnl Windows builds need gdiplus.dll in external/gdiplus/
5698dnl ===================================================================
5699if test "$_os" = "WINNT"; then
5700   AC_MSG_CHECKING([for gdiplus.dll])
5701   if test -x ./external/gdiplus/gdiplus.dll; then
5702      AC_MSG_RESULT([found and executable])
5703   else
5704      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5705Get it from the Microsoft site and put it into external/gdiplus.
5706You may have to search Microsoft's website. Last time it was seen at:
5707<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5708   fi
5709fi
5710
5711dnl ===================================================================
5712dnl Test which vclplugs have to be built.
5713dnl ===================================================================
5714AC_MSG_CHECKING([which VCLplugs shall be built])
5715ENABLE_GTK=""
5716if test "x$enable_gtk" = "xyes"; then
5717    ENABLE_GTK="TRUE"
5718    R="gtk"
5719fi
5720AC_SUBST(ENABLE_GTK)
5721
5722ENABLE_KDE=""
5723if test "x$enable_kde" = "xyes"; then
5724    ENABLE_KDE="TRUE"
5725    R="$R kde"
5726fi
5727AC_SUBST(ENABLE_KDE)
5728
5729ENABLE_KDE4=""
5730if test "x$enable_kde4" = "xyes"; then
5731    ENABLE_KDE4="TRUE"
5732    R="$R kde4"
5733fi
5734AC_SUBST(ENABLE_KDE4)
5735
5736if test -z "$R"; then
5737	AC_MSG_RESULT([none])
5738else
5739	AC_MSG_RESULT([$R])
5740fi
5741
5742dnl ===================================================================
5743dnl GCONF check
5744dnl ===================================================================
5745
5746ENABLE_GCONF=""
5747AC_MSG_CHECKING([whether to enable GConf support])
5748if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5749    ENABLE_GCONF="TRUE"
5750    AC_MSG_RESULT([yes])
5751    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5752else
5753    AC_MSG_RESULT([no])
5754fi
5755AC_SUBST(ENABLE_GCONF)
5756
5757dnl ===================================================================
5758dnl Gnome VFS check
5759dnl ===================================================================
5760
5761ENABLE_GNOMEVFS=""
5762AC_MSG_CHECKING([whether to enable GNOME VFS support])
5763if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5764    ENABLE_GNOMEVFS="TRUE"
5765    AC_MSG_RESULT([yes])
5766    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5767    if test "$ENABLE_GCONF" != "TRUE"; then
5768        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5769    fi
5770else
5771    AC_MSG_RESULT([no])
5772fi
5773AC_SUBST(ENABLE_GNOMEVFS)
5774
5775dnl ===================================================================
5776dnl Check whether the gtk 2.0 libraries are available.
5777dnl ===================================================================
5778
5779GTK_CFLAGS=""
5780GTK_LIBS=""
5781ENABLE_SYSTRAY_GTK=""
5782ENABLE_DBUS=""
5783if test  "$test_gtk" = "yes"; then
5784
5785   if test "$ENABLE_GTK" = "TRUE" ; then
5786      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]))
5787      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]))
5788      BUILD_TYPE="$BUILD_TYPE GTK"
5789
5790      if test "x$enable_systray" = "xyes"; then
5791         ENABLE_SYSTRAY_GTK="TRUE"
5792         BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"
5793      fi
5794
5795      AC_MSG_CHECKING([whether to enable DBUS support])
5796      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5797          ENABLE_DBUS="TRUE"
5798          AC_MSG_RESULT([yes])
5799          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5800      else
5801          AC_MSG_RESULT([no])
5802      fi
5803
5804      AC_MSG_CHECKING([whether to enable GIO support])
5805      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5806          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5807             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5808          fi
5809          ENABLE_GIO="TRUE"
5810          AC_MSG_RESULT([yes])
5811          PKG_CHECK_MODULES( GIO, gio-2.0 )
5812      else
5813          AC_MSG_RESULT([no])
5814      fi
5815
5816   fi
5817
5818fi
5819AC_SUBST(ENABLE_GIO)
5820AC_SUBST(ENABLE_DBUS)
5821AC_SUBST(ENABLE_SYSTRAY_GTK)
5822AC_SUBST(GTK_CFLAGS)
5823AC_SUBST(GTK_LIBS)
5824AC_SUBST(GTHREAD_CFLAGS)
5825AC_SUBST(GTHREAD_LIBS)
5826
5827dnl ===================================================================
5828dnl Check whether the GStreamer libraries are available.
5829dnl ===================================================================
5830
5831GSTREAMER_CFLAGS=""
5832GSTREAMER_LIBS=""
5833ENABLE_GSTREAMER=""
5834
5835if test "$test_gstreamer" = "yes"; then
5836    AC_MSG_CHECKING([whether to build the GStreamer media backend])
5837    if test "x$enable_gstreamer" != "xno" ; then
5838        PKG_CHECK_MODULES( GSTREAMER, gtk+-2.0 >= 2.4 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 ,,AC_MSG_ERROR([requirements to build the GStreamer media backend not met. Use --disable-gstreamer or install the missing packages]))
5839        ENABLE_GSTREAMER="TRUE"
5840        AC_MSG_RESULT([yes])
5841    else
5842        AC_MSG_RESULT([no])
5843    fi
5844fi
5845AC_SUBST(ENABLE_GSTREAMER)
5846AC_SUBST(GSTREAMER_CFLAGS)
5847AC_SUBST(GSTREAMER_LIBS)
5848
5849
5850dnl ===================================================================
5851dnl Check whether the Cairo libraries are available.
5852dnl ===================================================================
5853
5854ENABLE_CAIRO=""
5855BUILD_PIXMAN=""
5856SYSTEM_CAIRO=""
5857
5858if test  "$test_cairo" = "yes"; then
5859
5860    AC_MSG_CHECKING([whether to use cairo])
5861    if test "x$enable_cairo" != "xno" ; then
5862        ENABLE_CAIRO="TRUE"
5863	AC_MSG_RESULT([yes])
5864        AC_MSG_CHECKING([which cairo to use])
5865        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
5866           test "$with_system_cairo" != "no"; then
5867           AC_MSG_RESULT([external])
5868           SYSTEM_CAIRO=YES
5869
5870           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
5871	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
5872	      AC_MSG_ERROR([Cairo library requires fontconfig.])
5873	   fi
5874           if test "$with_system_xrender_headers" = "yes"; then
5875              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
5876              AC_TRY_RUN([
5877#include <X11/extensions/Xrender.h>
5878
5879int main(int argc, char **argv) {
5880#ifdef PictStandardA8
5881      return 0;
5882#else
5883      return 1;
5884#endif
5885}
5886               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
5887           fi
5888        else
5889           BUILD_TYPE="$BUILD_TYPE CAIRO"
5890	   dnl === compiler fails on pixman with 64bit architectures...===
5891	   if test "$build_cpu" != "x86_64"; then
5892	      BUILD_PIXMAN=YES
5893	   fi
5894           AC_MSG_RESULT([internal])
5895        fi
5896    else
5897	   AC_MSG_RESULT([no])
5898    fi
5899fi
5900
5901AC_SUBST(ENABLE_CAIRO)
5902AC_SUBST(BUILD_PIXMAN)
5903AC_SUBST(SYSTEM_CAIRO)
5904AC_SUBST(CAIRO_CFLAGS)
5905AC_SUBST(CAIRO_LIBS)
5906
5907ENABLE_CAIRO_CANVAS="FALSE"
5908if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
5909   ENABLE_CAIRO_CANVAS="TRUE"
5910fi
5911AC_SUBST(ENABLE_CAIRO_CANVAS)
5912
5913dnl ===================================================================
5914dnl Check whether the librsvg libraries are available.
5915dnl ===================================================================
5916
5917ENABLE_LIBRSVG=""
5918LIBRSVG_CFLAGS=""
5919LIBRSVG_LIBS=""
5920
5921if test  "$test_librsvg" = "yes"; then
5922    AC_MSG_CHECKING([whether to use librsvg])
5923    if test "x$enable_librsvg" != "xno" ; then
5924        PKG_CHECK_MODULES( LIBRSVG, librsvg-2.0 >= 2.14,,AC_MSG_ERROR([requirements to build with librsvg support not met. Use --disable-librsvg or install the missing packages]))
5925        ENABLE_LIBRSVG="TRUE"
5926        AC_MSG_RESULT([yes])
5927    else
5928        AC_MSG_RESULT([no])
5929    fi
5930fi
5931
5932AC_SUBST(ENABLE_LIBRSVG)
5933AC_SUBST(LIBRSVG_CFLAGS)
5934AC_SUBST(LIBRSVG_LIBS)
5935
5936dnl ===================================================================
5937dnl Check whether the OpenGL libraries are available
5938dnl ===================================================================
5939
5940AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
5941ENABLE_OPENGL=
5942
5943if test "x$enable_opengl" != "xno" ; then
5944   AC_MSG_RESULT([yes])
5945   AC_CHECK_HEADER(GL/gl.h, [],
5946                   [AC_MSG_ERROR([OpenGL headers not found])], [])
5947   AC_CHECK_LIB(GL, main, [],
5948     [AC_MSG_ERROR(libGL not installed or functional)], [])
5949   AC_CHECK_LIB(GLU, main, [],
5950     [AC_MSG_ERROR(libGLU not installed or functional)], [])
5951   ENABLE_OPENGL=TRUE
5952else
5953   AC_MSG_RESULT([no])
5954fi
5955
5956AC_SUBST(ENABLE_OPENGL)
5957
5958AC_MSG_CHECKING([whether to build extra presenter ui])
5959if test -n "$enable_presenter_extra_ui" -a "$enable_presenter_extra_ui" != "no"; then
5960   AC_MSG_RESULT([yes])
5961   ENABLE_PRESENTER_EXTRA_UI=YES
5962else
5963   AC_MSG_RESULT([no])
5964   ENABLE_PRESENTER_EXTRA_UI=NO
5965fi
5966AC_SUBST(ENABLE_PRESENTER_EXTRA_UI)
5967
5968AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
5969if test -n "$enable_minimizer" -a "$enable_minimizer" != "no"; then
5970   AC_MSG_RESULT([yes])
5971   ENABLE_MINIMIZER=YES
5972else
5973   AC_MSG_RESULT([no])
5974   ENABLE_MINIMIZER=NO
5975fi
5976AC_SUBST(ENABLE_MINIMIZER)
5977
5978AC_MSG_CHECKING([whether to build the Presenter Screen extension])
5979if test -n "$enable_presenter_console" -a "$enable_presenter_screen" != "no"; then
5980   AC_MSG_RESULT([yes])
5981   ENABLE_PRESENTER_SCREEN=YES
5982else
5983   AC_MSG_RESULT([no])
5984   ENABLE_PRESENTER_SCREEN=NO
5985fi
5986AC_SUBST(ENABLE_PRESENTER_SCREEN)
5987
5988AC_MSG_CHECKING([whether to build the PDF Import extension])
5989if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
5990  AC_MSG_RESULT([yes])
5991  ENABLE_PDFIMPORT=YES
5992
5993  dnl ===================================================================
5994  dnl Check for system poppler
5995  dnl ===================================================================
5996  AC_MSG_CHECKING([which pdf backend to use])
5997  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
5998       test "$with_system_poppler" != "no"; then
5999      AC_MSG_RESULT([external])
6000      SYSTEM_POPPLER=YES
6001      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6002  else
6003      AC_MSG_RESULT([internal])
6004      SYSTEM_POPPLER=NO
6005      BUILD_TYPE="$BUILD_TYPE XPDF"
6006      AC_MSG_CHECKING([for xpdf module])
6007      if test -d ./xpdf; then
6008       AC_MSG_RESULT([OK])
6009      else
6010        AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6011      fi
6012  fi
6013else
6014   AC_MSG_RESULT([no])
6015   ENABLE_PDFIMPORT=NO
6016fi
6017AC_SUBST(ENABLE_PDFIMPORT)
6018AC_SUBST(SYSTEM_POPPLER)
6019AC_SUBST(POPPLER_CFLAGS)
6020AC_SUBST(POPPLER_LIBS)
6021
6022if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
6023  AC_MSG_CHECKING([for sdext module])
6024  if test -d ./sdext; then
6025   AC_MSG_RESULT([OK])
6026  else
6027   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6028  fi
6029  BUILD_TYPE="$BUILD_TYPE SDEXT"
6030fi
6031
6032AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6033if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6034  AC_MSG_RESULT([yes])
6035  AC_MSG_CHECKING([for swext module])
6036  if test -d ./swext; then
6037   AC_MSG_RESULT([OK])
6038  else
6039   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6040  fi
6041  ENABLE_MEDIAWIKI=YES
6042  BUILD_TYPE="$BUILD_TYPE SWEXT"
6043else
6044  AC_MSG_RESULT([no])
6045  ENABLE_MEDIAWIKI=NO
6046fi
6047AC_SUBST(ENABLE_MEDIAWIKI)
6048
6049if test "$ENABLE_MEDIAWIKI" = "YES"; then
6050  AC_MSG_CHECKING([which Servlet API Jar to use])
6051  if test -n "$with_system_servlet_api"; then
6052    AC_MSG_RESULT([external])
6053    SYSTEM_SERVLETAPI=YES
6054      if test -z "$SERVLETAPI_JAR"; then
6055	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6056      fi
6057      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6058             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6059  else
6060    AC_MSG_RESULT([internal])
6061    SYSTEM_SERVLETAPI=NO
6062    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6063  fi
6064fi
6065AC_SUBST(SYSTEM_SERVLETAPI)
6066AC_SUBST(SERVLETAPI_JAR)
6067
6068AC_MSG_CHECKING([whether to build the Report Builder extension])
6069if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6070  AC_MSG_RESULT([yes])
6071  ENABLE_REPORTBUILDER=YES
6072  AC_MSG_CHECKING([for reportbuilder module])
6073  if test -d ./reportbuilder; then
6074    AC_MSG_RESULT([OK])
6075  else
6076    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6077  fi
6078  AC_MSG_CHECKING([which jfreereport libs to use])
6079  if test "$with_system_jfreereport" = "yes"; then
6080      SYSTEM_JFREEREPORT=YES
6081      AC_MSG_RESULT([external])
6082      if test -z $SAC_JAR; then
6083             SAC_JAR=/usr/share/java/sac.jar
6084      fi
6085      AC_CHECK_FILE($SAC_JAR, [],
6086             [AC_MSG_ERROR(sac.jar not found.)], [])
6087
6088      if test -z $LIBXML_JAR; then
6089        AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6090          [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6091          [
6092            AC_CHECK_FILE(/usr/share/java/libxml.jar,
6093              [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6094              [AC_MSG_ERROR(libxml.jar replacement not found.)]
6095            )
6096          ]
6097        )
6098      else
6099        AC_CHECK_FILE($LIBXML_JAR, [],
6100             [AC_MSG_ERROR(libxml.jar not found.)], [])
6101      fi
6102
6103      if test -z $FLUTE_JAR; then
6104        AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6105          [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6106          [
6107            AC_CHECK_FILE(/usr/share/java/flute.jar,
6108              [ FLUTE_JAR=/usr/share/java/flute.jar ],
6109              [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6110            )
6111          ]
6112        )
6113      else
6114        AC_CHECK_FILE($FLUTE_JAR, [],
6115             [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6116      fi
6117
6118      if test -z $JFREEREPORT_JAR; then
6119        AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6120          [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6121          [
6122            AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6123              [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6124              [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6125            )
6126          ]
6127        )
6128      else
6129        AC_CHECK_FILE($JFREEREPORT_JAR, [],
6130             [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6131      fi
6132
6133      if test -z $LIBLAYOUT_JAR; then
6134        AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6135          [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6136          [
6137            AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6138              [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6139              [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6140            )
6141          ]
6142        )
6143      else
6144        AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6145             [AC_MSG_ERROR(liblayout.jar not found.)], [])
6146      fi
6147
6148      if test -z $LIBLOADER_JAR; then
6149        AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6150          [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6151          [
6152            AC_CHECK_FILE(/usr/share/java/libloader.jar,
6153              [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6154              [AC_MSG_ERROR(libloader.jar replacement not found.)]
6155            )
6156          ]
6157        )
6158      else
6159        AC_CHECK_FILE($LIBLOADER_JAR, [],
6160             [AC_MSG_ERROR(libloader.jar not found.)], [])
6161      fi
6162
6163      if test -z $LIBFORMULA_JAR; then
6164        AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6165          [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6166          [
6167            AC_CHECK_FILE(/usr/share/java/libformula.jar,
6168              [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6169              [AC_MSG_ERROR(libformula.jar replacement not found.)]
6170            )
6171          ]
6172        )
6173      else
6174        AC_CHECK_FILE($LIBFORMULA_JAR, [],
6175             [AC_MSG_ERROR(libformula.jar not found.)], [])
6176      fi
6177
6178      if test -z $LIBREPOSITORY_JAR; then
6179        AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6180          [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6181          [
6182            AC_CHECK_FILE(/usr/share/java/librepository.jar,
6183              [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6184              [AC_MSG_ERROR(librepository.jar replacement not found.)]
6185            )
6186          ]
6187        )
6188      else
6189        AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6190             [AC_MSG_ERROR(librepository.jar not found.)], [])
6191      fi
6192
6193      if test -z $LIBFONTS_JAR; then
6194        AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6195          [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6196          [
6197            AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6198              [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6199              [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6200            )
6201          ]
6202        )
6203      else
6204        AC_CHECK_FILE($LIBFONTS_JAR, [],
6205             [AC_MSG_ERROR(libfonts.jar not found.)], [])
6206      fi
6207
6208      if test -z $LIBSERIALIZER_JAR; then
6209        AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6210          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6211          [
6212            AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6213              [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6214              [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6215            )
6216          ]
6217        )
6218      else
6219        AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6220             [AC_MSG_ERROR(libserializer.jar not found.)], [])
6221      fi
6222
6223
6224      if test -z $LIBBASE_JAR; then
6225        AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6226          [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6227          [
6228            AC_CHECK_FILE(/usr/share/java/libbase.jar,
6229              [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6230              [AC_MSG_ERROR(libbase.jar replacement not found.)]
6231            )
6232          ]
6233        )
6234      else
6235        AC_CHECK_FILE($LIBBASE_JAR, [],
6236             [AC_MSG_ERROR(libbase.jar not found.)], [])
6237      fi
6238
6239  else
6240     AC_MSG_RESULT([internal])
6241     AC_MSG_CHECKING([for jfreereport module])
6242     if test -d ./jfreereport; then
6243      AC_MSG_RESULT([OK])
6244     else
6245      AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6246     fi
6247     SYSTEM_JFREEREPORT=NO
6248     BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
6249  fi
6250  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6251else
6252  AC_MSG_RESULT([no])
6253  ENABLE_REPORTBUILDER=NO
6254  SYSTEM_JFREEREPORT=NO
6255fi
6256AC_SUBST(ENABLE_REPORTBUILDER)
6257AC_SUBST(SYSTEM_JFREEREPORT)
6258AC_SUBST(SAC_JAR)
6259AC_SUBST(LIBXML_JAR)
6260AC_SUBST(FLUTE_JAR)
6261AC_SUBST(JFREEREPORT_JAR)
6262AC_SUBST(LIBBASE_JAR)
6263AC_SUBST(LIBLAYOUT_JAR)
6264AC_SUBST(LIBLOADER_JAR)
6265AC_SUBST(LIBFORMULA_JAR)
6266AC_SUBST(LIBREPOSITORY_JAR)
6267AC_SUBST(LIBFONTS_JAR)
6268AC_SUBST(LIBSERIALIZER_JAR)
6269
6270# this has to be here because both the wiki publisher and the SRB use
6271# commons-logging
6272if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6273  AC_MSG_CHECKING([which Apache commons-* libs to use])
6274  if test "$with_system_apache_commons" = "yes"; then
6275    SYSTEM_APACHE_COMMONS=YES
6276    AC_MSG_RESULT([external])
6277    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6278      if test -z $COMMONS_CODEC_JAR; then
6279        AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
6280          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
6281          [
6282            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6283              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6284              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6285            )
6286          ]
6287        )
6288      else
6289        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6290             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6291      fi
6292
6293      if test -z $COMMONS_LANG_JAR; then
6294        AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
6295          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
6296          [
6297            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6298              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6299              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6300            )
6301          ]
6302        )
6303      else
6304        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6305             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6306      fi
6307
6308      if test -z $COMMONS_HTTPCLIENT_JAR; then
6309        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6310          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6311          [
6312            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6313              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6314              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6315            )
6316          ]
6317        )
6318      else
6319        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6320             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6321      fi
6322    fi
6323    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6324      if test -z $COMMONS_LOGGING_JAR; then
6325        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
6326          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
6327          [
6328            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6329              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6330              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6331            )
6332          ]
6333        )
6334      else
6335        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6336             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6337      fi
6338    fi
6339  else
6340    AC_MSG_RESULT([internal])
6341    SYSTEM_APACHE_COMMONS=NO
6342    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6343  fi
6344fi
6345AC_SUBST(SYSTEM_APACHE_COMMONS)
6346AC_SUBST(COMMONS_CODEC_JAR)
6347AC_SUBST(COMMONS_LANG_JAR)
6348AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6349AC_SUBST(COMMONS_LOGGING_JAR)
6350
6351dnl ===================================================================
6352dnl Check whether the Qt and KDE libraries are available.
6353dnl ===================================================================
6354
6355KDE_CFLAGS=""
6356KDE_LIBS=""
6357MOC="moc"
6358if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6359    dnl Search paths for Qt and KDE
6360    if test "$build_cpu" != "x86_64" ; then
6361        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 $x_includes"
6362        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 $x_libraries"
6363    else
6364        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 $x_includes"
6365        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 $x_libraries"
6366    fi
6367    if test -n "$QTDIR" ; then
6368        qt_incdirs="$QTDIR/include $qt_incdirs"
6369        if test "$build_cpu" != "x86_64" ; then
6370            qt_libdirs="$QTDIR/lib $qt_libdirs"
6371        else
6372            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6373        fi
6374    fi
6375    if test "$build_cpu" != "x86_64" ; then
6376        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"
6377        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"
6378    else
6379        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"
6380        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"
6381    fi
6382    if test -n "$KDEDIR" ; then
6383        kde_incdirs="$KDEDIR/include $kde_incdirs"
6384        if test "$build_cpu" != "x86_64" ; then
6385            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6386        else
6387            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6388        fi
6389    fi
6390
6391    dnl What to test
6392    qt_test_include="qstyle.h"
6393    qt_test_library="libqt-mt.so"
6394    kde_test_include="ksharedptr.h"
6395    kde_test_library="libkdeui.so"
6396
6397    dnl Check for Qt headers
6398    AC_MSG_CHECKING([for Qt headers])
6399    qt_incdir="no"
6400    for kde_check in $qt_incdirs ; do
6401        if test -r "$kde_check/$qt_test_include" ; then
6402            qt_incdir="$kde_check"
6403            break
6404        fi
6405    done
6406    AC_MSG_RESULT([$qt_incdir])
6407    if test "x$qt_incdir" = "xno" ; then
6408        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6409your Qt installation by exporting QTDIR before running "configure".])
6410    fi
6411
6412    dnl Check for Qt libraries
6413    AC_MSG_CHECKING([for Qt libraries])
6414    qt_libdir="no"
6415    for qt_check in $qt_libdirs ; do
6416        if test -r "$qt_check/$qt_test_library" ; then
6417            qt_libdir="$qt_check"
6418            break
6419        fi
6420    done
6421    AC_MSG_RESULT([$qt_libdir])
6422    if test "x$qt_libdir" = "xno" ; then
6423        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6424your Qt installation by exporting QTDIR before running "configure".])
6425    fi
6426
6427    dnl Check for Meta Object Compiler
6428    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6429    if test "$MOC" = "no" ; then
6430        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6431the root of your Qt installation by exporting QTDIR before running "configure".])
6432    fi
6433
6434    dnl Check for KDE headers
6435    AC_MSG_CHECKING([for KDE headers])
6436    kde_incdir="no"
6437    for kde_check in $kde_incdirs ; do
6438        if test -r "$kde_check/$kde_test_include" ; then
6439            kde_incdir="$kde_check"
6440            break
6441        fi
6442    done
6443    AC_MSG_RESULT([$kde_incdir])
6444    if test "x$kde_incdir" = "xno" ; then
6445        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6446your KDE installation by exporting KDEDIR before running "configure".])
6447    fi
6448
6449    dnl Check for KDE libraries
6450    AC_MSG_CHECKING([for KDE libraries])
6451    kde_libdir="no"
6452    for kde_check in $kde_libdirs ; do
6453        if test -r "$kde_check/$kde_test_library" ; then
6454            kde_libdir="$kde_check"
6455            break
6456        fi
6457    done
6458    AC_MSG_RESULT([$kde_libdir])
6459    if test "x$kde_libdir" = "xno" ; then
6460        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6461your KDE installation by exporting KDEDIR before running "configure".])
6462    fi
6463
6464    dnl Set the variables
6465    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6466    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6467fi
6468AC_SUBST(KDE_CFLAGS)
6469AC_SUBST(KDE_LIBS)
6470AC_SUBST(MOC)
6471
6472dnl ===================================================================
6473dnl KDE4 Integration
6474dnl ===================================================================
6475
6476KDE4_CFLAGS=""
6477KDE4_LIBS=""
6478MOC4="moc"
6479if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6480   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6481   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6482
6483   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6484   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6485
6486   if test "$build_cpu" = "x86_64" ; then
6487      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6488      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6489   fi
6490
6491   if test -n "$KDE4DIR" ; then
6492      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6493      if test "$build_cpu" != "x86_64" ; then
6494         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6495      else
6496         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6497      fi
6498   fi
6499
6500   qt_test_include="Qt/qobject.h"
6501   qt_test_library="libQtCore.so"
6502   kde_test_include="ksharedptr.h"
6503   kde_test_library="libkdeui.so"
6504
6505   AC_MSG_CHECKING([for Qt4 headers])
6506   qt_header_dir="no"
6507   for inc_dir in $qt_incdirs ; do
6508      if test -r "$inc_dir/$qt_test_include" ; then
6509         qt_header_dir="$inc_dir"
6510         break
6511      fi
6512   done
6513
6514   AC_MSG_RESULT([$qt_header_dir])
6515   if test "x$qt_header_dir" = "xno" ; then
6516      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6517   fi
6518
6519   AC_MSG_CHECKING([for Qt4 libraries])
6520   qt_lib_dir="no"
6521   for lib_dir in $qt_libdirs ; do
6522      if test -r "$lib_dir/$qt_test_library" ; then
6523         qt_lib_dir="$lib_dir"
6524         break
6525      fi
6526   done
6527
6528   AC_MSG_RESULT([$qt_lib_dir])
6529
6530   if test "x$qt_lib_dir" = "xno" ; then
6531      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6532   fi
6533
6534   dnl Check for Meta Object Compiler
6535   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6536   MOC4="$MOCQT4"
6537   if test "$MOC4" = "no" ; then
6538      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6539      if test "$MOC4" = "no" ; then
6540         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6541      fi
6542   fi
6543
6544   dnl Check for KDE4 headers
6545   AC_MSG_CHECKING([for KDE4 headers])
6546   kde_incdir="no"
6547   for kde_check in $kde_incdirs ; do
6548      if test -r "$kde_check/$kde_test_include" ; then
6549         kde_incdir="$kde_check"
6550         break
6551      fi
6552   done
6553   AC_MSG_RESULT([$kde_incdir])
6554   if test "x$kde_incdir" = "xno" ; then
6555      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6556   fi
6557
6558   dnl Check for KDE4 libraries
6559   AC_MSG_CHECKING([for KDE4 libraries])
6560   kde_libdir="no"
6561   for kde_check in $kde_libdirs ; do
6562      if test -r "$kde_check/$kde_test_library" ; then
6563         kde_libdir="$kde_check"
6564         break
6565      fi
6566   done
6567
6568   AC_MSG_RESULT([$kde_libdir])
6569   if test "x$kde_libdir" = "xno" ; then
6570      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6571   fi
6572
6573   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6574   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6575fi
6576AC_SUBST(KDE4_CFLAGS)
6577AC_SUBST(KDE4_LIBS)
6578AC_SUBST(MOC4)
6579
6580dnl ===================================================================
6581dnl Test for the enabling the lockdown pieces
6582dnl ===================================================================
6583AC_MSG_CHECKING([whether to enable the lockdown pieces])
6584ENABLE_LOCKDOWN=""
6585if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6586  ENABLE_LOCKDOWN=YES
6587  AC_MSG_RESULT([yes])
6588else
6589  AC_MSG_RESULT([no])
6590fi
6591AC_SUBST(ENABLE_LOCKDOWN)
6592
6593dnl ===================================================================
6594dnl Test whether to include Evolution 2 support
6595dnl ===================================================================
6596AC_MSG_CHECKING([whether to enable evolution 2 support])
6597if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6598   AC_MSG_RESULT([yes])
6599   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6600   ENABLE_EVOAB2="TRUE"
6601else
6602   ENABLE_EVOAB2=""
6603   AC_MSG_RESULT([no])
6604fi
6605AC_SUBST(ENABLE_EVOAB2)
6606AC_SUBST(GOBJECT_CFLAGS)
6607AC_SUBST(GOBJECT_LIBS)
6608
6609dnl ===================================================================
6610dnl Test whether to include KDE AB support
6611dnl ===================================================================
6612AC_MSG_CHECKING([whether to enable KDE address book support])
6613if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6614   AC_MSG_RESULT([yes])
6615   AC_LANG_PUSH([C++])
6616   save_CXXFLAGS=$CXXFLAGS
6617   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6618   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6619       AC_TRY_RUN([
6620#include <kdeversion.h>
6621
6622int main(int argc, char **argv) {
6623       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6624       else return 1;
6625}
6626       ], [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])])
6627   CXXFLAGS=$save_CXXFLAGS
6628   AC_LANG_POP([C++])
6629   ENABLE_KAB=TRUE
6630else
6631   AC_MSG_RESULT([no])
6632   ENABLE_KAB=
6633fi
6634AC_SUBST(ENABLE_KAB)
6635
6636dnl ===================================================================
6637dnl Test whether to include MathMLDTD
6638dnl ===================================================================
6639AC_MSG_CHECKING([whether to include MathMLDTD])
6640if test -n "$enable_mathmldtd"; then
6641  if test "$enable_mathmldtd" = "no"; then
6642    AC_MSG_RESULT([no])
6643    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6644  else
6645    AC_MSG_RESULT([yes])
6646    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6647  fi
6648else
6649  AC_MSG_RESULT([no])
6650  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6651fi
6652
6653dnl ===================================================================
6654dnl Test whether to include fonts
6655dnl ===================================================================
6656AC_MSG_CHECKING([whether to include third-party fonts])
6657if test "$with_fonts" != "no" ; then
6658  AC_MSG_RESULT([yes])
6659  WITH_FONTS=YES
6660  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6661else
6662  AC_MSG_RESULT([no])
6663  WITH_FONTS=NO
6664  SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
6665fi
6666AC_SUBST(WITH_FONTS)
6667
6668dnl ===================================================================
6669dnl Test whether to include ppds
6670dnl ===================================================================
6671AC_MSG_CHECKING([whether to include PPDs])
6672if test "$with_ppds" != "no"; then
6673  AC_MSG_RESULT([yes])
6674else
6675  AC_MSG_RESULT([no])
6676  WITHOUT_PPDS=YES
6677  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6678fi
6679AC_SUBST(WITHOUT_PPDS)
6680
6681dnl ===================================================================
6682dnl Test whether to include afms
6683dnl ===================================================================
6684AC_MSG_CHECKING([whether to include AFMs])
6685if test "$with_afms" != "no"; then
6686  AC_MSG_RESULT([yes])
6687  BUILD_TYPE="$BUILD_TYPE AFMS"
6688else
6689  AC_MSG_RESULT([no])
6690  WITHOUT_AFMS=YES
6691  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6692fi
6693AC_SUBST(WITHOUT_AFMS)
6694
6695AC_SUBST(SCPDEFS)
6696
6697AC_MSG_CHECKING([whether and how to use Xinerama])
6698if test "$_os" = "Darwin"; then
6699   USE_XINERAMA=YES
6700   XINERAMA_LINK=dynamic
6701   AC_MSG_RESULT([yes])
6702elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6703   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6704      # we have both versions, let the user decide but use the dynamic one
6705      # per default
6706      USE_XINERAMA=YES
6707      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6708         XINERAMA_LINK=dynamic
6709      else
6710         XINERAMA_LINK=static
6711      fi
6712   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6713      # we have only the dynamic version
6714      USE_XINERAMA=YES
6715      XINERAMA_LINK=dynamic
6716   elif test -e "$XLIB/libXinerama.a"; then
6717      # static version
6718      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6719         USE_XINERAMA=YES
6720         XINERAMA_LINK=static
6721      else
6722         USE_XINERAMA=NO
6723         XINERAMA_LINK=none
6724      fi
6725   else
6726      # no Xinerama
6727      USE_XINERAMA=NO
6728      XINERAMA_LINK=none
6729   fi
6730   if test "$USE_XINERAMA" = "YES"; then
6731      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6732      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6733          [AC_MSG_ERROR(Xinerama header not found.)], [])
6734      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6735      if test "$_os" = "FreeBSD"; then
6736          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6737      fi
6738      if test "$_os" = "Linux"; then
6739          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6740      fi
6741      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6742          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6743   else
6744      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6745   fi
6746else
6747   AC_MSG_RESULT([no])
6748fi
6749AC_SUBST(USE_XINERAMA)
6750AC_SUBST(XINERAMA_LINK)
6751
6752if test "$ENABLE_LIBRSVG" = "TRUE"
6753then
6754dnl ===================================================================
6755dnl Test whether to build librsvg or rely on the system version
6756dnl ===================================================================
6757AC_MSG_CHECKING([whether to build own version of librsvg])
6758
6759case "$_os" in
6760	WINNT*) # Windows
6761	    SYSTEM_LIBRSVG=NO
6762	    AC_MSG_RESULT([yes])
6763		;;
6764	Darwin*)
6765	    SYSTEM_LIBRSVG=NO
6766	    AC_MSG_RESULT([yes])
6767	    ;;
6768   *)
6769   SYSTEM_LIBRSVG=YES
6770   AC_MSG_RESULT([no])
6771   ;;
6772esac
6773AC_SUBST(SYSTEM_LIBRSVG)
6774
6775dnl ===================================================================
6776dnl Test whether to build gdk-pixbuf or rely on the system version
6777dnl ===================================================================
6778AC_MSG_CHECKING([whether to build own version of gdk-pixbuf])
6779
6780case "$_os" in
6781	WINNT*) # Windows
6782	    SYSTEM_GDKPIXBUF=NO
6783	    AC_MSG_RESULT([yes])
6784		;;
6785	Darwin*)
6786	    SYSTEM_GDKPIXBUF=NO
6787	    AC_MSG_RESULT([yes])
6788	    ;;
6789   *)
6790   SYSTEM_GDKPIXBUF=YES
6791   AC_MSG_RESULT([no])
6792   ;;
6793esac
6794AC_SUBST(SYSTEM_GDKPIXBUF)
6795
6796dnl ===================================================================
6797dnl Test whether to build glib or rely on the system version
6798dnl ===================================================================
6799AC_MSG_CHECKING([whether to build own version of glib])
6800
6801case "$_os" in
6802	WINNT*) # Windows
6803	    SYSTEM_GLIB=NO
6804	    AC_MSG_RESULT([yes])
6805		;;
6806	Darwin*)
6807	    SYSTEM_GLIB=NO
6808	    AC_MSG_RESULT([yes])
6809	    ;;
6810   *)
6811   SYSTEM_GLIB=YES
6812   AC_MSG_RESULT([no])
6813   ;;
6814esac
6815AC_SUBST(SYSTEM_GLIB)
6816
6817dnl ===================================================================
6818dnl Test whether to build gettext or rely on the system version
6819dnl ===================================================================
6820AC_MSG_CHECKING([whether to build own version of gettext])
6821
6822case "$_os" in
6823	WINNT*) # Windows
6824	    SYSTEM_GETTEXT=NO
6825	    AC_MSG_RESULT([yes])
6826		;;
6827	Darwin*)
6828	    SYSTEM_GETTEXT=NO
6829	    AC_MSG_RESULT([yes])
6830	    ;;
6831   *)
6832   SYSTEM_GETTEXT=YES
6833   AC_MSG_RESULT([no])
6834   ;;
6835esac
6836AC_SUBST(SYSTEM_GETTEXT)
6837
6838dnl ===================================================================
6839dnl Test whether to build libcroco or rely on the system version
6840dnl ===================================================================
6841AC_MSG_CHECKING([whether to build own version of libcroco])
6842
6843case "$_os" in
6844	WINNT*) # Windows
6845	    SYSTEM_LIBCROCO=NO
6846	    AC_MSG_RESULT([yes])
6847		;;
6848	Darwin*)
6849	    SYSTEM_LIBCROCO=NO
6850	    AC_MSG_RESULT([yes])
6851	    ;;
6852   *)
6853   SYSTEM_LIBCROCO=YES
6854   AC_MSG_RESULT([no])
6855   ;;
6856esac
6857AC_SUBST(SYSTEM_LIBCROCO)
6858
6859dnl ===================================================================
6860dnl Test whether to build pango or rely on the system version
6861dnl ===================================================================
6862AC_MSG_CHECKING([whether to build own version of pango])
6863
6864case "$_os" in
6865	WINNT*) # Windows
6866	    SYSTEM_PANGO=NO
6867	    AC_MSG_RESULT([yes])
6868		;;
6869	Darwin*)
6870	    SYSTEM_PANGO=NO
6871	    AC_MSG_RESULT([yes])
6872	    ;;
6873   *)
6874   SYSTEM_PANGO=YES
6875   AC_MSG_RESULT([no])
6876   ;;
6877esac
6878AC_SUBST(SYSTEM_PANGO)
6879
6880dnl ===================================================================
6881dnl Test whether to build libgsf or rely on the system version
6882dnl ===================================================================
6883AC_MSG_CHECKING([whether to build own version of libgsf])
6884
6885case "$_os" in
6886	WINNT*) # Windows
6887	    SYSTEM_LIBGSF=NO
6888	    AC_MSG_RESULT([yes])
6889		;;
6890   *)
6891   SYSTEM_LIBGSF=YES
6892   AC_MSG_RESULT([no])
6893   ;;
6894esac
6895AC_SUBST(SYSTEM_LIBGSF)
6896else
6897   SYSTEM_LIBGSF=YES
6898   AC_SUBST(SYSTEM_LIBGSF)
6899   SYSTEM_LIBRSVG=YES
6900   AC_SUBST(SYSTEM_LIBRSVG)
6901   SYSTEM_GDKPIXBUF=YES
6902   AC_SUBST(SYSTEM_GDKPIXBUF)
6903   SYSTEM_GLIB=YES
6904   AC_SUBST(SYSTEM_GLIB)
6905   SYSTEM_GETTEXT=YES
6906   AC_SUBST(SYSTEM_GETTEXT)
6907   SYSTEM_LIBCROCO=YES
6908   AC_SUBST(SYSTEM_LIBCROCO)
6909   SYSTEM_PANGO=YES
6910   AC_SUBST(SYSTEM_PANGO)
6911fi
6912
6913dnl ===================================================================
6914dnl Test whether to build libpng or rely on the system version
6915dnl ===================================================================
6916AC_MSG_CHECKING([whether to build own version of libpng])
6917
6918case "$_os" in
6919	WINNT*) # Windows
6920	    SYSTEM_LIBPNG=NO
6921	    AC_MSG_RESULT([yes])
6922		;;
6923	Darwin*)
6924	    SYSTEM_LIBPNG=NO
6925	    AC_MSG_RESULT([yes])
6926	    ;;
6927   *)
6928   SYSTEM_LIBPNG=YES
6929   AC_MSG_RESULT([no])
6930   ;;
6931esac
6932AC_SUBST(SYSTEM_LIBPNG)
6933
6934dnl ===================================================================
6935dnl Test whether to build libjpeg or rely on the system version
6936dnl ===================================================================
6937dnl FIXME: this is currently because we have jpeg-6b for our filters
6938dnl        and jpeg-8 as dependency for librsvg
6939dnl        this should be unified into using only one version for both
6940
6941AC_MSG_CHECKING([whether to build own version of libjpeg])
6942
6943if test "$SYSTEM_JPEG" == "YES"; then
6944SYSTEM_LIBJPEG=YES
6945else
6946case "$_os" in
6947	WINNT*) # Windows
6948	    SYSTEM_LIBJPEG=NO
6949	    AC_MSG_RESULT([yes])
6950		;;
6951	Darwin*)
6952	    SYSTEM_LIBJPEG=NO
6953	    AC_MSG_RESULT([yes])
6954	    ;;
6955   *)
6956   SYSTEM_LIBJPEG=YES
6957   AC_MSG_RESULT([no])
6958   ;;
6959esac
6960fi
6961
6962if test "$SYSTEM_LIBJPEG" == "YES"; then
6963   AC_MSG_RESULT([no])
6964else
6965   AC_MSG_RESULT([yes])
6966fi
6967AC_SUBST(SYSTEM_LIBJPEG)
6968
6969
6970dnl ===================================================================
6971dnl Test for the presence of Ant and that it works
6972dnl ===================================================================
6973
6974if test "$SOLAR_JAVA" != ""; then
6975ANT_HOME=; export ANT_HOME
6976WITH_ANT_HOME=; export WITH_ANT_HOME
6977if test -z "$with_ant_home"; then
6978   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
6979else
6980   if test "$_os" = "WINNT"; then
6981      with_ant_home=`cygpath -u "$with_ant_home"`
6982   fi
6983   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
6984   WITH_ANT_HOME=$with_ant_home
6985   ANT_HOME=$with_ant_home
6986fi
6987
6988if test -z "$ANT"; then
6989  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
6990else
6991  # resolve relative or absolute symlink
6992  while test -h "$ANT"; do
6993     a_cwd=`pwd`
6994     a_basename=`basename "$ANT"`
6995     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
6996     cd "`dirname "$ANT"`"
6997     cd "`dirname "$a_script"`"
6998     ANT="`pwd`"/"`basename "$a_script"`"
6999     cd "$a_cwd"
7000  done
7001
7002  if test "$_os" = "OS2"; then
7003    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7004    export ANT_HOME
7005  fi
7006
7007  AC_MSG_CHECKING([if $ANT works])
7008cat > conftest.java << EOF
7009    public class conftest {
7010	int testmethod(int a, int b) {
7011            return a + b;
7012	}
7013    }
7014EOF
7015
7016cat > conftest.xml << EOF
7017    <project name="conftest" default="conftest">
7018	<target name="conftest">
7019            <javac srcdir="." includes="conftest.java">
7020	    </javac>
7021	</target>
7022    </project>
7023EOF
7024  oldJAVA_HOME=$JAVA_HOME
7025  if test "$JAVACISGCJ" = "yes"; then
7026    JAVA_HOME=; export JAVA_HOME
7027    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7028  else
7029    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7030  fi
7031  AC_TRY_EVAL(ant_cmd)
7032  if test $? = 0 && test -f ./conftest.class ; then
7033    AC_MSG_RESULT([Ant works])
7034    if test -z "$WITH_ANT_HOME"; then
7035        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7036        if test -z "$ANT_HOME"; then
7037            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7038        fi
7039    else
7040        ANT_HOME="$WITH_ANT_HOME"
7041    fi
7042  else
7043    echo "configure: Ant test failed" >&5
7044    cat conftest.java >&5
7045    cat conftest.xml >&5
7046    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7047    ANT_HOME=""
7048    echo "Ant does not work - Some Java projects will not build!" >>warn
7049  fi
7050  JAVA_HOME=$oldJAVA_HOME
7051  rm -f conftest* core core.* *.core
7052fi
7053if test -z "$ANT_HOME"; then
7054   ANT_HOME="NO_ANT_HOME"
7055fi
7056AC_SUBST(ANT_HOME)
7057
7058dnl Checking for ant.jar
7059if test "$ANT_HOME" != "NO_ANT_HOME"; then
7060   AC_MSG_CHECKING([Ant lib directory])
7061   if test -f $ANT_HOME/lib/ant.jar; then
7062	  ANT_LIB="$ANT_HOME/lib"
7063   else
7064      if test -f $ANT_HOME/ant.jar; then
7065	     ANT_LIB="$ANT_HOME"
7066      else
7067          if test -f /usr/share/java/ant.jar; then
7068              ANT_LIB=/usr/share/java
7069          else
7070             if test -f /usr/share/ant-core/lib/ant.jar; then
7071                 ANT_LIB=/usr/share/ant-core/lib
7072             else
7073                if test -f $ANT_HOME/lib/ant/ant.jar; then
7074                    ANT_LIB="$ANT_HOME/lib/ant"
7075                else
7076                   if test -f /usr/share/lib/ant/ant.jar; then
7077                       ANT_LIB=/usr/share/lib/ant
7078                   else
7079                       AC_MSG_ERROR([Ant libraries not found!])
7080                   fi
7081                fi
7082             fi
7083          fi
7084      fi
7085   fi
7086   AC_MSG_RESULT([Ant lib directory found.])
7087fi
7088AC_SUBST(ANT_LIB)
7089fi
7090
7091ant_minver=1.6.0
7092# update for more extensions...
7093if test "$ENABLE_MEDIAWIKI" = "YES"; then
7094  ant_minver=1.7.0
7095fi
7096ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7097
7098AC_MSG_CHECKING([whether ant is >= $ant_minver])
7099ant_version=`$ANT -version | $AWK '{ print $4; }'`
7100ant_version_major=`echo $ant_version | cut -d. -f1`
7101ant_version_minor=`echo $ant_version | cut -d. -f2`
7102echo "configure: ant_version $ant_version " >&5
7103echo "configure: ant_version_major $ant_version_major " >&5
7104echo "configure: ant_version_minor $ant_version_minor " >&5
7105if test "$ant_version_major" -ge "2"; then
7106   AC_MSG_RESULT([yes, $ant_version])
7107elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7108   AC_MSG_RESULT([yes, $ant_version])
7109else
7110   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7111fi
7112
7113if test "$ENABLE_MEDIAWIKI" = "YES"; then
7114AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7115rm -rf confdir
7116mkdir confdir
7117cat > conftest.java << EOF
7118    public class conftest {
7119        int testmethod(int a, int b) {
7120            return a + b;
7121        }
7122    }
7123EOF
7124
7125cat > conftest.xml << EOF
7126    <project name="conftest" default="conftest">
7127        <target name="conftest" depends="copytest">
7128            <javac srcdir="." includes="conftest.java">
7129            </javac>
7130        </target>
7131        <target name="copytest">
7132             <copy todir="confdir">
7133                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7134                 <filterset/>
7135                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7136             </copy>
7137        </target>
7138    </project>
7139EOF
7140  if test "$JAVACISGCJ" = "yes"; then
7141    JAVA_HOME=; export JAVA_HOME
7142    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7143  else
7144    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7145  fi
7146  AC_TRY_EVAL(ant_cmd)
7147  if test $? = 0 && test -f ./conftest.class ; then
7148    AC_MSG_RESULT([yes])
7149    rm -rf confdir
7150  else
7151    echo "configure: Ant test failed" >&5
7152    cat conftest.java >&5
7153    cat conftest.xml >&5
7154    rm -rf confdir
7155    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7156  fi
7157fi
7158rm -f conftest* core core.* *.core
7159
7160OOO_JUNIT_JAR=
7161if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7162    AC_MSG_CHECKING([for JUnit 4])
7163    if test "$with_junit" == "yes"; then
7164        if test -e /usr/share/java/junit4.jar; then
7165            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7166        else
7167           if test -e /usr/share/lib/java/junit.jar; then
7168              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7169           else
7170              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7171           fi
7172        fi
7173    else
7174        OOO_JUNIT_JAR=$with_junit
7175    fi
7176    if test "$_os" = "WINNT"; then
7177        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7178    fi
7179    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7180        grep org/junit/Before.class > /dev/null 2>&5
7181    if test $? -eq 0; then
7182        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7183    else
7184        AC_MSG_RESULT([no])
7185        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7186location (/usr/share/java), specify its pathname via
7187--with-junit=..., or disable it via --without-junit])
7188    fi
7189fi
7190AC_SUBST(OOO_JUNIT_JAR)
7191
7192AC_MSG_CHECKING([which languages to be built])
7193WITH_LANG="$with_lang"
7194if test -z "$WITH_LANG"; then
7195   AC_MSG_RESULT([en-US])
7196else
7197   AC_MSG_RESULT([$WITH_LANG])
7198fi
7199AC_SUBST(WITH_LANG)
7200
7201AC_MSG_CHECKING([which languages have poor help localizations])
7202WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7203if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7204   AC_MSG_RESULT([none])
7205else
7206   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7207fi
7208AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7209
7210AC_MSG_CHECKING([which dictionaries to include])
7211if test -z "$with_dict"; then
7212   WITH_DICT=,ALL,
7213   AC_MSG_RESULT([ALL])
7214else
7215   WITH_DICT=","$with_dict","
7216   AC_MSG_RESULT([$with_dict])
7217fi
7218AC_SUBST(WITH_DICT)
7219
7220AC_MSG_CHECKING([for additional 'intro' bitmaps])
7221INTRO_BITMAPS=
7222if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7223   INTRO_BITMAPS=
7224   AC_MSG_RESULT([none])
7225else
7226   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7227      case "$bitmap" in
7228         *.bmp) ;;
7229         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .bmp files!]) ;;
7230      esac
7231      if test -n "$bitmap" ; then
7232         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7233      fi
7234   done
7235   AC_MSG_RESULT([$INTRO_BITMAPS])
7236fi
7237AC_SUBST(INTRO_BITMAPS)
7238
7239AC_MSG_CHECKING([for additional 'about' bitmaps])
7240ABOUT_BITMAPS=
7241if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7242   ABOUT_BITMAPS=
7243   AC_MSG_RESULT([none])
7244else
7245   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7246      case "$bitmap" in
7247         *.bmp) ;;
7248         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .bmp files!]) ;;
7249      esac
7250      if test -n "$bitmap" ; then
7251         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7252      fi
7253   done
7254   AC_MSG_RESULT([$ABOUT_BITMAPS])
7255fi
7256AC_SUBST(ABOUT_BITMAPS)
7257
7258OOO_VENDOR=
7259AC_MSG_CHECKING([for vendor])
7260if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7261   AC_MSG_RESULT([not set])
7262else
7263   OOO_VENDOR="$with_vendor"
7264   AC_MSG_RESULT([$OOO_VENDOR])
7265fi
7266AC_SUBST(OOO_VENDOR)
7267
7268UNIXWRAPPERNAME=
7269AC_MSG_CHECKING([for UNIX wrapper name])
7270if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7271   AC_MSG_RESULT([not set])
7272else
7273   UNIXWRAPPERNAME="$with_unix_wrapper"
7274   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7275fi
7276AC_SUBST(UNIXWRAPPERNAME)
7277
7278AC_MSG_CHECKING([whether to statically link to Gtk])
7279if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7280   ENABLE_STATIC_GTK="TRUE"
7281   AC_MSG_RESULT([yes])
7282else
7283   ENABLE_STATIC_GTK="FALSE"
7284   AC_MSG_RESULT([no])
7285fi
7286AC_SUBST(ENABLE_STATIC_GTK)
7287
7288AC_MSG_CHECKING([whether to use layout dialogs])
7289if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7290   ENABLE_LAYOUT="TRUE"
7291   AC_MSG_RESULT([yes])
7292else
7293   ENABLE_LAYOUT="FALSE"
7294   AC_MSG_RESULT([no])
7295fi
7296AC_SUBST(ENABLE_LAYOUT)
7297
7298# ===================================================================
7299# De- or increase default verbosity of build process
7300# ===================================================================
7301AC_MSG_CHECKING([build verbosity])
7302if test -n "$enable_verbose"; then
7303   if test "$enable_verbose" = "yes"; then
7304      VERBOSE="TRUE"
7305      AC_MSG_RESULT([high])
7306   fi
7307   if test "$enable_verbose" = "no"; then
7308      VERBOSE="FALSE"
7309      AC_MSG_RESULT([low])
7310   fi
7311else
7312   AC_MSG_RESULT([not set])
7313fi
7314AC_SUBST(VERBOSE)
7315
7316dnl ===================================================================
7317dnl Hook up OOos nodep environmental variable to automake's equivalent
7318dnl --enable-dependency-tracking configure option
7319dnl ===================================================================
7320AC_MSG_CHECKING([whether to enable dependency tracking])
7321if test "$enable_dependency_tracking" = "no"; then
7322    nodep=TRUE
7323    AC_MSG_RESULT([no])
7324else
7325    AC_MSG_RESULT([yes])
7326fi
7327AC_SUBST(nodep)
7328
7329dnl ===================================================================
7330dnl Setting up the environment.
7331dnl ===================================================================
7332echo "********************************************************************"
7333echo "*                                                                  *"
7334echo "*   Setting up the build environment variables.                    *"
7335echo "*                                                                  *"
7336echo "********************************************************************"
7337
7338if test -z "$COMPATH"; then
7339   AC_MSG_ERROR([No compiler found.])
7340fi
7341AC_SUBST(COMPATH)
7342
7343AC_MSG_CHECKING([solver path])
7344if test -z "$with_local_solver"; then
7345   LOCAL_SOLVER="DEFAULT"
7346   AC_MSG_RESULT([default])
7347else
7348   LOCAL_SOLVER=$with_local_solver
7349   AC_MSG_RESULT([$with_local_solver])
7350fi
7351AC_SUBST(LOCAL_SOLVER)
7352
7353AC_SUBST(BUILD_TYPE)
7354
7355# make sure config.guess is +x; we execute config.guess, so it has to be so;
7356chmod +x ./config.guess
7357
7358AC_OUTPUT([set_soenv Makefile])
7359
7360dnl Executing the set_soenv script to setup the environment variables.
7361chmod a+x set_soenv
7362if test -z "$enable_check_only"; then
7363   './set_soenv'
7364else
7365   echo
7366   echo Test Complete
7367   echo No environment file will be generated
7368   echo
7369   num_warnings=`wc -l warn`
7370   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7371   if test $_num -gt 0; then
7372      echo The following warning\(s\) were generated by configure
7373      echo ----------------------------------------------------
7374      echo
7375      cat warn
7376      echo
7377   else
7378      echo There were no warnings
7379   fi
7380   echo
7381fi
7382