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