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