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