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