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