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