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