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