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