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