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