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