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