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