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