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