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