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