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