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