xref: /aoo42x/main/configure.ac (revision 1439c24f)
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"
4589    WITH_MOZILLA=YES
4590if test -z "$with_mozilla_version"; then
4591   MOZILLA_VERSION=
4592else
4593   AC_MSG_CHECKING([which mozilla version to build])
4594   MOZILLA_VERSION=$with_mozilla_version
4595   enable_build_mozilla=1
4596   AC_MSG_RESULT([$MOZILLA_VERSION])
4597fi
4598
4599AC_SUBST(MOZILLA_VERSION)
4600
4601AC_MSG_CHECKING([for toolkit mozilla should use])
4602if test -z "$with_mozilla_toolkit"; then
4603   if test "$_os" != "WINNT" ; then
4604      if test "$_os" = "Darwin" ; then
4605         MOZILLA_TOOLKIT=mac
4606         AC_MSG_RESULT([mac])
4607      else
4608         MOZILLA_TOOLKIT=gtk2
4609         AC_MSG_RESULT([gtk2])
4610      fi
4611   fi
4612else
4613   MOZILLA_TOOLKIT=$with_mozilla_toolkit
4614   enable_build_mozilla=1
4615   AC_MSG_RESULT([$MOZILLA_TOOLKIT])
4616fi
4617#if test "$_os" = "Darwin" && test "$MOZILLA_TOOLKIT" != "gtk2"; then
4618#   #only gtk2 toolkit supported - xlib or cocoa nees glib1 and libIDL1 - the latter is not
4619#   #available using fink, mac (carbon) doesn't work because xcode installs conflicting headers
4620#   AC_MSG_ERROR([Only gtk2 toolkit supported on Mac, sorry.])
4621#fi
4622
4623AC_SUBST(MOZILLA_TOOLKIT)
4624
4625# default to enabling build mozilla
4626if test "$enable_build_mozilla" != "no"; then
4627      enable_build_mozilla=yes
4628else
4629      enable_build_mozilla=
4630fi
4631
4632AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
4633if test -n "$enable_build_mozilla"; then
4634   BUILD_MOZAB="TRUE"
4635   AC_MSG_RESULT([yes])
4636else
4637   BUILD_MOZAB=""
4638   AC_MSG_RESULT([no])
4639fi
4640
4641AC_MSG_CHECKING([whether to build provided NSS module])
4642if test "$enable_nss_module" != "no"; then
4643   ENABLE_NSS_MODULE="YES"
4644   BUILD_TYPE="$BUILD_TYPE NSS"
4645   AC_MSG_RESULT([yes])
4646   if test "$_os" = "WINNT"; then
4647      AC_MSG_CHECKING([for Mozilla build tooling])
4648      if test -z "$MOZILLABUILD" ; then
4649AC_MSG_ERROR([Mozilla build tooling not found.
4650Use the --with-mozilla-build option after installling the tools obtained
4651from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
4652      else
4653         if test \( "$WITH_MINGWIN" = "yes" \) ; then
4654            if test ! -d "$MOZILLABUILD" ; then
4655AC_MSG_ERROR([Mozilla build tooling incomplete!])
4656            else
4657               AC_MSG_RESULT([ok])
4658            fi
4659         else
4660            if test ! -d "$MOZILLABUILD/moztools" \
4661               -o ! -d "$MOZILLABUILD/msys" ; then
4662AC_MSG_ERROR([Mozilla build tooling incomplete!])
4663            else
4664               AC_MSG_RESULT([ok])
4665            fi
4666         fi
4667      fi
4668   fi
4669else
4670   ENABLE_NSS_MODULE="NO"
4671   AC_MSG_RESULT([no])
4672fi
4673
4674if test "$BUILD_MOZAB" = "TRUE"; then
4675  if test "$_os" = "WINNT"; then
4676    if test "$WITH_MINGWIN" != "yes"; then
4677      # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
4678      if test "$MSVSVER" != "2005"; then
4679        AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio .NET 2005 only.])
4680      fi
4681    else
4682      AC_MSG_WARN([Building SeaMonkey with mingwin is not tested, and likely to break.])
4683      echo "Building SeaMonkey with mingwin is not tested, and likely to break." >> warn
4684    fi
4685  fi
4686
4687   if test -z "$MOZILLA_VERSION"; then
4688      MOZILLA_VERSION=1.1.14
4689   fi
4690   MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
4691   MOZILLA_FETCH_FILE=`grep $MOZILLA_SOURCE_VERSION ooo.lst`
4692   AC_MSG_CHECKING([for mozilla sources])
4693   if test -z "$MOZILLA_FETCH_FILE"; then
4694      AC_MSG_RESULT([not found])
4695      HAVE_MOZILLA_TARBALL=n
4696   else
4697      AC_MSG_CHECKING([for $MOZILLA_FETCH_FILE])
4698      if test ! -e "$TARFILE_LOCATION/$MOZILLA_FETCH_FILE"; then
4699         if test -z "$DO_FETCH"; then
4700            AC_MSG_RESULT([will be fetched])
4701            HAVE_MOZILLA_TARBALL=y
4702         else
4703            AC_MSG_RESULT([not found])
4704            HAVE_MOZILLA_TARBALL=n
4705         fi
4706      else
4707         AC_MSG_RESULT([found])
4708         HAVE_MOZILLA_TARBALL=y
4709      fi
4710   fi
4711   if test "$HAVE_MOZILLA_TARBALL" != "y"; then
4712      AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
4713Use "./fetch_tarballs.sh ooo.lst" to download.])
4714   fi
4715   if test "$_os" = "WINNT"; then
4716      AC_MSG_CHECKING([for moztools binaries])
4717      if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
4718        AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
4719(from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
4720      else
4721         AC_MSG_RESULT([ok])
4722      fi
4723   elif test "$_os" = "Darwin"; then
4724      if test "$MOZILLA_TOOLKIT" = "gtk2"; then
4725         AC_MSG_NOTICE([checking whether mozilla can be built...])
4726         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]))
4727      else
4728         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
4729         if test -z "$MOZIDL"; then
4730            AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build mozilla with mac toolkit.])
4731         fi
4732      fi
4733   else
4734      # Generic Unix/Linux section
4735      if test "$MOZILLA_TOOLKIT" = "gtk2"; then
4736         PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
4737         if test -z "$MOZGTK"; then
4738            AC_MSG_ERROR([GTK2 is needed to build mozilla.])
4739         fi
4740         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
4741         if test -z "$MOZIDL"; then
4742            AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build mozilla.])
4743         fi
4744      else
4745         PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
4746         if test -z "$MOZGTK"; then
4747            AC_MSG_ERROR([gtk 1.2 is needed when not using GTK2 to build mozilla.])
4748         fi
4749         PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
4750         if test -z "$MOZIDL"; then
4751            AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build mozilla.])
4752         fi
4753      fi
4754   fi
4755fi
4756
4757AC_SUBST(BUILD_MOZAB)
4758
4759fi
4760AC_SUBST(ENABLE_NSS_MODULE)
4761AC_SUBST(MOZILLABUILD)
4762AC_SUBST(SYSTEM_MOZILLA)
4763AC_SUBST(MOZ_FLAVOUR)
4764AC_SUBST(MOZ_INC)
4765AC_SUBST(MOZ_LIB)
4766AC_SUBST(MOZ_LIB_XPCOM)
4767AC_SUBST(MOZ_NSPR_CFLAGS)
4768AC_SUBST(MOZ_NSS_CFLAGS)
4769AC_SUBST(MOZ_LDAP_CFLAGS)
4770
4771dnl ===================================================================
4772dnl Check for system sane
4773dnl ===================================================================
4774AC_MSG_CHECKING([which sane header to use])
4775if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
4776	test "$with_system_sane_header" != "no"; then
4777   AC_MSG_RESULT([external])
4778   SYSTEM_SANE_HEADER=YES
4779   AC_CHECK_HEADER(sane/sane.h, [],
4780      [AC_MSG_ERROR(sane not found. install sane)], [])
4781else
4782   AC_MSG_RESULT([internal])
4783   SYSTEM_SANE_HEADER=NO
4784   BUILD_TYPE="$BUILD_TYPE SANE"
4785fi
4786AC_SUBST(SYSTEM_SANE_HEADER)
4787
4788dnl ===================================================================
4789dnl Check for system icu
4790dnl ===================================================================
4791AC_MSG_CHECKING([which icu to use])
4792if test -n "$with_system_icu" -o -n "$with_system_libs" && \
4793	test "$with_system_icu" != "no"; then
4794   AC_MSG_RESULT([external])
4795   SYSTEM_ICU=YES
4796   AC_LANG_PUSH([C++])
4797   AC_MSG_CHECKING([for unicode/rbbi.h])
4798   AC_TRY_CPP(unicode/rbbi.h, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([icu headers not found.]))
4799   AC_LANG_POP([C++])
4800   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
4801   if test -z "$SYSTEM_GENBRK"; then
4802      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
4803   fi
4804   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
4805   if test -z "$SYSTEM_GENCCODE"; then
4806      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
4807   fi
4808   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
4809   if test -z "$SYSTEM_GENCMN"; then
4810      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
4811   fi
4812
4813   AC_PATH_PROG( ICUCONFIG, icu-config)
4814   AC_MSG_CHECKING([ICU version])
4815   ICU_VERSION=`$ICUCONFIG --version`
4816   ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
4817   ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
4818   ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
4819
4820   if test "$ICU_MAJOR" -ge "4"; then
4821      AC_MSG_RESULT([OK])
4822   else
4823      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
4824   fi
4825
4826else
4827    AC_MSG_RESULT([internal])
4828    SYSTEM_ICU=NO
4829    BUILD_TYPE="$BUILD_TYPE ICU"
4830fi
4831AC_SUBST(SYSTEM_ICU)
4832AC_SUBST(SYSTEM_GENBRK)
4833AC_SUBST(SYSTEM_GENCCODE)
4834AC_SUBST(SYSTEM_GENCMN)
4835AC_SUBST(ICU_MAJOR)
4836AC_SUBST(ICU_MINOR)
4837AC_SUBST(ICU_MICRO)
4838
4839dnl ===================================================================
4840dnl Graphite
4841dnl ===================================================================
4842
4843AC_MSG_CHECKING([whether to enable graphite support])
4844if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "z$enable_graphite" = "z" -o "$enable_graphite" != "no" ; then
4845    AC_MSG_RESULT([yes])
4846    ENABLE_GRAPHITE="TRUE"
4847    AC_MSG_CHECKING([which graphite to use])
4848    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
4849        test "$with_system_graphite" != "no"; then
4850        AC_MSG_RESULT([external])
4851        SYSTEM_GRAPHITE=YES
4852        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
4853    else
4854        AC_MSG_RESULT([internal])
4855        SYSTEM_GRAPHITE=NO
4856        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
4857    fi
4858else
4859   AC_MSG_RESULT([no])
4860fi
4861AC_SUBST(ENABLE_GRAPHITE)
4862AC_SUBST(SYSTEM_GRAPHITE)
4863AC_SUBST(GRAPHITE_LIBS)
4864AC_SUBST(GRAPHITE_CFLAGS)
4865
4866dnl ===================================================================
4867dnl Checks for libraries.
4868dnl ===================================================================
4869dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
4870dnl See if we have the AppKit framework for building with Quartz graphics.
4871
4872if test  "$_os" = "Darwin"; then
4873   if test "x$with_x" = "xyes"; then
4874      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
4875   else
4876      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
4877      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
4878         AC_MSG_RESULT([yes])
4879         x_includes="no_x_includes"
4880         x_libraries="no_x_libraries"
4881         dnl disable some things used on other Unix versions but not on the aqua build
4882         enable_gtk=no
4883         enable_cups=no
4884         ENABLE_CUPS=""
4885         AC_SUBST(ENABLE_CUPS)
4886      else
4887         AC_MSG_ERROR([No AppKit.framewrok found])
4888      fi
4889   fi
4890fi
4891
4892dnl ***************************************
4893dnl testing for X libraries and includes...
4894dnl ***************************************
4895if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
4896   echo "Do Nothing for _os = Darwin"
4897   dnl Mac OS X using Aqua graphics. Don't check for X11.
4898   :
4899elif test "$_os" = "OS2" ; then
4900   echo "Do Nothing for _os = OS2. Don't check for X11."
4901   dnl OS/2 uses native graphics. Don't check for X11.
4902   :
4903elif test "$_os" != "WINNT" ; then
4904   AC_PATH_X
4905   AC_PATH_XTRA
4906   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
4907
4908   if test "x$x_includes" = "x"; then
4909     x_includes="default_x_includes"
4910   fi
4911   if test "x$x_libraries" = "x"; then
4912     x_libraries="default_x_libraries"
4913   fi
4914   dnl The variables $x_libraries and $x_includes are set.
4915   if test -z "$x_libraries"; then
4916      AC_MSG_ERROR([No X libraries found]) # Exit
4917   fi
4918   if test -z "$x_includes"; then
4919      AC_MSG_ERROR([No X includes found]) # Exit
4920   fi
4921   CFLAGS=$X_CFLAGS
4922   LDFLAGS="$X_LDFLAGS $X_LIBS"
4923   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
4924   dnl Check if the XauDisposeAuth symbol is provided by libXau.
4925   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
4926else
4927   x_includes="no_x_includes"
4928   x_libraries="no_x_libraries"
4929fi
4930if test -z "$x_includes"; then
4931   x_includes="no_x_includes"
4932fi
4933if test -z "$x_libraries"; then
4934   x_libraries="no_x_libraries"
4935fi
4936if test "$x_includes" = "default_x_includes"; then
4937   XINC="/usr/include"
4938else
4939   XINC="$x_includes"
4940fi
4941AC_SUBST(XINC)
4942if test "$x_libraries" = "default_x_libraries"; then
4943   XLIB=`$PKG_CONFIG --variable=libdir x11`
4944   if test "x$XLIB" = x; then
4945         XLIB="/usr/lib"
4946   fi
4947else
4948   XLIB="$x_libraries"
4949fi
4950AC_SUBST(XLIB)
4951AC_SUBST(XAU_LIBS)
4952
4953if test "$_os" != "WINNT" -a "$_os" != "OS2" -a "$_os" != "Darwin"; then
4954   dnl ===================================================================
4955   dnl Check for using Xaw
4956   dnl ===================================================================
4957   AC_MSG_CHECKING([whether to use Xaw])
4958   if test "$enable_Xaw" = "no"; then
4959       DISABLE_XAW=TRUE
4960       AC_MSG_RESULT([no])
4961       AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt include headers not found])],
4962         [#include <X11/Intrinsic.h>])
4963   else
4964       AC_MSG_RESULT([yes])
4965       AC_CHECK_HEADERS(X11/Xaw/Label.h,[],[AC_MSG_ERROR([Xaw include headers not found])],
4966         [#include <X11/Intrinsic.h>])
4967       AC_CHECK_LIB(Xaw, main, [],
4968           [AC_MSG_ERROR(Xaw library not found or functional)], [])
4969   fi
4970fi
4971AC_SUBST(DISABLE_XAW)
4972
4973
4974
4975dnl ===================================================================
4976dnl Check if fontconfig/fontconfig.h is available
4977dnl ===================================================================
4978if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
4979    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
4980                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
4981    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
4982    AC_TRY_RUN([
4983#include <fontconfig/fontconfig.h>
4984
4985int main(int argc, char **argv) {
4986	if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
4987	else return 1;
4988}
4989], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])])
4990fi
4991
4992dnl ===================================================================
4993dnl Check for system Xrender
4994dnl ===================================================================
4995AC_MSG_CHECKING([whether to link to Xrender])
4996if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
4997   AC_MSG_RESULT([yes])
4998   XRENDER_LINK=YES
4999   with_system_xrender_headers=yes
5000else
5001   AC_MSG_RESULT([no, dynamically open it])
5002   XRENDER_LINK=NO
5003fi
5004AC_MSG_CHECKING([which Xrender headers to use])
5005if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
5006	test "$with_system_xrender_headers" != "no"; then
5007   AC_MSG_RESULT([external])
5008   SYSTEM_XRENDER_HEADERS=YES
5009   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
5010      [AC_MSG_ERROR(Xrender not found. install X)], [])
5011else
5012   AC_MSG_RESULT([internal])
5013   SYSTEM_XRENDER_HEADERS=NO
5014   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
5015fi
5016if test "$XRENDER_LINK" = "YES"; then
5017   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
5018      [AC_MSG_ERROR(libXrender not found or functional)], [])
5019fi
5020AC_SUBST(SYSTEM_XRENDER_HEADERS)
5021AC_SUBST(XRENDER_LINK)
5022
5023dnl ===================================================================
5024dnl Check for XRandr
5025dnl ===================================================================
5026AC_MSG_CHECKING([whether to enable RandR support])
5027if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5028   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5029	  XRANDR_DLOPEN="TRUE"
5030	  AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5031   else
5032	  XRANDR_DLOPEN="FALSE"
5033      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5034      if test "$ENABLE_RANDR" != "TRUE"; then
5035         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5036                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5037         XRANDR_CFLAGS=" "
5038         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5039              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5040         XRANDR_LIBS="-lXrandr "
5041         ENABLE_RANDR="TRUE"
5042	     AC_MSG_RESULT([enabling RandR support])
5043      fi
5044   fi
5045else
5046   ENABLE_RANDR=""
5047   AC_MSG_RESULT([no])
5048fi
5049AC_SUBST(XRANDR_DLOPEN)
5050AC_SUBST(XRANDR_CFLAGS)
5051AC_SUBST(XRANDR_LIBS)
5052AC_SUBST(ENABLE_RANDR)
5053
5054dnl ===================================================================
5055dnl Check for system neon
5056dnl ===================================================================
5057AC_MSG_CHECKING([which neon is used])
5058if test -n "$with_system_neon" -o -n "$with_system_libs" && \
5059	test "$with_system_neon" != "no"; then
5060        AC_MSG_RESULT([external])
5061        PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon]))
5062        NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
5063        NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
5064        SYSTEM_NEON=YES
5065fi
5066AC_SUBST(SYSTEM_NEON)
5067AC_SUBST(NEON_VERSION)
5068AC_SUBST(NEON_LIBS)
5069AC_SUBST(NEON_CFLAGS)
5070
5071dnl ===================================================================
5072dnl Check for system openssl
5073dnl ===================================================================
5074if test "$_os" = "Darwin" && test "$with_system_openssl" != "no"; then
5075   with_system_openssl=yes
5076fi
5077AC_MSG_CHECKING([which libssl to use])
5078if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5079        test "$with_system_openssl" != "no"; then
5080    AC_MSG_RESULT([external])
5081    # Mac OS builds should get out without extra stuff is the Mac porters'
5082    # wish. And pkg-config is although Xcode ships a .pc for openssl
5083    if test "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
5084        OPENSSL_CFLAGS=
5085        OPENSSL_LIBS="-lssl -lcrypto"
5086    else
5087    	PKG_CHECK_MODULES( OPENSSL, openssl )
5088    fi
5089    SYSTEM_OPENSSL=YES
5090else
5091    AC_MSG_RESULT([internal])
5092    SYSTEM_OPENSSL=NO
5093    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5094fi
5095AC_SUBST(SYSTEM_OPENSSL)
5096AC_SUBST(OPENSSL_CFLAGS)
5097AC_SUBST(OPENSSL_LIBS)
5098
5099dnl ===================================================================
5100dnl Check for system redland
5101dnl ===================================================================
5102AC_MSG_CHECKING([which redland library to use])
5103if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5104	test "$with_system_redland" != "no"; then
5105	AC_MSG_RESULT([external])
5106	SYSTEM_REDLAND=YES
5107   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5108   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5109else
5110	AC_MSG_RESULT([internal])
5111	BUILD_TYPE="$BUILD_TYPE REDLAND"
5112	SYSTEM_REDLAND=NO
5113fi
5114AC_SUBST(SYSTEM_REDLAND)
5115AC_SUBST(REDLAND_CFLAGS)
5116AC_SUBST(REDLAND_LIBS)
5117
5118dnl ===================================================================
5119dnl Check for hunspell
5120dnl ===================================================================
5121AC_MSG_CHECKING([whether to build the Spell Checking component])
5122ENABLE_HUNSPELL=
5123
5124if test "x$enable_hunspell" != "xno" ; then
5125    AC_MSG_CHECKING([which libhunspell to use])
5126    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5127        test "$with_system_hunspell" != "no"; then
5128        AC_MSG_RESULT([external])
5129        SYSTEM_HUNSPELL=YES
5130        AC_LANG_PUSH([C++])
5131        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5132        if test "$HUNSPELL_PC" != "TRUE"; then
5133            AC_CHECK_HEADER(hunspell.hxx, [],
5134            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5135                [AC_MSG_ERROR(hunspell headers not found.)], [])
5136             ], [])
5137            AC_CHECK_LIB(hunspell, main, [],
5138            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5139            HUNSPELL_LIBS=-lhunspell
5140        fi
5141        AC_LANG_POP([C++])
5142    else
5143        AC_MSG_RESULT([internal])
5144        SYSTEM_HUNSPELL=NO
5145        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5146    fi
5147    ENABLE_HUNSPELL=YES
5148    AC_SUBST(SYSTEM_HUNSPELL)
5149    AC_SUBST(HUNSPELL_CFLAGS)
5150    AC_SUBST(HUNSPELL_LIBS)
5151else
5152    AC_MSG_RESULT([no])
5153fi
5154AC_SUBST(ENABLE_HUNSPELL)
5155
5156dnl ===================================================================
5157dnl Checking for libhyphen
5158dnl ===================================================================
5159AC_MSG_CHECKING([whether to build the Hyphenator component])
5160ENABLE_HYPHEN=
5161
5162if test "x$enable_hyphen" != "xno" ; then
5163    AC_MSG_CHECKING([which libhyphen to use])
5164    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5165        test "$with_system_hyphen" != "no"; then
5166        AC_MSG_RESULT([external])
5167        SYSTEM_HYPH=YES
5168        AC_CHECK_HEADER(hyphen.h, [],
5169        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5170        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5171        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5172        [#include <hyphen.h>])
5173        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5174            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5175        if test -z "$HYPHEN_LIB"; then
5176        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5177            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5178        fi
5179        if test -z "$HYPHEN_LIB"; then
5180        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5181            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5182        fi
5183    else
5184        AC_MSG_RESULT([internal])
5185        SYSTEM_HYPH=NO
5186        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5187    fi
5188    ENABLE_HYPHEN=YES
5189    AC_SUBST(SYSTEM_HYPH)
5190    AC_SUBST(HYPHEN_LIB)
5191else
5192    AC_MSG_RESULT([no])
5193fi
5194AC_SUBST(ENABLE_HYPHEN)
5195
5196dnl ===================================================================
5197dnl Checking for mythes
5198dnl ===================================================================
5199AC_MSG_CHECKING([which mythes to use])
5200if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5201   test "$with_system_mythes" != "no"; then
5202    AC_MSG_RESULT([external])
5203    SYSTEM_MYTHES=YES
5204    AC_LANG_PUSH([C++])
5205    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5206    if test "$MYTHES_PKGCONFIG" = "no"; then
5207        AC_CHECK_HEADER(mythes.hxx, [],
5208            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5209        AC_CHECK_LIB(mythes-1.2, main, [],
5210            [ MYTHES_FOUND=no], [])
5211 	if test "$MYTHES_FOUND" = "no"; then
5212            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5213                [ MYTHES_FOUND=no], [])
5214	fi
5215	if test "$MYTHES_FOUND" = "no"; then
5216		AC_MSG_ERROR([mythes library not found!.])
5217	fi
5218    fi
5219    AC_LANG_POP([C++])
5220else
5221    AC_MSG_RESULT([internal])
5222    SYSTEM_MYTHES=NO
5223    BUILD_TYPE="$BUILD_TYPE MYTHES"
5224fi
5225AC_SUBST(SYSTEM_MYTHES)
5226AC_SUBST(MYTHES_CFLAGS)
5227AC_SUBST(MYTHES_LIBS)
5228
5229
5230dnl ===================================================================
5231dnl Checking for libtextcat
5232dnl ===================================================================
5233AC_MSG_CHECKING([which libtextcat to use])
5234if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5235    AC_MSG_RESULT([external])
5236    SYSTEM_LIBTEXTCAT=YES
5237    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5238       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5239    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5240        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5241else
5242    AC_MSG_RESULT([internal])
5243    SYSTEM_LIBTEXTCAT=NO
5244    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5245fi
5246AC_SUBST(SYSTEM_LIBTEXTCAT)
5247
5248AC_MSG_CHECKING([which libtextcat data directory to use])
5249if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5250    if test "$with_system_libtextcat_data" = "yes"; then
5251        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5252    else
5253        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5254    fi
5255    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5256else
5257    AC_MSG_RESULT([internal])
5258    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5259fi
5260AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5261
5262dnl ***************************************
5263dnl testing libc version for Linux...
5264dnl ***************************************
5265if test "$_os" = "Linux"; then
5266   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5267   exec 6>/dev/null # no output
5268   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5269   exec 6>&1 # output on again
5270   if test "$HAVE_LIBC"; then
5271      AC_MSG_RESULT([yes])
5272   else
5273      AC_MSG_ERROR([no, upgrade libc])
5274   fi
5275fi
5276
5277if test "$_os" != "WNT"; then
5278  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5279  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5280  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5281	SYSTEM_LIBC=YES
5282  fi
5283else
5284  HAVE_GETOPT=NO
5285  HAVE_READDIR_R=NO
5286  SYSTEM_LIBC=YES
5287fi
5288AC_SUBST(HAVE_GETOPT)
5289AC_SUBST(HAVE_READDIR_R)
5290AC_SUBST(SYSTEM_LIBC)
5291
5292dnl =========================================
5293dnl Check for the Microsoft Platform SDK.
5294dnl =========================================
5295dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5296dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5297if test \( "$_os" = "WINNT" \) ; then
5298	AC_MSG_CHECKING([for PSDK files])
5299	if test -z "$with_psdk_home"; then
5300		# This first line will detect a February 2003 Microsoft Platform SDK
5301		PSDK_HOME=`./oowintool --psdk-home`
5302        # But there might be also an April 2005 PSDK, unfortunately MS changed
5303        # the registry entry. (we prefer the old version!?)
5304        if test -z "$PSDK_HOME"; then
5305          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5306        fi
5307            # normalize if found
5308            if test -n "$PSDK_HOME"; then
5309              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5310              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5311           fi
5312	else
5313           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5314	fi
5315        # Remove a possible trailing backslash
5316        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5317    # Problem with current PSDK (iz 49865)
5318    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5319        AC_MSG_ERROR([
5320
5321Some modules do not build correctly with MS Platform SDK - April 2005
5322Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5323Remove/rename/backup that file and restart configure. Details about this
5324problem can be found in issue 49856.])
5325    fi
5326# WIndows SDK has different headers
5327	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5328		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5329		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5330		HAVE_PSDK_H="yes"
5331	else
5332		HAVE_PSDK_H="no"
5333	fi
5334	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5335		HAVE_PSDK_LIB="yes"
5336	else
5337		HAVE_PSDK_LIB="no"
5338	fi
5339    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5340        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5341are installed or use --with-psdk-home .])
5342    fi
5343    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5344         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5345         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5346         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5347        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5348    fi
5349    AC_MSG_RESULT([SDK files found ...)])
5350dnl Check if this is the right SDK.
5351    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5352        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5353        WINDOWS_VISTA_PSDK=TRUE
5354    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5355        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5356        WINDOWS_VISTA_PSDK=TRUE
5357    else
5358        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5359    fi
5360fi
5361AC_SUBST(PSDK_HOME)
5362AC_SUBST(WINDOWS_VISTA_PSDK)
5363
5364dnl =========================================
5365dnl Check for the Microsoft DirectX SDK.
5366dnl =========================================
5367if test \( "$_os" = "WINNT" \) ; then
5368    AC_MSG_CHECKING([for DirectX SDK files])
5369    if test -z "$with_directx_home"; then
5370        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5371        if test -n "$DXSDK_DIR"; then
5372            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5373            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5374        fi
5375        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5376        # the "DirectX SDK files not found" error later
5377    else
5378	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5379    fi
5380    # Remove a possible trailing backslash
5381    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5382
5383    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5384        HAVE_DIRECTDRAW_H="yes"
5385    else
5386        HAVE_DIRECTDRAW_H="no"
5387    fi
5388    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5389        HAVE_DIRECTXSDK_H="yes"
5390    else
5391        HAVE_DIRECTXSDK_H="no"
5392    fi
5393
5394    # MS changed the location of the libraries with dec 2004 directx sdk
5395    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5396        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5397    else
5398        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5399    fi
5400    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5401        HAVE_DIRECTDRAW_LIB="yes"
5402    else
5403        HAVE_DIRECTDRAW_LIB="no"
5404    fi
5405    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5406        HAVE_DIRECTXSDK_LIB="yes"
5407    else
5408        HAVE_DIRECTXSDK_LIB="no"
5409    fi
5410
5411    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5412       ENABLE_DIRECT_DRAW="TRUE"
5413    fi
5414    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5415       HAVE_DIRECTXSDK="yes"
5416    else
5417       HAVE_DIRECTXSDK="no"
5418    fi
5419
5420    if test -n "$ENABLE_DIRECTX"; then
5421	    if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5422		    AC_MSG_RESULT([found])
5423	    else
5424		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5425	    fi
5426    else
5427		DIRECTXSDK_HOME=""
5428		AC_MSG_RESULT([disabled])
5429    fi
5430fi
5431AC_SUBST(ENABLE_DIRECT_DRAW)
5432AC_SUBST(DIRECTXSDK_HOME)
5433AC_SUBST(DIRECTXSDK_LIB)
5434
5435dnl ============================================
5436dnl Check for Nullsoft Scriptable Install System
5437dnl ============================================
5438NSIS_PATH=""
5439if test "$_os" = "WINNT" ; then
5440    AC_MSG_CHECKING([for NSIS])
5441    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5442    if test -n "$NSIS_PATH"; then
5443        NSIS_PATH=`dirname "$NSIS_PATH"`
5444    fi
5445    if test -n "$with_nsis_path"; then
5446        with_nsis_path=`cygpath -u "$with_nsis_path"`
5447    fi
5448    if test -e "$with_nsis_path/nsis.exe"; then
5449        NSIS_PATH="$with_nsis_path"
5450    fi
5451    nsistest=`./oowintool --nsis-dir`;
5452    if test -x "$nsistest/nsis.exe"; then
5453        NSIS_PATH="$nsistest"
5454    fi
5455    if test -z "$NSIS_PATH"; then
5456        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5457        echo "NSIS not found, no self contained installer will be build." >> warn
5458    else
5459        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5460        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5461        AC_MSG_RESULT([found ($NSIS_PATH)])
5462    fi
5463fi
5464AC_SUBST(NSIS_PATH)
5465
5466dnl ***************************************
5467dnl testing bison and flex exist
5468dnl ***************************************
5469AC_PATH_PROG(BISON, bison)
5470if test -z "$BISON"; then
5471   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5472else
5473   AC_MSG_CHECKING([the bison version])
5474   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5475    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5476    # Accept newer than 1.875 or older(equal) than 1.75
5477    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5478       if test "$_bison_version" = "1.875" ; then
5479          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5480          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5481       else
5482          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5483       fi
5484    else
5485       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5486    fi
5487fi
5488AC_PATH_PROG(FLEX, flex)
5489if test -z "$FLEX"; then
5490   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5491fi
5492dnl ***************************************
5493dnl testing that patch exists
5494dnl ***************************************
5495AC_PATH_PROG(PATCH, patch)
5496if test -z "$PATCH"; then
5497   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5498fi
5499
5500dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5501if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5502   if test -z "$with_gnu_patch"; then
5503      GNUPATCH=$PATCH
5504   else
5505      if test -x "$with_gnu_patch"; then
5506	      GNUPATCH=$with_gnu_patch
5507      else
5508         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5509      fi
5510   fi
5511
5512   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5513   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5514	   AC_MSG_RESULT([yes])
5515   else
5516      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5517   fi
5518fi
5519
5520dnl We also need to check for --with-gnu-cp
5521
5522if test -z "$with_gnu_cp"; then
5523   # check the place where the good stuff is hidden on Solaris...
5524   if test -x /usr/gnu/bin/cp; then
5525      GNUCP=/usr/gnu/bin/cp
5526   else
5527      AC_PATH_PROGS(GNUCP, gnucp cp)
5528   fi
5529   if test -z $GNUCP; then
5530      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5531   fi
5532else
5533   if test -x "$with_gnu_cp"; then
5534      GNUCP=$with_gnu_cp
5535   else
5536      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5537   fi
5538fi
5539
5540AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5541if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5542   AC_MSG_RESULT([yes])
5543else
5544   AC_MSG_RESULT([no])
5545   GNUCP=''
5546fi
5547
5548if test -z "$GNUCP"; then
5549   if test "$_os" = "SunOS" -o "$_os" = "FreeBSD"; then
5550      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5551   else
5552      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5553   fi
5554fi
5555
5556AC_SUBST(GNUPATCH)
5557AC_SUBST(GNUCP)
5558
5559dnl ***************************************
5560dnl testing bash tools path on Windows
5561dnl ***************************************
5562if test "$_os" = "WINNT"; then
5563    CYGWIN_PATH=""
5564    AC_PATH_PROG(CYGWIN_PATH, bash)
5565    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5566fi
5567if test -z "$CYGWIN_PATH"; then
5568   CYGWIN_PATH="NO_CYGWIN"
5569fi
5570AC_SUBST(CYGWIN_PATH)
5571
5572dnl ***************************************
5573dnl testing ml.exe assembler path
5574dnl ***************************************
5575if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5576  AC_MSG_CHECKING([ml.exe assembler path])
5577  if test -n "$with_asm_home"; then
5578    with_asm_home=`cygpath -u "$with_asm_home"`
5579  fi
5580  if test ! -x "$with_asm_home/ml.exe"; then
5581    AC_PATH_PROG(ML_EXE, ml.exe)
5582    if test -z "$ML_EXE"; then
5583      if test -x "$with_cl_home/bin/ml.exe"; then
5584        with_asm_home=$with_cl_home/bin
5585        AC_MSG_RESULT([found ($with_asm_home)])
5586      else
5587        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5588      fi
5589    else
5590       with_asm_home="ASM_IN_PATH"
5591    fi
5592  fi
5593  AC_MSG_RESULT([$ASM_HOME])
5594else
5595  with_asm_home="NO_ASM_HOME"
5596fi
5597ASM_HOME="$with_asm_home"
5598AC_SUBST(ASM_HOME)
5599
5600dnl ===================================================================
5601dnl testing handle deprecated unzip switch
5602dnl ===================================================================
5603if test -z "$with_zip_home"; then
5604	with_zip_home="$with_unzip_home"
5605fi
5606dnl ===================================================================
5607dnl Zip will be found where you tell me to find it
5608dnl ===================================================================
5609if test -n "$with_zip_home" ; then
5610    if test "$_os" = "WINNT"; then
5611        with_zip_home=`cygpath -u "$with_zip_home"`
5612    fi
5613    ZIP="$with_zip_home/zip"
5614    UNZIP="$with_zip_home/unzip"
5615    ZIP_HOME="$with_zip_home"
5616else
5617    AC_PATH_PROG(ZIP, zip)
5618    AC_PATH_PROG(UNZIP, unzip)
5619    ZIP_HOME=`dirname "$ZIP"`
5620fi
5621dnl ===================================================================
5622dnl Zip must be available or else it is an error, all platforms
5623dnl ===================================================================
5624if test -z "$ZIP" -o -z "$UNZIP"; then
5625    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5626fi
5627
5628dnl ===================================================================
5629dnl Zip must be a specific type for different build types.
5630dnl ===================================================================
5631if test "$_os" = "WINNT"; then
5632    if test -n "`$ZIP -h | grep -i WinNT`" ; then
5633AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5634    fi
5635fi
5636AC_SUBST(ZIP_HOME)
5637
5638dnl ===================================================================
5639dnl Windows builds need dbghelp.dll in external/dbghelp/
5640dnl ===================================================================
5641if test "$_os" = "WINNT"; then
5642   AC_MSG_CHECKING([for dbghelp.dll])
5643   if test -x ./external/dbghelp/dbghelp.dll; then
5644      AC_MSG_RESULT([found and executable])
5645   else
5646      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5647Get it from the Microsoft site and put it into external/dbghelp.
5648(Note: Microsoft seems to enjoy changing the exact location of this file. You
5649may have to search Microsoft's website.) Last time it was seen at:
5650<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5651   fi
5652fi
5653
5654dnl ===================================================================
5655dnl Windows builds - use oowintool to copy CRT dlls and manifest
5656dnl ===================================================================
5657if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5658       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5659          :
5660       else
5661          AC_MSG_ERROR([oowintool failed to copy CRT])
5662       fi
5663fi
5664
5665dnl ===================================================================
5666dnl Windows builds need gdiplus.dll in external/gdiplus/
5667dnl ===================================================================
5668if test "$_os" = "WINNT"; then
5669   AC_MSG_CHECKING([for gdiplus.dll])
5670   if test -x ./external/gdiplus/gdiplus.dll; then
5671      AC_MSG_RESULT([found and executable])
5672   else
5673      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5674Get it from the Microsoft site and put it into external/gdiplus.
5675You may have to search Microsoft's website. Last time it was seen at:
5676<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5677   fi
5678fi
5679
5680dnl ===================================================================
5681dnl Test which vclplugs have to be built.
5682dnl ===================================================================
5683AC_MSG_CHECKING([which VCLplugs shall be built])
5684ENABLE_GTK=""
5685if test "x$enable_gtk" = "xyes"; then
5686    ENABLE_GTK="TRUE"
5687    R="gtk"
5688fi
5689AC_SUBST(ENABLE_GTK)
5690
5691ENABLE_KDE=""
5692if test "x$enable_kde" = "xyes"; then
5693    ENABLE_KDE="TRUE"
5694    R="$R kde"
5695fi
5696AC_SUBST(ENABLE_KDE)
5697
5698ENABLE_KDE4=""
5699if test "x$enable_kde4" = "xyes"; then
5700    ENABLE_KDE4="TRUE"
5701    R="$R kde4"
5702fi
5703AC_SUBST(ENABLE_KDE4)
5704
5705if test -z "$R"; then
5706	AC_MSG_RESULT([none])
5707else
5708	AC_MSG_RESULT([$R])
5709fi
5710
5711dnl ===================================================================
5712dnl GCONF check
5713dnl ===================================================================
5714
5715ENABLE_GCONF=""
5716AC_MSG_CHECKING([whether to enable GConf support])
5717if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5718    ENABLE_GCONF="TRUE"
5719    AC_MSG_RESULT([yes])
5720    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5721else
5722    AC_MSG_RESULT([no])
5723fi
5724AC_SUBST(ENABLE_GCONF)
5725
5726dnl ===================================================================
5727dnl Gnome VFS check
5728dnl ===================================================================
5729
5730ENABLE_GNOMEVFS=""
5731AC_MSG_CHECKING([whether to enable GNOME VFS support])
5732if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5733    ENABLE_GNOMEVFS="TRUE"
5734    AC_MSG_RESULT([yes])
5735    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5736    if test "$ENABLE_GCONF" != "TRUE"; then
5737        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5738    fi
5739else
5740    AC_MSG_RESULT([no])
5741fi
5742AC_SUBST(ENABLE_GNOMEVFS)
5743
5744dnl ===================================================================
5745dnl Check whether the gtk 2.0 libraries are available.
5746dnl ===================================================================
5747
5748GTK_CFLAGS=""
5749GTK_LIBS=""
5750ENABLE_SYSTRAY_GTK=""
5751ENABLE_DBUS=""
5752if test  "$test_gtk" = "yes"; then
5753
5754   if test "$ENABLE_GTK" = "TRUE" ; then
5755      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]))
5756      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]))
5757      BUILD_TYPE="$BUILD_TYPE GTK"
5758
5759      if test "x$enable_systray" = "xyes"; then
5760         PKG_CHECK_MODULES(GTK_2_16,gtk+-2.0 >= 2.16.0,
5761                           [ENABLE_SYSTRAY_GTK="TRUE"
5762                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
5763                           [ENABLE_SYSTRAY_GTK=""])
5764      fi
5765
5766      AC_MSG_CHECKING([whether to enable DBUS support])
5767      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5768          ENABLE_DBUS="TRUE"
5769          AC_MSG_RESULT([yes])
5770          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5771      else
5772          AC_MSG_RESULT([no])
5773      fi
5774
5775      AC_MSG_CHECKING([whether to enable GIO support])
5776      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5777          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5778             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5779          fi
5780          ENABLE_GIO="TRUE"
5781          AC_MSG_RESULT([yes])
5782          PKG_CHECK_MODULES( GIO, gio-2.0 )
5783      else
5784          AC_MSG_RESULT([no])
5785      fi
5786
5787   fi
5788
5789fi
5790AC_SUBST(ENABLE_GIO)
5791AC_SUBST(ENABLE_DBUS)
5792AC_SUBST(ENABLE_SYSTRAY_GTK)
5793AC_SUBST(GTK_CFLAGS)
5794AC_SUBST(GTK_LIBS)
5795AC_SUBST(GTHREAD_CFLAGS)
5796AC_SUBST(GTHREAD_LIBS)
5797
5798dnl ===================================================================
5799dnl Check whether the GStreamer libraries are available.
5800dnl ===================================================================
5801
5802GSTREAMER_CFLAGS=""
5803GSTREAMER_LIBS=""
5804ENABLE_GSTREAMER=""
5805
5806if test "$test_gstreamer" = "yes"; then
5807    AC_MSG_CHECKING([whether to build the GStreamer media backend])
5808    if test "x$enable_gstreamer" != "xno" ; then
5809        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]))
5810        ENABLE_GSTREAMER="TRUE"
5811        AC_MSG_RESULT([yes])
5812    else
5813        AC_MSG_RESULT([no])
5814    fi
5815fi
5816AC_SUBST(ENABLE_GSTREAMER)
5817AC_SUBST(GSTREAMER_CFLAGS)
5818AC_SUBST(GSTREAMER_LIBS)
5819
5820dnl ===================================================================
5821dnl Check the ARM target
5822dnl ===================================================================
5823
5824if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
5825    # default value
5826    ARM_TARGET=ARMV4T
5827    AC_MSG_CHECKING([which ARM processor optimization to use])
5828    if test "$with_arm_target" -lt "6"; then
5829	ARM_TARGET=ARMV4T
5830    elif test "$with_arm_target" = "6"; then
5831	ARM_TARGET=ARMV6
5832    elif test "$with_arm_target" -gt "6"; then
5833	ARM_TARGET=ARMV7
5834    fi
5835    AC_MSG_RESULT([$ARM_TARGET])
5836    AC_SUBST(ARM_TARGET)
5837fi
5838
5839dnl ===================================================================
5840dnl Check whether the Cairo libraries are available.
5841dnl ===================================================================
5842
5843ENABLE_CAIRO=""
5844BUILD_PIXMAN=""
5845SYSTEM_CAIRO=""
5846
5847if test  "$test_cairo" = "yes"; then
5848
5849    AC_MSG_CHECKING([whether to use cairo])
5850    if test "x$enable_cairo" != "xno" ; then
5851        ENABLE_CAIRO="TRUE"
5852	AC_MSG_RESULT([yes])
5853        AC_MSG_CHECKING([which cairo to use])
5854        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
5855           test "$with_system_cairo" != "no"; then
5856           AC_MSG_RESULT([external])
5857           SYSTEM_CAIRO=YES
5858
5859           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
5860	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
5861	      AC_MSG_ERROR([Cairo library requires fontconfig.])
5862	   fi
5863           if test "$with_system_xrender_headers" = "yes"; then
5864              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
5865              AC_TRY_RUN([
5866#include <X11/extensions/Xrender.h>
5867
5868int main(int argc, char **argv) {
5869#ifdef PictStandardA8
5870      return 0;
5871#else
5872      return 1;
5873#endif
5874}
5875               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
5876           fi
5877        else
5878           BUILD_TYPE="$BUILD_TYPE CAIRO"
5879	   dnl === compiler fails on pixman with 64bit architectures...===
5880	   if test "$build_cpu" != "x86_64"; then
5881	      BUILD_PIXMAN=YES
5882	   fi
5883           AC_MSG_RESULT([internal])
5884        fi
5885    else
5886	   AC_MSG_RESULT([no])
5887    fi
5888fi
5889
5890AC_SUBST(ENABLE_CAIRO)
5891AC_SUBST(BUILD_PIXMAN)
5892AC_SUBST(SYSTEM_CAIRO)
5893AC_SUBST(CAIRO_CFLAGS)
5894AC_SUBST(CAIRO_LIBS)
5895
5896ENABLE_CAIRO_CANVAS="FALSE"
5897if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
5898   ENABLE_CAIRO_CANVAS="TRUE"
5899fi
5900AC_SUBST(ENABLE_CAIRO_CANVAS)
5901
5902dnl ===================================================================
5903dnl Check whether the OpenGL libraries are available
5904dnl ===================================================================
5905
5906AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
5907ENABLE_OPENGL=
5908
5909if test "x$enable_opengl" != "xno" ; then
5910   AC_MSG_RESULT([yes])
5911   AC_CHECK_HEADER(GL/gl.h, [],
5912                   [AC_MSG_ERROR([OpenGL headers not found])], [])
5913   AC_CHECK_LIB(GL, main, [],
5914     [AC_MSG_ERROR(libGL not installed or functional)], [])
5915   AC_CHECK_LIB(GLU, main, [],
5916     [AC_MSG_ERROR(libGLU not installed or functional)], [])
5917   ENABLE_OPENGL=TRUE
5918else
5919   AC_MSG_RESULT([no])
5920fi
5921
5922AC_SUBST(ENABLE_OPENGL)
5923
5924AC_MSG_CHECKING([whether to build extra presenter ui])
5925if test -n "$enable_presenter_extra_ui" -a "$enable_presenter_extra_ui" != "no"; then
5926   AC_MSG_RESULT([yes])
5927   ENABLE_PRESENTER_EXTRA_UI=YES
5928else
5929   AC_MSG_RESULT([no])
5930   ENABLE_PRESENTER_EXTRA_UI=NO
5931fi
5932AC_SUBST(ENABLE_PRESENTER_EXTRA_UI)
5933
5934AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
5935if test -n "$enable_minimizer" -a "$enable_minimizer" != "no"; then
5936   AC_MSG_RESULT([yes])
5937   ENABLE_MINIMIZER=YES
5938else
5939   AC_MSG_RESULT([no])
5940   ENABLE_MINIMIZER=NO
5941fi
5942AC_SUBST(ENABLE_MINIMIZER)
5943
5944AC_MSG_CHECKING([whether to build the Presenter Screen extension])
5945if test -n "$enable_presenter_console" -a "$enable_presenter_screen" != "no"; then
5946   AC_MSG_RESULT([yes])
5947   ENABLE_PRESENTER_SCREEN=YES
5948else
5949   AC_MSG_RESULT([no])
5950   ENABLE_PRESENTER_SCREEN=NO
5951fi
5952AC_SUBST(ENABLE_PRESENTER_SCREEN)
5953
5954AC_MSG_CHECKING([whether to build the PDF Import extension])
5955if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
5956  AC_MSG_RESULT([yes])
5957  ENABLE_PDFIMPORT=YES
5958
5959  dnl ===================================================================
5960  dnl Check for system poppler
5961  dnl ===================================================================
5962  AC_MSG_CHECKING([whether to use system pdf backend])
5963  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
5964       test "$with_system_poppler" != "no"; then
5965      AC_MSG_RESULT([external])
5966      SYSTEM_POPPLER=YES
5967      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
5968  else
5969      AC_MSG_RESULT([no])
5970      SYSTEM_POPPLER=NO
5971      ENABLE_PDFIMPORT=NO
5972  fi
5973else
5974   AC_MSG_RESULT([no])
5975   ENABLE_PDFIMPORT=NO
5976fi
5977AC_SUBST(ENABLE_PDFIMPORT)
5978AC_SUBST(SYSTEM_POPPLER)
5979AC_SUBST(POPPLER_CFLAGS)
5980AC_SUBST(POPPLER_LIBS)
5981
5982if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
5983  AC_MSG_CHECKING([for sdext module])
5984  if test -d ./sdext; then
5985   AC_MSG_RESULT([OK])
5986  else
5987   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
5988  fi
5989  BUILD_TYPE="$BUILD_TYPE SDEXT"
5990fi
5991
5992AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
5993if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
5994  AC_MSG_RESULT([yes])
5995  AC_MSG_CHECKING([for swext module])
5996  if test -d ./swext; then
5997   AC_MSG_RESULT([OK])
5998  else
5999   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6000  fi
6001  ENABLE_MEDIAWIKI=YES
6002  BUILD_TYPE="$BUILD_TYPE SWEXT"
6003else
6004  AC_MSG_RESULT([no])
6005  ENABLE_MEDIAWIKI=NO
6006fi
6007AC_SUBST(ENABLE_MEDIAWIKI)
6008
6009if test "$ENABLE_MEDIAWIKI" = "YES"; then
6010  AC_MSG_CHECKING([which Servlet API Jar to use])
6011  if test -n "$with_system_servlet_api"; then
6012    AC_MSG_RESULT([external])
6013    SYSTEM_SERVLETAPI=YES
6014      if test -z "$SERVLETAPI_JAR"; then
6015	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6016      fi
6017      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6018             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6019  else
6020    AC_MSG_RESULT([internal])
6021    SYSTEM_SERVLETAPI=NO
6022    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6023  fi
6024fi
6025AC_SUBST(SYSTEM_SERVLETAPI)
6026AC_SUBST(SERVLETAPI_JAR)
6027
6028AC_MSG_CHECKING([whether to build the Report Builder extension])
6029if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6030  AC_MSG_RESULT([yes])
6031  ENABLE_REPORTBUILDER=YES
6032  SYSTEM_JFREEREPORT=YES
6033  AC_MSG_CHECKING([for reportbuilder module])
6034  if test -d ./reportbuilder; then
6035    AC_MSG_RESULT([OK])
6036  else
6037    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6038  fi
6039  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6040  AC_MSG_RESULT([external])
6041  if test -z $SAC_JAR; then
6042         SAC_JAR=/usr/share/java/sac.jar
6043  fi
6044  AC_CHECK_FILE($SAC_JAR, [],
6045         [AC_MSG_ERROR(sac.jar not found.)], [])
6046
6047  if test -z $LIBXML_JAR; then
6048    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6049      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6050      [
6051        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6052          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6053          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6054        )
6055      ]
6056    )
6057  else
6058    AC_CHECK_FILE($LIBXML_JAR, [],
6059         [AC_MSG_ERROR(libxml.jar not found.)], [])
6060  fi
6061
6062  if test -z $FLUTE_JAR; then
6063    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6064      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6065      [
6066        AC_CHECK_FILE(/usr/share/java/flute.jar,
6067          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6068          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6069        )
6070      ]
6071    )
6072  else
6073    AC_CHECK_FILE($FLUTE_JAR, [],
6074         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6075  fi
6076
6077  if test -z $JFREEREPORT_JAR; then
6078    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6079      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6080      [
6081        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6082          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6083          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6084        )
6085      ]
6086    )
6087  else
6088    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6089         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6090  fi
6091
6092  if test -z $LIBLAYOUT_JAR; then
6093    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6094      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6095      [
6096        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6097          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6098          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6099        )
6100      ]
6101    )
6102  else
6103    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6104         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6105  fi
6106
6107  if test -z $LIBLOADER_JAR; then
6108    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6109      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6110      [
6111        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6112          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6113          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6114        )
6115      ]
6116    )
6117  else
6118    AC_CHECK_FILE($LIBLOADER_JAR, [],
6119         [AC_MSG_ERROR(libloader.jar not found.)], [])
6120  fi
6121
6122  if test -z $LIBFORMULA_JAR; then
6123    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6124      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6125      [
6126        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6127          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6128          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6129        )
6130      ]
6131    )
6132  else
6133    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6134         [AC_MSG_ERROR(libformula.jar not found.)], [])
6135  fi
6136
6137  if test -z $LIBREPOSITORY_JAR; then
6138    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6139      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6140      [
6141        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6142          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6143          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6144        )
6145      ]
6146    )
6147  else
6148    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6149         [AC_MSG_ERROR(librepository.jar not found.)], [])
6150  fi
6151
6152  if test -z $LIBFONTS_JAR; then
6153    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6154      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6155      [
6156        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6157          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6158          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6159        )
6160      ]
6161    )
6162  else
6163    AC_CHECK_FILE($LIBFONTS_JAR, [],
6164         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6165  fi
6166
6167  if test -z $LIBSERIALIZER_JAR; then
6168    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6169      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6170      [
6171        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6172          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6173          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6174        )
6175      ]
6176    )
6177  else
6178    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6179         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6180  fi
6181
6182
6183  if test -z $LIBBASE_JAR; then
6184    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6185      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6186      [
6187        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6188          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6189          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6190        )
6191      ]
6192    )
6193  else
6194    AC_CHECK_FILE($LIBBASE_JAR, [],
6195         [AC_MSG_ERROR(libbase.jar not found.)], [])
6196  fi
6197  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6198else
6199  AC_MSG_RESULT([no])
6200  ENABLE_REPORTBUILDER=NO
6201fi
6202AC_SUBST(ENABLE_REPORTBUILDER)
6203AC_SUBST(SYSTEM_JFREEREPORT)
6204AC_SUBST(SAC_JAR)
6205AC_SUBST(LIBXML_JAR)
6206AC_SUBST(FLUTE_JAR)
6207AC_SUBST(JFREEREPORT_JAR)
6208AC_SUBST(LIBBASE_JAR)
6209AC_SUBST(LIBLAYOUT_JAR)
6210AC_SUBST(LIBLOADER_JAR)
6211AC_SUBST(LIBFORMULA_JAR)
6212AC_SUBST(LIBREPOSITORY_JAR)
6213AC_SUBST(LIBFONTS_JAR)
6214AC_SUBST(LIBSERIALIZER_JAR)
6215
6216# this has to be here because both the wiki publisher and the SRB use
6217# commons-logging
6218if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6219  AC_MSG_CHECKING([which Apache commons-* libs to use])
6220  if test "$with_system_apache_commons" = "yes"; then
6221    SYSTEM_APACHE_COMMONS=YES
6222    AC_MSG_RESULT([external])
6223    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6224      if test -z $COMMONS_CODEC_JAR; then
6225        AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
6226          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
6227          [
6228            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6229              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6230              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6231            )
6232          ]
6233        )
6234      else
6235        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6236             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6237      fi
6238
6239      if test -z $COMMONS_LANG_JAR; then
6240        AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
6241          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
6242          [
6243            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6244              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6245              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6246            )
6247          ]
6248        )
6249      else
6250        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6251             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6252      fi
6253
6254      if test -z $COMMONS_HTTPCLIENT_JAR; then
6255        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6256          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6257          [
6258            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6259              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6260              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6261            )
6262          ]
6263        )
6264      else
6265        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6266             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6267      fi
6268    fi
6269    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6270      if test -z $COMMONS_LOGGING_JAR; then
6271        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
6272          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
6273          [
6274            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6275              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6276              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6277            )
6278          ]
6279        )
6280      else
6281        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6282             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6283      fi
6284    fi
6285  else
6286    AC_MSG_RESULT([internal])
6287    SYSTEM_APACHE_COMMONS=NO
6288    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6289  fi
6290fi
6291AC_SUBST(SYSTEM_APACHE_COMMONS)
6292AC_SUBST(COMMONS_CODEC_JAR)
6293AC_SUBST(COMMONS_LANG_JAR)
6294AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6295AC_SUBST(COMMONS_LOGGING_JAR)
6296
6297dnl ===================================================================
6298dnl Check whether the Qt and KDE libraries are available.
6299dnl ===================================================================
6300
6301KDE_CFLAGS=""
6302KDE_LIBS=""
6303MOC="moc"
6304if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6305    dnl Search paths for Qt and KDE
6306    if test "$build_cpu" != "x86_64" ; then
6307        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"
6308        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"
6309    else
6310        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"
6311        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"
6312    fi
6313    if test -n "$QTDIR" ; then
6314        qt_incdirs="$QTDIR/include $qt_incdirs"
6315        if test "$build_cpu" != "x86_64" ; then
6316            qt_libdirs="$QTDIR/lib $qt_libdirs"
6317        else
6318            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6319        fi
6320    fi
6321    if test "$build_cpu" != "x86_64" ; then
6322        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"
6323        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"
6324    else
6325        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"
6326        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"
6327    fi
6328    if test -n "$KDEDIR" ; then
6329        kde_incdirs="$KDEDIR/include $kde_incdirs"
6330        if test "$build_cpu" != "x86_64" ; then
6331            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6332        else
6333            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6334        fi
6335    fi
6336
6337    dnl What to test
6338    qt_test_include="qstyle.h"
6339    qt_test_library="libqt-mt.so"
6340    kde_test_include="ksharedptr.h"
6341    kde_test_library="libkdeui.so"
6342
6343    dnl Check for Qt headers
6344    AC_MSG_CHECKING([for Qt headers])
6345    qt_incdir="no"
6346    for kde_check in $qt_incdirs ; do
6347        if test -r "$kde_check/$qt_test_include" ; then
6348            qt_incdir="$kde_check"
6349            break
6350        fi
6351    done
6352    AC_MSG_RESULT([$qt_incdir])
6353    if test "x$qt_incdir" = "xno" ; then
6354        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6355your Qt installation by exporting QTDIR before running "configure".])
6356    fi
6357
6358    dnl Check for Qt libraries
6359    AC_MSG_CHECKING([for Qt libraries])
6360    qt_libdir="no"
6361    for qt_check in $qt_libdirs ; do
6362        if test -r "$qt_check/$qt_test_library" ; then
6363            qt_libdir="$qt_check"
6364            break
6365        fi
6366    done
6367    AC_MSG_RESULT([$qt_libdir])
6368    if test "x$qt_libdir" = "xno" ; then
6369        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6370your Qt installation by exporting QTDIR before running "configure".])
6371    fi
6372
6373    dnl Check for Meta Object Compiler
6374    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6375    if test "$MOC" = "no" ; then
6376        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6377the root of your Qt installation by exporting QTDIR before running "configure".])
6378    fi
6379
6380    dnl Check for KDE headers
6381    AC_MSG_CHECKING([for KDE headers])
6382    kde_incdir="no"
6383    for kde_check in $kde_incdirs ; do
6384        if test -r "$kde_check/$kde_test_include" ; then
6385            kde_incdir="$kde_check"
6386            break
6387        fi
6388    done
6389    AC_MSG_RESULT([$kde_incdir])
6390    if test "x$kde_incdir" = "xno" ; then
6391        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6392your KDE installation by exporting KDEDIR before running "configure".])
6393    fi
6394
6395    dnl Check for KDE libraries
6396    AC_MSG_CHECKING([for KDE libraries])
6397    kde_libdir="no"
6398    for kde_check in $kde_libdirs ; do
6399        if test -r "$kde_check/$kde_test_library" ; then
6400            kde_libdir="$kde_check"
6401            break
6402        fi
6403    done
6404    AC_MSG_RESULT([$kde_libdir])
6405    if test "x$kde_libdir" = "xno" ; then
6406        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6407your KDE installation by exporting KDEDIR before running "configure".])
6408    fi
6409
6410    dnl Set the variables
6411    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6412    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6413fi
6414AC_SUBST(KDE_CFLAGS)
6415AC_SUBST(KDE_LIBS)
6416AC_SUBST(MOC)
6417
6418dnl ===================================================================
6419dnl KDE4 Integration
6420dnl ===================================================================
6421
6422KDE4_CFLAGS=""
6423KDE4_LIBS=""
6424MOC4="moc"
6425if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6426   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6427   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6428
6429   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6430   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6431
6432   if test "$build_cpu" = "x86_64" ; then
6433      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6434      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6435   fi
6436
6437   if test -n "$KDE4DIR" ; then
6438      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6439      if test "$build_cpu" != "x86_64" ; then
6440         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6441      else
6442         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6443      fi
6444   fi
6445
6446   qt_test_include="Qt/qobject.h"
6447   qt_test_library="libQtCore.so"
6448   kde_test_include="ksharedptr.h"
6449   kde_test_library="libkdeui.so"
6450
6451   AC_MSG_CHECKING([for Qt4 headers])
6452   qt_header_dir="no"
6453   for inc_dir in $qt_incdirs ; do
6454      if test -r "$inc_dir/$qt_test_include" ; then
6455         qt_header_dir="$inc_dir"
6456         break
6457      fi
6458   done
6459
6460   AC_MSG_RESULT([$qt_header_dir])
6461   if test "x$qt_header_dir" = "xno" ; then
6462      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6463   fi
6464
6465   AC_MSG_CHECKING([for Qt4 libraries])
6466   qt_lib_dir="no"
6467   for lib_dir in $qt_libdirs ; do
6468      if test -r "$lib_dir/$qt_test_library" ; then
6469         qt_lib_dir="$lib_dir"
6470         break
6471      fi
6472   done
6473
6474   AC_MSG_RESULT([$qt_lib_dir])
6475
6476   if test "x$qt_lib_dir" = "xno" ; then
6477      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6478   fi
6479
6480   dnl Check for Meta Object Compiler
6481   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6482   MOC4="$MOCQT4"
6483   if test "$MOC4" = "no" ; then
6484      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6485      if test "$MOC4" = "no" ; then
6486         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6487      fi
6488   fi
6489
6490   dnl Check for KDE4 headers
6491   AC_MSG_CHECKING([for KDE4 headers])
6492   kde_incdir="no"
6493   for kde_check in $kde_incdirs ; do
6494      if test -r "$kde_check/$kde_test_include" ; then
6495         kde_incdir="$kde_check"
6496         break
6497      fi
6498   done
6499   AC_MSG_RESULT([$kde_incdir])
6500   if test "x$kde_incdir" = "xno" ; then
6501      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6502   fi
6503
6504   dnl Check for KDE4 libraries
6505   AC_MSG_CHECKING([for KDE4 libraries])
6506   kde_libdir="no"
6507   for kde_check in $kde_libdirs ; do
6508      if test -r "$kde_check/$kde_test_library" ; then
6509         kde_libdir="$kde_check"
6510         break
6511      fi
6512   done
6513
6514   AC_MSG_RESULT([$kde_libdir])
6515   if test "x$kde_libdir" = "xno" ; then
6516      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6517   fi
6518
6519   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6520   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6521fi
6522AC_SUBST(KDE4_CFLAGS)
6523AC_SUBST(KDE4_LIBS)
6524AC_SUBST(MOC4)
6525
6526dnl ===================================================================
6527dnl Test for the enabling the lockdown pieces
6528dnl ===================================================================
6529AC_MSG_CHECKING([whether to enable the lockdown pieces])
6530ENABLE_LOCKDOWN=""
6531if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6532  ENABLE_LOCKDOWN=YES
6533  AC_MSG_RESULT([yes])
6534else
6535  AC_MSG_RESULT([no])
6536fi
6537AC_SUBST(ENABLE_LOCKDOWN)
6538
6539dnl ===================================================================
6540dnl Test whether to include Evolution 2 support
6541dnl ===================================================================
6542AC_MSG_CHECKING([whether to enable evolution 2 support])
6543if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6544   AC_MSG_RESULT([yes])
6545   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6546   ENABLE_EVOAB2="TRUE"
6547else
6548   ENABLE_EVOAB2=""
6549   AC_MSG_RESULT([no])
6550fi
6551AC_SUBST(ENABLE_EVOAB2)
6552AC_SUBST(GOBJECT_CFLAGS)
6553AC_SUBST(GOBJECT_LIBS)
6554
6555dnl ===================================================================
6556dnl Test whether to include KDE AB support
6557dnl ===================================================================
6558AC_MSG_CHECKING([whether to enable KDE address book support])
6559if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6560   AC_MSG_RESULT([yes])
6561   AC_LANG_PUSH([C++])
6562   save_CXXFLAGS=$CXXFLAGS
6563   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6564   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6565       AC_TRY_RUN([
6566#include <kdeversion.h>
6567
6568int main(int argc, char **argv) {
6569       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6570       else return 1;
6571}
6572       ], [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])])
6573   CXXFLAGS=$save_CXXFLAGS
6574   AC_LANG_POP([C++])
6575   ENABLE_KAB=TRUE
6576else
6577   AC_MSG_RESULT([no])
6578   ENABLE_KAB=
6579fi
6580AC_SUBST(ENABLE_KAB)
6581
6582dnl ===================================================================
6583dnl Test whether to include MathMLDTD
6584dnl ===================================================================
6585AC_MSG_CHECKING([whether to include MathMLDTD])
6586if test -n "$enable_mathmldtd"; then
6587  if test "$enable_mathmldtd" = "no"; then
6588    AC_MSG_RESULT([no])
6589    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6590  else
6591    AC_MSG_RESULT([yes])
6592    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6593  fi
6594else
6595  AC_MSG_RESULT([no])
6596  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6597fi
6598
6599dnl ===================================================================
6600dnl Test whether to include fonts
6601dnl ===================================================================
6602AC_MSG_CHECKING([whether to include third-party fonts])
6603if test "$with_fonts" != "no" ; then
6604  AC_MSG_RESULT([yes])
6605  WITH_FONTS=YES
6606  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6607else
6608  AC_MSG_RESULT([no])
6609  WITH_FONTS=NO
6610  SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
6611fi
6612AC_SUBST(WITH_FONTS)
6613
6614dnl ===================================================================
6615dnl Test whether to include ppds
6616dnl ===================================================================
6617AC_MSG_CHECKING([whether to include PPDs])
6618if test "$with_ppds" != "no"; then
6619  AC_MSG_RESULT([yes])
6620else
6621  AC_MSG_RESULT([no])
6622  WITHOUT_PPDS=YES
6623  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6624fi
6625AC_SUBST(WITHOUT_PPDS)
6626
6627dnl ===================================================================
6628dnl Test whether to include afms
6629dnl ===================================================================
6630AC_MSG_CHECKING([whether to include AFMs])
6631if test "$with_afms" != "no"; then
6632  AC_MSG_RESULT([yes])
6633  BUILD_TYPE="$BUILD_TYPE AFMS"
6634else
6635  AC_MSG_RESULT([no])
6636  WITHOUT_AFMS=YES
6637  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6638fi
6639AC_SUBST(WITHOUT_AFMS)
6640
6641AC_SUBST(SCPDEFS)
6642
6643AC_MSG_CHECKING([whether and how to use Xinerama])
6644if test "$_os" = "Darwin"; then
6645   USE_XINERAMA=YES
6646   XINERAMA_LINK=dynamic
6647   AC_MSG_RESULT([yes])
6648elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6649   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6650      # we have both versions, let the user decide but use the dynamic one
6651      # per default
6652      USE_XINERAMA=YES
6653      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6654         XINERAMA_LINK=dynamic
6655      else
6656         XINERAMA_LINK=static
6657      fi
6658   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6659      # we have only the dynamic version
6660      USE_XINERAMA=YES
6661      XINERAMA_LINK=dynamic
6662   elif test -e "$XLIB/libXinerama.a"; then
6663      # static version
6664      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6665         USE_XINERAMA=YES
6666         XINERAMA_LINK=static
6667      else
6668         USE_XINERAMA=NO
6669         XINERAMA_LINK=none
6670      fi
6671   else
6672      # no Xinerama
6673      USE_XINERAMA=NO
6674      XINERAMA_LINK=none
6675   fi
6676   if test "$USE_XINERAMA" = "YES"; then
6677      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6678      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6679          [AC_MSG_ERROR(Xinerama header not found.)], [])
6680      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6681      if test "$_os" = "FreeBSD"; then
6682          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6683      fi
6684      if test "$_os" = "Linux"; then
6685          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6686      fi
6687      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6688          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6689   else
6690      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6691   fi
6692else
6693   AC_MSG_RESULT([no])
6694fi
6695AC_SUBST(USE_XINERAMA)
6696AC_SUBST(XINERAMA_LINK)
6697
6698dnl ===================================================================
6699dnl always rely on the system version of gdk-pixbuf
6700dnl ===================================================================
6701
6702SYSTEM_GDKPIXBUF=YES
6703AC_SUBST(SYSTEM_GDKPIXBUF)
6704
6705dnl ===================================================================
6706dnl always rely on the system version of glib
6707dnl ===================================================================
6708
6709SYSTEM_GLIB=YES
6710AC_SUBST(SYSTEM_GLIB)
6711
6712dnl ===================================================================
6713dnl always rely on the system version of gettext
6714dnl ===================================================================
6715
6716SYSTEM_GETTEXT=YES
6717AC_SUBST(SYSTEM_GETTEXT)
6718
6719dnl ===================================================================
6720dnl always rely on the system version of pango
6721dnl ===================================================================
6722
6723SYSTEM_PANGO=YES
6724AC_SUBST(SYSTEM_PANGO)
6725
6726dnl ===================================================================
6727dnl Test whether to build libpng or rely on the system version
6728dnl ===================================================================
6729AC_MSG_CHECKING([whether to build own version of libpng])
6730
6731case "$_os" in
6732	WINNT*) # Windows
6733	    SYSTEM_LIBPNG=NO
6734	    AC_MSG_RESULT([yes])
6735		;;
6736	Darwin*)
6737	    SYSTEM_LIBPNG=NO
6738	    AC_MSG_RESULT([yes])
6739	    ;;
6740   *)
6741   SYSTEM_LIBPNG=YES
6742   AC_MSG_RESULT([no])
6743   ;;
6744esac
6745AC_SUBST(SYSTEM_LIBPNG)
6746
6747dnl ===================================================================
6748dnl Test whether to build libjpeg or rely on the system version
6749dnl ===================================================================
6750dnl FIXME: this is currently because we have jpeg-6b for our filters
6751dnl        and jpeg-8 as dependency for librsvg
6752dnl        this should be unified into using only one version for both
6753
6754AC_MSG_CHECKING([whether to build own version of libjpeg])
6755
6756if test "$SYSTEM_JPEG" = "YES"; then
6757SYSTEM_LIBJPEG=YES
6758else
6759case "$_os" in
6760	WINNT*) # Windows
6761	    SYSTEM_LIBJPEG=NO
6762	    AC_MSG_RESULT([yes])
6763		;;
6764	Darwin*)
6765	    SYSTEM_LIBJPEG=NO
6766	    AC_MSG_RESULT([yes])
6767	    ;;
6768   *)
6769   SYSTEM_LIBJPEG=YES
6770   AC_MSG_RESULT([no])
6771   ;;
6772esac
6773fi
6774
6775if test "$SYSTEM_LIBJPEG" = "YES"; then
6776   AC_MSG_RESULT([no])
6777else
6778   AC_MSG_RESULT([yes])
6779fi
6780AC_SUBST(SYSTEM_LIBJPEG)
6781
6782
6783dnl ===================================================================
6784dnl Test for the presence of Ant and that it works
6785dnl ===================================================================
6786
6787if test "$SOLAR_JAVA" != ""; then
6788ANT_HOME=; export ANT_HOME
6789WITH_ANT_HOME=; export WITH_ANT_HOME
6790if test -z "$with_ant_home"; then
6791   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
6792else
6793   if test "$_os" = "WINNT"; then
6794      with_ant_home=`cygpath -u "$with_ant_home"`
6795   fi
6796   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
6797   WITH_ANT_HOME=$with_ant_home
6798   ANT_HOME=$with_ant_home
6799fi
6800
6801if test -z "$ANT"; then
6802  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
6803else
6804  # resolve relative or absolute symlink
6805  while test -h "$ANT"; do
6806     a_cwd=`pwd`
6807     a_basename=`basename "$ANT"`
6808     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
6809     cd "`dirname "$ANT"`"
6810     cd "`dirname "$a_script"`"
6811     ANT="`pwd`"/"`basename "$a_script"`"
6812     cd "$a_cwd"
6813  done
6814
6815  if test "$_os" = "OS2"; then
6816    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
6817    export ANT_HOME
6818  fi
6819
6820  AC_MSG_CHECKING([if $ANT works])
6821cat > conftest.java << EOF
6822    public class conftest {
6823	int testmethod(int a, int b) {
6824            return a + b;
6825	}
6826    }
6827EOF
6828
6829cat > conftest.xml << EOF
6830    <project name="conftest" default="conftest">
6831	<target name="conftest">
6832            <javac srcdir="." includes="conftest.java">
6833	    </javac>
6834	</target>
6835    </project>
6836EOF
6837  oldJAVA_HOME=$JAVA_HOME
6838  if test "$JAVACISGCJ" = "yes"; then
6839    JAVA_HOME=; export JAVA_HOME
6840    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
6841  else
6842    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
6843  fi
6844  AC_TRY_EVAL(ant_cmd)
6845  if test $? = 0 && test -f ./conftest.class ; then
6846    AC_MSG_RESULT([Ant works])
6847    if test -z "$WITH_ANT_HOME"; then
6848        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
6849        if test -z "$ANT_HOME"; then
6850            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
6851        fi
6852    else
6853        ANT_HOME="$WITH_ANT_HOME"
6854    fi
6855  else
6856    echo "configure: Ant test failed" >&5
6857    cat conftest.java >&5
6858    cat conftest.xml >&5
6859    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
6860    ANT_HOME=""
6861    echo "Ant does not work - Some Java projects will not build!" >>warn
6862  fi
6863  JAVA_HOME=$oldJAVA_HOME
6864  rm -f conftest* core core.* *.core
6865fi
6866if test -z "$ANT_HOME"; then
6867   ANT_HOME="NO_ANT_HOME"
6868fi
6869AC_SUBST(ANT_HOME)
6870
6871dnl Checking for ant.jar
6872if test "$ANT_HOME" != "NO_ANT_HOME"; then
6873   AC_MSG_CHECKING([Ant lib directory])
6874   if test -f $ANT_HOME/lib/ant.jar; then
6875	  ANT_LIB="$ANT_HOME/lib"
6876   else
6877      if test -f $ANT_HOME/ant.jar; then
6878	     ANT_LIB="$ANT_HOME"
6879      else
6880          if test -f /usr/share/java/ant.jar; then
6881              ANT_LIB=/usr/share/java
6882          else
6883             if test -f /usr/share/ant-core/lib/ant.jar; then
6884                 ANT_LIB=/usr/share/ant-core/lib
6885             else
6886                if test -f $ANT_HOME/lib/ant/ant.jar; then
6887                    ANT_LIB="$ANT_HOME/lib/ant"
6888                else
6889                   if test -f /usr/share/lib/ant/ant.jar; then
6890                       ANT_LIB=/usr/share/lib/ant
6891                   else
6892                       AC_MSG_ERROR([Ant libraries not found!])
6893                   fi
6894                fi
6895             fi
6896          fi
6897      fi
6898   fi
6899   AC_MSG_RESULT([Ant lib directory found.])
6900fi
6901AC_SUBST(ANT_LIB)
6902fi
6903
6904ant_minver=1.6.0
6905# update for more extensions...
6906if test "$ENABLE_MEDIAWIKI" = "YES"; then
6907  ant_minver=1.7.0
6908fi
6909ant_minminor1=`echo $ant_minver | cut -d"." -f2`
6910
6911AC_MSG_CHECKING([whether ant is >= $ant_minver])
6912ant_version=`$ANT -version | $AWK '{ print $4; }'`
6913ant_version_major=`echo $ant_version | cut -d. -f1`
6914ant_version_minor=`echo $ant_version | cut -d. -f2`
6915echo "configure: ant_version $ant_version " >&5
6916echo "configure: ant_version_major $ant_version_major " >&5
6917echo "configure: ant_version_minor $ant_version_minor " >&5
6918if test "$ant_version_major" -ge "2"; then
6919   AC_MSG_RESULT([yes, $ant_version])
6920elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
6921   AC_MSG_RESULT([yes, $ant_version])
6922else
6923   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
6924fi
6925
6926if test "$ENABLE_MEDIAWIKI" = "YES"; then
6927AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
6928rm -rf confdir
6929mkdir confdir
6930cat > conftest.java << EOF
6931    public class conftest {
6932        int testmethod(int a, int b) {
6933            return a + b;
6934        }
6935    }
6936EOF
6937
6938cat > conftest.xml << EOF
6939    <project name="conftest" default="conftest">
6940        <target name="conftest" depends="copytest">
6941            <javac srcdir="." includes="conftest.java">
6942            </javac>
6943        </target>
6944        <target name="copytest">
6945             <copy todir="confdir">
6946                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
6947                 <filterset/>
6948                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
6949             </copy>
6950        </target>
6951    </project>
6952EOF
6953  if test "$JAVACISGCJ" = "yes"; then
6954    JAVA_HOME=; export JAVA_HOME
6955    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
6956  else
6957    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
6958  fi
6959  AC_TRY_EVAL(ant_cmd)
6960  if test $? = 0 && test -f ./conftest.class ; then
6961    AC_MSG_RESULT([yes])
6962    rm -rf confdir
6963  else
6964    echo "configure: Ant test failed" >&5
6965    cat conftest.java >&5
6966    cat conftest.xml >&5
6967    rm -rf confdir
6968    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
6969  fi
6970fi
6971rm -f conftest* core core.* *.core
6972
6973OOO_JUNIT_JAR=
6974if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
6975    AC_MSG_CHECKING([for JUnit 4])
6976    if test "$with_junit" = "yes"; then
6977        if test -e /usr/share/java/junit4.jar; then
6978            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
6979        else
6980           if test -e /usr/share/lib/java/junit.jar; then
6981              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
6982           else
6983              OOO_JUNIT_JAR=/usr/share/java/junit.jar
6984           fi
6985        fi
6986    else
6987        OOO_JUNIT_JAR=$with_junit
6988    fi
6989    if test "$_os" = "WINNT"; then
6990        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
6991    fi
6992    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
6993        grep org/junit/Before.class > /dev/null 2>&5
6994    if test $? -eq 0; then
6995        AC_MSG_RESULT([$OOO_JUNIT_JAR])
6996    else
6997        AC_MSG_RESULT([no])
6998        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
6999location (/usr/share/java), specify its pathname via
7000--with-junit=..., or disable it via --without-junit])
7001    fi
7002fi
7003AC_SUBST(OOO_JUNIT_JAR)
7004
7005AC_MSG_CHECKING([which languages to be built])
7006WITH_LANG="$with_lang"
7007if test -z "$WITH_LANG"; then
7008   AC_MSG_RESULT([en-US])
7009else
7010   AC_MSG_RESULT([$WITH_LANG])
7011fi
7012AC_SUBST(WITH_LANG)
7013
7014AC_MSG_CHECKING([which languages have poor help localizations])
7015WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7016if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7017   AC_MSG_RESULT([none])
7018else
7019   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7020fi
7021AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7022
7023AC_MSG_CHECKING([which dictionaries to include])
7024if test -z "$with_dict"; then
7025   WITH_DICT=,ALL,
7026   AC_MSG_RESULT([ALL])
7027else
7028   WITH_DICT=","$with_dict","
7029   AC_MSG_RESULT([$with_dict])
7030fi
7031AC_SUBST(WITH_DICT)
7032
7033AC_MSG_CHECKING([for additional 'intro' bitmaps])
7034INTRO_BITMAPS=
7035if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7036   INTRO_BITMAPS=
7037   AC_MSG_RESULT([none])
7038else
7039   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7040      case "$bitmap" in
7041         *.bmp) ;;
7042         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .bmp files!]) ;;
7043      esac
7044      if test -n "$bitmap" ; then
7045         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7046      fi
7047   done
7048   AC_MSG_RESULT([$INTRO_BITMAPS])
7049fi
7050AC_SUBST(INTRO_BITMAPS)
7051
7052AC_MSG_CHECKING([for additional 'about' bitmaps])
7053ABOUT_BITMAPS=
7054if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7055   ABOUT_BITMAPS=
7056   AC_MSG_RESULT([none])
7057else
7058   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7059      case "$bitmap" in
7060         *.bmp) ;;
7061         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .bmp files!]) ;;
7062      esac
7063      if test -n "$bitmap" ; then
7064         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7065      fi
7066   done
7067   AC_MSG_RESULT([$ABOUT_BITMAPS])
7068fi
7069AC_SUBST(ABOUT_BITMAPS)
7070
7071OOO_VENDOR=
7072AC_MSG_CHECKING([for vendor])
7073if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7074   AC_MSG_RESULT([not set])
7075else
7076   OOO_VENDOR="$with_vendor"
7077   AC_MSG_RESULT([$OOO_VENDOR])
7078fi
7079AC_SUBST(OOO_VENDOR)
7080
7081UNIXWRAPPERNAME=
7082AC_MSG_CHECKING([for UNIX wrapper name])
7083if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7084   AC_MSG_RESULT([not set])
7085else
7086   UNIXWRAPPERNAME="$with_unix_wrapper"
7087   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7088fi
7089AC_SUBST(UNIXWRAPPERNAME)
7090
7091AC_MSG_CHECKING([whether to statically link to Gtk])
7092if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7093   ENABLE_STATIC_GTK="TRUE"
7094   AC_MSG_RESULT([yes])
7095else
7096   ENABLE_STATIC_GTK="FALSE"
7097   AC_MSG_RESULT([no])
7098fi
7099AC_SUBST(ENABLE_STATIC_GTK)
7100
7101AC_MSG_CHECKING([whether to use layout dialogs])
7102if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7103   ENABLE_LAYOUT="TRUE"
7104   AC_MSG_RESULT([yes])
7105else
7106   ENABLE_LAYOUT="FALSE"
7107   AC_MSG_RESULT([no])
7108fi
7109AC_SUBST(ENABLE_LAYOUT)
7110
7111# ===================================================================
7112# De- or increase default verbosity of build process
7113# ===================================================================
7114AC_MSG_CHECKING([build verbosity])
7115if test -n "$enable_verbose"; then
7116   if test "$enable_verbose" = "yes"; then
7117      VERBOSE="TRUE"
7118      AC_MSG_RESULT([high])
7119   fi
7120   if test "$enable_verbose" = "no"; then
7121      VERBOSE="FALSE"
7122      AC_MSG_RESULT([low])
7123   fi
7124else
7125   AC_MSG_RESULT([not set])
7126fi
7127AC_SUBST(VERBOSE)
7128
7129dnl ===================================================================
7130dnl Hook up OOos nodep environmental variable to automake's equivalent
7131dnl --enable-dependency-tracking configure option
7132dnl ===================================================================
7133AC_MSG_CHECKING([whether to enable dependency tracking])
7134if test "$enable_dependency_tracking" = "no"; then
7135    nodep=TRUE
7136    AC_MSG_RESULT([no])
7137else
7138    AC_MSG_RESULT([yes])
7139fi
7140AC_SUBST(nodep)
7141
7142dnl ===================================================================
7143dnl Setting up the environment.
7144dnl ===================================================================
7145echo "********************************************************************"
7146echo "*                                                                  *"
7147echo "*   Setting up the build environment variables.                    *"
7148echo "*                                                                  *"
7149echo "********************************************************************"
7150
7151if test -z "$COMPATH"; then
7152   AC_MSG_ERROR([No compiler found.])
7153fi
7154AC_SUBST(COMPATH)
7155
7156AC_MSG_CHECKING([solver path])
7157if test -z "$with_local_solver"; then
7158   LOCAL_SOLVER="DEFAULT"
7159   AC_MSG_RESULT([default])
7160else
7161   LOCAL_SOLVER=$with_local_solver
7162   AC_MSG_RESULT([$with_local_solver])
7163fi
7164AC_SUBST(LOCAL_SOLVER)
7165
7166AC_SUBST(BUILD_TYPE)
7167
7168# make sure config.guess is +x; we execute config.guess, so it has to be so;
7169chmod +x ./config.guess
7170
7171AC_OUTPUT([set_soenv Makefile])
7172
7173dnl Executing the set_soenv script to setup the environment variables.
7174chmod a+x set_soenv
7175if test -z "$enable_check_only"; then
7176   './set_soenv'
7177else
7178   echo
7179   echo Test Complete
7180   echo No environment file will be generated
7181   echo
7182   num_warnings=`wc -l warn`
7183   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7184   if test $_num -gt 0; then
7185      echo The following warning\(s\) were generated by configure
7186      echo ----------------------------------------------------
7187      echo
7188      cat warn
7189      echo
7190   else
7191      echo There were no warnings
7192   fi
7193   echo
7194fi
7195