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