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