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