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