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