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