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