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