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