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