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