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