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