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