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