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