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