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