xref: /aoo42x/main/configure.ac (revision 421c89d1)
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 of agg altogether
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)
5107else
5108  AC_MSG_RESULT([no])
5109  ENABLE_AGG=NO
5110
5111  dnl ===================================================================
5112  dnl Check for system AGG
5113  dnl ===================================================================
5114  AC_MSG_CHECKING([which AGG to use])
5115  if test -n "$with_system_agg" -o -n "$with_system_libs" && \
5116     test "$with_system_agg" != "no"; then
5117         AC_MSG_RESULT([external])
5118         PKG_CHECK_MODULES(AGG, libagg >= 2.3)
5119         AC_MSG_CHECKING([agg version])
5120         # workaround; if AGG_CFLAGS is empty (broken libagg.pc in 2.3), add /usr/include/agg2 anyway
5121         # (/usr/include gets stripped from pkg-config output)
5122         if test -z "$AGG_CFLAGS" || test "$AGG_CFLAGS" = " "; then
5123            AGG_INCDIR="`$PKG_CONFIG --variable includedir libagg`/agg2"
5124         else
5125            AGG_INCDIR="`echo $AGG_CFLAGS | $SED -e s/-I//`"
5126         fi
5127	 if $PKG_CONFIG --modversion libagg | grep -q 2.3 || \
5128	 	$PKG_CONFIG --modversion libagg | grep -q 2.4; then
5129            # 2.4's libagg.pc.in still contains 2.3 :/
5130            if $EGREP -q "Version 2.4" `echo $AGG_INCDIR`/agg_basics.h; then
5131               AC_MSG_RESULT([2.4])
5132               AGG_VERSION=2400
5133            else
5134               AC_MSG_RESULT([2.3])
5135               AGG_VERSION=2300
5136            fi
5137            SYSTEM_AGG=YES
5138	 else
5139	    AC_MSG_ERROR([only agg 2.3 and 2.4 are supported])
5140	 fi
5141  else
5142         AC_MSG_RESULT([internal])
5143         SYSTEM_AGG=NO
5144         AGG_VERSION=2400
5145         BUILD_TYPE="$BUILD_TYPE AGG"
5146  fi
5147  AC_SUBST(SYSTEM_AGG)
5148  AC_SUBST(AGG_VERSION)
5149fi
5150
5151dnl ===================================================================
5152dnl Check for system redland
5153dnl ===================================================================
5154AC_MSG_CHECKING([which redland library to use])
5155if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5156	test "$with_system_redland" != "no"; then
5157	AC_MSG_RESULT([external])
5158	SYSTEM_REDLAND=YES
5159   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5160   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5161else
5162	AC_MSG_RESULT([internal])
5163	BUILD_TYPE="$BUILD_TYPE REDLAND"
5164	SYSTEM_REDLAND=NO
5165fi
5166AC_SUBST(SYSTEM_REDLAND)
5167AC_SUBST(REDLAND_CFLAGS)
5168AC_SUBST(REDLAND_LIBS)
5169
5170dnl ===================================================================
5171dnl Check for system hunspell
5172dnl ===================================================================
5173
5174if test -n "$enable_copyleft" -a "$enable_copyleft" != "no"; then
5175
5176AC_MSG_CHECKING([which libhunspell to use])
5177if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5178	test "$with_system_hunspell" != "no"; then
5179    AC_MSG_RESULT([external])
5180    SYSTEM_HUNSPELL=YES
5181    AC_LANG_PUSH([C++])
5182    PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5183    if test "$HUNSPELL_PC" != "TRUE"; then
5184      AC_CHECK_HEADER(hunspell.hxx, [],
5185      [
5186      AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5187           [AC_MSG_ERROR(hunspell headers not found.)], [])
5188         ], [])
5189      AC_CHECK_LIB(hunspell, main, [],
5190           [ AC_MSG_ERROR(hunspell library not found.) ], [])
5191      HUNSPELL_LIBS=-lhunspell
5192     fi
5193    AC_LANG_POP([C++])
5194else
5195    AC_MSG_RESULT([internal])
5196    SYSTEM_HUNSPELL=NO
5197    BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5198fi
5199AC_SUBST(SYSTEM_HUNSPELL)
5200AC_SUBST(HUNSPELL_CFLAGS)
5201AC_SUBST(HUNSPELL_LIBS)
5202
5203dnl ===================================================================
5204dnl Checking for altlinuxhyph
5205dnl ===================================================================
5206AC_MSG_CHECKING([which altlinuxhyph to use])
5207if test -n "$with_system_altlinuxhyph" -o -n "$with_system_libs" && \
5208	test "$with_system_altlinuxhyph" != "no"; then
5209    AC_MSG_RESULT([external])
5210    SYSTEM_HYPH=YES
5211    AC_CHECK_HEADER(hyphen.h, [],
5212       [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
5213    AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5214       [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
5215       [#include <hyphen.h>])
5216    AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5217        [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
5218    if test -z "$HYPHEN_LIB"; then
5219       AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5220           [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
5221    fi
5222    if test -z "$HYPHEN_LIB"; then
5223       AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5224           [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
5225    fi
5226else
5227    AC_MSG_RESULT([internal])
5228    SYSTEM_HYPH=NO
5229    BUILD_TYPE="$BUILD_TYPE HYPHEN"
5230fi
5231AC_SUBST(SYSTEM_HYPH)
5232AC_SUBST(HYPHEN_LIB)
5233
5234dnl ===================================================================
5235dnl Checking for mythes
5236dnl ===================================================================
5237AC_MSG_CHECKING([which mythes to use])
5238if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5239   test "$with_system_mythes" != "no"; then
5240    AC_MSG_RESULT([external])
5241    SYSTEM_MYTHES=YES
5242    AC_LANG_PUSH([C++])
5243    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5244    if test "$MYTHES_PKGCONFIG" = "no"; then
5245        AC_CHECK_HEADER(mythes.hxx, [],
5246            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5247        AC_CHECK_LIB(mythes-1.2, main, [],
5248            [ MYTHES_FOUND=no], [])
5249 	if test "$MYTHES_FOUND" = "no"; then
5250            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5251                [ MYTHES_FOUND=no], [])
5252	fi
5253	if test "$MYTHES_FOUND" = "no"; then
5254		AC_MSG_ERROR([mythes library not found!.])
5255	fi
5256    fi
5257    AC_LANG_POP([C++])
5258else
5259    AC_MSG_RESULT([internal])
5260    SYSTEM_MYTHES=NO
5261    BUILD_TYPE="$BUILD_TYPE MYTHES"
5262fi
5263AC_SUBST(SYSTEM_MYTHES)
5264AC_SUBST(MYTHES_CFLAGS)
5265AC_SUBST(MYTHES_LIBS)
5266
5267fi
5268
5269dnl ===================================================================
5270dnl Checking for lpsolve
5271dnl ===================================================================
5272AC_MSG_CHECKING([which lpsolve to use])
5273if test -n "$with_system_lpsolve" -o -n "$with_system_libs" && \
5274	test "$with_system_lpsolve" != "no"; then
5275    AC_MSG_RESULT([external])
5276    SYSTEM_LPSOLVE=YES
5277    AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
5278       [ AC_MSG_ERROR(lpsolve headers not found.)], [])
5279    # some systems need this. Like Ubuntu....
5280    AC_CHECK_LIB(m, floor)
5281    AC_CHECK_LIB(dl, dlopen)
5282    AC_CHECK_LIB(lpsolve55, make_lp, ,
5283        [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
5284else
5285    AC_MSG_RESULT([internal])
5286    SYSTEM_LPSOLVE=NO
5287    BUILD_TYPE="$BUILD_TYPE LPSOLVE"
5288fi
5289AC_SUBST(SYSTEM_LPSOLVE)
5290
5291dnl ===================================================================
5292dnl Checking for libtextcat
5293dnl ===================================================================
5294AC_MSG_CHECKING([which libtextcat to use])
5295if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5296    AC_MSG_RESULT([external])
5297    SYSTEM_LIBTEXTCAT=YES
5298    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5299       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5300    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5301        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5302else
5303    AC_MSG_RESULT([internal])
5304    SYSTEM_LIBTEXTCAT=NO
5305    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5306fi
5307AC_SUBST(SYSTEM_LIBTEXTCAT)
5308
5309AC_MSG_CHECKING([which libtextcat data directory to use])
5310if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5311    if test "$with_system_libtextcat_data" = "yes"; then
5312        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5313    else
5314        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5315    fi
5316    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5317else
5318    AC_MSG_RESULT([internal])
5319    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5320fi
5321AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5322
5323dnl ***************************************
5324dnl testing libc version for Linux...
5325dnl ***************************************
5326if test "$_os" = "Linux"; then
5327   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5328   exec 6>/dev/null # no output
5329   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5330   exec 6>&1 # output on again
5331   if test "$HAVE_LIBC"; then
5332      AC_MSG_RESULT([yes])
5333   else
5334      AC_MSG_ERROR([no, upgrade libc])
5335   fi
5336fi
5337
5338if test "$_os" != "WNT"; then
5339  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5340  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5341  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5342	SYSTEM_LIBC=YES
5343  fi
5344else
5345  HAVE_GETOPT=NO
5346  HAVE_READDIR_R=NO
5347  SYSTEM_LIBC=YES
5348fi
5349AC_SUBST(HAVE_GETOPT)
5350AC_SUBST(HAVE_READDIR_R)
5351AC_SUBST(SYSTEM_LIBC)
5352
5353dnl =========================================
5354dnl Check for the Microsoft Platform SDK.
5355dnl =========================================
5356dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5357dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5358if test \( "$_os" = "WINNT" \) ; then
5359	AC_MSG_CHECKING([for PSDK files])
5360	if test -z "$with_psdk_home"; then
5361		# This first line will detect a February 2003 Microsoft Platform SDK
5362		PSDK_HOME=`./oowintool --psdk-home`
5363        # But there might be also an April 2005 PSDK, unfortunately MS changed
5364        # the registry entry. (we prefer the old version!?)
5365        if test -z "$PSDK_HOME"; then
5366          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5367        fi
5368            # normalize if found
5369            if test -n "$PSDK_HOME"; then
5370              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5371              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5372           fi
5373	else
5374           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5375	fi
5376        # Remove a possible trailing backslash
5377        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5378    # Problem with current PSDK (iz 49865)
5379    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5380        AC_MSG_ERROR([
5381
5382Some modules do not build correctly with MS Platform SDK - April 2005
5383Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5384Remove/rename/backup that file and restart configure. Details about this
5385problem can be found in issue 49856.])
5386    fi
5387# WIndows SDK has different headers
5388	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5389		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5390		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5391		HAVE_PSDK_H="yes"
5392	else
5393		HAVE_PSDK_H="no"
5394	fi
5395	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5396		HAVE_PSDK_LIB="yes"
5397	else
5398		HAVE_PSDK_LIB="no"
5399	fi
5400    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5401        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5402are installed or use --with-psdk-home .])
5403    fi
5404    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5405         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5406         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5407         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5408        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5409    fi
5410    AC_MSG_RESULT([SDK files found ...)])
5411dnl Check if this is the right SDK.
5412    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5413        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5414        WINDOWS_VISTA_PSDK=TRUE
5415    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5416        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5417        WINDOWS_VISTA_PSDK=TRUE
5418    else
5419        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5420    fi
5421fi
5422AC_SUBST(PSDK_HOME)
5423AC_SUBST(WINDOWS_VISTA_PSDK)
5424
5425dnl =========================================
5426dnl Check for the Microsoft DirectX SDK.
5427dnl =========================================
5428if test \( "$_os" = "WINNT" \) ; then
5429    AC_MSG_CHECKING([for DirectX SDK files])
5430    if test -z "$with_directx_home"; then
5431        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5432        if test -n "$DXSDK_DIR"; then
5433            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5434            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5435        fi
5436        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5437        # the "DirectX SDK files not found" error later
5438    else
5439	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5440    fi
5441    # Remove a possible trailing backslash
5442    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5443
5444    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5445        HAVE_DIRECTXSDK_H="yes"
5446    else
5447        HAVE_DIRECTXSDK_H="no"
5448    fi
5449    # MS changed the location of the libraries with dec 2004 directx sdk
5450    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5451        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5452    else
5453        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5454    fi
5455    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5456        HAVE_DIRECTXSDK_LIB="yes"
5457    else
5458        HAVE_DIRECTXSDK_LIB="no"
5459    fi
5460    if test -n "$ENABLE_DIRECTX"; then
5461	    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
5462		    AC_MSG_RESULT([found])
5463	    else
5464		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5465	    fi
5466    else
5467		DIRECTXSDK_HOME=""
5468		AC_MSG_RESULT([disabled])
5469    fi
5470fi
5471AC_SUBST(DIRECTXSDK_HOME)
5472AC_SUBST(DIRECTXSDK_LIB)
5473
5474dnl ============================================
5475dnl Check for Nullsoft Scriptable Install System
5476dnl ============================================
5477NSIS_PATH=""
5478if test "$_os" = "WINNT" ; then
5479    AC_MSG_CHECKING([for NSIS])
5480    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5481    if test -n "$NSIS_PATH"; then
5482        NSIS_PATH=`dirname "$NSIS_PATH"`
5483    fi
5484    if test -n "$with_nsis_path"; then
5485        with_nsis_path=`cygpath -u "$with_nsis_path"`
5486    fi
5487    if test -e "$with_nsis_path/nsis.exe"; then
5488        NSIS_PATH="$with_nsis_path"
5489    fi
5490    nsistest=`./oowintool --nsis-dir`;
5491    if test -x "$nsistest/nsis.exe"; then
5492        NSIS_PATH="$nsistest"
5493    fi
5494    if test -z "$NSIS_PATH"; then
5495        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5496        echo "NSIS not found, no self contained installer will be build." >> warn
5497    else
5498        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5499        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5500        AC_MSG_RESULT([found ($NSIS_PATH)])
5501    fi
5502fi
5503AC_SUBST(NSIS_PATH)
5504
5505dnl ***************************************
5506dnl testing bison and flex exist
5507dnl ***************************************
5508AC_PATH_PROG(BISON, bison)
5509if test -z "$BISON"; then
5510   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5511else
5512   AC_MSG_CHECKING([the bison version])
5513   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5514    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5515    # Accept newer than 1.875 or older(equal) than 1.75
5516    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5517       if test "$_bison_version" = "1.875" ; then
5518          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5519          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5520       else
5521          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5522       fi
5523    else
5524       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5525    fi
5526fi
5527AC_PATH_PROG(FLEX, flex)
5528if test -z "$FLEX"; then
5529   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5530fi
5531dnl ***************************************
5532dnl testing that patch exists
5533dnl ***************************************
5534AC_PATH_PROG(PATCH, patch)
5535if test -z "$PATCH"; then
5536   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5537fi
5538
5539dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5540if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5541   if test -z "$with_gnu_patch"; then
5542      GNUPATCH=$PATCH
5543   else
5544      if test -x "$with_gnu_patch"; then
5545	      GNUPATCH=$with_gnu_patch
5546      else
5547         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5548      fi
5549   fi
5550
5551   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5552   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5553	   AC_MSG_RESULT([yes])
5554   else
5555      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5556   fi
5557fi
5558
5559dnl We also need to check for --with-gnu-cp
5560
5561if test -z "$with_gnu_cp"; then
5562   # check the place where the good stuff is hidden on Solaris...
5563   if test -x /usr/gnu/bin/cp; then
5564      GNUCP=/usr/gnu/bin/cp
5565   else
5566      AC_PATH_PROGS(GNUCP, gnucp cp)
5567   fi
5568   if test -z $GNUCP; then
5569      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5570   fi
5571else
5572   if test -x "$with_gnu_cp"; then
5573      GNUCP=$with_gnu_cp
5574   else
5575      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5576   fi
5577fi
5578
5579AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5580if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5581   AC_MSG_RESULT([yes])
5582else
5583   AC_MSG_RESULT([no])
5584   GNUCP=''
5585fi
5586
5587if test -z "$GNUCP"; then
5588   if test "$_os" = "SunOS" -o "$_os" = "FreeBSD"; then
5589      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5590   else
5591      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5592   fi
5593fi
5594
5595AC_SUBST(GNUPATCH)
5596AC_SUBST(GNUCP)
5597
5598dnl ***************************************
5599dnl testing bash tools path on Windows
5600dnl ***************************************
5601if test "$_os" = "WINNT"; then
5602    CYGWIN_PATH=""
5603    AC_PATH_PROG(CYGWIN_PATH, bash)
5604    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5605fi
5606if test -z "$CYGWIN_PATH"; then
5607   CYGWIN_PATH="NO_CYGWIN"
5608fi
5609AC_SUBST(CYGWIN_PATH)
5610
5611dnl ***************************************
5612dnl testing ml.exe assembler path
5613dnl ***************************************
5614if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5615  AC_MSG_CHECKING([ml.exe assembler path])
5616  if test -n "$with_asm_home"; then
5617    with_asm_home=`cygpath -u "$with_asm_home"`
5618  fi
5619  if test ! -x "$with_asm_home/ml.exe"; then
5620    AC_PATH_PROG(ML_EXE, ml.exe)
5621    if test -z "$ML_EXE"; then
5622      if test -x "$with_cl_home/bin/ml.exe"; then
5623        with_asm_home=$with_cl_home/bin
5624        AC_MSG_RESULT([found ($with_asm_home)])
5625      else
5626        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5627      fi
5628    else
5629       with_asm_home="ASM_IN_PATH"
5630    fi
5631  fi
5632  AC_MSG_RESULT([$ASM_HOME])
5633else
5634  with_asm_home="NO_ASM_HOME"
5635fi
5636ASM_HOME="$with_asm_home"
5637AC_SUBST(ASM_HOME)
5638
5639dnl ===================================================================
5640dnl testing handle deprecated unzip switch
5641dnl ===================================================================
5642if test -z "$with_zip_home"; then
5643	with_zip_home="$with_unzip_home"
5644fi
5645dnl ===================================================================
5646dnl Zip will be found where you tell me to find it
5647dnl ===================================================================
5648if test -n "$with_zip_home" ; then
5649    if test "$_os" = "WINNT"; then
5650        with_zip_home=`cygpath -u "$with_zip_home"`
5651    fi
5652    ZIP="$with_zip_home/zip"
5653    UNZIP="$with_zip_home/unzip"
5654    ZIP_HOME="$with_zip_home"
5655else
5656    AC_PATH_PROG(ZIP, zip)
5657    AC_PATH_PROG(UNZIP, unzip)
5658    ZIP_HOME=`dirname "$ZIP"`
5659fi
5660dnl ===================================================================
5661dnl Zip must be available or else it is an error, all platforms
5662dnl ===================================================================
5663if test -z "$ZIP" -o -z "$UNZIP"; then
5664    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5665fi
5666
5667dnl ===================================================================
5668dnl Zip must be a specific type for different build types.
5669dnl ===================================================================
5670if test "$_os" = "WINNT"; then
5671    if test -n "`$ZIP -h | grep -i WinNT`" ; then
5672AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5673    fi
5674fi
5675AC_SUBST(ZIP_HOME)
5676
5677dnl ===================================================================
5678dnl Windows builds need dbghelp.dll in external/dbghelp/
5679dnl ===================================================================
5680if test "$_os" = "WINNT"; then
5681   AC_MSG_CHECKING([for dbghelp.dll])
5682   if test -x ./external/dbghelp/dbghelp.dll; then
5683      AC_MSG_RESULT([found and executable])
5684   else
5685      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5686Get it from the Microsoft site and put it into external/dbghelp.
5687(Note: Microsoft seems to enjoy changing the exact location of this file. You
5688may have to search Microsoft's website.) Last time it was seen at:
5689<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5690   fi
5691fi
5692
5693dnl ===================================================================
5694dnl Windows builds - use oowintool to copy CRT dlls and manifest
5695dnl ===================================================================
5696if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5697       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5698          :
5699       else
5700          AC_MSG_ERROR([oowintool failed to copy CRT])
5701       fi
5702fi
5703
5704dnl ===================================================================
5705dnl Windows builds need gdiplus.dll in external/gdiplus/
5706dnl ===================================================================
5707if test "$_os" = "WINNT"; then
5708   AC_MSG_CHECKING([for gdiplus.dll])
5709   if test -x ./external/gdiplus/gdiplus.dll; then
5710      AC_MSG_RESULT([found and executable])
5711   else
5712      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5713Get it from the Microsoft site and put it into external/gdiplus.
5714You may have to search Microsoft's website. Last time it was seen at:
5715<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5716   fi
5717fi
5718
5719dnl ===================================================================
5720dnl Test which vclplugs have to be built.
5721dnl ===================================================================
5722AC_MSG_CHECKING([which VCLplugs shall be built])
5723ENABLE_GTK=""
5724if test "x$enable_gtk" = "xyes"; then
5725    ENABLE_GTK="TRUE"
5726    R="gtk"
5727fi
5728AC_SUBST(ENABLE_GTK)
5729
5730ENABLE_KDE=""
5731if test "x$enable_kde" = "xyes"; then
5732    ENABLE_KDE="TRUE"
5733    R="$R kde"
5734fi
5735AC_SUBST(ENABLE_KDE)
5736
5737ENABLE_KDE4=""
5738if test "x$enable_kde4" = "xyes"; then
5739    ENABLE_KDE4="TRUE"
5740    R="$R kde4"
5741fi
5742AC_SUBST(ENABLE_KDE4)
5743
5744if test -z "$R"; then
5745	AC_MSG_RESULT([none])
5746else
5747	AC_MSG_RESULT([$R])
5748fi
5749
5750dnl ===================================================================
5751dnl GCONF check
5752dnl ===================================================================
5753
5754ENABLE_GCONF=""
5755AC_MSG_CHECKING([whether to enable GConf support])
5756if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5757    ENABLE_GCONF="TRUE"
5758    AC_MSG_RESULT([yes])
5759    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5760else
5761    AC_MSG_RESULT([no])
5762fi
5763AC_SUBST(ENABLE_GCONF)
5764
5765dnl ===================================================================
5766dnl Gnome VFS check
5767dnl ===================================================================
5768
5769ENABLE_GNOMEVFS=""
5770AC_MSG_CHECKING([whether to enable GNOME VFS support])
5771if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5772    ENABLE_GNOMEVFS="TRUE"
5773    AC_MSG_RESULT([yes])
5774    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5775    if test "$ENABLE_GCONF" != "TRUE"; then
5776        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5777    fi
5778else
5779    AC_MSG_RESULT([no])
5780fi
5781AC_SUBST(ENABLE_GNOMEVFS)
5782
5783dnl ===================================================================
5784dnl Check whether the gtk 2.0 libraries are available.
5785dnl ===================================================================
5786
5787GTK_CFLAGS=""
5788GTK_LIBS=""
5789ENABLE_SYSTRAY_GTK=""
5790ENABLE_DBUS=""
5791if test  "$test_gtk" = "yes"; then
5792
5793   if test "$ENABLE_GTK" = "TRUE" ; then
5794      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]))
5795      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]))
5796      BUILD_TYPE="$BUILD_TYPE GTK"
5797
5798      if test "x$enable_systray" = "xyes"; then
5799         ENABLE_SYSTRAY_GTK="TRUE"
5800         BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"
5801      fi
5802
5803      AC_MSG_CHECKING([whether to enable DBUS support])
5804      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5805          ENABLE_DBUS="TRUE"
5806          AC_MSG_RESULT([yes])
5807          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5808      else
5809          AC_MSG_RESULT([no])
5810      fi
5811
5812      AC_MSG_CHECKING([whether to enable GIO support])
5813      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5814          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5815             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5816          fi
5817          ENABLE_GIO="TRUE"
5818          AC_MSG_RESULT([yes])
5819          PKG_CHECK_MODULES( GIO, gio-2.0 )
5820      else
5821          AC_MSG_RESULT([no])
5822      fi
5823
5824   fi
5825
5826fi
5827AC_SUBST(ENABLE_GIO)
5828AC_SUBST(ENABLE_DBUS)
5829AC_SUBST(ENABLE_SYSTRAY_GTK)
5830AC_SUBST(GTK_CFLAGS)
5831AC_SUBST(GTK_LIBS)
5832AC_SUBST(GTHREAD_CFLAGS)
5833AC_SUBST(GTHREAD_LIBS)
5834
5835dnl ===================================================================
5836dnl Check whether the GStreamer libraries are available.
5837dnl ===================================================================
5838
5839GSTREAMER_CFLAGS=""
5840GSTREAMER_LIBS=""
5841ENABLE_GSTREAMER=""
5842
5843if test "$test_gstreamer" = "yes"; then
5844    AC_MSG_CHECKING([whether to build the GStreamer media backend])
5845    if test "x$enable_gstreamer" != "xno" ; then
5846        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]))
5847        ENABLE_GSTREAMER="TRUE"
5848        AC_MSG_RESULT([yes])
5849    else
5850        AC_MSG_RESULT([no])
5851    fi
5852fi
5853AC_SUBST(ENABLE_GSTREAMER)
5854AC_SUBST(GSTREAMER_CFLAGS)
5855AC_SUBST(GSTREAMER_LIBS)
5856
5857
5858dnl ===================================================================
5859dnl Check whether the Cairo libraries are available.
5860dnl ===================================================================
5861
5862ENABLE_CAIRO=""
5863BUILD_PIXMAN=""
5864SYSTEM_CAIRO=""
5865
5866if test  "$test_cairo" = "yes"; then
5867
5868    AC_MSG_CHECKING([whether to use cairo])
5869    if test "x$enable_cairo" != "xno" ; then
5870        ENABLE_CAIRO="TRUE"
5871	AC_MSG_RESULT([yes])
5872        AC_MSG_CHECKING([which cairo to use])
5873        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
5874           test "$with_system_cairo" != "no"; then
5875           AC_MSG_RESULT([external])
5876           SYSTEM_CAIRO=YES
5877
5878           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
5879	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
5880	      AC_MSG_ERROR([Cairo library requires fontconfig.])
5881	   fi
5882           if test "$with_system_xrender_headers" = "yes"; then
5883              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
5884              AC_TRY_RUN([
5885#include <X11/extensions/Xrender.h>
5886
5887int main(int argc, char **argv) {
5888#ifdef PictStandardA8
5889      return 0;
5890#else
5891      return 1;
5892#endif
5893}
5894               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
5895           fi
5896        else
5897           BUILD_TYPE="$BUILD_TYPE CAIRO"
5898	   dnl === compiler fails on pixman with 64bit architectures...===
5899	   if test "$build_cpu" != "x86_64"; then
5900	      BUILD_PIXMAN=YES
5901	   fi
5902           AC_MSG_RESULT([internal])
5903        fi
5904    else
5905	   AC_MSG_RESULT([no])
5906    fi
5907fi
5908
5909AC_SUBST(ENABLE_CAIRO)
5910AC_SUBST(BUILD_PIXMAN)
5911AC_SUBST(SYSTEM_CAIRO)
5912AC_SUBST(CAIRO_CFLAGS)
5913AC_SUBST(CAIRO_LIBS)
5914
5915ENABLE_CAIRO_CANVAS="FALSE"
5916if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
5917   ENABLE_CAIRO_CANVAS="TRUE"
5918fi
5919AC_SUBST(ENABLE_CAIRO_CANVAS)
5920
5921dnl ===================================================================
5922dnl Check whether the librsvg libraries are available.
5923dnl ===================================================================
5924
5925ENABLE_LIBRSVG=""
5926LIBRSVG_CFLAGS=""
5927LIBRSVG_LIBS=""
5928
5929if test  "$test_librsvg" = "yes"; then
5930    AC_MSG_CHECKING([whether to use librsvg])
5931    if test "x$enable_librsvg" != "xno" ; then
5932        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]))
5933        ENABLE_LIBRSVG="TRUE"
5934        AC_MSG_RESULT([yes])
5935    else
5936        AC_MSG_RESULT([no])
5937    fi
5938fi
5939
5940AC_SUBST(ENABLE_LIBRSVG)
5941AC_SUBST(LIBRSVG_CFLAGS)
5942AC_SUBST(LIBRSVG_LIBS)
5943
5944dnl ===================================================================
5945dnl Check whether the OpenGL libraries are available
5946dnl ===================================================================
5947
5948AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
5949ENABLE_OPENGL=
5950
5951if test "x$enable_opengl" != "xno" ; then
5952   AC_MSG_RESULT([yes])
5953   AC_CHECK_HEADER(GL/gl.h, [],
5954                   [AC_MSG_ERROR([OpenGL headers not found])], [])
5955   AC_CHECK_LIB(GL, main, [],
5956     [AC_MSG_ERROR(libGL not installed or functional)], [])
5957   AC_CHECK_LIB(GLU, main, [],
5958     [AC_MSG_ERROR(libGLU not installed or functional)], [])
5959   ENABLE_OPENGL=TRUE
5960else
5961   AC_MSG_RESULT([no])
5962fi
5963
5964AC_SUBST(ENABLE_OPENGL)
5965
5966AC_MSG_CHECKING([whether to build extra presenter ui])
5967if test -n "$enable_presenter_extra_ui" -a "$enable_presenter_extra_ui" != "no"; then
5968   AC_MSG_RESULT([yes])
5969   ENABLE_PRESENTER_EXTRA_UI=YES
5970else
5971   AC_MSG_RESULT([no])
5972   ENABLE_PRESENTER_EXTRA_UI=NO
5973fi
5974AC_SUBST(ENABLE_PRESENTER_EXTRA_UI)
5975
5976AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
5977if test -n "$enable_minimizer" -a "$enable_minimizer" != "no"; then
5978   AC_MSG_RESULT([yes])
5979   ENABLE_MINIMIZER=YES
5980else
5981   AC_MSG_RESULT([no])
5982   ENABLE_MINIMIZER=NO
5983fi
5984AC_SUBST(ENABLE_MINIMIZER)
5985
5986AC_MSG_CHECKING([whether to build the Presenter Screen extension])
5987if test -n "$enable_presenter_console" -a "$enable_presenter_screen" != "no"; then
5988   AC_MSG_RESULT([yes])
5989   ENABLE_PRESENTER_SCREEN=YES
5990else
5991   AC_MSG_RESULT([no])
5992   ENABLE_PRESENTER_SCREEN=NO
5993fi
5994AC_SUBST(ENABLE_PRESENTER_SCREEN)
5995
5996AC_MSG_CHECKING([whether to build the PDF Import extension])
5997if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
5998  AC_MSG_RESULT([yes])
5999  ENABLE_PDFIMPORT=YES
6000
6001  dnl ===================================================================
6002  dnl Check for system poppler
6003  dnl ===================================================================
6004  AC_MSG_CHECKING([which pdf backend to use])
6005  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6006       test "$with_system_poppler" != "no"; then
6007      AC_MSG_RESULT([external])
6008      SYSTEM_POPPLER=YES
6009      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6010  else
6011      AC_MSG_RESULT([internal])
6012      SYSTEM_POPPLER=NO
6013      BUILD_TYPE="$BUILD_TYPE XPDF"
6014      AC_MSG_CHECKING([for xpdf module])
6015      if test -d ./xpdf; then
6016       AC_MSG_RESULT([OK])
6017      else
6018        AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6019      fi
6020  fi
6021else
6022   AC_MSG_RESULT([no])
6023   ENABLE_PDFIMPORT=NO
6024fi
6025AC_SUBST(ENABLE_PDFIMPORT)
6026AC_SUBST(SYSTEM_POPPLER)
6027AC_SUBST(POPPLER_CFLAGS)
6028AC_SUBST(POPPLER_LIBS)
6029
6030if test "$ENABLE_PRESENTER_SCREEN" = "YES" -o "$ENABLE_MINIMIZER" = "YES" -o "$ENABLE_PDFIMPORT" = "YES"; then
6031  AC_MSG_CHECKING([for sdext module])
6032  if test -d ./sdext; then
6033   AC_MSG_RESULT([OK])
6034  else
6035   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6036  fi
6037  BUILD_TYPE="$BUILD_TYPE SDEXT"
6038fi
6039
6040AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6041if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6042  AC_MSG_RESULT([yes])
6043  AC_MSG_CHECKING([for swext module])
6044  if test -d ./swext; then
6045   AC_MSG_RESULT([OK])
6046  else
6047   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6048  fi
6049  ENABLE_MEDIAWIKI=YES
6050  BUILD_TYPE="$BUILD_TYPE SWEXT"
6051else
6052  AC_MSG_RESULT([no])
6053  ENABLE_MEDIAWIKI=NO
6054fi
6055AC_SUBST(ENABLE_MEDIAWIKI)
6056
6057if test "$ENABLE_MEDIAWIKI" = "YES"; then
6058  AC_MSG_CHECKING([which Servlet API Jar to use])
6059  if test -n "$with_system_servlet_api"; then
6060    AC_MSG_RESULT([external])
6061    SYSTEM_SERVLETAPI=YES
6062      if test -z "$SERVLETAPI_JAR"; then
6063	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6064      fi
6065      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6066             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6067  else
6068    AC_MSG_RESULT([internal])
6069    SYSTEM_SERVLETAPI=NO
6070    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6071  fi
6072fi
6073AC_SUBST(SYSTEM_SERVLETAPI)
6074AC_SUBST(SERVLETAPI_JAR)
6075
6076AC_MSG_CHECKING([whether to build the Report Builder extension])
6077if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6078  AC_MSG_RESULT([yes])
6079  ENABLE_REPORTBUILDER=YES
6080  AC_MSG_CHECKING([for reportbuilder module])
6081  if test -d ./reportbuilder; then
6082    AC_MSG_RESULT([OK])
6083  else
6084    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6085  fi
6086  AC_MSG_CHECKING([which jfreereport libs to use])
6087  if test "$with_system_jfreereport" = "yes"; then
6088      SYSTEM_JFREEREPORT=YES
6089      AC_MSG_RESULT([external])
6090      if test -z $SAC_JAR; then
6091             SAC_JAR=/usr/share/java/sac.jar
6092      fi
6093      AC_CHECK_FILE($SAC_JAR, [],
6094             [AC_MSG_ERROR(sac.jar not found.)], [])
6095
6096      if test -z $LIBXML_JAR; then
6097        AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6098          [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6099          [
6100            AC_CHECK_FILE(/usr/share/java/libxml.jar,
6101              [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6102              [AC_MSG_ERROR(libxml.jar replacement not found.)]
6103            )
6104          ]
6105        )
6106      else
6107        AC_CHECK_FILE($LIBXML_JAR, [],
6108             [AC_MSG_ERROR(libxml.jar not found.)], [])
6109      fi
6110
6111      if test -z $FLUTE_JAR; then
6112        AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6113          [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6114          [
6115            AC_CHECK_FILE(/usr/share/java/flute.jar,
6116              [ FLUTE_JAR=/usr/share/java/flute.jar ],
6117              [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6118            )
6119          ]
6120        )
6121      else
6122        AC_CHECK_FILE($FLUTE_JAR, [],
6123             [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6124      fi
6125
6126      if test -z $JFREEREPORT_JAR; then
6127        AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6128          [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6129          [
6130            AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6131              [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6132              [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6133            )
6134          ]
6135        )
6136      else
6137        AC_CHECK_FILE($JFREEREPORT_JAR, [],
6138             [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6139      fi
6140
6141      if test -z $LIBLAYOUT_JAR; then
6142        AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6143          [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6144          [
6145            AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6146              [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6147              [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6148            )
6149          ]
6150        )
6151      else
6152        AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6153             [AC_MSG_ERROR(liblayout.jar not found.)], [])
6154      fi
6155
6156      if test -z $LIBLOADER_JAR; then
6157        AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6158          [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6159          [
6160            AC_CHECK_FILE(/usr/share/java/libloader.jar,
6161              [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6162              [AC_MSG_ERROR(libloader.jar replacement not found.)]
6163            )
6164          ]
6165        )
6166      else
6167        AC_CHECK_FILE($LIBLOADER_JAR, [],
6168             [AC_MSG_ERROR(libloader.jar not found.)], [])
6169      fi
6170
6171      if test -z $LIBFORMULA_JAR; then
6172        AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6173          [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6174          [
6175            AC_CHECK_FILE(/usr/share/java/libformula.jar,
6176              [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6177              [AC_MSG_ERROR(libformula.jar replacement not found.)]
6178            )
6179          ]
6180        )
6181      else
6182        AC_CHECK_FILE($LIBFORMULA_JAR, [],
6183             [AC_MSG_ERROR(libformula.jar not found.)], [])
6184      fi
6185
6186      if test -z $LIBREPOSITORY_JAR; then
6187        AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6188          [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6189          [
6190            AC_CHECK_FILE(/usr/share/java/librepository.jar,
6191              [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6192              [AC_MSG_ERROR(librepository.jar replacement not found.)]
6193            )
6194          ]
6195        )
6196      else
6197        AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6198             [AC_MSG_ERROR(librepository.jar not found.)], [])
6199      fi
6200
6201      if test -z $LIBFONTS_JAR; then
6202        AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6203          [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6204          [
6205            AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6206              [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6207              [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6208            )
6209          ]
6210        )
6211      else
6212        AC_CHECK_FILE($LIBFONTS_JAR, [],
6213             [AC_MSG_ERROR(libfonts.jar not found.)], [])
6214      fi
6215
6216      if test -z $LIBSERIALIZER_JAR; then
6217        AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6218          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6219          [
6220            AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6221              [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6222              [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6223            )
6224          ]
6225        )
6226      else
6227        AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6228             [AC_MSG_ERROR(libserializer.jar not found.)], [])
6229      fi
6230
6231
6232      if test -z $LIBBASE_JAR; then
6233        AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6234          [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6235          [
6236            AC_CHECK_FILE(/usr/share/java/libbase.jar,
6237              [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6238              [AC_MSG_ERROR(libbase.jar replacement not found.)]
6239            )
6240          ]
6241        )
6242      else
6243        AC_CHECK_FILE($LIBBASE_JAR, [],
6244             [AC_MSG_ERROR(libbase.jar not found.)], [])
6245      fi
6246
6247  else
6248     AC_MSG_RESULT([internal])
6249     AC_MSG_CHECKING([for jfreereport module])
6250     if test -d ./jfreereport; then
6251      AC_MSG_RESULT([OK])
6252     else
6253      AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6254     fi
6255     SYSTEM_JFREEREPORT=NO
6256     BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
6257  fi
6258  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6259else
6260  AC_MSG_RESULT([no])
6261  ENABLE_REPORTBUILDER=NO
6262  SYSTEM_JFREEREPORT=NO
6263fi
6264AC_SUBST(ENABLE_REPORTBUILDER)
6265AC_SUBST(SYSTEM_JFREEREPORT)
6266AC_SUBST(SAC_JAR)
6267AC_SUBST(LIBXML_JAR)
6268AC_SUBST(FLUTE_JAR)
6269AC_SUBST(JFREEREPORT_JAR)
6270AC_SUBST(LIBBASE_JAR)
6271AC_SUBST(LIBLAYOUT_JAR)
6272AC_SUBST(LIBLOADER_JAR)
6273AC_SUBST(LIBFORMULA_JAR)
6274AC_SUBST(LIBREPOSITORY_JAR)
6275AC_SUBST(LIBFONTS_JAR)
6276AC_SUBST(LIBSERIALIZER_JAR)
6277
6278# this has to be here because both the wiki publisher and the SRB use
6279# commons-logging
6280if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6281  AC_MSG_CHECKING([which Apache commons-* libs to use])
6282  if test "$with_system_apache_commons" = "yes"; then
6283    SYSTEM_APACHE_COMMONS=YES
6284    AC_MSG_RESULT([external])
6285    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6286      if test -z $COMMONS_CODEC_JAR; then
6287        AC_CHECK_FILE(/usr/share/java/commons-codec-1.3.jar,
6288          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.3.jar ],
6289          [
6290            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6291              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6292              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6293            )
6294          ]
6295        )
6296      else
6297        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6298             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6299      fi
6300
6301      if test -z $COMMONS_LANG_JAR; then
6302        AC_CHECK_FILE(/usr/share/java/commons-lang-2.3.jar,
6303          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.3.jar ],
6304          [
6305            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6306              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6307              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6308            )
6309          ]
6310        )
6311      else
6312        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6313             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6314      fi
6315
6316      if test -z $COMMONS_HTTPCLIENT_JAR; then
6317        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6318          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6319          [
6320            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6321              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6322              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6323            )
6324          ]
6325        )
6326      else
6327        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6328             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6329      fi
6330    fi
6331    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6332      if test -z $COMMONS_LOGGING_JAR; then
6333        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
6334          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
6335          [
6336            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6337              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6338              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6339            )
6340          ]
6341        )
6342      else
6343        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6344             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6345      fi
6346    fi
6347  else
6348    AC_MSG_RESULT([internal])
6349    SYSTEM_APACHE_COMMONS=NO
6350    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6351  fi
6352fi
6353AC_SUBST(SYSTEM_APACHE_COMMONS)
6354AC_SUBST(COMMONS_CODEC_JAR)
6355AC_SUBST(COMMONS_LANG_JAR)
6356AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6357AC_SUBST(COMMONS_LOGGING_JAR)
6358
6359dnl ===================================================================
6360dnl Check whether the Qt and KDE libraries are available.
6361dnl ===================================================================
6362
6363KDE_CFLAGS=""
6364KDE_LIBS=""
6365MOC="moc"
6366if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6367    dnl Search paths for Qt and KDE
6368    if test "$build_cpu" != "x86_64" ; then
6369        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"
6370        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"
6371    else
6372        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"
6373        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"
6374    fi
6375    if test -n "$QTDIR" ; then
6376        qt_incdirs="$QTDIR/include $qt_incdirs"
6377        if test "$build_cpu" != "x86_64" ; then
6378            qt_libdirs="$QTDIR/lib $qt_libdirs"
6379        else
6380            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6381        fi
6382    fi
6383    if test "$build_cpu" != "x86_64" ; then
6384        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"
6385        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"
6386    else
6387        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"
6388        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"
6389    fi
6390    if test -n "$KDEDIR" ; then
6391        kde_incdirs="$KDEDIR/include $kde_incdirs"
6392        if test "$build_cpu" != "x86_64" ; then
6393            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6394        else
6395            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6396        fi
6397    fi
6398
6399    dnl What to test
6400    qt_test_include="qstyle.h"
6401    qt_test_library="libqt-mt.so"
6402    kde_test_include="ksharedptr.h"
6403    kde_test_library="libkdeui.so"
6404
6405    dnl Check for Qt headers
6406    AC_MSG_CHECKING([for Qt headers])
6407    qt_incdir="no"
6408    for kde_check in $qt_incdirs ; do
6409        if test -r "$kde_check/$qt_test_include" ; then
6410            qt_incdir="$kde_check"
6411            break
6412        fi
6413    done
6414    AC_MSG_RESULT([$qt_incdir])
6415    if test "x$qt_incdir" = "xno" ; then
6416        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6417your Qt installation by exporting QTDIR before running "configure".])
6418    fi
6419
6420    dnl Check for Qt libraries
6421    AC_MSG_CHECKING([for Qt libraries])
6422    qt_libdir="no"
6423    for qt_check in $qt_libdirs ; do
6424        if test -r "$qt_check/$qt_test_library" ; then
6425            qt_libdir="$qt_check"
6426            break
6427        fi
6428    done
6429    AC_MSG_RESULT([$qt_libdir])
6430    if test "x$qt_libdir" = "xno" ; then
6431        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6432your Qt installation by exporting QTDIR before running "configure".])
6433    fi
6434
6435    dnl Check for Meta Object Compiler
6436    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6437    if test "$MOC" = "no" ; then
6438        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6439the root of your Qt installation by exporting QTDIR before running "configure".])
6440    fi
6441
6442    dnl Check for KDE headers
6443    AC_MSG_CHECKING([for KDE headers])
6444    kde_incdir="no"
6445    for kde_check in $kde_incdirs ; do
6446        if test -r "$kde_check/$kde_test_include" ; then
6447            kde_incdir="$kde_check"
6448            break
6449        fi
6450    done
6451    AC_MSG_RESULT([$kde_incdir])
6452    if test "x$kde_incdir" = "xno" ; then
6453        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6454your KDE installation by exporting KDEDIR before running "configure".])
6455    fi
6456
6457    dnl Check for KDE libraries
6458    AC_MSG_CHECKING([for KDE libraries])
6459    kde_libdir="no"
6460    for kde_check in $kde_libdirs ; do
6461        if test -r "$kde_check/$kde_test_library" ; then
6462            kde_libdir="$kde_check"
6463            break
6464        fi
6465    done
6466    AC_MSG_RESULT([$kde_libdir])
6467    if test "x$kde_libdir" = "xno" ; then
6468        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6469your KDE installation by exporting KDEDIR before running "configure".])
6470    fi
6471
6472    dnl Set the variables
6473    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6474    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6475fi
6476AC_SUBST(KDE_CFLAGS)
6477AC_SUBST(KDE_LIBS)
6478AC_SUBST(MOC)
6479
6480dnl ===================================================================
6481dnl KDE4 Integration
6482dnl ===================================================================
6483
6484KDE4_CFLAGS=""
6485KDE4_LIBS=""
6486MOC4="moc"
6487if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6488   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6489   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6490
6491   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6492   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6493
6494   if test "$build_cpu" = "x86_64" ; then
6495      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6496      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6497   fi
6498
6499   if test -n "$KDE4DIR" ; then
6500      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6501      if test "$build_cpu" != "x86_64" ; then
6502         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6503      else
6504         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6505      fi
6506   fi
6507
6508   qt_test_include="Qt/qobject.h"
6509   qt_test_library="libQtCore.so"
6510   kde_test_include="ksharedptr.h"
6511   kde_test_library="libkdeui.so"
6512
6513   AC_MSG_CHECKING([for Qt4 headers])
6514   qt_header_dir="no"
6515   for inc_dir in $qt_incdirs ; do
6516      if test -r "$inc_dir/$qt_test_include" ; then
6517         qt_header_dir="$inc_dir"
6518         break
6519      fi
6520   done
6521
6522   AC_MSG_RESULT([$qt_header_dir])
6523   if test "x$qt_header_dir" = "xno" ; then
6524      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6525   fi
6526
6527   AC_MSG_CHECKING([for Qt4 libraries])
6528   qt_lib_dir="no"
6529   for lib_dir in $qt_libdirs ; do
6530      if test -r "$lib_dir/$qt_test_library" ; then
6531         qt_lib_dir="$lib_dir"
6532         break
6533      fi
6534   done
6535
6536   AC_MSG_RESULT([$qt_lib_dir])
6537
6538   if test "x$qt_lib_dir" = "xno" ; then
6539      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6540   fi
6541
6542   dnl Check for Meta Object Compiler
6543   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6544   MOC4="$MOCQT4"
6545   if test "$MOC4" = "no" ; then
6546      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6547      if test "$MOC4" = "no" ; then
6548         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6549      fi
6550   fi
6551
6552   dnl Check for KDE4 headers
6553   AC_MSG_CHECKING([for KDE4 headers])
6554   kde_incdir="no"
6555   for kde_check in $kde_incdirs ; do
6556      if test -r "$kde_check/$kde_test_include" ; then
6557         kde_incdir="$kde_check"
6558         break
6559      fi
6560   done
6561   AC_MSG_RESULT([$kde_incdir])
6562   if test "x$kde_incdir" = "xno" ; then
6563      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6564   fi
6565
6566   dnl Check for KDE4 libraries
6567   AC_MSG_CHECKING([for KDE4 libraries])
6568   kde_libdir="no"
6569   for kde_check in $kde_libdirs ; do
6570      if test -r "$kde_check/$kde_test_library" ; then
6571         kde_libdir="$kde_check"
6572         break
6573      fi
6574   done
6575
6576   AC_MSG_RESULT([$kde_libdir])
6577   if test "x$kde_libdir" = "xno" ; then
6578      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6579   fi
6580
6581   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6582   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6583fi
6584AC_SUBST(KDE4_CFLAGS)
6585AC_SUBST(KDE4_LIBS)
6586AC_SUBST(MOC4)
6587
6588dnl ===================================================================
6589dnl Test for the enabling the lockdown pieces
6590dnl ===================================================================
6591AC_MSG_CHECKING([whether to enable the lockdown pieces])
6592ENABLE_LOCKDOWN=""
6593if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6594  ENABLE_LOCKDOWN=YES
6595  AC_MSG_RESULT([yes])
6596else
6597  AC_MSG_RESULT([no])
6598fi
6599AC_SUBST(ENABLE_LOCKDOWN)
6600
6601dnl ===================================================================
6602dnl Test whether to include Evolution 2 support
6603dnl ===================================================================
6604AC_MSG_CHECKING([whether to enable evolution 2 support])
6605if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6606   AC_MSG_RESULT([yes])
6607   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6608   ENABLE_EVOAB2="TRUE"
6609else
6610   ENABLE_EVOAB2=""
6611   AC_MSG_RESULT([no])
6612fi
6613AC_SUBST(ENABLE_EVOAB2)
6614AC_SUBST(GOBJECT_CFLAGS)
6615AC_SUBST(GOBJECT_LIBS)
6616
6617dnl ===================================================================
6618dnl Test whether to include KDE AB support
6619dnl ===================================================================
6620AC_MSG_CHECKING([whether to enable KDE address book support])
6621if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6622   AC_MSG_RESULT([yes])
6623   AC_LANG_PUSH([C++])
6624   save_CXXFLAGS=$CXXFLAGS
6625   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6626   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6627       AC_TRY_RUN([
6628#include <kdeversion.h>
6629
6630int main(int argc, char **argv) {
6631       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6632       else return 1;
6633}
6634       ], [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])])
6635   CXXFLAGS=$save_CXXFLAGS
6636   AC_LANG_POP([C++])
6637   ENABLE_KAB=TRUE
6638else
6639   AC_MSG_RESULT([no])
6640   ENABLE_KAB=
6641fi
6642AC_SUBST(ENABLE_KAB)
6643
6644dnl ===================================================================
6645dnl Test whether to include MathMLDTD
6646dnl ===================================================================
6647AC_MSG_CHECKING([whether to include MathMLDTD])
6648if test -n "$enable_mathmldtd"; then
6649  if test "$enable_mathmldtd" = "no"; then
6650    AC_MSG_RESULT([no])
6651    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6652  else
6653    AC_MSG_RESULT([yes])
6654    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6655  fi
6656else
6657  AC_MSG_RESULT([no])
6658  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6659fi
6660
6661dnl ===================================================================
6662dnl Test whether to include fonts
6663dnl ===================================================================
6664AC_MSG_CHECKING([whether to include third-party fonts])
6665if test "$with_fonts" != "no" ; then
6666  AC_MSG_RESULT([yes])
6667  WITH_FONTS=YES
6668  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6669else
6670  AC_MSG_RESULT([no])
6671  WITH_FONTS=NO
6672  SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
6673fi
6674AC_SUBST(WITH_FONTS)
6675
6676dnl ===================================================================
6677dnl Test whether to include ppds
6678dnl ===================================================================
6679AC_MSG_CHECKING([whether to include PPDs])
6680if test "$with_ppds" != "no"; then
6681  AC_MSG_RESULT([yes])
6682else
6683  AC_MSG_RESULT([no])
6684  WITHOUT_PPDS=YES
6685  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6686fi
6687AC_SUBST(WITHOUT_PPDS)
6688
6689dnl ===================================================================
6690dnl Test whether to include afms
6691dnl ===================================================================
6692AC_MSG_CHECKING([whether to include AFMs])
6693if test "$with_afms" != "no"; then
6694  AC_MSG_RESULT([yes])
6695  BUILD_TYPE="$BUILD_TYPE AFMS"
6696else
6697  AC_MSG_RESULT([no])
6698  WITHOUT_AFMS=YES
6699  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6700fi
6701AC_SUBST(WITHOUT_AFMS)
6702
6703AC_SUBST(SCPDEFS)
6704
6705AC_MSG_CHECKING([whether and how to use Xinerama])
6706if test "$_os" = "Darwin"; then
6707   USE_XINERAMA=YES
6708   XINERAMA_LINK=dynamic
6709   AC_MSG_RESULT([yes])
6710elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6711   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6712      # we have both versions, let the user decide but use the dynamic one
6713      # per default
6714      USE_XINERAMA=YES
6715      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6716         XINERAMA_LINK=dynamic
6717      else
6718         XINERAMA_LINK=static
6719      fi
6720   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6721      # we have only the dynamic version
6722      USE_XINERAMA=YES
6723      XINERAMA_LINK=dynamic
6724   elif test -e "$XLIB/libXinerama.a"; then
6725      # static version
6726      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6727         USE_XINERAMA=YES
6728         XINERAMA_LINK=static
6729      else
6730         USE_XINERAMA=NO
6731         XINERAMA_LINK=none
6732      fi
6733   else
6734      # no Xinerama
6735      USE_XINERAMA=NO
6736      XINERAMA_LINK=none
6737   fi
6738   if test "$USE_XINERAMA" = "YES"; then
6739      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6740      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6741          [AC_MSG_ERROR(Xinerama header not found.)], [])
6742      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6743      if test "$_os" = "FreeBSD"; then
6744          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6745      fi
6746      if test "$_os" = "Linux"; then
6747          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6748      fi
6749      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6750          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6751   else
6752      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6753   fi
6754else
6755   AC_MSG_RESULT([no])
6756fi
6757AC_SUBST(USE_XINERAMA)
6758AC_SUBST(XINERAMA_LINK)
6759
6760if test "$ENABLE_LIBRSVG" = "TRUE"
6761then
6762dnl ===================================================================
6763dnl Test whether to build librsvg or rely on the system version
6764dnl ===================================================================
6765AC_MSG_CHECKING([whether to build own version of librsvg])
6766
6767case "$_os" in
6768	WINNT*) # Windows
6769	    SYSTEM_LIBRSVG=NO
6770	    AC_MSG_RESULT([yes])
6771		;;
6772	Darwin*)
6773	    SYSTEM_LIBRSVG=NO
6774	    AC_MSG_RESULT([yes])
6775	    ;;
6776   *)
6777   SYSTEM_LIBRSVG=YES
6778   AC_MSG_RESULT([no])
6779   ;;
6780esac
6781AC_SUBST(SYSTEM_LIBRSVG)
6782
6783dnl ===================================================================
6784dnl Test whether to build gdk-pixbuf or rely on the system version
6785dnl ===================================================================
6786AC_MSG_CHECKING([whether to build own version of gdk-pixbuf])
6787
6788case "$_os" in
6789	WINNT*) # Windows
6790	    SYSTEM_GDKPIXBUF=NO
6791	    AC_MSG_RESULT([yes])
6792		;;
6793	Darwin*)
6794	    SYSTEM_GDKPIXBUF=NO
6795	    AC_MSG_RESULT([yes])
6796	    ;;
6797   *)
6798   SYSTEM_GDKPIXBUF=YES
6799   AC_MSG_RESULT([no])
6800   ;;
6801esac
6802AC_SUBST(SYSTEM_GDKPIXBUF)
6803
6804dnl ===================================================================
6805dnl Test whether to build glib or rely on the system version
6806dnl ===================================================================
6807AC_MSG_CHECKING([whether to build own version of glib])
6808
6809case "$_os" in
6810	WINNT*) # Windows
6811	    SYSTEM_GLIB=NO
6812	    AC_MSG_RESULT([yes])
6813		;;
6814	Darwin*)
6815	    SYSTEM_GLIB=NO
6816	    AC_MSG_RESULT([yes])
6817	    ;;
6818   *)
6819   SYSTEM_GLIB=YES
6820   AC_MSG_RESULT([no])
6821   ;;
6822esac
6823AC_SUBST(SYSTEM_GLIB)
6824
6825dnl ===================================================================
6826dnl Test whether to build gettext or rely on the system version
6827dnl ===================================================================
6828AC_MSG_CHECKING([whether to build own version of gettext])
6829
6830case "$_os" in
6831	WINNT*) # Windows
6832	    SYSTEM_GETTEXT=NO
6833	    AC_MSG_RESULT([yes])
6834		;;
6835	Darwin*)
6836	    SYSTEM_GETTEXT=NO
6837	    AC_MSG_RESULT([yes])
6838	    ;;
6839   *)
6840   SYSTEM_GETTEXT=YES
6841   AC_MSG_RESULT([no])
6842   ;;
6843esac
6844AC_SUBST(SYSTEM_GETTEXT)
6845
6846dnl ===================================================================
6847dnl Test whether to build libcroco or rely on the system version
6848dnl ===================================================================
6849AC_MSG_CHECKING([whether to build own version of libcroco])
6850
6851case "$_os" in
6852	WINNT*) # Windows
6853	    SYSTEM_LIBCROCO=NO
6854	    AC_MSG_RESULT([yes])
6855		;;
6856	Darwin*)
6857	    SYSTEM_LIBCROCO=NO
6858	    AC_MSG_RESULT([yes])
6859	    ;;
6860   *)
6861   SYSTEM_LIBCROCO=YES
6862   AC_MSG_RESULT([no])
6863   ;;
6864esac
6865AC_SUBST(SYSTEM_LIBCROCO)
6866
6867dnl ===================================================================
6868dnl Test whether to build pango or rely on the system version
6869dnl ===================================================================
6870AC_MSG_CHECKING([whether to build own version of pango])
6871
6872case "$_os" in
6873	WINNT*) # Windows
6874	    SYSTEM_PANGO=NO
6875	    AC_MSG_RESULT([yes])
6876		;;
6877	Darwin*)
6878	    SYSTEM_PANGO=NO
6879	    AC_MSG_RESULT([yes])
6880	    ;;
6881   *)
6882   SYSTEM_PANGO=YES
6883   AC_MSG_RESULT([no])
6884   ;;
6885esac
6886AC_SUBST(SYSTEM_PANGO)
6887
6888dnl ===================================================================
6889dnl Test whether to build libgsf or rely on the system version
6890dnl ===================================================================
6891AC_MSG_CHECKING([whether to build own version of libgsf])
6892
6893case "$_os" in
6894	WINNT*) # Windows
6895	    SYSTEM_LIBGSF=NO
6896	    AC_MSG_RESULT([yes])
6897		;;
6898   *)
6899   SYSTEM_LIBGSF=YES
6900   AC_MSG_RESULT([no])
6901   ;;
6902esac
6903AC_SUBST(SYSTEM_LIBGSF)
6904else
6905   SYSTEM_LIBGSF=YES
6906   AC_SUBST(SYSTEM_LIBGSF)
6907   SYSTEM_LIBRSVG=YES
6908   AC_SUBST(SYSTEM_LIBRSVG)
6909   SYSTEM_GDKPIXBUF=YES
6910   AC_SUBST(SYSTEM_GDKPIXBUF)
6911   SYSTEM_GLIB=YES
6912   AC_SUBST(SYSTEM_GLIB)
6913   SYSTEM_GETTEXT=YES
6914   AC_SUBST(SYSTEM_GETTEXT)
6915   SYSTEM_LIBCROCO=YES
6916   AC_SUBST(SYSTEM_LIBCROCO)
6917   SYSTEM_PANGO=YES
6918   AC_SUBST(SYSTEM_PANGO)
6919fi
6920
6921dnl ===================================================================
6922dnl Test whether to build libpng or rely on the system version
6923dnl ===================================================================
6924AC_MSG_CHECKING([whether to build own version of libpng])
6925
6926case "$_os" in
6927	WINNT*) # Windows
6928	    SYSTEM_LIBPNG=NO
6929	    AC_MSG_RESULT([yes])
6930		;;
6931	Darwin*)
6932	    SYSTEM_LIBPNG=NO
6933	    AC_MSG_RESULT([yes])
6934	    ;;
6935   *)
6936   SYSTEM_LIBPNG=YES
6937   AC_MSG_RESULT([no])
6938   ;;
6939esac
6940AC_SUBST(SYSTEM_LIBPNG)
6941
6942dnl ===================================================================
6943dnl Test whether to build libjpeg or rely on the system version
6944dnl ===================================================================
6945dnl FIXME: this is currently because we have jpeg-6b for our filters
6946dnl        and jpeg-8 as dependency for librsvg
6947dnl        this should be unified into using only one version for both
6948
6949AC_MSG_CHECKING([whether to build own version of libjpeg])
6950
6951if test "$SYSTEM_JPEG" == "YES"; then
6952SYSTEM_LIBJPEG=YES
6953else
6954case "$_os" in
6955	WINNT*) # Windows
6956	    SYSTEM_LIBJPEG=NO
6957	    AC_MSG_RESULT([yes])
6958		;;
6959	Darwin*)
6960	    SYSTEM_LIBJPEG=NO
6961	    AC_MSG_RESULT([yes])
6962	    ;;
6963   *)
6964   SYSTEM_LIBJPEG=YES
6965   AC_MSG_RESULT([no])
6966   ;;
6967esac
6968fi
6969
6970if test "$SYSTEM_LIBJPEG" == "YES"; then
6971   AC_MSG_RESULT([no])
6972else
6973   AC_MSG_RESULT([yes])
6974fi
6975AC_SUBST(SYSTEM_LIBJPEG)
6976
6977
6978dnl ===================================================================
6979dnl Test for the presence of Ant and that it works
6980dnl ===================================================================
6981
6982if test "$SOLAR_JAVA" != ""; then
6983ANT_HOME=; export ANT_HOME
6984WITH_ANT_HOME=; export WITH_ANT_HOME
6985if test -z "$with_ant_home"; then
6986   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
6987else
6988   if test "$_os" = "WINNT"; then
6989      with_ant_home=`cygpath -u "$with_ant_home"`
6990   fi
6991   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
6992   WITH_ANT_HOME=$with_ant_home
6993   ANT_HOME=$with_ant_home
6994fi
6995
6996if test -z "$ANT"; then
6997  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
6998else
6999  # resolve relative or absolute symlink
7000  while test -h "$ANT"; do
7001     a_cwd=`pwd`
7002     a_basename=`basename "$ANT"`
7003     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7004     cd "`dirname "$ANT"`"
7005     cd "`dirname "$a_script"`"
7006     ANT="`pwd`"/"`basename "$a_script"`"
7007     cd "$a_cwd"
7008  done
7009
7010  if test "$_os" = "OS2"; then
7011    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7012    export ANT_HOME
7013  fi
7014
7015  AC_MSG_CHECKING([if $ANT works])
7016cat > conftest.java << EOF
7017    public class conftest {
7018	int testmethod(int a, int b) {
7019            return a + b;
7020	}
7021    }
7022EOF
7023
7024cat > conftest.xml << EOF
7025    <project name="conftest" default="conftest">
7026	<target name="conftest">
7027            <javac srcdir="." includes="conftest.java">
7028	    </javac>
7029	</target>
7030    </project>
7031EOF
7032  oldJAVA_HOME=$JAVA_HOME
7033  if test "$JAVACISGCJ" = "yes"; then
7034    JAVA_HOME=; export JAVA_HOME
7035    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7036  else
7037    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7038  fi
7039  AC_TRY_EVAL(ant_cmd)
7040  if test $? = 0 && test -f ./conftest.class ; then
7041    AC_MSG_RESULT([Ant works])
7042    if test -z "$WITH_ANT_HOME"; then
7043        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7044        if test -z "$ANT_HOME"; then
7045            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7046        fi
7047    else
7048        ANT_HOME="$WITH_ANT_HOME"
7049    fi
7050  else
7051    echo "configure: Ant test failed" >&5
7052    cat conftest.java >&5
7053    cat conftest.xml >&5
7054    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7055    ANT_HOME=""
7056    echo "Ant does not work - Some Java projects will not build!" >>warn
7057  fi
7058  JAVA_HOME=$oldJAVA_HOME
7059  rm -f conftest* core core.* *.core
7060fi
7061if test -z "$ANT_HOME"; then
7062   ANT_HOME="NO_ANT_HOME"
7063fi
7064AC_SUBST(ANT_HOME)
7065
7066dnl Checking for ant.jar
7067if test "$ANT_HOME" != "NO_ANT_HOME"; then
7068   AC_MSG_CHECKING([Ant lib directory])
7069   if test -f $ANT_HOME/lib/ant.jar; then
7070	  ANT_LIB="$ANT_HOME/lib"
7071   else
7072      if test -f $ANT_HOME/ant.jar; then
7073	     ANT_LIB="$ANT_HOME"
7074      else
7075          if test -f /usr/share/java/ant.jar; then
7076              ANT_LIB=/usr/share/java
7077          else
7078             if test -f /usr/share/ant-core/lib/ant.jar; then
7079                 ANT_LIB=/usr/share/ant-core/lib
7080             else
7081                if test -f $ANT_HOME/lib/ant/ant.jar; then
7082                    ANT_LIB="$ANT_HOME/lib/ant"
7083                else
7084                   if test -f /usr/share/lib/ant/ant.jar; then
7085                       ANT_LIB=/usr/share/lib/ant
7086                   else
7087                       AC_MSG_ERROR([Ant libraries not found!])
7088                   fi
7089                fi
7090             fi
7091          fi
7092      fi
7093   fi
7094   AC_MSG_RESULT([Ant lib directory found.])
7095fi
7096AC_SUBST(ANT_LIB)
7097fi
7098
7099ant_minver=1.6.0
7100# update for more extensions...
7101if test "$ENABLE_MEDIAWIKI" = "YES"; then
7102  ant_minver=1.7.0
7103fi
7104ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7105
7106AC_MSG_CHECKING([whether ant is >= $ant_minver])
7107ant_version=`$ANT -version | $AWK '{ print $4; }'`
7108ant_version_major=`echo $ant_version | cut -d. -f1`
7109ant_version_minor=`echo $ant_version | cut -d. -f2`
7110echo "configure: ant_version $ant_version " >&5
7111echo "configure: ant_version_major $ant_version_major " >&5
7112echo "configure: ant_version_minor $ant_version_minor " >&5
7113if test "$ant_version_major" -ge "2"; then
7114   AC_MSG_RESULT([yes, $ant_version])
7115elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7116   AC_MSG_RESULT([yes, $ant_version])
7117else
7118   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7119fi
7120
7121if test "$ENABLE_MEDIAWIKI" = "YES"; then
7122AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7123rm -rf confdir
7124mkdir confdir
7125cat > conftest.java << EOF
7126    public class conftest {
7127        int testmethod(int a, int b) {
7128            return a + b;
7129        }
7130    }
7131EOF
7132
7133cat > conftest.xml << EOF
7134    <project name="conftest" default="conftest">
7135        <target name="conftest" depends="copytest">
7136            <javac srcdir="." includes="conftest.java">
7137            </javac>
7138        </target>
7139        <target name="copytest">
7140             <copy todir="confdir">
7141                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7142                 <filterset/>
7143                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7144             </copy>
7145        </target>
7146    </project>
7147EOF
7148  if test "$JAVACISGCJ" = "yes"; then
7149    JAVA_HOME=; export JAVA_HOME
7150    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7151  else
7152    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7153  fi
7154  AC_TRY_EVAL(ant_cmd)
7155  if test $? = 0 && test -f ./conftest.class ; then
7156    AC_MSG_RESULT([yes])
7157    rm -rf confdir
7158  else
7159    echo "configure: Ant test failed" >&5
7160    cat conftest.java >&5
7161    cat conftest.xml >&5
7162    rm -rf confdir
7163    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7164  fi
7165fi
7166rm -f conftest* core core.* *.core
7167
7168OOO_JUNIT_JAR=
7169if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7170    AC_MSG_CHECKING([for JUnit 4])
7171    if test "$with_junit" == "yes"; then
7172        if test -e /usr/share/java/junit4.jar; then
7173            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7174        else
7175           if test -e /usr/share/lib/java/junit.jar; then
7176              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7177           else
7178              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7179           fi
7180        fi
7181    else
7182        OOO_JUNIT_JAR=$with_junit
7183    fi
7184    if test "$_os" = "WINNT"; then
7185        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7186    fi
7187    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7188        grep org/junit/Before.class > /dev/null 2>&5
7189    if test $? -eq 0; then
7190        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7191    else
7192        AC_MSG_RESULT([no])
7193        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7194location (/usr/share/java), specify its pathname via
7195--with-junit=..., or disable it via --without-junit])
7196    fi
7197fi
7198AC_SUBST(OOO_JUNIT_JAR)
7199
7200AC_MSG_CHECKING([which languages to be built])
7201WITH_LANG="$with_lang"
7202if test -z "$WITH_LANG"; then
7203   AC_MSG_RESULT([en-US])
7204else
7205   AC_MSG_RESULT([$WITH_LANG])
7206fi
7207AC_SUBST(WITH_LANG)
7208
7209AC_MSG_CHECKING([which languages have poor help localizations])
7210WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7211if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7212   AC_MSG_RESULT([none])
7213else
7214   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7215fi
7216AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7217
7218AC_MSG_CHECKING([which dictionaries to include])
7219if test -z "$with_dict"; then
7220   WITH_DICT=,ALL,
7221   AC_MSG_RESULT([ALL])
7222else
7223   WITH_DICT=","$with_dict","
7224   AC_MSG_RESULT([$with_dict])
7225fi
7226AC_SUBST(WITH_DICT)
7227
7228AC_MSG_CHECKING([for additional 'intro' bitmaps])
7229INTRO_BITMAPS=
7230if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7231   INTRO_BITMAPS=
7232   AC_MSG_RESULT([none])
7233else
7234   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7235      case "$bitmap" in
7236         *.bmp) ;;
7237         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .bmp files!]) ;;
7238      esac
7239      if test -n "$bitmap" ; then
7240         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7241      fi
7242   done
7243   AC_MSG_RESULT([$INTRO_BITMAPS])
7244fi
7245AC_SUBST(INTRO_BITMAPS)
7246
7247AC_MSG_CHECKING([for additional 'about' bitmaps])
7248ABOUT_BITMAPS=
7249if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7250   ABOUT_BITMAPS=
7251   AC_MSG_RESULT([none])
7252else
7253   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7254      case "$bitmap" in
7255         *.bmp) ;;
7256         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .bmp files!]) ;;
7257      esac
7258      if test -n "$bitmap" ; then
7259         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7260      fi
7261   done
7262   AC_MSG_RESULT([$ABOUT_BITMAPS])
7263fi
7264AC_SUBST(ABOUT_BITMAPS)
7265
7266OOO_VENDOR=
7267AC_MSG_CHECKING([for vendor])
7268if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7269   AC_MSG_RESULT([not set])
7270else
7271   OOO_VENDOR="$with_vendor"
7272   AC_MSG_RESULT([$OOO_VENDOR])
7273fi
7274AC_SUBST(OOO_VENDOR)
7275
7276UNIXWRAPPERNAME=
7277AC_MSG_CHECKING([for UNIX wrapper name])
7278if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7279   AC_MSG_RESULT([not set])
7280else
7281   UNIXWRAPPERNAME="$with_unix_wrapper"
7282   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7283fi
7284AC_SUBST(UNIXWRAPPERNAME)
7285
7286AC_MSG_CHECKING([whether to statically link to Gtk])
7287if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7288   ENABLE_STATIC_GTK="TRUE"
7289   AC_MSG_RESULT([yes])
7290else
7291   ENABLE_STATIC_GTK="FALSE"
7292   AC_MSG_RESULT([no])
7293fi
7294AC_SUBST(ENABLE_STATIC_GTK)
7295
7296AC_MSG_CHECKING([whether to use layout dialogs])
7297if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7298   ENABLE_LAYOUT="TRUE"
7299   AC_MSG_RESULT([yes])
7300else
7301   ENABLE_LAYOUT="FALSE"
7302   AC_MSG_RESULT([no])
7303fi
7304AC_SUBST(ENABLE_LAYOUT)
7305
7306# ===================================================================
7307# De- or increase default verbosity of build process
7308# ===================================================================
7309AC_MSG_CHECKING([build verbosity])
7310if test -n "$enable_verbose"; then
7311   if test "$enable_verbose" = "yes"; then
7312      VERBOSE="TRUE"
7313      AC_MSG_RESULT([high])
7314   fi
7315   if test "$enable_verbose" = "no"; then
7316      VERBOSE="FALSE"
7317      AC_MSG_RESULT([low])
7318   fi
7319else
7320   AC_MSG_RESULT([not set])
7321fi
7322AC_SUBST(VERBOSE)
7323
7324dnl ===================================================================
7325dnl Hook up OOos nodep environmental variable to automake's equivalent
7326dnl --enable-dependency-tracking configure option
7327dnl ===================================================================
7328AC_MSG_CHECKING([whether to enable dependency tracking])
7329if test "$enable_dependency_tracking" = "no"; then
7330    nodep=TRUE
7331    AC_MSG_RESULT([no])
7332else
7333    AC_MSG_RESULT([yes])
7334fi
7335AC_SUBST(nodep)
7336
7337dnl ===================================================================
7338dnl Setting up the environment.
7339dnl ===================================================================
7340echo "********************************************************************"
7341echo "*                                                                  *"
7342echo "*   Setting up the build environment variables.                    *"
7343echo "*                                                                  *"
7344echo "********************************************************************"
7345
7346if test -z "$COMPATH"; then
7347   AC_MSG_ERROR([No compiler found.])
7348fi
7349AC_SUBST(COMPATH)
7350
7351AC_MSG_CHECKING([solver path])
7352if test -z "$with_local_solver"; then
7353   LOCAL_SOLVER="DEFAULT"
7354   AC_MSG_RESULT([default])
7355else
7356   LOCAL_SOLVER=$with_local_solver
7357   AC_MSG_RESULT([$with_local_solver])
7358fi
7359AC_SUBST(LOCAL_SOLVER)
7360
7361AC_SUBST(BUILD_TYPE)
7362
7363# make sure config.guess is +x; we execute config.guess, so it has to be so;
7364chmod +x ./config.guess
7365
7366AC_OUTPUT([set_soenv Makefile])
7367
7368dnl Executing the set_soenv script to setup the environment variables.
7369chmod a+x set_soenv
7370if test -z "$enable_check_only"; then
7371   './set_soenv'
7372else
7373   echo
7374   echo Test Complete
7375   echo No environment file will be generated
7376   echo
7377   num_warnings=`wc -l warn`
7378   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7379   if test $_num -gt 0; then
7380      echo The following warning\(s\) were generated by configure
7381      echo ----------------------------------------------------
7382      echo
7383      cat warn
7384      echo
7385   else
7386      echo There were no warnings
7387   fi
7388   echo
7389fi
7390