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