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