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