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