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