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