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