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