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