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