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