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