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