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