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