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