xref: /aoo42x/main/configure.ac (revision 1fb03631)
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.])
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([if hash_map will be in __gnu_cxx namespace])
2920   AC_LANG_PUSH([C++])
2921
2922   AC_TRY_COMPILE([#include <ext/hash_map>
2923using namespace __gnu_cxx;
2924],[hash_map<int, int> t; return 0;],
2925  ac_cv_cxx_have_ext_hash_map=yes, ac_cv_cxx_have_ext_hash_map=no)
2926
2927   if test "$ac_cv_cxx_have_ext_hash_map" = "no"; then
2928      AC_MSG_ERROR([Can't find hash_map. Try with --with-stlport])
2929   else
2930      AC_MSG_RESULT([$ac_cv_cxx_have_ext_hash_map])
2931   fi
2932
2933   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2934      AC_MSG_CHECKING([if STL headers are visibility safe])
2935      AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
2936      AC_MSG_RESULT([$stlvisok])
2937      if test "$stlvisok" = "no"; then
2938         AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
2939         echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
2940         unset HAVE_GCC_VISIBILITY_FEATURE
2941      fi
2942   fi
2943
2944   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2945      sharedlink_ldflags_save=$LDFLAGS
2946      LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
2947
2948      AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
2949      AC_TRY_LINK([#include <sstream>
2950using namespace std;
2951],[istringstream strm( "test" ); return 0;],
2952      $EGREP -q  unresolvable conftest.err;
2953      if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi,
2954      gccvisok=no)
2955      AC_MSG_RESULT([$gccvisok])
2956      if test "$gccvisok" = "no"; then
2957         AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility])
2958         echo "Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility" >> warn
2959         unset HAVE_GCC_VISIBILITY_FEATURE
2960      fi
2961
2962      LDFLAGS=$sharedlink_ldflags_save
2963   fi
2964
2965   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2966      AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
2967      cat >visibility.cxx <<_ACEOF
2968#pragma GCC visibility push(hidden)
2969struct __attribute__ ((visibility ("default"))) TestStruct {
2970  static void Init();
2971};
2972__attribute__ ((visibility ("default"))) void TestFunc() {
2973  TestStruct::Init();
2974}
2975_ACEOF
2976      if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
2977         gccvisbroken=yes
2978      else
2979         case "$build_cpu" in
2980            i?86|x86_64)
2981               if $EGREP -q '@PLT' visibility.s; then
2982                  gccvisbroken=no
2983               else
2984                  gccvisbroken=yes
2985               fi
2986               ;;
2987            *)
2988               gccvisbroken=no
2989               ;;
2990         esac
2991      fi
2992      rm -f visibility.s visibility.cxx
2993
2994      AC_MSG_RESULT([$gccvisbroken])
2995      if test "$gccvisbroken" = "yes"; then
2996         AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
2997         echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
2998         unset HAVE_GCC_VISIBILITY_FEATURE
2999      fi
3000   fi
3001
3002   AC_LANG_POP([C++])
3003fi
3004
3005AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3006
3007dnl ===================================================================
3008dnl allocator
3009dnl ===================================================================
3010AC_MSG_CHECKING([which memory allocator to use])
3011if test "$with_alloc" = "system"; then
3012    AC_MSG_RESULT([system])
3013    ALLOC="SYS_ALLOC";
3014    AC_CHECK_FUNCS([malloc realloc calloc free])
3015fi
3016if test "$with_alloc" = "tcmalloc"; then
3017    AC_MSG_RESULT(tcmalloc)
3018    if ! echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3019        AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3020    fi
3021    AC_CHECK_LIB(tcmalloc, malloc, [],
3022        [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3023    ALLOC="TCMALLOC";
3024fi
3025if test "$with_alloc" = "jemalloc"; then
3026  if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3027    AC_MSG_RESULT(jemalloc)
3028    save_CFLAGS=$CFLAGS
3029    CFLAGS="$CFLAGS -pthread"
3030    AC_CHECK_LIB(jemalloc, malloc, [],
3031        [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3032    ALLOC="JEMALLOC";
3033    CFLAGS=$save_CFLAGS
3034  else
3035    AC_MSG_RESULT([system])
3036    ALLOC="SYS_ALLOC";
3037    AC_CHECK_FUNCS([malloc realloc calloc free])
3038  fi
3039fi
3040if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3041   AC_MSG_RESULT([internal])
3042fi
3043AC_SUBST(ALLOC)
3044
3045dnl ===================================================================
3046dnl Custom build version
3047dnl ===================================================================
3048
3049AC_MSG_CHECKING([whether to add custom build version])
3050if test "z$with_build_version" != "z"; then
3051   BUILD_VER_STRING=$with_build_version
3052   AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3053else
3054   BUILD_VER_STRING=
3055   AC_MSG_RESULT([no])
3056fi
3057AC_SUBST(BUILD_VER_STRING)
3058
3059dnl ===================================================================
3060dnl Java support enable
3061dnl ===================================================================
3062AC_MSG_CHECKING([whether to build with Java support])
3063if test "$WITH_JAVA" != "no"; then
3064   AC_MSG_RESULT([yes])
3065   SOLAR_JAVA="TRUE"
3066else
3067   AC_MSG_RESULT([no])
3068   SOLAR_JAVA=""
3069
3070   AC_MSG_WARN([building without java will mean some features will not be available])
3071   echo "building without java will mean some features will not be available" >>warn
3072fi
3073AC_SUBST(SOLAR_JAVA)
3074
3075if test "$_os" = "Linux" && test "$build_cpu" = "powerpc"; then
3076   # IBMs JDK needs this...
3077   JITC_PROCESSOR_TYPE=6
3078   export JITC_PROCESSOR_TYPE
3079fi
3080
3081if test "$_os" = "WINNT"; then
3082   if test -z "$with_jdk_home"; then
3083      _jdk_home=`./oowintool --jdk-home`
3084       if test -d "$_jdk_home"; then
3085          with_jdk_home="$_jdk_home"
3086       fi
3087   else
3088      with_jdk_home=`cygpath -u "$with_jdk_home"`
3089   fi
3090fi
3091
3092dnl ===================================================================
3093dnl Checks for java
3094dnl ===================================================================
3095if test "$SOLAR_JAVA" != ""; then
3096   JAVA_HOME=; export JAVA_HOME
3097   if test -z "$with_jdk_home"; then
3098      AC_PATH_PROG(JAVAINTERPRETER, $WITH_JAVA)
3099   else
3100      _java_path="$with_jdk_home/bin/$WITH_JAVA"
3101      dnl Check if there is a java interpreter at all.
3102      if test -x "$_java_path"; then
3103         JAVAINTERPRETER=$_java_path
3104      else
3105         AC_MSG_ERROR([$_java_path not found, please use --with-jdk-home])
3106      fi
3107   fi
3108   if test "$_os" = "WINNT"; then
3109      if test x`echo "$JAVAINTERPRETER" | grep -i '\.exe$'` = x; then
3110          JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3111      fi
3112      JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3113      JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3114   elif test "$_os" = "Darwin"; then
3115      dnl HACK:  There currently is only a 32 bit version of OOo for Mac OS X,
3116      dnl and Tiger java complains about -d32 while Snow Leopard java needs it
3117      dnl to run in 32 bit mode and be able to load OOo jnilibs:
3118      AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
3119      if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
3120         AC_MSG_RESULT([yes])
3121         JAVAIFLAGS=-d32
3122      else
3123         AC_MSG_RESULT([no])
3124      fi
3125   fi
3126fi
3127
3128dnl ===================================================================
3129dnl Checks for JDK.
3130dnl ===================================================================
3131if test "$SOLAR_JAVA" != ""; then
3132   _gij_longver=0
3133   AC_MSG_CHECKING([the installed JDK])
3134   if test -n "$JAVAINTERPRETER"; then
3135      dnl java -version sends output to stderr!
3136      if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then
3137         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3138#        dnl Kaffe specific tests
3139#        KAFFE_VER=`$JAVAINTERPRETER -version 2>&1 | $EGREP "  Version:" | $SED -r "s/.*  Version: ([[0-9\.]]*).*/\1/"`
3140#        if test -z "$KAFFE_VER"; then
3141#          AC_MSG_ERROR([looks like Kaffe but version detection failed])
3142#        fi
3143#        _kaffe_ver=`echo "$KAFFE_VER" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3144#        if test "$_kaffe_ver" -lt 10100; then
3145#           AC_MSG_ERROR([Kaffe is too old ($KAFFE_VER - $_kaffe_ver), you need at least 1.1.0])
3146#        fi
3147#        JDK=kaffe
3148#
3149#        dnl TODO: define some project exclusion variables
3150#
3151#        AC_MSG_RESULT([checked (Kaffe $KAFFE_VER)])
3152#        AC_MSG_WARN([EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile])
3153#        echo "EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile" >>warn
3154#        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3155      elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then
3156        JDK=gcj
3157        AC_MSG_RESULT([checked (gcj)])
3158        _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
3159        _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3160
3161      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | grep -c "BEA"` -gt 0; then
3162         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3163#        JDK=bea
3164#
3165#        dnl BEA JDK specific tests
3166#        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3167#        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3168#
3169#        if test "$_jdk_ver" -lt 10500; then
3170#          AC_MSG_ERROR([JDK is too old, you need at least BEA JDK 1.5.0])
3171#        fi
3172#
3173#        AC_MSG_RESULT([checked (BEA JDK $_jdk)])
3174#
3175#        if test "$with_jdk_home" = ""; then
3176#             AC_MSG_ERROR([In order to successfully build Apache OpenOffice using the BEA JDK,
3177#you must use the "--with-jdk-home" configure option explicitly])
3178#        fi
3179#
3180#        AC_MSG_WARN([A bug in certain BEA JREs can prevent you from successfully compiling some modules])
3181#        echo "A bug in certain BEA JREs can prevent you from successfully compiling some modules" >>warn
3182#
3183#        JAVA_HOME=$with_jdk_home
3184#
3185      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | grep -c "IBM"` -gt 0; then
3186        JDK=ibm
3187
3188        dnl IBM JDK specific tests
3189        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3190        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3191
3192        if test "$_jdk_ver" -lt 10500; then
3193             AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
3194        fi
3195
3196        AC_MSG_RESULT([checked (IBM JDK $_jdk)])
3197
3198        if test "$with_jdk_home" = ""; then
3199             AC_MSG_ERROR([In order to successfully build Apache OpenOffice using the IBM JDK,
3200you must use the "--with-jdk-home" configure option explicitly])
3201        fi
3202
3203        JAVA_HOME=$with_jdk_home
3204
3205      else
3206        JDK=sun
3207
3208        dnl SUN JDK specific tests
3209        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3210        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3211
3212        if test "$_jdk_ver" -lt 10500; then
3213             AC_MSG_ERROR([JDK is too old, you need at least 1.5])
3214        fi
3215        AC_MSG_RESULT([checked (JDK $_jdk)])
3216        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3217        if test "$_os" = "WINNT"; then
3218          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3219        fi
3220        if test "$_os" = "OS2"; then
3221          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3222        fi
3223      fi
3224   else
3225      AC_MSG_ERROR([JAVA not found. You need at least jdk-1.5, or gcj-4])
3226   fi
3227else
3228   dnl Java disabled
3229   JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
3230fi
3231
3232dnl ===================================================================
3233dnl Checks for javac
3234dnl ===================================================================
3235if test "$SOLAR_JAVA" != ""; then
3236    if test "$JDK" = "gcj"; then
3237        javacompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
3238    else
3239        javacompiler="javac"
3240    fi
3241    if test "$_os" = "OS2"; then
3242      if test x`echo "$javacompiler" | grep -i '\.exe$'` = x; then
3243          javacompiler="${javacompiler}.exe"
3244      fi
3245    fi
3246    if test -z "$with_jdk_home"; then
3247        AC_PATH_PROG(JAVACOMPILER, $javacompiler)
3248    else
3249        _javac_path="$with_jdk_home/bin/$javacompiler"
3250        dnl Check if there is a java compiler at all.
3251        if test -x "$_javac_path"; then
3252            JAVACOMPILER=$_javac_path
3253        fi
3254    fi
3255    if test -z "$JAVACOMPILER"; then
3256      AC_MSG_ERROR([$javacompiler not found, please use --with-jdk-home])
3257    fi
3258    if test "$_os" = "WINNT"; then
3259       if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
3260          JAVACOMPILER="${JAVACOMPILER}.exe"
3261       fi
3262       JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
3263       JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
3264    fi
3265    if test "$_os" = "OS2"; then
3266       if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
3267          JAVACOMPILER="${JAVACOMPILER}.exe"
3268       fi
3269    fi
3270
3271    if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
3272        AC_MSG_CHECKING([re-checking JDK])
3273        JDK=gcj
3274        AC_MSG_RESULT([checked (ecj)])
3275        #TODO: what's to do here? some switch to do 1.5 compiling?
3276        JAVAFLAGS="-source 1.5 -target 1.5"
3277        _gij_longver="40200"
3278    fi
3279fi
3280
3281JAVACISGCJ=""
3282dnl ===================================================================
3283dnl Checks that javac is gcj
3284dnl ===================================================================
3285if test "$SOLAR_JAVA" != ""; then
3286    if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
3287        JAVACISGCJ="yes"
3288    fi
3289fi
3290AC_SUBST(JAVACISGCJ)
3291
3292dnl ===================================================================
3293dnl Checks for javadoc
3294dnl ===================================================================
3295if test "$SOLAR_JAVA" != ""; then
3296    if test -z "$with_jdk_home"; then
3297        AC_PATH_PROG(JAVADOC, javadoc)
3298    else
3299        _javadoc_path="$with_jdk_home/bin/javadoc"
3300        if test "$_os" = "OS2"; then
3301          if test x`echo "$_javadoc_path" | grep -i '\.exe$'` = x; then
3302              _javadoc_path="${_javadoc_path}.exe"
3303          fi
3304        fi
3305        dnl Check if there is a javadoc at all.
3306        if test -x "$_javadoc_path"; then
3307            JAVADOC=$_javadoc_path
3308        else
3309            AC_PATH_PROG(JAVADOC, javadoc)
3310        fi
3311    fi
3312    if test -z "$JAVADOC"; then
3313      AC_MSG_ERROR([$_javadoc_path not found, please use --with-jdk-home])
3314    fi
3315    if test "$_os" = "WINNT"; then
3316        if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3317            JAVADOC="${JAVADOC}.exe"
3318        fi
3319        JAVADOC=`cygpath -d "$JAVADOC"`
3320        JAVADOC=`cygpath -u "$JAVADOC"`
3321    fi
3322    if test "$_os" = "OS2"; then
3323        if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3324            JAVADOC="${JAVADOC}.exe"
3325        fi
3326    fi
3327fi
3328
3329if test "$SOLAR_JAVA" != ""; then
3330    dnl first check if we have been asked to autodetect JAVA_HOME with a recent gij
3331    if test "$JDK" = "gcj" -a -z "$JAVA_HOME"; then
3332      if test "x$with_jdk_home" = "x" -a "$_gij_longver" -ge "40200"; then
3333        cat > findhome.java <<_ACEOF
3334[import java.io.File;
3335
3336class findhome
3337{
3338    public static void main(String args[])
3339    {
3340        String jrelocation = System.getProperty("java.home");
3341        File jre = new File(jrelocation);
3342        System.out.println(jre.getParent());
3343    }
3344}]
3345_ACEOF
3346        AC_MSG_CHECKING([if javac works])
3347        javac_cmd="$JAVACOMPILER findhome.java 1>&2"
3348        AC_TRY_EVAL(javac_cmd)
3349        if test $? = 0 && test -f ./findhome.class ; then
3350          AC_MSG_RESULT([javac works])
3351        else
3352          echo "configure: javac test failed" >&5
3353          cat findhome.java >&5
3354          AC_MSG_ERROR([javac does not work - java projects will not build!])
3355        fi
3356
3357        AC_MSG_CHECKING([if gij knows its java.home])
3358        JAVA_HOME=`$JAVAINTERPRETER findhome`
3359        if test $? = 0 && test "$JAVA_HOME" != "" ; then
3360          AC_MSG_RESULT([$JAVA_HOME])
3361        else
3362          echo "configure: java test failed" >&5
3363          cat findhome.java >&5
3364          AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
3365        fi
3366      else
3367        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
3368      fi
3369    fi
3370
3371    dnl second sanity check JAVA_HOME if possible
3372    if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
3373      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
3374      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
3375         javac_link_f=`readlink -f "$JAVACOMPILER" 2>/dev/null`
3376         if test $? == 0 && test "$JAVACOMPILER" != "$javac_link_f"; then
3377          # try to recover first by looking whether we have a alternatives
3378          # system as in Debian or newer SuSEs where following /usr/bin/javac
3379          # over /etc/alternatives/javac leads to the right bindir where we
3380          # just need to strip a bit away to get a valid JAVA_HOME
3381          # Solaris 11 is even worse, because target is relative, so use -f
3382            JAVA_HOME="$javac_link_f"
3383         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
3384          # Darwin readlink(1) is so primitive it doesn't even support -f
3385          # maybe only one level of symlink (e.g. on Mac)
3386            JAVA_HOME=`readlink $JAVACOMPILER`
3387         else
3388          # else warn
3389          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
3390          AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
3391          echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
3392          echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
3393          fi
3394         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
3395         if test "$JAVA_HOME" != "/usr"; then
3396            if test "$_os" = "Darwin"; then
3397               dnl Leopard returns a non-suitable path with readlink - points to "Current" only
3398               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
3399               dnl Tiger already returns a JDK path..
3400               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
3401            else
3402               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
3403            fi
3404         fi
3405      fi
3406      # now check if $JAVA_HOME is really valid
3407      if test "$_os" = "Darwin"; then
3408         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
3409            JAVA_HOME_OK="NO"
3410         fi
3411      elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
3412         JAVA_HOME_OK="NO"
3413      fi
3414      if test "$JAVA_HOME_OK" = "NO"; then
3415         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
3416         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
3417         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
3418         echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
3419         echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
3420         echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
3421#         if test "$JDK" = "gcj"; then
3422#             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
3423#         fi
3424      fi
3425    fi
3426fi
3427
3428AWTLIB=
3429if test "$SOLAR_JAVA" != ""; then
3430   AC_MSG_CHECKING([for jawt lib name])
3431   if test "$JDK" = "gcj"; then
3432      save_CFLAGS=$CFLAGS
3433      save_LDFLAGS=$LDFLAGS
3434      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3435      LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
3436      exec 6>/dev/null # no output
3437      AC_CHECK_HEADER(jni.h, [],
3438                    [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
3439      AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
3440      exec 6>&1 # output on again
3441      CFLAGS=$save_CFLAGS
3442      LDFLAGS=$save_LDFLAGS
3443   fi
3444   # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
3445   # A workaround is to link also against libpmawt.so
3446   if test "$JDK" = "ibm" ; then
3447      save_CFLAGS=$CFLAGS
3448      save_LDFLAGS=$LDFLAGS
3449      save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
3450      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3451      LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
3452      LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
3453      export LD_LIBRARY_PATH
3454      exec 6>/dev/null # no output
3455      AC_CHECK_HEADER(jni.h, [],
3456                    [AC_MSG_ERROR([jni.h could not be found.])], [])
3457      AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
3458      if test -z "$AWTLIB"; then
3459         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
3460         AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
3461      fi
3462      exec 6>&1 # output on again
3463      CFLAGS=$save_CFLAGS
3464      LDFLAGS=$save_LDFLAGS
3465      LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
3466   fi
3467   if test -z "$AWTLIB"; then
3468      AWTLIB=-ljawt
3469   fi
3470   AC_MSG_RESULT([$AWTLIB])
3471   AC_SUBST(AWTLIB)
3472fi
3473
3474dnl ===================================================================
3475dnl Check for optional gcj for AOT
3476dnl ===================================================================
3477if test "$SOLAR_JAVA" != ""; then
3478  AC_MSG_CHECKING([whether to enable gcj aot compilation])
3479  if test -n "$enable_gcjaot" && test "$enable_gcjaot" != "no"; then
3480     AC_MSG_RESULT([yes])
3481     if test `echo $WITH_JAVA | grep -c "gij"` -eq 0; then
3482        gcjaot="gcj"
3483     else
3484        gcjaot=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g"`
3485     fi
3486     AC_MSG_RESULT([$gcjaot])
3487     if test -n "$with_jdk_home"; then
3488        _javac_path="$with_jdk_home/bin/$gcjaot"
3489        dnl Check if there is a gcj at all.
3490        if test -x "$_javac_path"; then
3491           JAVAAOTCOMPILER=$_javac_path
3492        fi
3493     fi
3494     if test -z "$JAVAAOTCOMPILER"; then
3495        AC_PATH_PROG(JAVAAOTCOMPILER, $gcjaot)
3496     fi
3497     if test -z "$JAVAAOTCOMPILER"; then
3498        AC_MSG_WARN([$gcjaot not found, please use --with-jdk-home])
3499     fi
3500  else
3501     AC_MSG_RESULT([no])
3502  fi
3503fi
3504
3505AC_SUBST(JAVA_HOME)
3506AC_SUBST(JDK)
3507AC_SUBST(JAVAFLAGS)
3508AC_SUBST(JAVAINTERPRETER)
3509AC_SUBST(JAVAIFLAGS)
3510AC_SUBST(JAVACOMPILER)
3511AC_SUBST(JAVAAOTCOMPILER)
3512AC_SUBST(JAVADOC)
3513
3514dnl ===================================================================
3515dnl Checks for specific files.
3516dnl ===================================================================
3517
3518dnl ===================================================================
3519dnl Checks for programs.
3520dnl ===================================================================
3521
3522AC_MSG_CHECKING([whether to enable EPM for packing])
3523if test "$enable_epm" = "yes"; then
3524   AC_MSG_RESULT([yes])
3525   dnl ===================================================================
3526   dnl Check for epm - not needed for windows
3527   dnl ===================================================================
3528   if test "$_os" != "WINNT"; then
3529      if test -n "$with_epm"; then
3530	      EPM=$with_epm
3531      else
3532         AC_PATH_PROG(EPM, epm, no)
3533      fi
3534
3535      if test "$EPM" = "no" && test -n "$with_epm_url" ; then
3536         # At this moment we can not verify the URL or the content that we want to download.
3537      	 # Neither can we apply the test below for ruling out that it is the SunStudio dmake.
3538       	 EPM_URL=$with_epm_url
3539       	 AC_MSG_RESULT([epm will be downloaded and compiled in bootstrap])
3540       	 EPM=
3541         echo "EPM will be built."
3542         BUILD_EPM=YES
3543         BUILD_TYPE="$BUILD_TYPE EPM"
3544      else
3545         if test "$EPM" = "no" ; then
3546	    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)])
3547	 else
3548	    # Gentoo has some epm which is something different...
3549            AC_MSG_CHECKING([whether the found epm is the right epm])
3550            if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
3551               AC_MSG_RESULT([yes])
3552            else
3553	       AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
3554            fi
3555            AC_MSG_CHECKING([epm version])
3556            EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
3557	    if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
3558	       	    test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
3559               AC_MSG_RESULT([OK, >= 3.7])
3560               BUILD_EPM=NO
3561	       if test "$_os" = "Darwin"; then
3562                  AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
3563        	  _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
3564        	  if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
3565          	     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)])
3566        	  elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
3567          	     AC_MSG_RESULT([$_pm, ok])
3568        	  else # we never should get here, but go safe
3569		     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)])
3570		  fi
3571	       fi
3572	    else
3573               AC_MSG_ERROR([too old. epm >= 3.7 is required.])
3574	    fi
3575      	 fi
3576      fi
3577   fi
3578
3579   # test which package format to use
3580   AC_MSG_CHECKING([which package format to use])
3581
3582   # defaults
3583   case "$_os" in
3584	OS2)
3585		PKGFORMAT=native
3586		;;
3587	Darwin)
3588		PKGFORMAT=dmg
3589		;;
3590	SunOS)
3591		PKGFORMAT=pkg
3592		;;
3593	Linux)
3594      # if building on Debian, default should be deb...
3595      if test -e /etc/debian_version; then
3596         PKGFORMAT=deb
3597      else
3598         PKGFORMAT=rpm
3599      fi
3600		;;
3601	AIX)
3602		PKGFORMAT=aix
3603		;;
3604	*BSD)
3605		PKGFORMAT=bsd
3606		;;
3607	OSF1)
3608		PKGFORMAT=setld
3609		;;
3610    WINNT)
3611        PKGFORMAT=msi
3612        ;;
3613	# we never should get here since we check the arciecture/os at the beginning,
3614	# but go sure...
3615	*)
3616		AC_MSG_ERROR([unknown system])
3617   esac
3618   if test -n "$with_package_format"; then
3619	for i in $with_package_format; do
3620		case "$i" in
3621			aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
3622			;;
3623		*)
3624			AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
3625aix - AIX software distribution
3626bsd - FreeBSD, NetBSD, or OpenBSD software distribution
3627depot or swinstall - HP-UX software distribution
3628deb - Debian software distribution
3629inst or tardist - IRIX software distribution
3630osx - MacOS X software distribution
3631pkg - Solaris software distribution
3632rpm - RedHat software distribution
3633setld - Tru64 (setld) software distribution
3634native - "Native" software distribution for the platform
3635portable - Portable software distribution
3636OOo additionally supports:
3637archive - .tar.gz or .zip
3638dmg - Mac OS X .dmg
3639installed - installation tree
3640msi - Windows .msi
3641			])
3642			;;
3643		esac
3644	done
3645	PKGFORMAT="$with_package_format"
3646   fi
3647   AC_MSG_RESULT([$PKGFORMAT])
3648   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
3649      AC_MSG_CHECKING([for rpm])
3650      for a in "$RPM" rpmbuild rpm; do
3651         $a --usage >/dev/null 2> /dev/null
3652         if test $? -eq 0; then
3653            RPM=$a
3654            break
3655         else
3656            $a --version >/dev/null 2> /dev/null
3657            if test $? -eq 0; then
3658               RPM=$a
3659               break
3660            fi
3661         fi
3662       done
3663       if test -z "$RPM" ; then
3664          AC_MSG_ERROR([not found])
3665       elif "$RPM" --usage 2>&1 | $EGREP -- -bb >/dev/null; then
3666          RPM_PATH=`which $RPM`
3667          AC_MSG_RESULT([$RPM_PATH])
3668       else
3669          AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
3670       fi
3671   fi
3672   if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
3673      AC_PATH_PROG(DPKG, dpkg, no)
3674      if test "$DPKG" = "no"; then
3675         AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
3676      fi
3677   fi
3678   if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
3679      if test "$_os" = "Darwin"; then
3680         AC_MSG_CHECKING([for PackageMaker availability])
3681         if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
3682            AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
3683         else
3684            AC_MSG_RESULT([ok])
3685         fi
3686      else
3687         AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
3688       fi
3689   fi
3690   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
3691      echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3692      	if test "$EPM" != "no" && test "$EPM" != "internal"; then
3693           if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
3694               AC_MSG_CHECKING([whether epm is patched for OOos needs])
3695               if grep "Patched for Apache OpenOffice" $EPM >/dev/null 2>/dev/null; then
3696                  AC_MSG_RESULT([yes])
3697               else
3698                  AC_MSG_RESULT([no])
3699                  if echo "$PKGFORMAT" | grep -q rpm; then
3700                      _pt="rpm"
3701                      AC_MSG_WARN([the rpms will need to be installed with --nodeps])
3702                      echo "the rpms will need to be installed with --nodeps" >> warn
3703                  else
3704                      _pt="pkg"
3705                  fi
3706                  AC_MSG_WARN([the ${_pt}s will not be relocateable])
3707                  echo "the ${_pt}s will not be relocateable" >> warn
3708                  AC_MSG_WARN([if you want to make sure installation without --nodeps and
3709                  relocation will work, you need to patch your epm with the
3710                  patch in epm/epm-3.7.patch or build with
3711                  --with-epm=internal which will build a suitable epm])
3712               fi
3713           fi
3714        fi
3715   fi
3716   if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3717      AC_PATH_PROG(PKGMK, pkgmk, no)
3718      if test "$PKGMK" = "no"; then
3719         AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
3720      fi
3721   fi
3722   AC_SUBST(RPM)
3723   AC_SUBST(DPKG)
3724   AC_SUBST(PKGMK)
3725else
3726   AC_MSG_RESULT([no])
3727   BUILD_EPM=NO
3728   EPM=NO
3729   PKGFORMAT=native
3730fi
3731AC_SUBST(BUILD_EPM)
3732AC_SUBST(EPM_URL)
3733AC_SUBST(EPM)
3734AC_SUBST(PKGFORMAT)
3735
3736dnl ===================================================================
3737dnl Check for gperf
3738dnl ===================================================================
3739AC_PATH_PROG(GPERF, gperf)
3740if test -z "$with_gperf"; then
3741    AC_PATH_PROG(GPERF, gperf)
3742    if test -z "$GPERF"; then
3743       AC_MSG_ERROR([gperf not found but needed. Install it and/or specify --with-gperf=/path/to/it.])
3744    fi
3745else
3746  if test -x "$with_gperf"; then
3747    GPERF=$with_gperf
3748  else
3749    AC_MSG_ERROR([--with-gperf did not point to an executable])
3750  fi
3751fi
3752AC_MSG_CHECKING([gperf version])
3753if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
3754	AC_MSG_RESULT([OK])
3755   GPERF=$GPERF
3756else
3757	AC_MSG_ERROR([too old, you need at least 3.0.0])
3758fi
3759AC_SUBST(GPERF)
3760
3761dnl ===================================================================
3762dnl Check for building stax
3763dnl ===================================================================
3764AC_MSG_CHECKING([whether to build the stax])
3765if test -f "./stax/download/stax-1.2.0.jar"; then
3766   BUILD_STAX=NO
3767   AC_MSG_RESULT([no, will use the prebuilt stax/download/stax-1.2.0.jar])
3768else
3769   BUILD_STAX=YES
3770   AC_MSG_RESULT([yes])
3771fi
3772AC_SUBST(BUILD_STAX)
3773
3774dnl ===================================================================
3775dnl Check for building ODK
3776dnl ===================================================================
3777AC_MSG_CHECKING([whether to build the ODK])
3778if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
3779   AC_MSG_RESULT([yes])
3780   if test "$WITH_JAVA" != "no"; then
3781   AC_MSG_CHECKING([for external/unowinreg/unowinreg.dll])
3782   if ! test -f "./external/unowinreg/unowinreg.dll"; then
3783      HAVE_UNOWINREG_DLL=no
3784   else
3785      HAVE_UNOWINREG_DLL=yes
3786   fi
3787   if test "$HAVE_UNOWINREG_DLL" = "yes"; then
3788      AC_MSG_RESULT([found])
3789      BUILD_UNOWINREG=NO
3790   else
3791      if test "$_os" = "WINNT"; then
3792         AC_MSG_RESULT([not found, will be built])
3793      else
3794         AC_MSG_WARN([not found, will be cross-built using mingw32])
3795      fi
3796      BUILD_UNOWINREG=YES
3797   fi
3798   if test "$_os" != "WINNT" && test "$BUILD_UNOWINREG" = "YES"; then
3799      if test -z "$WITH_MINGWIN" || test "$WITH_MINGWIN" = "0"; then
3800         AC_MSG_ERROR([for rebuilding unowinreg.dll you need the mingw32 C++ compiler.
3801         Specify mingw32 g++ executable name with --with-mingwin.
3802         Or use prebuilt one from http://tools.openoffice.org/unowinreg_prebuild/680/ and
3803         put it into external/unowinreg])
3804      fi
3805      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3806         if ! test -x "$WITH_MINGWIN"; then MINGWCXX=false; else MINGWCXX=`basename $WITH_MINGWIN`; fi
3807      else
3808         AC_CHECK_TOOL(MINGWCXX, $WITH_MINGWIN, false)
3809      fi
3810      if test "$MINGWCXX" = "false"; then
3811         AC_MSG_ERROR(specified MinGW32 C++ cross-compiler not found. Install it or correct name.)
3812      fi
3813      AC_MSG_CHECKING(whether we are using the MinGW32 cross C++ compiler)
3814      if ! echo "`$MINGWCXX -dumpmachine`" | grep -q mingw32; then
3815         AC_MSG_ERROR(no)
3816      else
3817         AC_MSG_RESULT(yes)
3818      fi
3819      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3820         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
3821      else
3822         AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`, false)
3823      fi
3824      if test "$MINGWSTRIP" = "false"; then
3825         AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
3826      fi
3827      AC_LANG_PUSH([C++])
3828      save_CXX=$CXX
3829      save_CXXCPP=$CXXCPP
3830      CXX=$MINGWCXX
3831      CXXCPP="$MINGWCXX -E"
3832      save_CXXFLAGS=$CXXFLAGS
3833      save_CPPFLAGS=$CPPFLAGS
3834      CXXFLAGS="$CXXFLAGS -I$JAVA_HOME/include"
3835      CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include"
3836      # LIBS contains -lcrypt etc due to teh AC_CHECK_LIBS which obviously
3837      # do not make sense here (and 'd make the check fail)
3838      save_LIBS=$LIBS
3839      LIBS=""
3840      AC_HAVE_LIBRARY(kernel32)
3841      AC_HAVE_LIBRARY(advapi32)
3842      AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR([windows.h missing])])
3843      CXXFLAGS=$save_CXXFLAGS
3844      CPPFLAGS=$save_CPPFLAGS
3845      CXX=$save_CXX
3846      CXXCPP=$save_CXXCPP
3847      LIBS=$save_LIBS
3848      AC_LANG_POP([C++])
3849      fi
3850   fi
3851   BUILD_TYPE="$BUILD_TYPE ODK"
3852else
3853   AC_MSG_RESULT([no])
3854   BUILD_UNOWINREG=NO
3855fi
3856AC_SUBST(BUILD_UNOWINREG)
3857AC_SUBST(MINGWCXX)
3858AC_SUBST(MINGWSTRIP)
3859
3860dnl ===================================================================
3861dnl Check for system stdlibs
3862dnl ===================================================================
3863AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
3864if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
3865   test "$with_system_stdlibs" != "no"; then
3866   AC_MSG_RESULT([no])
3867   SYSTEM_STDLIBS=YES
3868else
3869   AC_MSG_RESULT([yes])
3870   SYSTEM_STDLIBS=NO
3871fi
3872AC_SUBST(SYSTEM_STDLIBS)
3873
3874dnl ===================================================================
3875dnl Check for system zlib
3876dnl ===================================================================
3877if test "$_os" = "Darwin" && test "$with_system_zlib" != "no"; then
3878   with_system_zlib=yes
3879fi
3880AC_MSG_CHECKING([which zlib to use])
3881if test -n "$with_system_zlib" -o -n "$with_system_libs" && \
3882	test "$with_system_zlib" != "no"; then
3883    AC_MSG_RESULT([external])
3884    SYSTEM_ZLIB=YES
3885    AC_CHECK_HEADER(zlib.h, [],
3886        [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
3887    AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
3888        [AC_MSG_ERROR(zlib not found or functional)], [])
3889else
3890    AC_MSG_RESULT([internal])
3891    SYSTEM_ZLIB=NO
3892    BUILD_TYPE="$BUILD_TYPE ZLIB"
3893fi
3894AC_SUBST(SYSTEM_ZLIB)
3895
3896dnl ===================================================================
3897dnl Check for system jpeg
3898dnl ===================================================================
3899AC_MSG_CHECKING([which jpeg to use])
3900if test -n "$with_system_jpeg" -o -n "$with_system_libs" && \
3901	test "$with_system_jpeg" != "no"; then
3902    AC_MSG_RESULT([external])
3903    SYSTEM_JPEG=YES
3904    AC_CHECK_HEADER(jpeglib.h, [],
3905        [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
3906    AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
3907	[AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
3908else
3909    AC_MSG_RESULT([internal])
3910    SYSTEM_JPEG=NO
3911    BUILD_TYPE="$BUILD_TYPE JPEG"
3912fi
3913AC_SUBST(SYSTEM_JPEG)
3914
3915dnl ===================================================================
3916dnl Check for system expat
3917dnl ===================================================================
3918AC_MSG_CHECKING([which expat to use])
3919if test -n "$with_system_expat" -o -n "$with_system_libs" && \
3920	test "$with_system_expat" != "no"; then
3921    AC_MSG_RESULT([external])
3922    SYSTEM_EXPAT=YES
3923    AC_CHECK_HEADER(expat.h, [],
3924        [AC_MSG_ERROR(expat.h not found. install expat)], [])
3925    AC_CHECK_LIB(expat, XML_ParserCreate, [],
3926	[AC_MSG_RESULT(expat library not found or functional.)], [])
3927else
3928    AC_MSG_RESULT([internal])
3929    SYSTEM_EXPAT=NO
3930    BUILD_TYPE="$BUILD_TYPE EXPAT"
3931fi
3932AC_SUBST(SYSTEM_EXPAT)
3933
3934dnl ===================================================================
3935dnl Check for system libwpd
3936dnl ===================================================================
3937AC_MSG_CHECKING([which libwpd to use])
3938if test -n "$with_system_libwpd" -o -n "$with_system_libs" && \
3939        test "$with_system_libwpd" != "no"; then
3940    AC_MSG_RESULT([external])
3941    SYSTEM_LIBWPD=YES
3942    PKG_CHECK_MODULES( LIBWPD, libwpd-0.8 )
3943else
3944    AC_MSG_RESULT([no])
3945    SYSTEM_LIBWPD=
3946fi
3947AC_SUBST(SYSTEM_LIBWPD)
3948AC_SUBST(LIBWPD_CFLAGS)
3949AC_SUBST(LIBWPD_LIBS)
3950
3951dnl ===================================================================
3952dnl Check for system cppunit
3953dnl ===================================================================
3954WITH_CPPUNIT=
3955AC_MSG_CHECKING([which cppunit to use])
3956if test -n "$with_system_cppunit" -o -n "$with_system_libs" && \
3957        test "$with_system_cppunit" != "no"; then
3958    SYSTEM_CPPUNIT=YES
3959    # might work for earlier, too but go sure:
3960    PKG_CHECK_MODULES( CPPUNIT,
3961                       cppunit >= 1.12.0,
3962                       WITH_CPPUNIT="YES",
3963                       WITH_CPPUNIT=")
3964    if test -n "$WITH_CPPUNIT"; then
3965       AC_MSG_RESULT([found system cppunit $CPPUNIT])
3966    else
3967       AC_MSG_WARN([dit not find system cppunit version 1.12.0 or later])
3968    fi
3969
3970else
3971    AC_MSG_WARN([not using cppunit])
3972    SYSTEM_CPPUNIT=NO
3973fi
3974AC_SUBST(SYSTEM_CPPUNIT)
3975AC_SUBST(CPPUNIT_CFLAGS)
3976AC_SUBST(CPPUNIT_LIBS)
3977AC_SUBST(WITH_CPPUNIT)
3978
3979dnl ===================================================================
3980dnl Check whether freetype is available
3981dnl ===================================================================
3982if test  "$test_freetype" = "yes"; then
3983   AC_MSG_CHECKING([whether freetype is available])
3984	PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
3985fi
3986AC_SUBST(FREETYPE_CFLAGS)
3987AC_SUBST(FREETYPE_LIBS)
3988
3989dnl ===================================================================
3990dnl Check whether freetype2 supports emboldening
3991dnl ===================================================================
3992if test  "$test_freetype" = "yes"; then
3993    save_CPPFLAGS="$CPPFLAGS"
3994    save_LDFLAGS="$LDFLAGS"
3995    save_LIBS="$LIBS"
3996    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
3997    LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
3998    AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
3999                 [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4000    LDFLAGS="$save_LDFLAGS"
4001    CPPFLAGS="$save_CPPFLAGS"
4002    LIBS="$save_LIBS"
4003fi
4004AC_SUBST(USE_FT_EMBOLDEN)
4005
4006if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
4007   test "$with_system_libxslt" != "no"; then
4008    if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
4009      test "$with_system_libxml" = "no"; then
4010      # somehow AC_MSG_WARN won't work...
4011       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
4012       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
4013       with_system_libxml=yes
4014    fi
4015fi
4016if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
4017   test "$with_system_libxml" != "no"; then
4018    if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
4019      test "$with_system_libxslt" = "no"; then
4020      # somehow AC_MSG_WARN won't work...
4021       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
4022       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
4023       with_system_libxslt=yes
4024    fi
4025fi
4026
4027dnl ===================================================================
4028dnl Check for system libxslt
4029dnl ===================================================================
4030AC_MSG_CHECKING([which libxslt to use])
4031if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
4032       "$_os" = "Darwin" && \
4033   test "$with_system_libxslt" != "no"; then
4034   AC_MSG_RESULT([external])
4035   SYSTEM_LIBXSLT=YES
4036
4037	if test "$_os" != "Darwin"; then
4038		PKG_CHECK_MODULES(LIBXSLT, libxslt)
4039	else
4040		LIBXSLT_CFLAGS=`xslt-config --cflags`
4041		LIBXSLT_LIBS=`xslt-config --libs`
4042	fi
4043
4044   dnl Check for xsltproc
4045   AC_PATH_PROG(XSLTPROC, xsltproc, no)
4046   if test "$XSLTPROC" = "no"; then
4047      AC_MSG_ERROR([xsltproc is required])
4048   fi
4049else
4050   AC_MSG_RESULT([internal])
4051   SYSTEM_LIBXSLT=NO
4052   BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4053fi
4054AC_SUBST(SYSTEM_LIBXSLT)
4055AC_SUBST(LIBXSLT_CFLAGS)
4056AC_SUBST(LIBXSLT_LIBS)
4057
4058
4059dnl ===================================================================
4060dnl Check for system libxml
4061dnl ===================================================================
4062AC_MSG_CHECKING([which libxml to use])
4063if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
4064            "$_os" = "Darwin" && \
4065	test "$with_system_libxml" != "no"; then
4066    AC_MSG_RESULT([external])
4067    SYSTEM_LIBXML=YES
4068    BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
4069
4070	if test "$_os" != "Darwin"; then
4071		PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4072	else
4073		LIBXML_CFLAGS=`xml2-config --cflags`
4074		LIBXML_LIBS=`xml2-config --libs`
4075	fi
4076else
4077    AC_MSG_RESULT([internal])
4078    SYSTEM_LIBXML=NO
4079    BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
4080fi
4081AC_SUBST(SYSTEM_LIBXML)
4082AC_SUBST(LIBXML_CFLAGS)
4083AC_SUBST(LIBXML_LIBS)
4084
4085dnl ===================================================================
4086dnl Check for system python
4087dnl ===================================================================
4088AC_MSG_CHECKING([which python to use])
4089if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
4090   with_system_python=yes
4091
4092   _python="/Library/Frameworks/Python.framework/Versions/Current/bin/python"
4093   _python_hexversion=`$_python -c "import sys; print(sys.hexversion);"`
4094
4095   dnl hex version of Python 2.7.1 = 34013680
4096   if test $_python_hexversion -ge 34013680 ; then
4097      AC_MSG_RESULT([compiling against system python (version $_python_version)])
4098
4099	  _python_ver=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4100
4101   	  PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4102   else
4103		AC_MSG_ERROR([Python 2.7.1 or higher is required])
4104   fi
4105
4106   PYTHON_LIBS="-framework Python"
4107elif test -n "$with_system_python" -o -n "$with_system_libs" && \
4108	test "$with_system_python" != "no"; then
4109   with_system_python=yes
4110   AC_MSG_RESULT([external])
4111   AM_PATH_PYTHON([2.3])
4112
4113   python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
4114   python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4115   PYTHON_CFLAGS="-I$python_include"
4116   PYTHON_LIBS="-lpython$python_version"
4117fi
4118if test "$with_system_python" = "yes" ; then
4119   SYSTEM_PYTHON=YES
4120   dnl check if the headers really work:
4121   save_CPPFLAGS="$CPPFLAGS"
4122   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4123   AC_CHECK_HEADER(Python.h, [],
4124       [AC_MSG_ERROR(Python headers not found)], [])
4125   CPPFLAGS="$save_CPPFLAGS"
4126else
4127   SYSTEM_PYTHON=NO
4128   BUILD_TYPE="$BUILD_TYPE PYTHON"
4129   AC_MSG_RESULT([internal])
4130   # Embedded python dies without Home set
4131   if test "z$HOME" = "z"; then
4132      export HOME="";
4133   fi
4134   # bz2 tarball and bzip2 is not standard
4135   if test -z "$BZIP2"; then
4136	AC_PATH_PROG( BZIP2, bzip2)
4137	if test -z "$BZIP2"; then
4138   		AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
4139   	fi
4140   fi
4141fi
4142AC_SUBST(SYSTEM_PYTHON)
4143AC_SUBST(PYTHON_CFLAGS)
4144AC_SUBST(PYTHON_LIBS)
4145HOME=`echo $HOME | sed 's:\\\\:/:g'`
4146AC_SUBST(HOME)
4147
4148dnl ===================================================================
4149dnl Check for system lucene
4150dnl ===================================================================
4151AC_MSG_CHECKING([which lucene to use])
4152if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4153       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4154        AC_MSG_RESULT([external])
4155        SYSTEM_LUCENE=YES
4156        if test -z $LUCENE_CORE_JAR; then
4157          AC_CHECK_FILE(/usr/share/java/lucene-core-2.9.4.jar,
4158            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.9.4.jar ],
4159            [
4160              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4161                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4162                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4163                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4164                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4165                  )
4166                ]
4167              )
4168            ]
4169          )
4170        else
4171          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4172               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
4173        fi
4174
4175        if test -z $LUCENE_ANALYZERS_JAR; then
4176          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
4177            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
4178            [
4179              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
4180                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
4181                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
4182              )
4183            ]
4184          )
4185        else
4186          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4187               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
4188        fi
4189        AC_MSG_CHECKING([whether lucene is version 2.x])
4190        export LUCENE_CORE_JAR
4191        if $PERL -e 'use Archive::Zip;
4192            my $file = "$ENV{'LUCENE_CORE_JAR'}";
4193            my $zip = Archive::Zip->new( $file );
4194            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4195            if ( $mf =~ m/Specification-Version: 2.*/ ) {
4196                exit 0;
4197            } else {
4198                exit 1;
4199            }'; then
4200            AC_MSG_RESULT([yes])
4201         else
4202            AC_MSG_RESULT([no])
4203            AC_MSG_CHECKING([whether lucene is version 3.x])
4204
4205            if $PERL -e 'use Archive::Zip;
4206                my $file = "$ENV{'LUCENE_CORE_JAR'}";
4207                my $zip = Archive::Zip->new( $file );
4208                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4209                if ( $mf =~ m/Specification-Version: 3.*/ ) {
4210                    exit 0;
4211                } else {
4212                    exit 1;
4213                }'; then
4214                AC_MSG_RESULT([yes])
4215             else
4216                AC_MSG_ERROR([no, you need lucene 2 or 3])
4217             fi
4218         fi
4219
4220else
4221    AC_MSG_RESULT([internal])
4222    SYSTEM_LUCENE=NO
4223    BUILD_TYPE="$BUILD_TYPE LUCENE"
4224fi
4225AC_SUBST(SYSTEM_LUCENE)
4226AC_SUBST(LUCENE_CORE_JAR)
4227AC_SUBST(LUCENE_ANALYZERS_JAR)
4228
4229AC_MSG_CHECKING([whether to build the MySQL Connector extension])
4230if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
4231  AC_MSG_RESULT([yes])
4232  ENABLE_MYSQLC=YES
4233  AC_MSG_CHECKING([for mysqlc module])
4234  if test -d mysqlc; then
4235   AC_MSG_RESULT([OK])
4236  else
4237   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4238  fi
4239  BUILD_TYPE="$BUILD_TYPE MYSQLC"
4240else
4241  AC_MSG_RESULT([no])
4242  ENABLE_MYSQLC=NO
4243fi
4244AC_SUBST(ENABLE_MYSQLC)
4245
4246if test "$ENABLE_MYSQLC" = "YES"; then
4247dnl ===================================================================
4248dnl Check for system MySQL
4249dnl ===================================================================
4250AC_MSG_CHECKING([for mysql pre-requisites])
4251if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
4252       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
4253	AC_MSG_RESULT([external MySQL])
4254	SYSTEM_MYSQL=YES
4255	AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4256	AC_MSG_CHECKING([MySQL version])
4257	if test -z "$MYSQLCONFIG" -o ! -x "$MYSQLCONFIG" ; then
4258		AC_MSG_ERROR([can not find/execute mysql_config]);
4259	fi
4260	MYSQL_VERSION=`$MYSQLCONFIG --version`
4261	MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4262	if test "$MYSQL_MAJOR" -ge "5"; then
4263		AC_MSG_RESULT([OK])
4264	else
4265		AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4266	fi
4267	AC_MSG_CHECKING([for MySQL Client library])
4268	MYSQL_INC=`$MYSQLCONFIG --include`
4269	MYSQL_LIB=`$MYSQLCONFIG --libs`
4270	MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4271	AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4272else
4273    SYSTEM_MYSQL=NO
4274    if test -n "$with_libmysql_path"; then
4275        AC_MSG_RESULT([external Connector/C (libmysql)])
4276        LIBMYSQL=libmysql.so
4277        if test "$_os" = "Darwin"; then
4278            LIBMYSQL=libmysql.dylib
4279        elif test "$_os" = "WINNT"; then
4280            LIBMYSQL=libmysql.dll
4281        fi
4282        AC_MSG_CHECKING([for $LIBMYSQL])
4283        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4284            AC_MSG_RESULT([found.])
4285            LIBMYSQL_PATH=$with_libmysql_path
4286        else
4287            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4288        fi
4289    else
4290        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4291    fi
4292fi
4293AC_SUBST(SYSTEM_MYSQL)
4294AC_SUBST(MYSQL_INC)
4295AC_SUBST(MYSQL_LIB)
4296AC_SUBST(MYSQL_DEFINES)
4297AC_SUBST(LIBMYSQL_PATH)
4298
4299AC_LANG_PUSH([C++])
4300dnl ===================================================================
4301dnl Check for system MySQL C++ Connector
4302dnl ===================================================================
4303# FIXME!
4304# who thought this too-generic cppconn dir was a good idea?
4305AC_MSG_CHECKING([MySQL Connector/C++])
4306if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4307		test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4308	AC_MSG_RESULT([external])
4309	SYSTEM_MYSQL_CPPCONN=YES
4310        AC_LANG_PUSH([C++])
4311	AC_CHECK_HEADER(mysql_driver.h, [],
4312					[AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4313	AC_CHECK_LIB(mysqlcppconn, main, [],
4314					[AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4315   AC_MSG_CHECKING([version])
4316      AC_TRY_RUN([
4317#include <mysql_driver.h>
4318
4319int main(int argc, char **argv) {
4320	sql::Driver *driver;
4321	driver = get_driver_instance();
4322	if (driver->getMajorVersion() > 1 || \
4323	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4324	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4325        return 0;
4326      else
4327        return 1;
4328}
4329      ], [AC_MSG_RESULT(OK)], [AC_MSG_ERROR([not suitable, we need >= 1.0.6])])
4330        AC_LANG_POP([C++])
4331
4332else
4333	AC_MSG_RESULT([no])
4334	SYSTEM_MYSQL_CPPCONN=
4335fi
4336AC_LANG_POP([C++])
4337AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4338fi
4339
4340dnl ===================================================================
4341dnl Check for system hsqldb
4342dnl ===================================================================
4343AC_MSG_CHECKING([which hsqldb to use])
4344if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4345       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4346        AC_MSG_RESULT([external])
4347        SYSTEM_HSQLDB=YES
4348        if test -z $HSQLDB_JAR; then
4349               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4350        fi
4351        AC_CHECK_FILE($HSQLDB_JAR, [],
4352               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4353        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4354        export HSQLDB_JAR
4355        if $PERL -e 'use Archive::Zip;
4356            my $file = "$ENV{'HSQLDB_JAR'}";
4357            my $zip = Archive::Zip->new( $file );
4358            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4359            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4360               push @l, split(/\n/, $mf);
4361               foreach my $line (@l) {
4362                  if ($line =~ m/Specification-Version:/) {
4363                      ($t, $version) = split (/:/,$line);
4364                      $version =~ s/^\s//;
4365                      ($a, $b, $c, $d) = split (/\./,$version);
4366                      if ($c == "0" && $d > "8")  {
4367                          exit 0;
4368                      } else {
4369                          exit 1;
4370                      }
4371                  }
4372               }
4373            } else {
4374                exit 1;
4375            }'; then
4376            AC_MSG_RESULT([yes])
4377         else
4378            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
4379         fi
4380else
4381    AC_MSG_RESULT([internal])
4382    SYSTEM_HSQLDB=NO
4383    BUILD_TYPE="$BUILD_TYPE HSQLDB"
4384fi
4385AC_SUBST(SYSTEM_HSQLDB)
4386AC_SUBST(HSQLDB_JAR)
4387
4388dnl ===================================================================
4389dnl Check for system beanshell
4390dnl ===================================================================
4391ENABLE_BEANSHELL=YES
4392AC_MSG_CHECKING([which beanshell to use])
4393if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
4394       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
4395        AC_MSG_RESULT([external])
4396        SYSTEM_BSH=YES
4397        if test -z $BSH_JAR; then
4398               BSH_JAR=/usr/share/java/bsh.jar
4399        fi
4400        AC_CHECK_FILE($BSH_JAR, [],
4401               [AC_MSG_ERROR(bsh.jar not found.)], [])
4402elif test "x$enable_beanshell" = "xyes"; then
4403    AC_MSG_RESULT([internal])
4404    SYSTEM_BSH=NO
4405    BUILD_TYPE="$BUILD_TYPE BSH"
4406else
4407    AC_MSG_RESULT([none (disabled)])
4408    SYSTEM_BSH=NO
4409    ENABLE_BEANSHELL=NO
4410fi
4411AC_SUBST(SYSTEM_BSH)
4412AC_SUBST(BSH_JAR)
4413AC_SUBST(ENABLE_BEANSHELL)
4414
4415
4416dnl ===================================================================
4417dnl Check for saxon.  It can come from two different places:
4418dnl - pre-installed on the system.  This is checked when the --with-system-saxon
4419dnl   option is given to configure.
4420dnl   The exact place can be specified with the --with-saxon-jar=<path> option.
4421dnl - From the saxon tar ball in ext_sources/.  This is used when --enable-saxon
4422dnl   is given to configure but not any of --with-system-saxon or --with-saxon-jar.
4423dnl ===================================================================
4424DISABLE_SAXON=
4425AC_MSG_CHECKING([which saxon to use])
4426if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
4427       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
4428        AC_MSG_RESULT([external])
4429        SYSTEM_SAXON=YES
4430        if test -z $SAXON_JAR; then
4431          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4432            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4433            [
4434              AC_CHECK_FILE(/usr/share/java/saxon.jar,
4435                [ SAXON_JAR=/usr/share/java/saxon.jar ],
4436                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4437                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4438                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
4439                  )
4440                ]
4441              )
4442            ]
4443          )
4444        else
4445          AC_CHECK_FILE($SAXON_JAR, [],
4446               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
4447        fi
4448        if test -n "$SERIALIZER_JAR"; then
4449          AC_CHECK_FILE($SERIALIZER_JAR, [],
4450               [AC_MSG_ERROR(serializer.jar not found.)], [])
4451          AC_SUBST(SERIALIZER_JAR)
4452        fi
4453
4454dnl Saxon comes in two practically available versions, the out-of-date saxonb which
4455dnl supports the java extensions that OOo uses, and the up-to-date saxon he
4456dnl "home edition" version, which is crippled to not support those java extensions.
4457dnl And as an aside the he one also needs to be tweaked to include
4458dnl a META-INF/services to broadcast that it supports the jaxp transform factory
4459
4460        AC_MSG_CHECKING([if saxon works])
4461        cat > saxontest.java <<_ACEOF
4462[import javax.xml.transform.TransformerFactory;
4463import javax.xml.transform.Transformer;
4464import javax.xml.transform.stream.StreamSource;
4465import java.io.*;
4466
4467import net.sf.saxon.FeatureKeys;
4468
4469class saxontest {
4470    public static void main(String[] args) {
4471      System.setProperty("javax.xml.transform.TransformerFactory",
4472        "net.sf.saxon.TransformerFactoryImpl");
4473      try {
4474        TransformerFactory tfactory = TransformerFactory.newInstance();
4475	// some external saxons (Debian, Ubuntu, ...) have this disabled
4476	// per default
4477	tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
4478        System.out.println("TransformerFactory is" +
4479          tfactory.getClass().getName());
4480        Transformer transformer = tfactory.newTransformer(
4481          new StreamSource(new File(args[0])));
4482      } catch(Exception e){
4483        e.printStackTrace(System.err);
4484        System.exit(-1);
4485      }
4486      System.exit(0);
4487    }
4488}
4489]
4490_ACEOF
4491        cat > saxontest.xsl<<_ACEOF
4492[<?xml version="1.0" encoding="UTF-8"?>
4493<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4494 <xsl:template match="/">
4495  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
4496 </xsl:template>
4497</xsl:stylesheet>
4498]
4499_ACEOF
4500        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
4501        AC_TRY_EVAL(javac_cmd)
4502        if test $? = 0 && test -f ./saxontest.class ; then
4503            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
4504            AC_TRY_EVAL(java_cmd)
4505            if test $? = 0; then
4506              AC_MSG_RESULT([yes])
4507            else
4508              cat saxontest.java >&5
4509              AC_MSG_RESULT([no])
4510              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
4511            fi
4512        else
4513          AC_MSG_RESULT([no])
4514          cat saxontest.java >&5
4515          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
4516        fi
4517elif test "x$enable_saxon" = "xyes"; then
4518    AC_MSG_RESULT([internal])
4519    SYSTEM_SAXON=NO
4520    BUILD_TYPE="$BUILD_TYPE SAXON"
4521else
4522    AC_MSG_RESULT([none (disabled)])
4523    SYSTEM_SAXON=NO
4524    DISABLE_SAXON=YES
4525fi
4526AC_SUBST(SYSTEM_SAXON)
4527AC_SUBST(SAXON_JAR)
4528AC_SUBST(DISABLE_SAXON)
4529
4530
4531dnl ===================================================================
4532dnl Check for rhino
4533dnl ===================================================================
4534ENABLE_JAVASCRIPT=
4535AC_MSG_CHECKING([whether to enable support for JavaScript])
4536if test "x$enable_javascript" = "xyes"; then
4537   BUILD_TYPE="$BUILD_TYPE RHINO"
4538   AC_MSG_RESULT([yes])
4539   ENABLE_JAVASCRIPT=YES
4540else
4541   AC_MSG_RESULT([no])
4542   ENABLE_JAVASCRIPT=NO
4543fi
4544AC_SUBST(ENABLE_JAVASCRIPT)
4545
4546
4547dnl ===================================================================
4548dnl Check for system apr
4549dnl ===================================================================
4550SYSTEM_APR=NO
4551APR_CFLAGS=
4552APR_LIBS=
4553AC_MSG_CHECKING([which libapr to use])
4554if test "x$with_system_apr" = "xyes" -o -n "$with_system_libs"; then
4555    AC_MSG_RESULT([system])
4556    PKG_CHECK_MODULES([APR], [apr-1 >= 1.0])
4557    SYSTEM_APR=YES
4558else
4559    AC_MSG_RESULT([internal])
4560    SYSTEM_APR=NO
4561    BUILD_TYPE="$BUILD_TYPE APR"
4562fi
4563AC_SUBST(SYSTEM_APR)
4564AC_SUBST(APR_CFLAGS)
4565AC_SUBST(APR_LIBS)
4566
4567
4568dnl ===================================================================
4569dnl Check for system apr-util
4570dnl ===================================================================
4571SYSTEM_APR_UTIL=NO
4572APR_UTIL_CFLAGS=
4573APR_UTIL_LIBS=
4574AC_MSG_CHECKING([which libapr-util to use])
4575if test "x$with_system_apr_util" = "xyes" -o -n "$with_system_libs"; then
4576    AC_MSG_RESULT([system])
4577    PKG_CHECK_MODULES([APR_UTIL], [apr-util-1 >= 1.0])
4578    SYSTEM_APR_UTIL=YES
4579else
4580    AC_MSG_RESULT([internal])
4581    SYSTEM_APR_UTIL=NO
4582    BUILD_TYPE="$BUILD_TYPE APR_UTIL"
4583fi
4584AC_SUBST(SYSTEM_APR_UTIL)
4585AC_SUBST(APR_UTIL_CFLAGS)
4586AC_SUBST(APR_UTIL_LIBS)
4587
4588
4589dnl ===================================================================
4590dnl Check for system serf
4591dnl ===================================================================
4592SYSTEM_SERF=NO
4593SERF_CFLAGS=
4594SERF_LIBS=
4595AC_MSG_CHECKING([which libserf to use])
4596if test -n "$with_system_serf" -o -n "$with_system_libs" && \
4597  test "$with_system_serf" != "no"; then
4598    AC_MSG_RESULT([system])
4599    PKG_CHECK_MODULES([SERF], [serf-1 >= 1.1])
4600    SYSTEM_SERF=YES
4601else
4602    AC_MSG_RESULT([internal])
4603    SYSTEM_SERF=NO
4604    BUILD_TYPE="$BUILD_TYPE SERF"
4605fi
4606AC_SUBST(SYSTEM_SERF)
4607AC_SUBST(SERF_CFLAGS)
4608AC_SUBST(SERF_LIBS)
4609
4610
4611dnl ===================================================================
4612dnl Check for CoinMP
4613dnl ===================================================================
4614ENABLE_COINMP=
4615SYSTEM_COINMP=NO
4616COINMP_CFLAGS=
4617COINMP_LIBS=
4618AC_MSG_CHECKING([whether to enable support for CoinMP])
4619if test "x$enable_coinmp" = "xyes"; then
4620    BUILD_TYPE="$BUILD_TYPE COINMP"
4621    AC_MSG_RESULT([yes])
4622    ENABLE_COINMP=YES
4623
4624    dnl Check wether to use system or internal CoinMP
4625    AC_MSG_CHECKING([which coinmp to use])
4626    if test "x$with_system_coinmp" = "xyes" -o -n "$with_system_libs"; then
4627        AC_MSG_RESULT([system])
4628	PKG_CHECK_MODULES([COINMP], [coinmp])
4629        SYSTEM_COINMP=YES
4630        # some systems need this. Like Ubuntu....
4631        AC_CHECK_LIB(m, floor)
4632        AC_CHECK_LIB(dl, dlopen)
4633    else
4634        AC_MSG_RESULT([internal])
4635        SYSTEM_COINMP=NO
4636        BUILD_TYPE="$BUILD_TYPE COINMP"
4637    fi
4638else
4639    AC_MSG_RESULT([no])
4640    ENABLE_COINMP=NO
4641fi
4642AC_SUBST(ENABLE_COINMP)
4643AC_SUBST(SYSTEM_COINMP)
4644AC_SUBST(COINMP_CFLAGS)
4645AC_SUBST(COINMP_LIBS)
4646
4647
4648dnl ===================================================================
4649dnl Check for system curl
4650dnl ===================================================================
4651if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
4652   with_system_curl=yes
4653fi
4654AC_MSG_CHECKING([which curl to use])
4655if test -n "$with_system_curl" -o -n "$with_system_libs" && \
4656	test "$with_system_curl" != "no"; then
4657   AC_MSG_RESULT([external])
4658   SYSTEM_CURL=YES
4659
4660   AC_PATH_PROG( CURLCONFIG, curl-config)
4661   if test -z "$CURLCONFIG"; then
4662      AC_MSG_ERROR([install curl to run this script])
4663   fi
4664
4665   # check curl version
4666   AC_MSG_CHECKING([whether curl is >= 7.13.1])
4667   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
4668	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
4669	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
4670      AC_MSG_ERROR([no, you need at least curl 7.13,1])
4671   else
4672      AC_MSG_RESULT([yes])
4673   fi
4674   CURL_LIBS=`$CURLCONFIG --libs`
4675   CURL_CFLAGS=`$CURLCONFIG --cflags`
4676else
4677   AC_MSG_RESULT([internal])
4678   SYSTEM_CURL=NO
4679   BUILD_TYPE="$BUILD_TYPE CURL"
4680fi
4681AC_SUBST(SYSTEM_CURL)
4682AC_SUBST(CURL_CFLAGS)
4683AC_SUBST(CURL_LIBS)
4684
4685dnl ===================================================================
4686dnl Check for system mdds
4687dnl ===================================================================
4688AC_MSG_CHECKING([which mdds to use])
4689if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
4690	test "$with_system_mdds" != "no"; then
4691    AC_MSG_RESULT([external])
4692    SYSTEM_MDDS=YES
4693    AC_LANG_PUSH([C++])
4694    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
4695        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
4696    AC_LANG_POP([C++])
4697else
4698   AC_MSG_RESULT([internal])
4699   BUILD_TYPE="$BUILD_TYPE MDDS"
4700   SYSTEM_MDDS=NO
4701fi
4702AC_SUBST(SYSTEM_MDDS)
4703
4704dnl ===================================================================
4705dnl Check for system boost
4706dnl ===================================================================
4707AC_MSG_CHECKING([which boost to use])
4708if test -n "$with_system_boost" -o -n "$with_system_headers" && \
4709	test "$with_system_boost" != "no"; then
4710   AC_MSG_RESULT([external])
4711   SYSTEM_BOOST=YES
4712   AC_LANG_PUSH([C++])
4713   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
4714       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
4715   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
4716       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
4717   AC_CHECK_HEADER(boost/function.hpp, [],
4718       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
4719
4720   save_CXXFLAGS=$CXXFLAGS
4721   CXXFLAGS="$CXXFLAGS -fno-exceptions"
4722   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
4723   AC_TRY_COMPILE([#include <boost/function.hpp>
4724], [],
4725   ac_cv_cxx_boost_no_exceptons_broken=no, ac_cv_cxx_boost_no_exceptons_broken=yes)
4726
4727   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
4728	AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
4729   else
4730  	AC_MSG_RESULT([yes])
4731   fi
4732   CXXFLAGS=$save_CXXFLAGS
4733   AC_LANG_POP([C++])
4734else
4735   AC_MSG_RESULT([internal])
4736   BUILD_TYPE="$BUILD_TYPE BOOST"
4737   SYSTEM_BOOST=NO
4738fi
4739AC_SUBST(SYSTEM_BOOST)
4740
4741dnl ===================================================================
4742dnl Check for system vigra
4743dnl ===================================================================
4744AC_MSG_CHECKING([which vigra to use])
4745if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
4746	test "$with_system_vigra" != "no"; then
4747   AC_MSG_RESULT([external])
4748   SYSTEM_VIGRA=YES
4749   AC_LANG_PUSH([C++])
4750   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
4751       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
4752   AC_LANG_POP([C++])
4753else
4754   AC_MSG_RESULT([internal])
4755   BUILD_TYPE="$BUILD_TYPE VIGRA"
4756   SYSTEM_VIGRA=NO
4757fi
4758AC_SUBST(SYSTEM_VIGRA)
4759
4760dnl ===================================================================
4761dnl Check for system odbc
4762dnl ===================================================================
4763AC_MSG_CHECKING([which odbc headers to use])
4764if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
4765	test "$with_system_odbc_headers" != "no"; then
4766   AC_MSG_RESULT([external])
4767   SYSTEM_ODBC_HEADERS=YES
4768
4769   AC_CHECK_HEADER(sqlext.h, [],
4770      [AC_MSG_ERROR(odbc not found. install odbc)], [])
4771else
4772   AC_MSG_RESULT([internal])
4773   SYSTEM_ODBC_HEADERS=NO
4774   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
4775fi
4776AC_SUBST(SYSTEM_ODBC_HEADERS)
4777
4778WITH_MOZILLA=NO
4779AC_MSG_CHECKING([whether to enable build of Mozilla/Mozilla NSS-using components])
4780if test "$enable_mozilla" = "no"; then
4781   AC_MSG_RESULT([no])
4782   WITH_MOZILLA=NO
4783   ENABLE_NSS_MODULE=NO
4784else
4785   AC_MSG_RESULT([yes])
4786   WITH_MOZILLA=YES
4787fi
4788
4789AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity])
4790if test "$enable_mozilla" = "no"; then
4791   AC_MSG_RESULT([no])
4792elif test "$with_system_mozilla" = "yes"; then
4793   AC_MSG_RESULT([no, not possible with system-mozilla])
4794else
4795   AC_MSG_RESULT([yes])
4796fi
4797
4798AC_MSG_CHECKING([whether to build XML Security support])
4799if test "$enable_mozilla" = "no"; then
4800   AC_MSG_RESULT([no, since Mozilla (NSS) disabled but needed])
4801else
4802   AC_MSG_RESULT([yes])
4803fi
4804
4805AC_MSG_CHECKING([whether to build LDAP configuration backend])
4806if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
4807   if test "$enable_mozilla" = "yes" || test "$with_openldap" = "yes"; then
4808      AC_MSG_RESULT([yes])
4809      WITH_LDAP=YES
4810   else
4811      AC_MSG_RESULT([no. Either Mozilla or OpenLDAP needed])
4812      WITH_LDAP=NO
4813   fi
4814else
4815   AC_MSG_RESULT([no])
4816   WITH_LDAP=NO
4817fi
4818
4819if test "$WITH_LDAP" = "YES"; then
4820   dnl ===================================================================
4821   dnl Test whether we want to use the Mozilla or the OpenLDAP LDAP SDK
4822   dnl ===================================================================
4823   AC_MSG_CHECKING([which LDAP SDK to use])
4824   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
4825  	   AC_MSG_RESULT([OpenLDAP])
4826	   WITH_OPENLDAP=YES
4827	   AC_CHECK_HEADERS(ldap.h, [],
4828		   [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
4829	   AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
4830		   [AC_MSG_ERROR(openldap lib not found or functional)], [])
4831	   # rumours say that OpenLDAP doesn't have that function. I looked and
4832	   # it has it. Test for it to be sure
4833         AC_CHECK_LIB(ldap, ldap_set_option, [],
4834                [AC_MSG_ERROR(openldap lib not found or functional)], [])
4835   else
4836	   AC_MSG_RESULT([Netscape/Mozilla])
4837	   # TODO. Actually do a sanity check and check for
4838	   # LDAP_OPT_SIZELIMIT and LDAP_X_OPT_CONNECT_TIMEOUT
4839	   WITH_OPENLDAP=NO
4840   fi
4841fi
4842AC_SUBST(WITH_LDAP)
4843AC_SUBST(WITH_OPENLDAP)
4844
4845dnl ===================================================================
4846dnl Check for system mozilla
4847dnl ===================================================================
4848AC_MSG_CHECKING([which mozilla to use])
4849if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then
4850    AC_MSG_RESULT([external])
4851    SYSTEM_MOZILLA=YES
4852    ENABLE_NSS_MODULE=NO
4853    enable_nss_module=no
4854    AC_MSG_CHECKING([which Mozilla flavour to use])
4855    if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then
4856      MOZ_FLAVOUR=libxul
4857    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then
4858      MOZ_FLAVOUR=xulrunner
4859    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then
4860      MOZ_FLAVOUR=seamonkey
4861    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then
4862      MOZ_FLAVOUR=firefox
4863    elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then
4864      MOZ_FLAVOUR=mozilla
4865    else
4866      MOZ_FLAVOUR=libxul
4867    fi
4868    tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'`
4869    AC_MSG_RESULT($tmp)
4870
4871    PKG_CHECK_MODULES( MOZ_NSS, nss, STANDALONENSS="TRUE", STANDALONENSS="" )
4872    if test -z "$STANDALONENSS"; then
4873        PKG_CHECK_MODULES( MOZ_NSS, $MOZ_FLAVOUR-nss )
4874    else
4875        NSS_LIB="-L`$PKG_CONFIG --variable=libdir nss`"
4876        AC_SUBST(NSS_LIB)
4877    fi
4878
4879    if $PKG_CONFIG --exists nspr ; then
4880      PKG_CHECK_MODULES( MOZ_NSPR, nspr )
4881      NSPR_LIB="-L`$PKG_CONFIG --variable=libdir nspr`"
4882      AC_SUBST(NSPR_LIB)
4883    else
4884      PKG_CHECK_MODULES( MOZ_NSPR, $MOZ_FLAVOUR-nspr )
4885    fi
4886
4887    if test "$MOZ_FLAVOUR" != "libxul"; then
4888      PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" )
4889      MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom`
4890      MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom`
4891    fi
4892
4893    if test -z "$HASXPCOM"; then
4894      PKG_CHECK_MODULES( MOZILLAXPCOM, libxul )
4895      MOZ_INC=`$PKG_CONFIG --variable=includedir libxul`
4896      MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul`
4897      if ! test -e "$MOZ_LIB/libxul.so"; then
4898         MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul`
4899         if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then
4900            MOZ_LIB="$MOZ_LIB/sdk/lib"
4901         fi
4902      fi
4903    fi
4904
4905    save_CPPFLAGS="$CPPFLAGS"
4906    save_LDFLAGS="$LDFLAGS"
4907    save_LIBS="$LIBS"
4908    CPPFLAGS="$CPPFLAGS $MOZ_NSS_CFLAGS"
4909    LDFLAGS="$LDFLAGS $MOZ_NSS_LIBS"
4910    AC_CHECK_LIB(nss3, PK11_GetCertFromPrivateKey, [],
4911      [AC_MSG_ERROR(PK11_GetCertFromPrivateKey missing but needed.
4912See https://bugzilla.mozilla.org/show_bug.cgi?id=262274.
4913Fixed since nss 3.9.3 (contained by e.g. mozilla >= 1.7.5))], [])
4914    LDFLAGS="$save_LDFLAGS"
4915    CPPFLAGS="$save_CPPFLAGS"
4916    LIBS="$save_LIBS"
4917
4918    MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS
4919    if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then
4920      AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap])
4921      if test -d "$MOZ_INC/ldap"; then
4922         AC_MSG_RESULT([yes])
4923         MOZ_LDAP_CFLAGS="-I$MOZ_INC"
4924      else
4925        AC_MSG_ERROR([no.
4926Could not find LDAP header include files in $MOZ_INC/ldap.
4927Please recompile $tmp with --enable-ldap or use --with-openldap.])
4928      fi
4929    fi
4930
4931    #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges
4932    #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul
4933    if test "$MOZ_FLAVOUR" = "libxul"; then
4934        MOZ_FLAVOUR="mozilla"
4935    fi
4936
4937elif test "$enable_mozilla" = "no"; then
4938    AC_MSG_RESULT([none])
4939    WITH_MOZILLA=NO
4940    ENABLE_NSS_MODULE=NO
4941    enable_nss_module=no
4942else
4943    AC_MSG_RESULT([internal])
4944    SYSTEM_MOZILLA=NO
4945    BUILD_TYPE="$BUILD_TYPE MOZ"
4946    WITH_MOZILLA=YES
4947if test -z "$with_mozilla_version"; then
4948   MOZILLA_VERSION=
4949else
4950   AC_MSG_CHECKING([which mozilla version to build])
4951   MOZILLA_VERSION=$with_mozilla_version
4952   enable_build_mozilla=1
4953   AC_MSG_RESULT([$MOZILLA_VERSION])
4954fi
4955
4956AC_SUBST(MOZILLA_VERSION)
4957AC_SUBST(WITH_MOZILLA)
4958
4959AC_MSG_CHECKING([for toolkit mozilla should use])
4960if test -z "$with_mozilla_toolkit"; then
4961   if test "$_os" != "WINNT" ; then
4962      if test "$_os" = "Darwin" ; then
4963         MOZILLA_TOOLKIT=mac
4964         AC_MSG_RESULT([mac])
4965      else
4966         MOZILLA_TOOLKIT=gtk2
4967         AC_MSG_RESULT([gtk2])
4968      fi
4969   fi
4970else
4971   MOZILLA_TOOLKIT=$with_mozilla_toolkit
4972   enable_build_mozilla=1
4973   AC_MSG_RESULT([$MOZILLA_TOOLKIT])
4974fi
4975#if test "$_os" = "Darwin" && test "$MOZILLA_TOOLKIT" != "gtk2"; then
4976#   #only gtk2 toolkit supported - xlib or cocoa nees glib1 and libIDL1 - the latter is not
4977#   #available using fink, mac (carbon) doesn't work because xcode installs conflicting headers
4978#   AC_MSG_ERROR([Only gtk2 toolkit supported on Mac, sorry.])
4979#fi
4980
4981AC_SUBST(MOZILLA_TOOLKIT)
4982
4983# default to enabling build mozilla
4984if test "$enable_build_mozilla" != "no"; then
4985      enable_build_mozilla=yes
4986else
4987      enable_build_mozilla=
4988fi
4989
4990AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
4991if test -n "$enable_build_mozilla"; then
4992   BUILD_MOZAB="TRUE"
4993   AC_MSG_RESULT([yes])
4994else
4995   BUILD_MOZAB=""
4996   AC_MSG_RESULT([no])
4997fi
4998
4999AC_MSG_CHECKING([whether to build provided NSS module])
5000if test "$enable_nss_module" != "no"; then
5001   ENABLE_NSS_MODULE="YES"
5002   BUILD_TYPE="$BUILD_TYPE NSS"
5003   AC_MSG_RESULT([yes])
5004   if test "$_os" = "WINNT"; then
5005      AC_MSG_CHECKING([for Mozilla build tooling])
5006      if test -z "$MOZILLABUILD" ; then
5007AC_MSG_ERROR([Mozilla build tooling not found.
5008Use the --with-mozilla-build option after installling the tools obtained
5009from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
5010      else
5011         if test \( "$WITH_MINGWIN" = "yes" \) ; then
5012            if test ! -d "$MOZILLABUILD" ; then
5013AC_MSG_ERROR([Mozilla build tooling incomplete!])
5014            else
5015               AC_MSG_RESULT([ok])
5016            fi
5017         else
5018            if test ! -d "$MOZILLABUILD/moztools" \
5019               -o ! -d "$MOZILLABUILD/msys" ; then
5020AC_MSG_ERROR([Mozilla build tooling incomplete!])
5021            else
5022               AC_MSG_RESULT([ok])
5023            fi
5024         fi
5025      fi
5026   fi
5027else
5028   ENABLE_NSS_MODULE="NO"
5029   AC_MSG_RESULT([no])
5030fi
5031
5032if test "$BUILD_MOZAB" = "TRUE"; then
5033  if test "$_os" = "WINNT"; then
5034    if test "$WITH_MINGWIN" != "yes"; then
5035      # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
5036      if test "$MSVSVER" != "2005"; then
5037        AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio .NET 2005 only.])
5038      fi
5039    else
5040      AC_MSG_WARN([Building SeaMonkey with mingwin is not tested, and likely to break.])
5041      echo "Building SeaMonkey with mingwin is not tested, and likely to break." >> warn
5042    fi
5043  fi
5044
5045   if test -z "$MOZILLA_VERSION"; then
5046      MOZILLA_VERSION=1.1.14
5047   fi
5048   if test "$_os" = "WINNT"; then
5049      AC_MSG_CHECKING([for moztools binaries])
5050      if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then
5051        AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip
5052(from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
5053      else
5054         AC_MSG_RESULT([ok])
5055      fi
5056   elif test "$_os" = "Darwin"; then
5057      if test "$MOZILLA_TOOLKIT" = "gtk2"; then
5058         AC_MSG_NOTICE([checking whether mozilla can be built...])
5059         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]))
5060      else
5061         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3,  MOZIDL="TRUE", MOZIDL="")
5062         if test -z "$MOZIDL"; then
5063            AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build mozilla with mac toolkit.])
5064         fi
5065      fi
5066   else
5067      # Generic Unix/Linux section
5068      if test "$MOZILLA_TOOLKIT" = "gtk2"; then
5069         PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="")
5070         if test -z "$MOZGTK"; then
5071            AC_MSG_ERROR([GTK2 is needed to build mozilla.])
5072         fi
5073         PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="")
5074         if test -z "$MOZIDL"; then
5075            AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build mozilla.])
5076         fi
5077      else
5078         PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="")
5079         if test -z "$MOZGTK"; then
5080            AC_MSG_ERROR([gtk 1.2 is needed when not using GTK2 to build mozilla.])
5081         fi
5082         PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="")
5083         if test -z "$MOZIDL"; then
5084            AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build mozilla.])
5085         fi
5086      fi
5087   fi
5088fi
5089
5090AC_SUBST(BUILD_MOZAB)
5091
5092fi
5093AC_SUBST(ENABLE_NSS_MODULE)
5094AC_SUBST(MOZILLABUILD)
5095AC_SUBST(SYSTEM_MOZILLA)
5096AC_SUBST(MOZ_FLAVOUR)
5097AC_SUBST(MOZ_INC)
5098AC_SUBST(MOZ_LIB)
5099AC_SUBST(MOZ_LIB_XPCOM)
5100AC_SUBST(MOZ_NSPR_CFLAGS)
5101AC_SUBST(MOZ_NSS_CFLAGS)
5102AC_SUBST(MOZ_LDAP_CFLAGS)
5103
5104dnl ===================================================================
5105dnl Check for system sane
5106dnl ===================================================================
5107AC_MSG_CHECKING([which sane header to use])
5108if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
5109	test "$with_system_sane_header" != "no"; then
5110   AC_MSG_RESULT([external])
5111   SYSTEM_SANE_HEADER=YES
5112   AC_CHECK_HEADER(sane/sane.h, [],
5113      [AC_MSG_ERROR(sane not found. install sane)], [])
5114else
5115   AC_MSG_RESULT([internal])
5116   SYSTEM_SANE_HEADER=NO
5117   BUILD_TYPE="$BUILD_TYPE SANE"
5118fi
5119AC_SUBST(SYSTEM_SANE_HEADER)
5120
5121dnl ===================================================================
5122dnl Check for system icu
5123dnl ===================================================================
5124AC_MSG_CHECKING([which icu to use])
5125if test -n "$with_system_icu" -o -n "$with_system_libs" && \
5126	test "$with_system_icu" != "no"; then
5127   AC_MSG_RESULT([external])
5128   SYSTEM_ICU=YES
5129   AC_LANG_PUSH([C++])
5130   AC_MSG_CHECKING([for unicode/rbbi.h])
5131   AC_TRY_CPP(unicode/rbbi.h, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([icu headers not found.]))
5132   AC_LANG_POP([C++])
5133   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
5134   if test -z "$SYSTEM_GENBRK"; then
5135      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
5136   fi
5137   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
5138   if test -z "$SYSTEM_GENCCODE"; then
5139      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
5140   fi
5141   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
5142   if test -z "$SYSTEM_GENCMN"; then
5143      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
5144   fi
5145
5146   AC_PATH_PROG( ICUCONFIG, icu-config)
5147   AC_MSG_CHECKING([ICU version])
5148   if test "$_os" = "OS2"; then
5149      ICU_MAJOR=4
5150   else
5151      ICU_VERSION=`$ICUCONFIG --version`
5152      ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
5153      ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
5154      ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
5155   fi
5156
5157   if test "$ICU_MAJOR" -ge "4"; then
5158      AC_MSG_RESULT([OK])
5159   else
5160      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
5161   fi
5162
5163else
5164    AC_MSG_RESULT([internal])
5165    SYSTEM_ICU=NO
5166    BUILD_TYPE="$BUILD_TYPE ICU"
5167fi
5168AC_SUBST(SYSTEM_ICU)
5169AC_SUBST(SYSTEM_GENBRK)
5170AC_SUBST(SYSTEM_GENCCODE)
5171AC_SUBST(SYSTEM_GENCMN)
5172AC_SUBST(ICU_MAJOR)
5173AC_SUBST(ICU_MINOR)
5174AC_SUBST(ICU_MICRO)
5175
5176dnl ===================================================================
5177dnl Graphite
5178dnl ===================================================================
5179
5180ENABLE_GRAPHITE="FALSE"
5181AC_MSG_CHECKING([whether to enable graphite support])
5182if test "x$enable_graphite" = "xyes" -a \( "$_os" = "WINNT" -o "$_os" = "Linux" -o "$_os" = "FreeBSD" \) ; then
5183    AC_MSG_RESULT([yes])
5184    ENABLE_GRAPHITE="TRUE"
5185    AC_MSG_CHECKING([which graphite to use])
5186    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
5187        test "$with_system_graphite" != "no"; then
5188        AC_MSG_RESULT([external])
5189        SYSTEM_GRAPHITE=YES
5190        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
5191    else
5192        AC_MSG_RESULT([internal])
5193        SYSTEM_GRAPHITE=NO
5194        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
5195    fi
5196else
5197   AC_MSG_RESULT([no])
5198   ENABLE_GRAPHITE="FALSE"
5199fi
5200AC_SUBST(ENABLE_GRAPHITE)
5201AC_SUBST(SYSTEM_GRAPHITE)
5202AC_SUBST(GRAPHITE_LIBS)
5203AC_SUBST(GRAPHITE_CFLAGS)
5204
5205dnl ===================================================================
5206dnl Checks for libraries.
5207dnl ===================================================================
5208dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
5209dnl See if we have the AppKit framework for building with Quartz graphics.
5210
5211if test  "$_os" = "Darwin"; then
5212   if test "x$with_x" = "xyes"; then
5213      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
5214   else
5215      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
5216      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
5217         AC_MSG_RESULT([yes])
5218         x_includes="no_x_includes"
5219         x_libraries="no_x_libraries"
5220         dnl disable some things used on other Unix versions but not on the aqua build
5221         enable_gtk=no
5222         enable_cups=no
5223         ENABLE_CUPS=""
5224         AC_SUBST(ENABLE_CUPS)
5225      else
5226         AC_MSG_ERROR([No AppKit.framewrok found])
5227      fi
5228   fi
5229fi
5230
5231dnl ***************************************
5232dnl testing for X libraries and includes...
5233dnl ***************************************
5234if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
5235   echo "Do Nothing for _os = Darwin"
5236   dnl Mac OS X using Aqua graphics. Don't check for X11.
5237   :
5238elif test "$_os" = "OS2" ; then
5239   echo "Do Nothing for _os = OS2. Don't check for X11."
5240   dnl OS/2 uses native graphics. Don't check for X11.
5241   :
5242elif test "$_os" != "WINNT" ; then
5243   AC_PATH_X
5244   AC_PATH_XTRA
5245   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
5246
5247   if test "x$x_includes" = "x"; then
5248     x_includes="default_x_includes"
5249   fi
5250   if test "x$x_libraries" = "x"; then
5251     x_libraries="default_x_libraries"
5252   fi
5253   dnl The variables $x_libraries and $x_includes are set.
5254   if test -z "$x_libraries"; then
5255      AC_MSG_ERROR([No X libraries found]) # Exit
5256   fi
5257   if test -z "$x_includes"; then
5258      AC_MSG_ERROR([No X includes found]) # Exit
5259   fi
5260   CFLAGS=$X_CFLAGS
5261   LDFLAGS="$X_LDFLAGS $X_LIBS"
5262   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
5263   dnl Check if the XauDisposeAuth symbol is provided by libXau.
5264   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
5265else
5266   x_includes="no_x_includes"
5267   x_libraries="no_x_libraries"
5268fi
5269if test -z "$x_includes"; then
5270   x_includes="no_x_includes"
5271fi
5272if test -z "$x_libraries"; then
5273   x_libraries="no_x_libraries"
5274fi
5275if test "$x_includes" = "default_x_includes"; then
5276   XINC="/usr/include"
5277else
5278   XINC="$x_includes"
5279fi
5280AC_SUBST(XINC)
5281if test "$x_libraries" = "default_x_libraries"; then
5282   XLIB=`$PKG_CONFIG --variable=libdir x11`
5283   if test "x$XLIB" = x; then
5284         XLIB="/usr/lib"
5285   fi
5286else
5287   XLIB="$x_libraries"
5288fi
5289AC_SUBST(XLIB)
5290AC_SUBST(XAU_LIBS)
5291
5292if test "$_os" != "WINNT" -a "$_os" != "OS2" -a "$_os" != "Darwin"; then
5293   dnl ===================================================================
5294   dnl Check for using Xaw
5295   dnl ===================================================================
5296   AC_MSG_CHECKING([whether to use Xaw])
5297   if test "$enable_Xaw" = "no"; then
5298       DISABLE_XAW=TRUE
5299       AC_MSG_RESULT([no])
5300       AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt include headers not found])],
5301         [#include <X11/Intrinsic.h>])
5302   else
5303       AC_MSG_RESULT([yes])
5304       AC_CHECK_HEADERS(X11/Xaw/Label.h,[],[AC_MSG_ERROR([Xaw include headers not found])],
5305         [#include <X11/Intrinsic.h>])
5306       AC_CHECK_LIB(Xaw, main, [],
5307           [AC_MSG_ERROR(Xaw library not found or functional)], [])
5308   fi
5309fi
5310AC_SUBST(DISABLE_XAW)
5311
5312
5313
5314dnl ===================================================================
5315dnl Check if fontconfig/fontconfig.h is available
5316dnl ===================================================================
5317if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
5318    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
5319                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
5320    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
5321    AC_TRY_RUN([
5322#include <fontconfig/fontconfig.h>
5323
5324int main(int argc, char **argv) {
5325	if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
5326	else return 1;
5327}
5328], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])])
5329fi
5330
5331dnl ===================================================================
5332dnl Check for system Xrender
5333dnl ===================================================================
5334AC_MSG_CHECKING([whether to link to Xrender])
5335if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
5336   AC_MSG_RESULT([yes])
5337   XRENDER_LINK=YES
5338   with_system_xrender_headers=yes
5339else
5340   AC_MSG_RESULT([no, dynamically open it])
5341   XRENDER_LINK=NO
5342fi
5343AC_MSG_CHECKING([which Xrender headers to use])
5344if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
5345	test "$with_system_xrender_headers" != "no"; then
5346   AC_MSG_RESULT([external])
5347   SYSTEM_XRENDER_HEADERS=YES
5348   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
5349      [AC_MSG_ERROR(Xrender not found. install X)], [])
5350else
5351   AC_MSG_RESULT([internal])
5352   SYSTEM_XRENDER_HEADERS=NO
5353   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
5354fi
5355if test "$XRENDER_LINK" = "YES"; then
5356   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
5357      [AC_MSG_ERROR(libXrender not found or functional)], [])
5358fi
5359AC_SUBST(SYSTEM_XRENDER_HEADERS)
5360AC_SUBST(XRENDER_LINK)
5361
5362dnl ===================================================================
5363dnl Check for XRandr
5364dnl ===================================================================
5365AC_MSG_CHECKING([whether to enable RandR support])
5366if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5367   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5368	  XRANDR_DLOPEN="TRUE"
5369	  AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5370   else
5371	  XRANDR_DLOPEN="FALSE"
5372      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5373      if test "$ENABLE_RANDR" != "TRUE"; then
5374         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5375                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5376         XRANDR_CFLAGS=" "
5377         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5378              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5379         XRANDR_LIBS="-lXrandr "
5380         ENABLE_RANDR="TRUE"
5381	     AC_MSG_RESULT([enabling RandR support])
5382      fi
5383   fi
5384else
5385   ENABLE_RANDR=""
5386   AC_MSG_RESULT([no])
5387fi
5388AC_SUBST(XRANDR_DLOPEN)
5389AC_SUBST(XRANDR_CFLAGS)
5390AC_SUBST(XRANDR_LIBS)
5391AC_SUBST(ENABLE_RANDR)
5392
5393dnl ===================================================================
5394dnl Check for system openssl
5395dnl ===================================================================
5396if test "$_os" = "Darwin" && test "$with_system_openssl" != "no"; then
5397   with_system_openssl=yes
5398fi
5399AC_MSG_CHECKING([which libssl to use])
5400if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5401        test "$with_system_openssl" != "no"; then
5402    AC_MSG_RESULT([external])
5403    # Mac OS builds should get out without extra stuff is the Mac porters'
5404    # wish. And pkg-config is although Xcode ships a .pc for openssl
5405    if test "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
5406        OPENSSL_CFLAGS=
5407        OPENSSL_LIBS="-lssl -lcrypto"
5408    else
5409    	PKG_CHECK_MODULES( OPENSSL, openssl )
5410    fi
5411    SYSTEM_OPENSSL=YES
5412else
5413    AC_MSG_RESULT([internal])
5414    SYSTEM_OPENSSL=NO
5415    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5416fi
5417AC_SUBST(SYSTEM_OPENSSL)
5418AC_SUBST(OPENSSL_CFLAGS)
5419AC_SUBST(OPENSSL_LIBS)
5420
5421dnl ===================================================================
5422dnl Check for system redland
5423dnl ===================================================================
5424AC_MSG_CHECKING([which redland library to use])
5425if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5426	test "$with_system_redland" != "no"; then
5427	AC_MSG_RESULT([external])
5428	SYSTEM_REDLAND=YES
5429   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5430   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5431else
5432	AC_MSG_RESULT([internal])
5433	BUILD_TYPE="$BUILD_TYPE REDLAND"
5434	SYSTEM_REDLAND=NO
5435fi
5436AC_SUBST(SYSTEM_REDLAND)
5437AC_SUBST(REDLAND_CFLAGS)
5438AC_SUBST(REDLAND_LIBS)
5439
5440dnl ===================================================================
5441dnl Check for hunspell
5442dnl ===================================================================
5443AC_MSG_CHECKING([whether to build the Spell Checking component])
5444ENABLE_HUNSPELL=
5445
5446if test "x$enable_hunspell" != "xno" ; then
5447    AC_MSG_CHECKING([which libhunspell to use])
5448    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5449        test "$with_system_hunspell" != "no"; then
5450        AC_MSG_RESULT([external])
5451        SYSTEM_HUNSPELL=YES
5452        AC_LANG_PUSH([C++])
5453        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5454        if test "$HUNSPELL_PC" != "TRUE"; then
5455            AC_CHECK_HEADER(hunspell.hxx, [],
5456            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5457                [AC_MSG_ERROR(hunspell headers not found.)], [])
5458             ], [])
5459            AC_CHECK_LIB(hunspell, main, [],
5460            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5461            HUNSPELL_LIBS=-lhunspell
5462        fi
5463        AC_LANG_POP([C++])
5464    else
5465        AC_MSG_RESULT([internal])
5466        SYSTEM_HUNSPELL=NO
5467        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5468    fi
5469    ENABLE_HUNSPELL=YES
5470    AC_SUBST(SYSTEM_HUNSPELL)
5471    AC_SUBST(HUNSPELL_CFLAGS)
5472    AC_SUBST(HUNSPELL_LIBS)
5473else
5474    AC_MSG_RESULT([no])
5475fi
5476AC_SUBST(ENABLE_HUNSPELL)
5477
5478dnl ===================================================================
5479dnl Checking for libhyphen
5480dnl ===================================================================
5481AC_MSG_CHECKING([whether to build the Hyphenator component])
5482ENABLE_HYPHEN=
5483
5484if test "x$enable_hyphen" != "xno" ; then
5485    AC_MSG_CHECKING([which libhyphen to use])
5486    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5487        test "$with_system_hyphen" != "no"; then
5488        AC_MSG_RESULT([external])
5489        SYSTEM_HYPH=YES
5490        AC_CHECK_HEADER(hyphen.h, [],
5491        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5492        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5493        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5494        [#include <hyphen.h>])
5495        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5496            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5497        if test -z "$HYPHEN_LIB"; then
5498        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5499            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5500        fi
5501        if test -z "$HYPHEN_LIB"; then
5502        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5503            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5504        fi
5505    else
5506        AC_MSG_RESULT([internal])
5507        SYSTEM_HYPH=NO
5508        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5509    fi
5510    ENABLE_HYPHEN=YES
5511    AC_SUBST(SYSTEM_HYPH)
5512    AC_SUBST(HYPHEN_LIB)
5513else
5514    AC_MSG_RESULT([no])
5515fi
5516AC_SUBST(ENABLE_HYPHEN)
5517
5518
5519#dnl ===================================================================
5520#dnl Check whether we are allowed to bundle dictionaries and whether
5521#dnl hunspell is available.
5522#dnl ===================================================================
5523ENABLE_BUNDLED_DICTIONARIES=
5524if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5525   ENABLE_BUNDLED_DICTIONARIES=YES
5526fi
5527AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5528
5529
5530
5531dnl ===================================================================
5532dnl Checking for mythes
5533dnl ===================================================================
5534AC_MSG_CHECKING([which mythes to use])
5535if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5536   test "$with_system_mythes" != "no"; then
5537    AC_MSG_RESULT([external])
5538    SYSTEM_MYTHES=YES
5539    AC_LANG_PUSH([C++])
5540    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5541    if test "$MYTHES_PKGCONFIG" = "no"; then
5542        AC_CHECK_HEADER(mythes.hxx, [],
5543            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5544        AC_CHECK_LIB(mythes-1.2, main, [],
5545            [ MYTHES_FOUND=no], [])
5546 	if test "$MYTHES_FOUND" = "no"; then
5547            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5548                [ MYTHES_FOUND=no], [])
5549	fi
5550	if test "$MYTHES_FOUND" = "no"; then
5551		AC_MSG_ERROR([mythes library not found!.])
5552	fi
5553    fi
5554    AC_LANG_POP([C++])
5555else
5556    AC_MSG_RESULT([internal])
5557    SYSTEM_MYTHES=NO
5558    BUILD_TYPE="$BUILD_TYPE MYTHES"
5559fi
5560AC_SUBST(SYSTEM_MYTHES)
5561AC_SUBST(MYTHES_CFLAGS)
5562AC_SUBST(MYTHES_LIBS)
5563
5564
5565dnl ===================================================================
5566dnl Checking for libtextcat
5567dnl ===================================================================
5568AC_MSG_CHECKING([which libtextcat to use])
5569if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5570    AC_MSG_RESULT([external])
5571    SYSTEM_LIBTEXTCAT=YES
5572    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5573       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5574    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5575        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5576else
5577    AC_MSG_RESULT([internal])
5578    SYSTEM_LIBTEXTCAT=NO
5579    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5580fi
5581AC_SUBST(SYSTEM_LIBTEXTCAT)
5582
5583AC_MSG_CHECKING([which libtextcat data directory to use])
5584if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5585    if test "$with_system_libtextcat_data" = "yes"; then
5586        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5587    else
5588        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5589    fi
5590    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5591else
5592    AC_MSG_RESULT([internal])
5593    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5594fi
5595AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5596
5597dnl ***************************************
5598dnl testing libc version for Linux...
5599dnl ***************************************
5600if test "$_os" = "Linux"; then
5601   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5602   exec 6>/dev/null # no output
5603   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5604   exec 6>&1 # output on again
5605   if test "$HAVE_LIBC"; then
5606      AC_MSG_RESULT([yes])
5607   else
5608      AC_MSG_ERROR([no, upgrade libc])
5609   fi
5610fi
5611
5612if test "$_os" != "WNT"; then
5613  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5614  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5615  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5616	SYSTEM_LIBC=YES
5617  fi
5618else
5619  HAVE_GETOPT=NO
5620  HAVE_READDIR_R=NO
5621  SYSTEM_LIBC=YES
5622fi
5623AC_SUBST(HAVE_GETOPT)
5624AC_SUBST(HAVE_READDIR_R)
5625AC_SUBST(SYSTEM_LIBC)
5626
5627dnl =========================================
5628dnl Check for the Microsoft Platform SDK.
5629dnl =========================================
5630dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5631dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5632if test \( "$_os" = "WINNT" \) ; then
5633	AC_MSG_CHECKING([for PSDK files])
5634	if test -z "$with_psdk_home"; then
5635		# This first line will detect a February 2003 Microsoft Platform SDK
5636		PSDK_HOME=`./oowintool --psdk-home`
5637        # But there might be also an April 2005 PSDK, unfortunately MS changed
5638        # the registry entry. (we prefer the old version!?)
5639        if test -z "$PSDK_HOME"; then
5640          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5641        fi
5642            # normalize if found
5643            if test -n "$PSDK_HOME"; then
5644              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5645              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5646           fi
5647	else
5648           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5649	fi
5650        # Remove a possible trailing backslash
5651        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5652    # Problem with current PSDK (iz 49865)
5653    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5654        AC_MSG_ERROR([
5655
5656Some modules do not build correctly with MS Platform SDK - April 2005
5657Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5658Remove/rename/backup that file and restart configure. Details about this
5659problem can be found in issue 49856.])
5660    fi
5661# WIndows SDK has different headers
5662	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5663		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5664		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5665		HAVE_PSDK_H="yes"
5666	else
5667		HAVE_PSDK_H="no"
5668	fi
5669	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5670		HAVE_PSDK_LIB="yes"
5671	else
5672		HAVE_PSDK_LIB="no"
5673	fi
5674    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5675        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5676are installed or use --with-psdk-home .])
5677    fi
5678    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5679         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5680         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5681         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5682        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5683    fi
5684    AC_MSG_RESULT([SDK files found ...)])
5685dnl Check if this is the right SDK.
5686    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5687        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5688        WINDOWS_VISTA_PSDK=TRUE
5689    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5690        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5691        WINDOWS_VISTA_PSDK=TRUE
5692    else
5693        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5694    fi
5695fi
5696AC_SUBST(PSDK_HOME)
5697AC_SUBST(WINDOWS_VISTA_PSDK)
5698
5699dnl =========================================
5700dnl Check for the Microsoft DirectX SDK.
5701dnl =========================================
5702if test \( "$_os" = "WINNT" \) ; then
5703    AC_MSG_CHECKING([for DirectX SDK files])
5704    if test -z "$with_directx_home"; then
5705        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5706        if test -n "$DXSDK_DIR"; then
5707            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5708            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5709        fi
5710        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5711        # the "DirectX SDK files not found" error later
5712    else
5713	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5714    fi
5715    # Remove a possible trailing backslash
5716    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5717
5718    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5719        HAVE_DIRECTDRAW_H="yes"
5720    else
5721        HAVE_DIRECTDRAW_H="no"
5722    fi
5723    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5724        HAVE_DIRECTXSDK_H="yes"
5725    else
5726        HAVE_DIRECTXSDK_H="no"
5727    fi
5728
5729    # MS changed the location of the libraries with dec 2004 directx sdk
5730    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5731        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5732    else
5733        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5734    fi
5735    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5736        HAVE_DIRECTDRAW_LIB="yes"
5737    else
5738        HAVE_DIRECTDRAW_LIB="no"
5739    fi
5740    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5741        HAVE_DIRECTXSDK_LIB="yes"
5742    else
5743        HAVE_DIRECTXSDK_LIB="no"
5744    fi
5745
5746    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5747       ENABLE_DIRECT_DRAW="TRUE"
5748    fi
5749    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5750       HAVE_DIRECTXSDK="yes"
5751    else
5752       HAVE_DIRECTXSDK="no"
5753    fi
5754
5755    if test -n "$ENABLE_DIRECTX"; then
5756	    if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5757		    AC_MSG_RESULT([found])
5758	    else
5759		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5760	    fi
5761    else
5762		DIRECTXSDK_HOME=""
5763		AC_MSG_RESULT([disabled])
5764    fi
5765fi
5766AC_SUBST(ENABLE_DIRECT_DRAW)
5767AC_SUBST(DIRECTXSDK_HOME)
5768AC_SUBST(DIRECTXSDK_LIB)
5769
5770
5771dnl ============================================
5772dnl Check for ATL and MFC
5773dnl ============================================
5774if test \( "$_os" = "WINNT" \) ; then
5775    AC_MSG_CHECKING([for ATL and MFC])
5776    if test "$DISABLE_ATL" = "TRUE"; then
5777        AC_MSG_RESULT([ATL is disabled, nothing to check])
5778    else
5779        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
5780        if test -z "$with_atl_include_dir"; then
5781            ATL_INCLUDE=$COMPATH/atlmfc/include
5782        else
5783            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
5784        fi
5785        if test -z "$with_atl_lib_dir"; then
5786            ATL_LIB=$COMPATH/atlmfc/lib
5787	    ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
5788        else
5789            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
5790            ATL_LIB_X64=$ATL_LIB/../amd64
5791        fi
5792        if test -z "$with_mfc_include_dir"; then
5793            MFC_INCLUDE=$COMPATH/atlmfc/include
5794        else
5795            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
5796        fi
5797        if test -z "$with_mfc_lib_dir"; then
5798            MFC_LIB=$COMPATH/atlmfc/lib
5799        else
5800            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
5801        fi
5802
5803        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
5804        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
5805        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
5806        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
5807        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
5808
5809        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
5810        if test -f "$ATL_INCLUDE/atlbase.h"; then
5811            HAVE_ATL_H="yes"
5812        else
5813            HAVE_ATL_H="no"
5814        fi
5815        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
5816
5817        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
5818        if test -f "$MFC_INCLUDE/afx.h"; then
5819            HAVE_MFC_H="yes"
5820        else
5821            HAVE_MFC_H="no"
5822        fi
5823        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
5824
5825        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
5826        if test -f "$ATL_LIB/atls.lib"; then
5827            HAVE_ATL_LIB="yes"
5828            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
5829            if test -f "$ATL_LIB/atlthunk.lib"; then
5830                HAVE_ATLTHUNK="YES"
5831            else
5832                HAVE_ATLTHUNK="NO"
5833            fi
5834            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
5835        else
5836            HAVE_ATL_LIB="no"
5837        fi
5838        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
5839
5840        dnl TODO check also MFC libraries, they seem to have diferent names
5841        dnl mfc42.lib mfc90.lib
5842        if test -d "$MFC_LIB"; then
5843            HAVE_MFC_LIB="yes"
5844        else
5845            HAVE_MFC_LIB="no"
5846        fi
5847
5848        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
5849            ATL_INCLUDE=
5850            ATL_LIB=
5851            ATL_LIB_X64=
5852            MFC_INCLUDE=
5853            MFC_LIB=
5854            HAVE_ATL_LIB=
5855            dnl TODO shouldn't this be an error?
5856            DISABLE_ACTIVEX="TRUE"
5857            DISABLE_ATL="TRUE"
5858            AC_MSG_RESULT([ATL/MFC disabled])
5859        else
5860            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
5861            ATL_LIB=`cygpath -dm "$ATL_LIB"`
5862            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
5863            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
5864            MFC_LIB=`cygpath -dm "$MFC_LIB"`
5865            AC_MSG_RESULT([ATL/MFC enabled])
5866        fi
5867    fi
5868fi
5869AC_SUBST(ATL_INCLUDE)
5870AC_SUBST(ATL_LIB)
5871AC_SUBST(ATL_LIB_X64)
5872AC_SUBST(HAVE_ATLTHUNK)
5873AC_SUBST(MFC_INCLUDE)
5874AC_SUBST(MFC_LIB)
5875
5876
5877dnl ============================================
5878dnl Check for Nullsoft Scriptable Install System
5879dnl ============================================
5880NSIS_PATH=""
5881if test "$_os" = "WINNT" ; then
5882    AC_MSG_CHECKING([for NSIS])
5883    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5884    if test -n "$NSIS_PATH"; then
5885        NSIS_PATH=`dirname "$NSIS_PATH"`
5886    fi
5887    if test -n "$with_nsis_path"; then
5888        with_nsis_path=`cygpath -u "$with_nsis_path"`
5889    fi
5890    if test -e "$with_nsis_path/nsis.exe"; then
5891        NSIS_PATH="$with_nsis_path"
5892    fi
5893    nsistest=`./oowintool --nsis-dir`;
5894    if test -x "$nsistest/nsis.exe"; then
5895        NSIS_PATH="$nsistest"
5896    fi
5897    if test -z "$NSIS_PATH"; then
5898        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5899        echo "NSIS not found, no self contained installer will be build." >> warn
5900    else
5901        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5902        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5903        AC_MSG_RESULT([found ($NSIS_PATH)])
5904    fi
5905fi
5906AC_SUBST(NSIS_PATH)
5907
5908dnl ***************************************
5909dnl testing bison and flex exist
5910dnl ***************************************
5911AC_PATH_PROG(BISON, bison)
5912if test -z "$BISON"; then
5913   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5914else
5915   AC_MSG_CHECKING([the bison version])
5916   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5917    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5918    # Accept newer than 1.875 or older(equal) than 1.75
5919    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5920       if test "$_bison_version" = "1.875" ; then
5921          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5922          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5923       else
5924          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5925       fi
5926    else
5927       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5928    fi
5929fi
5930AC_PATH_PROG(FLEX, flex)
5931if test -z "$FLEX"; then
5932   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5933fi
5934dnl ***************************************
5935dnl testing that patch exists
5936dnl ***************************************
5937AC_PATH_PROG(PATCH, patch)
5938if test -z "$PATCH"; then
5939   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5940fi
5941
5942dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5943if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5944   if test -z "$with_gnu_patch"; then
5945      GNUPATCH=$PATCH
5946   else
5947      if test -x "$with_gnu_patch"; then
5948	      GNUPATCH=$with_gnu_patch
5949      else
5950         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5951      fi
5952   fi
5953
5954   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5955   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5956	   AC_MSG_RESULT([yes])
5957   else
5958      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5959   fi
5960fi
5961
5962dnl We also need to check for --with-gnu-cp
5963
5964if test -z "$with_gnu_cp"; then
5965   # check the place where the GNU stuff is hidden on Solaris...
5966   if test -x /usr/gnu/bin/cp; then
5967      GNUCP=/usr/gnu/bin/cp
5968   else
5969      AC_PATH_PROGS(GNUCP, gnucp cp)
5970   fi
5971   if test -z $GNUCP; then
5972      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5973   fi
5974else
5975   if test -x "$with_gnu_cp"; then
5976      GNUCP=$with_gnu_cp
5977   else
5978      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5979   fi
5980fi
5981
5982AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5983if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5984   AC_MSG_RESULT([yes])
5985else
5986   AC_MSG_RESULT([no])
5987   GNUCP=''
5988fi
5989
5990if test -z "$GNUCP"; then
5991   if test "$_os" = "SunOS"; then
5992      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5993   else
5994      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5995   fi
5996fi
5997
5998AC_SUBST(GNUPATCH)
5999AC_SUBST(GNUCP)
6000
6001dnl ***************************************
6002dnl testing bash tools path on Windows
6003dnl ***************************************
6004if test "$_os" = "WINNT"; then
6005    CYGWIN_PATH=""
6006    AC_PATH_PROG(CYGWIN_PATH, bash)
6007    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
6008fi
6009if test -z "$CYGWIN_PATH"; then
6010   CYGWIN_PATH="NO_CYGWIN"
6011fi
6012AC_SUBST(CYGWIN_PATH)
6013
6014dnl ***************************************
6015dnl testing ml.exe assembler path
6016dnl ***************************************
6017if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
6018  AC_MSG_CHECKING([ml.exe assembler path])
6019  if test -n "$with_asm_home"; then
6020    with_asm_home=`cygpath -u "$with_asm_home"`
6021  fi
6022  if test ! -x "$with_asm_home/ml.exe"; then
6023    AC_PATH_PROG(ML_EXE, ml.exe)
6024    if test -z "$ML_EXE"; then
6025      if test -x "$with_cl_home/bin/ml.exe"; then
6026        with_asm_home=$with_cl_home/bin
6027        AC_MSG_RESULT([found ($with_asm_home)])
6028      else
6029        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
6030      fi
6031    else
6032       with_asm_home="ASM_IN_PATH"
6033    fi
6034  fi
6035  AC_MSG_RESULT([$ASM_HOME])
6036else
6037  with_asm_home="NO_ASM_HOME"
6038fi
6039ASM_HOME="$with_asm_home"
6040AC_SUBST(ASM_HOME)
6041
6042dnl ===================================================================
6043dnl testing handle deprecated unzip switch
6044dnl ===================================================================
6045if test -z "$with_zip_home"; then
6046	with_zip_home="$with_unzip_home"
6047fi
6048dnl ===================================================================
6049dnl Zip will be found where you tell me to find it
6050dnl ===================================================================
6051if test -n "$with_zip_home" ; then
6052    if test "$_os" = "WINNT"; then
6053        with_zip_home=`cygpath -u "$with_zip_home"`
6054    fi
6055    ZIP="$with_zip_home/zip"
6056    UNZIP="$with_zip_home/unzip"
6057    ZIP_HOME="$with_zip_home"
6058else
6059    AC_PATH_PROG(ZIP, zip)
6060    AC_PATH_PROG(UNZIP, unzip)
6061    ZIP_HOME=`dirname "$ZIP"`
6062fi
6063dnl ===================================================================
6064dnl Zip must be available or else it is an error, all platforms
6065dnl ===================================================================
6066if test -z "$ZIP" -o -z "$UNZIP"; then
6067    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
6068fi
6069
6070dnl ===================================================================
6071dnl Zip must be a specific type for different build types.
6072dnl ===================================================================
6073if test "$_os" = "WINNT"; then
6074    if test -n "`$ZIP -h | grep -i WinNT`" ; then
6075AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
6076    fi
6077fi
6078AC_SUBST(ZIP_HOME)
6079
6080dnl ===================================================================
6081dnl Windows builds need dbghelp.dll in external/dbghelp/
6082dnl ===================================================================
6083if test "$_os" = "WINNT"; then
6084   AC_MSG_CHECKING([for dbghelp.dll])
6085   if test -x ./external/dbghelp/dbghelp.dll; then
6086      AC_MSG_RESULT([found and executable])
6087   else
6088      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
6089Get it from the Microsoft site and put it into external/dbghelp.
6090(Note: Microsoft seems to enjoy changing the exact location of this file. You
6091may have to search Microsoft's website.) Last time it was seen at:
6092<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
6093   fi
6094fi
6095
6096dnl ===================================================================
6097dnl Windows builds need vcredist_x*.exe in external/vcredist/
6098dnl ===================================================================
6099WITH_VC_REDIST=""
6100
6101if test "$_os" = "WINNT"; then
6102   AC_MSG_CHECKING([for vcredist_x86.exe])
6103   if test -x ./external/vcredist/vcredist_x86.exe; then
6104      AC_MSG_RESULT([found and executable])
6105   else
6106      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
6107Get it from the Microsoft site and put it into external/vcredist. You can try
6108to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
6109   fi
6110   AC_MSG_CHECKING([for vcredist_x64.exe])
6111   if test -x ./external/vcredist/vcredist_x64.exe; then
6112      AC_MSG_RESULT([found and executable])
6113   else
6114      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
6115Get it from the Microsoft site and put it into external/vcredist. You can try
6116to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
6117   fi
6118   WITH_VC_REDIST=YES
6119   AC_SUBST(WITH_VC_REDIST)
6120fi
6121
6122dnl ===================================================================
6123dnl Windows builds - use oowintool to copy CRT dlls and manifest
6124dnl ===================================================================
6125if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
6126       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
6127          :
6128       else
6129          AC_MSG_ERROR([oowintool failed to copy CRT])
6130       fi
6131fi
6132
6133dnl ===================================================================
6134dnl Windows builds need gdiplus.dll in external/gdiplus/
6135dnl ===================================================================
6136if test "$_os" = "WINNT"; then
6137   AC_MSG_CHECKING([for gdiplus.dll])
6138   if test -x ./external/gdiplus/gdiplus.dll; then
6139      AC_MSG_RESULT([found and executable])
6140   else
6141      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
6142Get it from the Microsoft site and put it into external/gdiplus.
6143You may have to search Microsoft's website. Last time it was seen at:
6144<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
6145   fi
6146fi
6147
6148dnl ===================================================================
6149dnl Windows builds need msvcr100.dll in external/msvcp100/
6150dnl ===================================================================
6151if test "$_os" = "WINNT"; then
6152   AC_MSG_CHECKING([for msvcr100.dll])
6153   if test -x ./external/msvcp100/msvcr100.dll; then
6154      AC_MSG_RESULT([found and executable])
6155   else
6156      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
6157Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
6158from the Microsoft site and put it into external/msvcp100.
6159You may have to search Microsoft's website. Last time it was seen at:
6160<http://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
6161   fi
6162fi
6163
6164dnl ===================================================================
6165dnl Test which vclplugs have to be built.
6166dnl ===================================================================
6167AC_MSG_CHECKING([which VCLplugs shall be built])
6168ENABLE_GTK=""
6169if test "x$enable_gtk" = "xyes"; then
6170    ENABLE_GTK="TRUE"
6171    R="gtk"
6172fi
6173AC_SUBST(ENABLE_GTK)
6174
6175ENABLE_KDE=""
6176if test "x$enable_kde" = "xyes"; then
6177    ENABLE_KDE="TRUE"
6178    R="$R kde"
6179fi
6180AC_SUBST(ENABLE_KDE)
6181
6182ENABLE_KDE4=""
6183if test "x$enable_kde4" = "xyes"; then
6184    ENABLE_KDE4="TRUE"
6185    R="$R kde4"
6186fi
6187AC_SUBST(ENABLE_KDE4)
6188
6189if test -z "$R"; then
6190	AC_MSG_RESULT([none])
6191else
6192	AC_MSG_RESULT([$R])
6193fi
6194
6195dnl ===================================================================
6196dnl GCONF check
6197dnl ===================================================================
6198
6199ENABLE_GCONF=""
6200AC_MSG_CHECKING([whether to enable GConf support])
6201if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
6202    ENABLE_GCONF="TRUE"
6203    AC_MSG_RESULT([yes])
6204    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6205else
6206    AC_MSG_RESULT([no])
6207fi
6208AC_SUBST(ENABLE_GCONF)
6209
6210dnl ===================================================================
6211dnl Gnome VFS check
6212dnl ===================================================================
6213
6214ENABLE_GNOMEVFS=""
6215AC_MSG_CHECKING([whether to enable GNOME VFS support])
6216if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
6217    ENABLE_GNOMEVFS="TRUE"
6218    AC_MSG_RESULT([yes])
6219    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
6220    if test "$ENABLE_GCONF" != "TRUE"; then
6221        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6222    fi
6223else
6224    AC_MSG_RESULT([no])
6225fi
6226AC_SUBST(ENABLE_GNOMEVFS)
6227
6228dnl ===================================================================
6229dnl Check whether the gtk 2.0 libraries are available.
6230dnl ===================================================================
6231
6232GTK_CFLAGS=""
6233GTK_LIBS=""
6234ENABLE_SYSTRAY_GTK=""
6235ENABLE_DBUS=""
6236if test  "$test_gtk" = "yes"; then
6237
6238   if test "$ENABLE_GTK" = "TRUE" ; then
6239      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]))
6240      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]))
6241      BUILD_TYPE="$BUILD_TYPE GTK"
6242
6243      if test "x$enable_systray" = "xyes"; then
6244         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
6245                           [ENABLE_SYSTRAY_GTK="TRUE"
6246                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
6247                           [ENABLE_SYSTRAY_GTK=""])
6248      fi
6249
6250      AC_MSG_CHECKING([whether to enable DBUS support])
6251      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
6252          ENABLE_DBUS="TRUE"
6253          AC_MSG_RESULT([yes])
6254          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
6255      else
6256          AC_MSG_RESULT([no])
6257      fi
6258
6259      AC_MSG_CHECKING([whether to enable GIO support])
6260      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
6261          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
6262             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
6263          fi
6264          ENABLE_GIO="TRUE"
6265          AC_MSG_RESULT([yes])
6266          PKG_CHECK_MODULES( GIO, gio-2.0 )
6267      else
6268          AC_MSG_RESULT([no])
6269      fi
6270
6271   fi
6272
6273fi
6274AC_SUBST(ENABLE_GIO)
6275AC_SUBST(ENABLE_DBUS)
6276AC_SUBST(ENABLE_SYSTRAY_GTK)
6277AC_SUBST(GTK_CFLAGS)
6278AC_SUBST(GTK_LIBS)
6279AC_SUBST(GTHREAD_CFLAGS)
6280AC_SUBST(GTHREAD_LIBS)
6281
6282dnl ===================================================================
6283dnl Check whether the GStreamer libraries are available.
6284dnl ===================================================================
6285
6286GSTREAMER_CFLAGS=""
6287GSTREAMER_LIBS=""
6288ENABLE_GSTREAMER=""
6289
6290if test "$test_gstreamer" = "yes"; then
6291    AC_MSG_CHECKING([whether to build the GStreamer media backend])
6292    if test "x$enable_gstreamer" != "xno" ; then
6293        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]))
6294        ENABLE_GSTREAMER="TRUE"
6295        AC_MSG_RESULT([yes])
6296    else
6297        AC_MSG_RESULT([no])
6298    fi
6299fi
6300AC_SUBST(ENABLE_GSTREAMER)
6301AC_SUBST(GSTREAMER_CFLAGS)
6302AC_SUBST(GSTREAMER_LIBS)
6303
6304dnl ===================================================================
6305dnl Check the ARM target
6306dnl ===================================================================
6307
6308if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
6309    # default value
6310    ARM_TARGET=ARMV4T
6311    AC_MSG_CHECKING([which ARM processor optimization to use])
6312    if test "$with_arm_target" -lt "6"; then
6313	ARM_TARGET=ARMV4T
6314    elif test "$with_arm_target" = "6"; then
6315	ARM_TARGET=ARMV6
6316    elif test "$with_arm_target" -gt "6"; then
6317	ARM_TARGET=ARMV7
6318    fi
6319    AC_MSG_RESULT([$ARM_TARGET])
6320    AC_SUBST(ARM_TARGET)
6321fi
6322
6323dnl ===================================================================
6324dnl Check whether the Cairo libraries are available.
6325dnl ===================================================================
6326
6327ENABLE_CAIRO=""
6328BUILD_PIXMAN=""
6329SYSTEM_CAIRO=""
6330
6331if test  "$test_cairo" = "yes"; then
6332
6333    AC_MSG_CHECKING([whether to use cairo])
6334    if test "x$enable_cairo" != "xno" ; then
6335        ENABLE_CAIRO="TRUE"
6336	AC_MSG_RESULT([yes])
6337        AC_MSG_CHECKING([which cairo to use])
6338        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6339           test "$with_system_cairo" != "no"; then
6340           AC_MSG_RESULT([external])
6341           SYSTEM_CAIRO=YES
6342
6343           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6344	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6345	      AC_MSG_ERROR([Cairo library requires fontconfig.])
6346	   fi
6347           if test "$with_system_xrender_headers" = "yes"; then
6348              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6349              AC_TRY_RUN([
6350#include <X11/extensions/Xrender.h>
6351
6352int main(int argc, char **argv) {
6353#ifdef PictStandardA8
6354      return 0;
6355#else
6356      return 1;
6357#endif
6358}
6359               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
6360           fi
6361        else
6362           BUILD_TYPE="$BUILD_TYPE CAIRO"
6363	   dnl === compiler fails on pixman with 64bit architectures...===
6364	   if test "$build_cpu" != "x86_64"; then
6365	      BUILD_PIXMAN=YES
6366	   fi
6367           AC_MSG_RESULT([internal])
6368        fi
6369    else
6370	   AC_MSG_RESULT([no])
6371    fi
6372fi
6373
6374AC_SUBST(ENABLE_CAIRO)
6375AC_SUBST(BUILD_PIXMAN)
6376AC_SUBST(SYSTEM_CAIRO)
6377AC_SUBST(CAIRO_CFLAGS)
6378AC_SUBST(CAIRO_LIBS)
6379
6380ENABLE_CAIRO_CANVAS="FALSE"
6381if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6382   ENABLE_CAIRO_CANVAS="TRUE"
6383fi
6384AC_SUBST(ENABLE_CAIRO_CANVAS)
6385
6386dnl ===================================================================
6387dnl Check whether the OpenGL libraries are available
6388dnl ===================================================================
6389
6390AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6391ENABLE_OPENGL=
6392
6393if test "x$enable_opengl" != "xno" ; then
6394   AC_MSG_RESULT([yes])
6395   AC_CHECK_HEADER(GL/gl.h, [],
6396                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6397   AC_CHECK_LIB(GL, main, [],
6398     [AC_MSG_ERROR(libGL not installed or functional)], [])
6399   AC_CHECK_LIB(GLU, main, [],
6400     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6401   ENABLE_OPENGL=TRUE
6402else
6403   AC_MSG_RESULT([no])
6404fi
6405
6406AC_SUBST(ENABLE_OPENGL)
6407
6408
6409AC_MSG_CHECKING([whether to build the PDF Import extension])
6410if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6411  AC_MSG_RESULT([yes])
6412  ENABLE_PDFIMPORT=YES
6413
6414  dnl ===================================================================
6415  dnl Check for system poppler
6416  dnl ===================================================================
6417  AC_MSG_CHECKING([whether to use system pdf backend])
6418  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6419       test "$with_system_poppler" != "no"; then
6420      AC_MSG_RESULT([external])
6421      SYSTEM_POPPLER=YES
6422      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6423  else
6424      AC_MSG_RESULT([no])
6425      SYSTEM_POPPLER=NO
6426      ENABLE_PDFIMPORT=NO
6427  fi
6428else
6429   AC_MSG_RESULT([no])
6430   ENABLE_PDFIMPORT=NO
6431fi
6432AC_SUBST(ENABLE_PDFIMPORT)
6433AC_SUBST(SYSTEM_POPPLER)
6434AC_SUBST(POPPLER_CFLAGS)
6435AC_SUBST(POPPLER_LIBS)
6436
6437AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6438if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6439  AC_MSG_RESULT([yes])
6440  AC_MSG_CHECKING([for swext module])
6441  if test -d ./swext; then
6442   AC_MSG_RESULT([OK])
6443  else
6444   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6445  fi
6446  ENABLE_MEDIAWIKI=YES
6447  BUILD_TYPE="$BUILD_TYPE SWEXT"
6448else
6449  AC_MSG_RESULT([no])
6450  ENABLE_MEDIAWIKI=NO
6451fi
6452AC_SUBST(ENABLE_MEDIAWIKI)
6453
6454if test "$ENABLE_MEDIAWIKI" = "YES"; then
6455  AC_MSG_CHECKING([which Servlet API Jar to use])
6456  if test -n "$with_system_servlet_api"; then
6457    AC_MSG_RESULT([external])
6458    SYSTEM_SERVLETAPI=YES
6459      if test -z "$SERVLETAPI_JAR"; then
6460	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6461      fi
6462      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6463             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6464  else
6465    AC_MSG_RESULT([internal])
6466    SYSTEM_SERVLETAPI=NO
6467    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6468  fi
6469fi
6470AC_SUBST(SYSTEM_SERVLETAPI)
6471AC_SUBST(SERVLETAPI_JAR)
6472
6473AC_MSG_CHECKING([whether to build the Report Builder extension])
6474if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6475  AC_MSG_RESULT([yes])
6476  ENABLE_REPORTBUILDER=YES
6477  SYSTEM_JFREEREPORT=YES
6478  AC_MSG_CHECKING([for reportbuilder module])
6479  if test -d ./reportbuilder; then
6480    AC_MSG_RESULT([OK])
6481  else
6482    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6483  fi
6484  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6485  AC_MSG_RESULT([external])
6486  if test -z $SAC_JAR; then
6487         SAC_JAR=/usr/share/java/sac.jar
6488  fi
6489  AC_CHECK_FILE($SAC_JAR, [],
6490         [AC_MSG_ERROR(sac.jar not found.)], [])
6491
6492  if test -z $LIBXML_JAR; then
6493    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6494      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6495      [
6496        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6497          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6498          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6499        )
6500      ]
6501    )
6502  else
6503    AC_CHECK_FILE($LIBXML_JAR, [],
6504         [AC_MSG_ERROR(libxml.jar not found.)], [])
6505  fi
6506
6507  if test -z $FLUTE_JAR; then
6508    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6509      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6510      [
6511        AC_CHECK_FILE(/usr/share/java/flute.jar,
6512          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6513          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6514        )
6515      ]
6516    )
6517  else
6518    AC_CHECK_FILE($FLUTE_JAR, [],
6519         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6520  fi
6521
6522  if test -z $JFREEREPORT_JAR; then
6523    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6524      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6525      [
6526        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6527          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6528          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6529        )
6530      ]
6531    )
6532  else
6533    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6534         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6535  fi
6536
6537  if test -z $LIBLAYOUT_JAR; then
6538    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6539      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6540      [
6541        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6542          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6543          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6544        )
6545      ]
6546    )
6547  else
6548    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6549         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6550  fi
6551
6552  if test -z $LIBLOADER_JAR; then
6553    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6554      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6555      [
6556        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6557          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6558          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6559        )
6560      ]
6561    )
6562  else
6563    AC_CHECK_FILE($LIBLOADER_JAR, [],
6564         [AC_MSG_ERROR(libloader.jar not found.)], [])
6565  fi
6566
6567  if test -z $LIBFORMULA_JAR; then
6568    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6569      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6570      [
6571        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6572          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6573          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6574        )
6575      ]
6576    )
6577  else
6578    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6579         [AC_MSG_ERROR(libformula.jar not found.)], [])
6580  fi
6581
6582  if test -z $LIBREPOSITORY_JAR; then
6583    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6584      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6585      [
6586        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6587          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6588          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6589        )
6590      ]
6591    )
6592  else
6593    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6594         [AC_MSG_ERROR(librepository.jar not found.)], [])
6595  fi
6596
6597  if test -z $LIBFONTS_JAR; then
6598    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6599      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6600      [
6601        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6602          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6603          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6604        )
6605      ]
6606    )
6607  else
6608    AC_CHECK_FILE($LIBFONTS_JAR, [],
6609         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6610  fi
6611
6612  if test -z $LIBSERIALIZER_JAR; then
6613    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6614      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6615      [
6616        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6617          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6618          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6619        )
6620      ]
6621    )
6622  else
6623    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6624         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6625  fi
6626
6627
6628  if test -z $LIBBASE_JAR; then
6629    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6630      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6631      [
6632        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6633          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6634          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6635        )
6636      ]
6637    )
6638  else
6639    AC_CHECK_FILE($LIBBASE_JAR, [],
6640         [AC_MSG_ERROR(libbase.jar not found.)], [])
6641  fi
6642  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6643else
6644  AC_MSG_RESULT([no])
6645  ENABLE_REPORTBUILDER=NO
6646fi
6647AC_SUBST(ENABLE_REPORTBUILDER)
6648AC_SUBST(SYSTEM_JFREEREPORT)
6649AC_SUBST(SAC_JAR)
6650AC_SUBST(LIBXML_JAR)
6651AC_SUBST(FLUTE_JAR)
6652AC_SUBST(JFREEREPORT_JAR)
6653AC_SUBST(LIBBASE_JAR)
6654AC_SUBST(LIBLAYOUT_JAR)
6655AC_SUBST(LIBLOADER_JAR)
6656AC_SUBST(LIBFORMULA_JAR)
6657AC_SUBST(LIBREPOSITORY_JAR)
6658AC_SUBST(LIBFONTS_JAR)
6659AC_SUBST(LIBSERIALIZER_JAR)
6660
6661# this has to be here because both the wiki publisher and the SRB use
6662# commons-logging
6663if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6664  AC_MSG_CHECKING([which Apache commons-* libs to use])
6665  if test "$with_system_apache_commons" = "yes"; then
6666    SYSTEM_APACHE_COMMONS=YES
6667    AC_MSG_RESULT([external])
6668    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6669      if test -z $COMMONS_CODEC_JAR; then
6670        AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
6671          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
6672          [
6673            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6674              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6675              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6676            )
6677          ]
6678        )
6679      else
6680        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6681             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6682      fi
6683
6684      if test -z $COMMONS_LANG_JAR; then
6685        AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
6686          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
6687          [
6688            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6689              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6690              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6691            )
6692          ]
6693        )
6694      else
6695        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6696             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6697      fi
6698
6699      if test -z $COMMONS_HTTPCLIENT_JAR; then
6700        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6701          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6702          [
6703            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6704              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6705              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6706            )
6707          ]
6708        )
6709      else
6710        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6711             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6712      fi
6713    fi
6714    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6715      if test -z $COMMONS_LOGGING_JAR; then
6716        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
6717          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
6718          [
6719            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6720              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6721              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6722            )
6723          ]
6724        )
6725      else
6726        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6727             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6728      fi
6729    fi
6730  else
6731    AC_MSG_RESULT([internal])
6732    SYSTEM_APACHE_COMMONS=NO
6733    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6734  fi
6735fi
6736AC_SUBST(SYSTEM_APACHE_COMMONS)
6737AC_SUBST(COMMONS_CODEC_JAR)
6738AC_SUBST(COMMONS_LANG_JAR)
6739AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6740AC_SUBST(COMMONS_LOGGING_JAR)
6741
6742dnl ===================================================================
6743dnl Check whether the Qt and KDE libraries are available.
6744dnl ===================================================================
6745
6746KDE_CFLAGS=""
6747KDE_LIBS=""
6748MOC="moc"
6749if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6750    dnl Search paths for Qt and KDE
6751    if test "$build_cpu" != "x86_64" ; then
6752        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"
6753        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"
6754    else
6755        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"
6756        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"
6757    fi
6758    if test -n "$QTDIR" ; then
6759        qt_incdirs="$QTDIR/include $qt_incdirs"
6760        if test "$build_cpu" != "x86_64" ; then
6761            qt_libdirs="$QTDIR/lib $qt_libdirs"
6762        else
6763            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6764        fi
6765    fi
6766    if test "$build_cpu" != "x86_64" ; then
6767        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"
6768        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"
6769    else
6770        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"
6771        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"
6772    fi
6773    if test -n "$KDEDIR" ; then
6774        kde_incdirs="$KDEDIR/include $kde_incdirs"
6775        if test "$build_cpu" != "x86_64" ; then
6776            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6777        else
6778            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6779        fi
6780    fi
6781
6782    dnl What to test
6783    qt_test_include="qstyle.h"
6784    qt_test_library="libqt-mt.so"
6785    kde_test_include="ksharedptr.h"
6786    kde_test_library="libkdeui.so"
6787
6788    dnl Check for Qt headers
6789    AC_MSG_CHECKING([for Qt headers])
6790    qt_incdir="no"
6791    for kde_check in $qt_incdirs ; do
6792        if test -r "$kde_check/$qt_test_include" ; then
6793            qt_incdir="$kde_check"
6794            break
6795        fi
6796    done
6797    AC_MSG_RESULT([$qt_incdir])
6798    if test "x$qt_incdir" = "xno" ; then
6799        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6800your Qt installation by exporting QTDIR before running "configure".])
6801    fi
6802
6803    dnl Check for Qt libraries
6804    AC_MSG_CHECKING([for Qt libraries])
6805    qt_libdir="no"
6806    for qt_check in $qt_libdirs ; do
6807        if test -r "$qt_check/$qt_test_library" ; then
6808            qt_libdir="$qt_check"
6809            break
6810        fi
6811    done
6812    AC_MSG_RESULT([$qt_libdir])
6813    if test "x$qt_libdir" = "xno" ; then
6814        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6815your Qt installation by exporting QTDIR before running "configure".])
6816    fi
6817
6818    dnl Check for Meta Object Compiler
6819    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6820    if test "$MOC" = "no" ; then
6821        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6822the root of your Qt installation by exporting QTDIR before running "configure".])
6823    fi
6824
6825    dnl Check for KDE headers
6826    AC_MSG_CHECKING([for KDE headers])
6827    kde_incdir="no"
6828    for kde_check in $kde_incdirs ; do
6829        if test -r "$kde_check/$kde_test_include" ; then
6830            kde_incdir="$kde_check"
6831            break
6832        fi
6833    done
6834    AC_MSG_RESULT([$kde_incdir])
6835    if test "x$kde_incdir" = "xno" ; then
6836        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6837your KDE installation by exporting KDEDIR before running "configure".])
6838    fi
6839
6840    dnl Check for KDE libraries
6841    AC_MSG_CHECKING([for KDE libraries])
6842    kde_libdir="no"
6843    for kde_check in $kde_libdirs ; do
6844        if test -r "$kde_check/$kde_test_library" ; then
6845            kde_libdir="$kde_check"
6846            break
6847        fi
6848    done
6849    AC_MSG_RESULT([$kde_libdir])
6850    if test "x$kde_libdir" = "xno" ; then
6851        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6852your KDE installation by exporting KDEDIR before running "configure".])
6853    fi
6854
6855    dnl Set the variables
6856    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6857    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6858fi
6859AC_SUBST(KDE_CFLAGS)
6860AC_SUBST(KDE_LIBS)
6861AC_SUBST(MOC)
6862
6863dnl ===================================================================
6864dnl KDE4 Integration
6865dnl ===================================================================
6866
6867KDE4_CFLAGS=""
6868KDE4_LIBS=""
6869MOC4="moc"
6870if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6871   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6872   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6873
6874   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6875   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6876
6877   if test "$build_cpu" = "x86_64" ; then
6878      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6879      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6880   fi
6881
6882   if test -n "$KDE4DIR" ; then
6883      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6884      if test "$build_cpu" != "x86_64" ; then
6885         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6886      else
6887         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6888      fi
6889   fi
6890
6891   qt_test_include="Qt/qobject.h"
6892   qt_test_library="libQtCore.so"
6893   kde_test_include="ksharedptr.h"
6894   kde_test_library="libkdeui.so"
6895
6896   AC_MSG_CHECKING([for Qt4 headers])
6897   qt_header_dir="no"
6898   for inc_dir in $qt_incdirs ; do
6899      if test -r "$inc_dir/$qt_test_include" ; then
6900         qt_header_dir="$inc_dir"
6901         break
6902      fi
6903   done
6904
6905   AC_MSG_RESULT([$qt_header_dir])
6906   if test "x$qt_header_dir" = "xno" ; then
6907      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6908   fi
6909
6910   AC_MSG_CHECKING([for Qt4 libraries])
6911   qt_lib_dir="no"
6912   for lib_dir in $qt_libdirs ; do
6913      if test -r "$lib_dir/$qt_test_library" ; then
6914         qt_lib_dir="$lib_dir"
6915         break
6916      fi
6917   done
6918
6919   AC_MSG_RESULT([$qt_lib_dir])
6920
6921   if test "x$qt_lib_dir" = "xno" ; then
6922      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6923   fi
6924
6925   dnl Check for Meta Object Compiler
6926   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6927   MOC4="$MOCQT4"
6928   if test "$MOC4" = "no" ; then
6929      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6930      if test "$MOC4" = "no" ; then
6931         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6932      fi
6933   fi
6934
6935   dnl Check for KDE4 headers
6936   AC_MSG_CHECKING([for KDE4 headers])
6937   kde_incdir="no"
6938   for kde_check in $kde_incdirs ; do
6939      if test -r "$kde_check/$kde_test_include" ; then
6940         kde_incdir="$kde_check"
6941         break
6942      fi
6943   done
6944   AC_MSG_RESULT([$kde_incdir])
6945   if test "x$kde_incdir" = "xno" ; then
6946      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6947   fi
6948
6949   dnl Check for KDE4 libraries
6950   AC_MSG_CHECKING([for KDE4 libraries])
6951   kde_libdir="no"
6952   for kde_check in $kde_libdirs ; do
6953      if test -r "$kde_check/$kde_test_library" ; then
6954         kde_libdir="$kde_check"
6955         break
6956      fi
6957   done
6958
6959   AC_MSG_RESULT([$kde_libdir])
6960   if test "x$kde_libdir" = "xno" ; then
6961      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6962   fi
6963
6964   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6965   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6966fi
6967AC_SUBST(KDE4_CFLAGS)
6968AC_SUBST(KDE4_LIBS)
6969AC_SUBST(MOC4)
6970
6971dnl ===================================================================
6972dnl Test for the enabling the lockdown pieces
6973dnl ===================================================================
6974AC_MSG_CHECKING([whether to enable the lockdown pieces])
6975ENABLE_LOCKDOWN=""
6976if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6977  ENABLE_LOCKDOWN=YES
6978  AC_MSG_RESULT([yes])
6979else
6980  AC_MSG_RESULT([no])
6981fi
6982AC_SUBST(ENABLE_LOCKDOWN)
6983
6984dnl ===================================================================
6985dnl Test whether to include Evolution 2 support
6986dnl ===================================================================
6987AC_MSG_CHECKING([whether to enable evolution 2 support])
6988if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6989   AC_MSG_RESULT([yes])
6990   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6991   ENABLE_EVOAB2="TRUE"
6992else
6993   ENABLE_EVOAB2=""
6994   AC_MSG_RESULT([no])
6995fi
6996AC_SUBST(ENABLE_EVOAB2)
6997AC_SUBST(GOBJECT_CFLAGS)
6998AC_SUBST(GOBJECT_LIBS)
6999
7000dnl ===================================================================
7001dnl Test whether to include KDE AB support
7002dnl ===================================================================
7003AC_MSG_CHECKING([whether to enable KDE address book support])
7004if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
7005   AC_MSG_RESULT([yes])
7006   AC_LANG_PUSH([C++])
7007   save_CXXFLAGS=$CXXFLAGS
7008   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
7009   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
7010       AC_TRY_RUN([
7011#include <kdeversion.h>
7012
7013int main(int argc, char **argv) {
7014       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
7015       else return 1;
7016}
7017       ], [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])])
7018   CXXFLAGS=$save_CXXFLAGS
7019   AC_LANG_POP([C++])
7020   ENABLE_KAB=TRUE
7021else
7022   AC_MSG_RESULT([no])
7023   ENABLE_KAB=
7024fi
7025AC_SUBST(ENABLE_KAB)
7026
7027dnl ===================================================================
7028dnl Test whether to include MathMLDTD
7029dnl ===================================================================
7030AC_MSG_CHECKING([whether to include MathMLDTD])
7031if test -n "$enable_mathmldtd"; then
7032  if test "$enable_mathmldtd" = "no"; then
7033    AC_MSG_RESULT([no])
7034    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7035  else
7036    AC_MSG_RESULT([yes])
7037    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7038  fi
7039else
7040  AC_MSG_RESULT([no])
7041  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7042fi
7043
7044dnl ===================================================================
7045dnl Test whether to include category-B fonts
7046dnl ===================================================================
7047WITH_CATB_FONTS=
7048AC_MSG_CHECKING([whether to include category B fonts])
7049if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
7050   AC_MSG_RESULT([yes])
7051   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
7052   WITH_CATB_FONTS=YES
7053   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
7054else
7055   AC_MSG_RESULT([no])
7056   WITH_CATB_FONTS=NO
7057fi
7058
7059dnl ===================================================================
7060dnl Test whether to include category-A fonts
7061dnl ===================================================================
7062WITH_CATA_FONTS=
7063AC_MSG_CHECKING([whether to include category A fonts])
7064if test "x$with_fonts" != "xno" ; then
7065  AC_MSG_RESULT([yes])
7066  WITH_CATA_FONTS=YES
7067  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
7068else
7069  AC_MSG_RESULT([no])
7070  WITH_CATA_FONTS=NO
7071  WITH_CATB_FONTS=NO
7072fi
7073
7074WITH_FONTS=NO
7075AC_MSG_CHECKING([whether any fonts are included])
7076if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
7077  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
7078  WITH_FONTS=YES
7079  AC_MSG_RESULT([yes])
7080else
7081  AC_MSG_RESULT([no])
7082fi
7083
7084AC_SUBST(WITH_CATA_FONTS)
7085AC_SUBST(WITH_CATB_FONTS)
7086AC_SUBST(WITH_FONTS)
7087
7088dnl ===================================================================
7089dnl Test whether to include ppds
7090dnl ===================================================================
7091AC_MSG_CHECKING([whether to include PPDs])
7092if test "$with_ppds" != "no"; then
7093  AC_MSG_RESULT([yes])
7094else
7095  AC_MSG_RESULT([no])
7096  WITHOUT_PPDS=YES
7097  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
7098fi
7099AC_SUBST(WITHOUT_PPDS)
7100
7101dnl ===================================================================
7102dnl Test whether to include afms
7103dnl ===================================================================
7104AC_MSG_CHECKING([whether to include AFMs])
7105if test "$with_afms" != "no"; then
7106  AC_MSG_RESULT([yes])
7107  BUILD_TYPE="$BUILD_TYPE AFMS"
7108else
7109  AC_MSG_RESULT([no])
7110  WITHOUT_AFMS=YES
7111  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
7112fi
7113AC_SUBST(WITHOUT_AFMS)
7114
7115AC_SUBST(SCPDEFS)
7116
7117AC_MSG_CHECKING([whether and how to use Xinerama])
7118if test "$_os" = "Darwin"; then
7119   USE_XINERAMA=YES
7120   XINERAMA_LINK=dynamic
7121   AC_MSG_RESULT([yes])
7122elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
7123   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
7124      # we have both versions, let the user decide but use the dynamic one
7125      # per default
7126      USE_XINERAMA=YES
7127      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
7128         XINERAMA_LINK=dynamic
7129      else
7130         XINERAMA_LINK=static
7131      fi
7132   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
7133      # we have only the dynamic version
7134      USE_XINERAMA=YES
7135      XINERAMA_LINK=dynamic
7136   elif test -e "$XLIB/libXinerama.a"; then
7137      # static version
7138      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
7139         USE_XINERAMA=YES
7140         XINERAMA_LINK=static
7141      else
7142         USE_XINERAMA=NO
7143         XINERAMA_LINK=none
7144      fi
7145   else
7146      # no Xinerama
7147      USE_XINERAMA=NO
7148      XINERAMA_LINK=none
7149   fi
7150   if test "$USE_XINERAMA" = "YES"; then
7151      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
7152      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
7153          [AC_MSG_ERROR(Xinerama header not found.)], [])
7154      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
7155      if test "$_os" = "FreeBSD"; then
7156          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
7157      fi
7158      if test "$_os" = "Linux"; then
7159          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
7160      fi
7161      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
7162          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
7163   else
7164      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
7165   fi
7166else
7167   AC_MSG_RESULT([no])
7168fi
7169AC_SUBST(USE_XINERAMA)
7170AC_SUBST(XINERAMA_LINK)
7171
7172dnl ===================================================================
7173dnl always rely on the system version of gdk-pixbuf
7174dnl ===================================================================
7175
7176SYSTEM_GDKPIXBUF=YES
7177AC_SUBST(SYSTEM_GDKPIXBUF)
7178
7179dnl ===================================================================
7180dnl always rely on the system version of glib
7181dnl ===================================================================
7182
7183SYSTEM_GLIB=YES
7184AC_SUBST(SYSTEM_GLIB)
7185
7186dnl ===================================================================
7187dnl always rely on the system version of gettext
7188dnl ===================================================================
7189
7190SYSTEM_GETTEXT=YES
7191AC_SUBST(SYSTEM_GETTEXT)
7192
7193dnl ===================================================================
7194dnl always rely on the system version of pango
7195dnl ===================================================================
7196
7197SYSTEM_PANGO=YES
7198AC_SUBST(SYSTEM_PANGO)
7199
7200dnl ===================================================================
7201dnl Test whether to build libpng or rely on the system version
7202dnl ===================================================================
7203AC_MSG_CHECKING([whether to build own version of libpng])
7204
7205case "$_os" in
7206	WINNT*) # Windows
7207	    SYSTEM_LIBPNG=NO
7208	    AC_MSG_RESULT([yes])
7209		;;
7210	Darwin*)
7211	    SYSTEM_LIBPNG=NO
7212	    AC_MSG_RESULT([yes])
7213	    ;;
7214   *)
7215   SYSTEM_LIBPNG=YES
7216   AC_MSG_RESULT([no])
7217   ;;
7218esac
7219AC_SUBST(SYSTEM_LIBPNG)
7220
7221dnl ===================================================================
7222dnl Test whether to build libjpeg or rely on the system version
7223dnl ===================================================================
7224dnl FIXME: this is currently because we have jpeg-6b for our filters
7225dnl        and jpeg-8 as dependency for librsvg
7226dnl        this should be unified into using only one version for both
7227
7228AC_MSG_CHECKING([whether to build own version of libjpeg])
7229
7230if test "$SYSTEM_JPEG" = "YES"; then
7231SYSTEM_LIBJPEG=YES
7232else
7233case "$_os" in
7234	WINNT*) # Windows
7235	    SYSTEM_LIBJPEG=NO
7236		;;
7237	Darwin*)
7238	    SYSTEM_LIBJPEG=NO
7239	    ;;
7240   *)
7241        SYSTEM_LIBJPEG=YES
7242        ;;
7243esac
7244fi
7245
7246if test "$SYSTEM_LIBJPEG" = "YES"; then
7247   AC_MSG_RESULT([no])
7248else
7249   AC_MSG_RESULT([yes])
7250fi
7251AC_SUBST(SYSTEM_LIBJPEG)
7252
7253dnl ===================================================================
7254dnl Test whether rat scan was requested and whether apache-rat is available
7255dnl ===================================================================
7256RAT_JAR=
7257AC_MSG_CHECKING([whether to trigger rat scan])
7258if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
7259    AC_MSG_RESULT([no])
7260else
7261    if test "$WITH_JAVA" = "no"; then
7262        AC_MSG_ERROR([no, java disabled, enable with --with-java])
7263    elif test "$enable_saxon" = "no"; then
7264        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
7265    elif test "$with_rat_scan" = "yes"; then
7266        AC_MSG_RESULT([yes, use pre-built library])
7267        RAT_JAR_HOME="BUILD"
7268        BUILD_TYPE="$BUILD_TYPE RAT"
7269    else
7270        AC_MSG_RESULT([yes, use pre-installed library])
7271        AC_MSG_CHECKING([whether apache-rat is available])
7272        if test -d "$with_rat_scan"; then
7273            RAT_JAR_HOME=$with_rat_scan
7274        else
7275            AC_MSG_ERROR([$with_rat_scan is not a directory])
7276        fi
7277    fi
7278fi
7279AC_SUBST(RAT_JAR_HOME)
7280
7281
7282dnl ===================================================================
7283dnl Test for the presence of Ant and that it works
7284dnl ===================================================================
7285
7286if test "$SOLAR_JAVA" != ""; then
7287ANT_HOME=; export ANT_HOME
7288WITH_ANT_HOME=; export WITH_ANT_HOME
7289if test -z "$with_ant_home"; then
7290   if test "$_os" = "OS2"; then
7291     AC_PATH_PROGS(ANT, ant.cmd)
7292   else
7293     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
7294   fi
7295else
7296   if test "$_os" = "WINNT"; then
7297      with_ant_home=`cygpath -u "$with_ant_home"`
7298   fi
7299   if test "$_os" = "OS2"; then
7300     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
7301   else
7302     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
7303   fi
7304   WITH_ANT_HOME=$with_ant_home
7305   ANT_HOME=$with_ant_home
7306fi
7307
7308if test -z "$ANT"; then
7309  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
7310else
7311  # resolve relative or absolute symlink
7312  while test -h "$ANT"; do
7313     a_cwd=`pwd`
7314     a_basename=`basename "$ANT"`
7315     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7316     cd "`dirname "$ANT"`"
7317     cd "`dirname "$a_script"`"
7318     ANT="`pwd`"/"`basename "$a_script"`"
7319     cd "$a_cwd"
7320  done
7321
7322  if test "$_os" = "OS2"; then
7323    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7324    export ANT_HOME
7325  fi
7326
7327  AC_MSG_CHECKING([if $ANT works])
7328cat > conftest.java << EOF
7329    public class conftest {
7330	int testmethod(int a, int b) {
7331            return a + b;
7332	}
7333    }
7334EOF
7335
7336cat > conftest.xml << EOF
7337    <project name="conftest" default="conftest">
7338	<target name="conftest">
7339            <javac srcdir="." includes="conftest.java">
7340	    </javac>
7341	</target>
7342    </project>
7343EOF
7344  oldJAVA_HOME=$JAVA_HOME
7345  if test "$JAVACISGCJ" = "yes"; then
7346    JAVA_HOME=; export JAVA_HOME
7347    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7348  else
7349    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7350  fi
7351  AC_TRY_EVAL(ant_cmd)
7352  if test $? = 0 && test -f ./conftest.class ; then
7353    AC_MSG_RESULT([Ant works])
7354    if test -z "$WITH_ANT_HOME"; then
7355        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7356        if test -z "$ANT_HOME"; then
7357            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7358        fi
7359    else
7360        ANT_HOME="$WITH_ANT_HOME"
7361    fi
7362  else
7363    echo "configure: Ant test failed" >&5
7364    cat conftest.java >&5
7365    cat conftest.xml >&5
7366    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7367    ANT_HOME=""
7368    echo "Ant does not work - Some Java projects will not build!" >>warn
7369  fi
7370  JAVA_HOME=$oldJAVA_HOME
7371  rm -f conftest* core core.* *.core
7372fi
7373if test -z "$ANT_HOME"; then
7374   ANT_HOME="NO_ANT_HOME"
7375fi
7376AC_SUBST(ANT_HOME)
7377
7378dnl Checking for ant.jar
7379if test "$ANT_HOME" != "NO_ANT_HOME"; then
7380   AC_MSG_CHECKING([Ant lib directory])
7381   if test -f $ANT_HOME/lib/ant.jar; then
7382	  ANT_LIB="$ANT_HOME/lib"
7383   else
7384      if test -f $ANT_HOME/ant.jar; then
7385	     ANT_LIB="$ANT_HOME"
7386      else
7387          if test -f /usr/share/java/ant.jar; then
7388              ANT_LIB=/usr/share/java
7389          else
7390             if test -f /usr/share/ant-core/lib/ant.jar; then
7391                 ANT_LIB=/usr/share/ant-core/lib
7392             else
7393                if test -f $ANT_HOME/lib/ant/ant.jar; then
7394                    ANT_LIB="$ANT_HOME/lib/ant"
7395                else
7396                   if test -f /usr/share/lib/ant/ant.jar; then
7397                       ANT_LIB=/usr/share/lib/ant
7398                   else
7399                       AC_MSG_ERROR([Ant libraries not found!])
7400                   fi
7401                fi
7402             fi
7403          fi
7404      fi
7405   fi
7406   AC_MSG_RESULT([Ant lib directory found.])
7407fi
7408AC_SUBST(ANT_LIB)
7409fi
7410
7411ant_minver=1.6.0
7412# update for more extensions...
7413if test "$ENABLE_MEDIAWIKI" = "YES"; then
7414  ant_minver=1.7.0
7415fi
7416ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7417
7418AC_MSG_CHECKING([whether ant is >= $ant_minver])
7419ant_version=`$ANT -version | $AWK '{ print $4; }'`
7420ant_version_major=`echo $ant_version | cut -d. -f1`
7421ant_version_minor=`echo $ant_version | cut -d. -f2`
7422echo "configure: ant_version $ant_version " >&5
7423echo "configure: ant_version_major $ant_version_major " >&5
7424echo "configure: ant_version_minor $ant_version_minor " >&5
7425if test "$ant_version_major" -ge "2"; then
7426   AC_MSG_RESULT([yes, $ant_version])
7427elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7428   AC_MSG_RESULT([yes, $ant_version])
7429else
7430   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7431fi
7432
7433if test "$ENABLE_MEDIAWIKI" = "YES"; then
7434AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7435rm -rf confdir
7436mkdir confdir
7437cat > conftest.java << EOF
7438    public class conftest {
7439        int testmethod(int a, int b) {
7440            return a + b;
7441        }
7442    }
7443EOF
7444
7445cat > conftest.xml << EOF
7446    <project name="conftest" default="conftest">
7447        <target name="conftest" depends="copytest">
7448            <javac srcdir="." includes="conftest.java">
7449            </javac>
7450        </target>
7451        <target name="copytest">
7452             <copy todir="confdir">
7453                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7454                 <filterset/>
7455                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7456             </copy>
7457        </target>
7458    </project>
7459EOF
7460  if test "$JAVACISGCJ" = "yes"; then
7461    JAVA_HOME=; export JAVA_HOME
7462    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7463  else
7464    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7465  fi
7466  AC_TRY_EVAL(ant_cmd)
7467  if test $? = 0 && test -f ./conftest.class ; then
7468    AC_MSG_RESULT([yes])
7469    rm -rf confdir
7470  else
7471    echo "configure: Ant test failed" >&5
7472    cat conftest.java >&5
7473    cat conftest.xml >&5
7474    rm -rf confdir
7475    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7476  fi
7477fi
7478rm -f conftest* core core.* *.core
7479
7480OOO_JUNIT_JAR=
7481if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7482    AC_MSG_CHECKING([for JUnit 4])
7483    if test "$with_junit" = "yes"; then
7484        if test -e /usr/share/java/junit4.jar; then
7485            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7486        else
7487           if test -e /usr/share/lib/java/junit.jar; then
7488              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7489           else
7490              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7491           fi
7492        fi
7493    else
7494        OOO_JUNIT_JAR=$with_junit
7495    fi
7496    if test "$_os" = "WINNT"; then
7497        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7498    fi
7499    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7500        grep org/junit/Before.class > /dev/null 2>&5
7501    if test $? -eq 0; then
7502        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7503    else
7504        AC_MSG_RESULT([no])
7505        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7506location (/usr/share/java), specify its pathname via
7507--with-junit=..., or disable it via --without-junit])
7508    fi
7509fi
7510AC_SUBST(OOO_JUNIT_JAR)
7511
7512AC_MSG_CHECKING([which languages to be built])
7513WITH_LANG="$with_lang"
7514if test -z "$WITH_LANG"; then
7515   AC_MSG_RESULT([en-US])
7516else
7517   AC_MSG_RESULT([$WITH_LANG])
7518   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7519   BUILD_TYPE="$BUILD_TYPE L10N"
7520fi
7521AC_SUBST(WITH_LANG)
7522
7523AC_MSG_CHECKING([which languages have poor help localizations])
7524WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7525if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7526   AC_MSG_RESULT([none])
7527else
7528   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7529fi
7530AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7531
7532AC_MSG_CHECKING([which dictionaries to include])
7533if test -z "$with_dict"; then
7534   WITH_DICT=,ALL,
7535   AC_MSG_RESULT([ALL])
7536else
7537   WITH_DICT=","$with_dict","
7538   AC_MSG_RESULT([$with_dict])
7539fi
7540AC_SUBST(WITH_DICT)
7541
7542AC_MSG_CHECKING([for additional 'intro' bitmaps])
7543INTRO_BITMAPS=
7544if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7545   INTRO_BITMAPS=
7546   AC_MSG_RESULT([none])
7547else
7548   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7549      case "$bitmap" in
7550         *.bmp) ;;
7551         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .bmp files!]) ;;
7552      esac
7553      if test -n "$bitmap" ; then
7554         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7555      fi
7556   done
7557   AC_MSG_RESULT([$INTRO_BITMAPS])
7558fi
7559AC_SUBST(INTRO_BITMAPS)
7560
7561AC_MSG_CHECKING([for additional 'about' bitmaps])
7562ABOUT_BITMAPS=
7563if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7564   ABOUT_BITMAPS=
7565   AC_MSG_RESULT([none])
7566else
7567   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7568      case "$bitmap" in
7569         *.bmp) ;;
7570         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .bmp files!]) ;;
7571      esac
7572      if test -n "$bitmap" ; then
7573         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7574      fi
7575   done
7576   AC_MSG_RESULT([$ABOUT_BITMAPS])
7577fi
7578AC_SUBST(ABOUT_BITMAPS)
7579
7580OOO_VENDOR=
7581AC_MSG_CHECKING([for vendor])
7582if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7583   AC_MSG_RESULT([not set])
7584else
7585   OOO_VENDOR="$with_vendor"
7586   AC_MSG_RESULT([$OOO_VENDOR])
7587fi
7588AC_SUBST(OOO_VENDOR)
7589
7590UNIXWRAPPERNAME=
7591AC_MSG_CHECKING([for UNIX wrapper name])
7592if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7593   AC_MSG_RESULT([not set])
7594else
7595   UNIXWRAPPERNAME="$with_unix_wrapper"
7596   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7597fi
7598AC_SUBST(UNIXWRAPPERNAME)
7599
7600AC_MSG_CHECKING([whether to statically link to Gtk])
7601if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7602   ENABLE_STATIC_GTK="TRUE"
7603   AC_MSG_RESULT([yes])
7604else
7605   ENABLE_STATIC_GTK="FALSE"
7606   AC_MSG_RESULT([no])
7607fi
7608AC_SUBST(ENABLE_STATIC_GTK)
7609
7610AC_MSG_CHECKING([whether to use layout dialogs])
7611if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7612   ENABLE_LAYOUT="TRUE"
7613   AC_MSG_RESULT([yes])
7614else
7615   ENABLE_LAYOUT="FALSE"
7616   AC_MSG_RESULT([no])
7617fi
7618AC_SUBST(ENABLE_LAYOUT)
7619
7620# ===================================================================
7621# De- or increase default verbosity of build process
7622# ===================================================================
7623AC_MSG_CHECKING([build verbosity])
7624if test -n "$enable_verbose"; then
7625   if test "$enable_verbose" = "yes"; then
7626      VERBOSE="TRUE"
7627      AC_MSG_RESULT([high])
7628   fi
7629   if test "$enable_verbose" = "no"; then
7630      VERBOSE="FALSE"
7631      AC_MSG_RESULT([low])
7632   fi
7633else
7634   AC_MSG_RESULT([not set])
7635fi
7636AC_SUBST(VERBOSE)
7637
7638dnl ===================================================================
7639dnl Hook up OOos nodep environmental variable to automake's equivalent
7640dnl --enable-dependency-tracking configure option
7641dnl ===================================================================
7642AC_MSG_CHECKING([whether to enable dependency tracking])
7643if test "$enable_dependency_tracking" = "no"; then
7644    nodep=TRUE
7645    AC_MSG_RESULT([no])
7646else
7647    AC_MSG_RESULT([yes])
7648fi
7649AC_SUBST(nodep)
7650
7651dnl ===================================================================
7652dnl Setting up the environment.
7653dnl ===================================================================
7654echo "********************************************************************"
7655echo "*                                                                  *"
7656echo "*   Setting up the build environment variables.                    *"
7657echo "*                                                                  *"
7658echo "********************************************************************"
7659
7660if test -z "$COMPATH"; then
7661   AC_MSG_ERROR([No compiler found.])
7662fi
7663AC_SUBST(COMPATH)
7664
7665AC_MSG_CHECKING([solver path])
7666if test -z "$with_local_solver"; then
7667   LOCAL_SOLVER="DEFAULT"
7668   AC_MSG_RESULT([default])
7669else
7670   LOCAL_SOLVER=$with_local_solver
7671   AC_MSG_RESULT([$with_local_solver])
7672fi
7673AC_SUBST(LOCAL_SOLVER)
7674
7675AC_SUBST(BUILD_TYPE)
7676AC_SUBST(ADDITIONAL_REPOSITORIES)
7677
7678# make sure config.guess is +x; we execute config.guess, so it has to be so;
7679chmod +x ./config.guess
7680
7681# Create files from their *.in templates.
7682AC_CONFIG_FILES([set_soenv Makefile])
7683
7684AC_MSG_NOTICE([writing config.status])
7685AC_OUTPUT
7686
7687dnl Executing the set_soenv script to setup the environment variables.
7688chmod a+x set_soenv
7689if test -z "$enable_check_only"; then
7690   './set_soenv'
7691else
7692   echo
7693   echo Test Complete
7694   echo No environment file will be generated
7695   echo
7696   num_warnings=`wc -l warn`
7697   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7698   if test $_num -gt 0; then
7699      echo The following warning\(s\) were generated by configure
7700      echo ----------------------------------------------------
7701      echo
7702      cat warn
7703      echo
7704   else
7705      echo There were no warnings
7706   fi
7707   echo
7708fi
7709