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