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