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