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