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