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