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