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