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