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