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