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