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