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