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