xref: /aoo42x/main/configure.ac (revision b871de36)
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		AC_MSG_CHECKING([whether NSIS version is >= 3.*])
5433		nsis_version_string=`"$NSIS_PATH/makensis.exe" /VERSION | $SED -e s/^v//i`
5434        nsis_version_major=`echo $nsis_version_string | cut -d. -f1`
5435		nsis_version_minor=`echo $nsis_version_string | cut -d. -f2`
5436		if test "$nsis_version_major" -ge "3"; then
5437			AC_MSG_RESULT([found NSIS $nsis_version_major.$nsis_version_minor >= 3.*])
5438			AC_MSG_CHECKING([whether NSIS was compiled with Unicode support])
5439			if echo `"$NSIS_PATH/makensis.exe" /HDRINFO` | $EGREP  "\bNSIS_UNICODE_MAKENSIS\b" 2>&1 >/dev/null; then
5440				AC_MSG_RESULT([NSIS version compiled with Unicode support.])
5441			else
5442				NSIS_PATH=""
5443				AC_MSG_WARN([NSIS version compiled without Unicode support, no self contained installer will be build.])
5444			fi
5445		else
5446			NSIS_PATH=""
5447			AC_MSG_WARN([NSIS version found is < 3.*, no self contained installer will be build.])
5448		fi
5449    fi
5450fi
5451AC_SUBST(NSIS_PATH)
5452
5453dnl ***************************************
5454dnl testing bison and flex exist
5455dnl ***************************************
5456AC_PATH_PROG(BISON, bison)
5457if test -z "$BISON"; then
5458   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5459else
5460   AC_MSG_CHECKING([the bison version])
5461   _bison_version=`$BISON --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5462    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5463    # Accept newer than 1.875 or older(equal) than 1.75
5464    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5465       if test "$_bison_version" = "1.875" ; then
5466          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5467          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5468       else
5469          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5470       fi
5471    else
5472       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5473    fi
5474fi
5475AC_PATH_PROG(FLEX, flex)
5476if test -z "$FLEX"; then
5477   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5478fi
5479dnl ***************************************
5480dnl testing that patch exists
5481dnl ***************************************
5482AC_PATH_PROG(PATCH, patch)
5483if test -z "$PATCH"; then
5484   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5485fi
5486
5487dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5488if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5489   if test -z "$with_gnu_patch"; then
5490      GNUPATCH=$PATCH
5491   else
5492      if test -x "$with_gnu_patch"; then
5493	      GNUPATCH=$with_gnu_patch
5494      else
5495         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5496      fi
5497   fi
5498
5499   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5500   if $GNUPATCH --version | $GREP "Free Software Foundation" >/dev/null 2>/dev/null; then
5501	   AC_MSG_RESULT([yes])
5502   else
5503      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5504   fi
5505fi
5506
5507dnl We also need to check for --with-gnu-cp
5508
5509if test -z "$with_gnu_cp"; then
5510   # check the place where the GNU stuff is hidden on Solaris...
5511   if test -x /usr/gnu/bin/cp; then
5512      GNUCP=/usr/gnu/bin/cp
5513   else
5514      AC_PATH_PROGS(GNUCP, gnucp cp)
5515   fi
5516   if test -z $GNUCP; then
5517      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5518   fi
5519else
5520   if test -x "$with_gnu_cp"; then
5521      GNUCP=$with_gnu_cp
5522   else
5523      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5524   fi
5525fi
5526
5527AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5528if $GNUCP --version 2>/dev/null | $GREP "coreutils" >/dev/null 2>/dev/null; then
5529   AC_MSG_RESULT([yes])
5530else
5531   AC_MSG_RESULT([no])
5532   GNUCP=''
5533fi
5534
5535if test -z "$GNUCP"; then
5536   if test "$_os" = "SunOS"; then
5537      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5538   else
5539      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5540   fi
5541fi
5542
5543AC_SUBST(GNUPATCH)
5544AC_SUBST(GNUCP)
5545
5546dnl ***************************************
5547dnl testing bash tools path on Windows
5548dnl ***************************************
5549if test "$_os" = "WINNT"; then
5550    CYGWIN_PATH=""
5551    AC_PATH_PROG(CYGWIN_PATH, bash)
5552    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5553fi
5554if test -z "$CYGWIN_PATH"; then
5555   CYGWIN_PATH="NO_CYGWIN"
5556fi
5557AC_SUBST(CYGWIN_PATH)
5558
5559dnl ***************************************
5560dnl testing ml.exe assembler path
5561dnl ***************************************
5562if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5563  AC_MSG_CHECKING([ml.exe assembler path])
5564  if test -n "$with_asm_home"; then
5565    with_asm_home=`cygpath -u "$with_asm_home"`
5566  fi
5567  if test ! -x "$with_asm_home/ml.exe"; then
5568    AC_PATH_PROG(ML_EXE, ml.exe)
5569    if test -z "$ML_EXE"; then
5570      if test -x "$with_cl_home/bin/ml.exe"; then
5571        with_asm_home=$with_cl_home/bin
5572        AC_MSG_RESULT([found ($with_asm_home)])
5573      else
5574        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5575      fi
5576    else
5577       with_asm_home="ASM_IN_PATH"
5578    fi
5579  fi
5580  AC_MSG_RESULT([$ASM_HOME])
5581else
5582  with_asm_home="NO_ASM_HOME"
5583fi
5584ASM_HOME="$with_asm_home"
5585AC_SUBST(ASM_HOME)
5586
5587dnl ***************************************
5588dnl testing nasm.exe assembler path
5589dnl ***************************************
5590if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes" -a "$SYSTEM_OPENSSL" = "NO"; then
5591  AC_MSG_CHECKING([nasm.exe assembler path])
5592  if test -n "$with_nasm_home"; then
5593    with_nasm_home=`cygpath -u "$with_nasm_home"`
5594  fi
5595  if test ! -x "$with_nasm_home/nasm.exe"; then
5596    AC_PATH_PROG(NASM_EXE, nasm.exe)
5597    if test -z "$NASM_EXE"; then
5598      with_nasm_home="NO_NASM_HOME"
5599    else
5600      with_nasm_home="NASM_IN_PATH"
5601    fi
5602  fi
5603  AC_MSG_RESULT([$NASM_HOME])
5604else
5605  with_nasm_home="NO_NASM_HOME"
5606fi
5607NASM_HOME="$with_nasm_home"
5608AC_SUBST(NASM_HOME)
5609
5610dnl ===================================================================
5611dnl testing handle deprecated unzip switch
5612dnl ===================================================================
5613if test -z "$with_zip_home"; then
5614	with_zip_home="$with_unzip_home"
5615fi
5616dnl ===================================================================
5617dnl Zip will be found where you tell me to find it
5618dnl ===================================================================
5619if test -n "$with_zip_home" ; then
5620    if test "$_os" = "WINNT"; then
5621        with_zip_home=`cygpath -u "$with_zip_home"`
5622    fi
5623    ZIP="$with_zip_home/zip"
5624    UNZIP="$with_zip_home/unzip"
5625    ZIP_HOME="$with_zip_home"
5626else
5627    AC_PATH_PROG(ZIP, zip)
5628    AC_PATH_PROG(UNZIP, unzip)
5629    ZIP_HOME=`dirname "$ZIP"`
5630fi
5631dnl ===================================================================
5632dnl Zip must be available or else it is an error, all platforms
5633dnl ===================================================================
5634if test -z "$ZIP" -o -z "$UNZIP"; then
5635    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5636fi
5637if "$ZIP" -FS < /dev/null 2>&1 | $EGREP "no such option: S" > /dev/null; then
5638    AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
5639fi
5640
5641dnl ===================================================================
5642dnl Zip must be a specific type for different build types.
5643dnl ===================================================================
5644if test "$_os" = "WINNT"; then
5645    if test -n "`$ZIP -h | $GREP -i WinNT`" ; then
5646AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5647    fi
5648fi
5649AC_SUBST(ZIP_HOME)
5650
5651dnl ===================================================================
5652dnl Windows builds need dbghelp.dll in external/dbghelp/
5653dnl ===================================================================
5654if test "$_os" = "WINNT"; then
5655   AC_MSG_CHECKING([for dbghelp.dll])
5656   if test -x ./external/dbghelp/dbghelp.dll; then
5657      AC_MSG_RESULT([found and executable])
5658   else
5659      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5660Get it from the Microsoft site and put it into external/dbghelp.
5661(Note: Microsoft seems to enjoy changing the exact location of this file. You
5662may have to search Microsoft's website.) Last time it was seen at:
5663<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5664   fi
5665fi
5666
5667dnl ===================================================================
5668dnl Windows builds need vcredist_x*.exe in external/vcredist/
5669dnl ===================================================================
5670WITH_VC_REDIST=""
5671
5672if test "$_os" = "WINNT"; then
5673   AC_MSG_CHECKING([for vcredist_x86.exe])
5674   if test -x ./external/vcredist/vcredist_x86.exe; then
5675      AC_MSG_RESULT([found and executable])
5676   else
5677      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
5678Get it from the Microsoft site and put it into external/vcredist. You can try
5679to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5680   fi
5681   AC_MSG_CHECKING([for vcredist_x64.exe])
5682   if test -x ./external/vcredist/vcredist_x64.exe; then
5683      AC_MSG_RESULT([found and executable])
5684   else
5685      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
5686Get it from the Microsoft site and put it into external/vcredist. You can try
5687to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5688   fi
5689   WITH_VC_REDIST=YES
5690   AC_SUBST(WITH_VC_REDIST)
5691fi
5692
5693dnl ===================================================================
5694dnl Windows builds - use oowintool to copy CRT dlls and manifest
5695dnl ===================================================================
5696if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5697       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5698          :
5699       else
5700          AC_MSG_ERROR([oowintool failed to copy CRT])
5701       fi
5702fi
5703
5704dnl ===================================================================
5705dnl Windows builds need gdiplus.dll in external/gdiplus/
5706dnl ===================================================================
5707if test "$_os" = "WINNT"; then
5708   AC_MSG_CHECKING([for gdiplus.dll])
5709   if test -x ./external/gdiplus/gdiplus.dll; then
5710      AC_MSG_RESULT([found and executable])
5711   else
5712      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5713Get it from the Microsoft site and put it into external/gdiplus.
5714You may have to search Microsoft's website. Last time it was seen at:
5715<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5716   fi
5717fi
5718
5719dnl ===================================================================
5720dnl Windows builds need msvcr100.dll in external/msvcp100/
5721dnl ===================================================================
5722if test "$_os" = "WINNT"; then
5723   AC_MSG_CHECKING([for msvcr100.dll])
5724   if test -x ./external/msvcp100/msvcr100.dll; then
5725      AC_MSG_RESULT([found and executable])
5726   else
5727      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
5728Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
5729from the Microsoft site and put it into external/msvcp100.
5730You may have to search Microsoft's website. Last time it was seen at:
5731<http://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
5732   fi
5733fi
5734
5735dnl ===================================================================
5736dnl Test which vclplugs have to be built.
5737dnl ===================================================================
5738AC_MSG_CHECKING([which VCLplugs shall be built])
5739ENABLE_GTK=""
5740if test "x$enable_gtk" = "xyes"; then
5741    ENABLE_GTK="TRUE"
5742    R="gtk"
5743fi
5744AC_SUBST(ENABLE_GTK)
5745
5746ENABLE_KDE=""
5747if test "x$enable_kde" = "xyes"; then
5748    ENABLE_KDE="TRUE"
5749    R="$R kde"
5750fi
5751AC_SUBST(ENABLE_KDE)
5752
5753ENABLE_KDE4=""
5754if test "x$enable_kde4" = "xyes"; then
5755    ENABLE_KDE4="TRUE"
5756    R="$R kde4"
5757fi
5758AC_SUBST(ENABLE_KDE4)
5759
5760if test -z "$R"; then
5761	AC_MSG_RESULT([none])
5762else
5763	AC_MSG_RESULT([$R])
5764fi
5765
5766dnl ===================================================================
5767dnl GCONF check
5768dnl ===================================================================
5769
5770ENABLE_GCONF=""
5771AC_MSG_CHECKING([whether to enable GConf support])
5772if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5773    ENABLE_GCONF="TRUE"
5774    AC_MSG_RESULT([yes])
5775    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5776else
5777    AC_MSG_RESULT([no])
5778fi
5779AC_SUBST(ENABLE_GCONF)
5780
5781dnl ===================================================================
5782dnl Gnome VFS check
5783dnl ===================================================================
5784
5785ENABLE_GNOMEVFS=""
5786AC_MSG_CHECKING([whether to enable GNOME VFS support])
5787if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5788    ENABLE_GNOMEVFS="TRUE"
5789    AC_MSG_RESULT([yes])
5790    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5791    if test "$ENABLE_GCONF" != "TRUE"; then
5792        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5793    fi
5794else
5795    AC_MSG_RESULT([no])
5796fi
5797AC_SUBST(ENABLE_GNOMEVFS)
5798
5799dnl ===================================================================
5800dnl Check whether the gtk 2.0 libraries are available.
5801dnl ===================================================================
5802
5803GTK_CFLAGS=""
5804GTK_LIBS=""
5805ENABLE_SYSTRAY_GTK=""
5806ENABLE_DBUS=""
5807if test  "$test_gtk" = "yes"; then
5808
5809   if test "$ENABLE_GTK" = "TRUE" ; then
5810      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]))
5811      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]))
5812      BUILD_TYPE="$BUILD_TYPE GTK"
5813
5814      if test "x$enable_systray" = "xyes"; then
5815         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
5816                           [ENABLE_SYSTRAY_GTK="TRUE"
5817                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
5818                           [ENABLE_SYSTRAY_GTK=""])
5819      fi
5820
5821      AC_MSG_CHECKING([whether to enable DBUS support])
5822      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5823          ENABLE_DBUS="TRUE"
5824          AC_MSG_RESULT([yes])
5825          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5826      else
5827          AC_MSG_RESULT([no])
5828      fi
5829
5830      AC_MSG_CHECKING([whether to enable GIO support])
5831      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5832          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5833             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5834          fi
5835          ENABLE_GIO="TRUE"
5836          AC_MSG_RESULT([yes])
5837          PKG_CHECK_MODULES( GIO, gio-2.0 )
5838      else
5839          AC_MSG_RESULT([no])
5840      fi
5841
5842   fi
5843
5844fi
5845AC_SUBST(ENABLE_GIO)
5846AC_SUBST(ENABLE_DBUS)
5847AC_SUBST(ENABLE_SYSTRAY_GTK)
5848AC_SUBST(GTK_CFLAGS)
5849AC_SUBST(GTK_LIBS)
5850AC_SUBST(GTHREAD_CFLAGS)
5851AC_SUBST(GTHREAD_LIBS)
5852
5853dnl ===================================================================
5854dnl Check whether the GStreamer libraries are available.
5855dnl ===================================================================
5856
5857GSTREAMER_CFLAGS=""
5858GSTREAMER_LIBS=""
5859ENABLE_GSTREAMER=""
5860
5861if test "$test_gstreamer" = "yes"; then
5862    AC_MSG_CHECKING([whether to build the GStreamer media backend])
5863    if test "x$enable_gstreamer" != "xno" ; then
5864        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]))
5865        ENABLE_GSTREAMER="TRUE"
5866        AC_MSG_RESULT([yes])
5867    else
5868        AC_MSG_RESULT([no])
5869    fi
5870fi
5871AC_SUBST(ENABLE_GSTREAMER)
5872AC_SUBST(GSTREAMER_CFLAGS)
5873AC_SUBST(GSTREAMER_LIBS)
5874
5875dnl ===================================================================
5876dnl Check the ARM target
5877dnl ===================================================================
5878
5879if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
5880    # default value
5881    ARM_TARGET=ARMV4T
5882    AC_MSG_CHECKING([which ARM processor optimization to use])
5883    if test "$with_arm_target" -lt "6"; then
5884	ARM_TARGET=ARMV4T
5885    elif test "$with_arm_target" = "6"; then
5886	ARM_TARGET=ARMV6
5887    elif test "$with_arm_target" -gt "6"; then
5888	ARM_TARGET=ARMV7
5889    fi
5890    AC_MSG_RESULT([$ARM_TARGET])
5891    AC_SUBST(ARM_TARGET)
5892fi
5893
5894dnl ===================================================================
5895dnl Check whether the Cairo libraries are available.
5896dnl ===================================================================
5897
5898ENABLE_CAIRO=""
5899BUILD_PIXMAN=""
5900SYSTEM_CAIRO=""
5901
5902if test  "$test_cairo" = "yes"; then
5903
5904    AC_MSG_CHECKING([whether to use cairo])
5905    if test "x$enable_cairo" != "xno" ; then
5906        ENABLE_CAIRO="TRUE"
5907	AC_MSG_RESULT([yes])
5908        AC_MSG_CHECKING([which cairo to use])
5909        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
5910           test "$with_system_cairo" != "no"; then
5911           AC_MSG_RESULT([external])
5912           SYSTEM_CAIRO=YES
5913
5914           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
5915	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
5916	      AC_MSG_ERROR([Cairo library requires fontconfig.])
5917	   fi
5918           if test "$with_system_xrender_headers" = "yes"; then
5919              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
5920              AC_TRY_RUN([
5921#include <X11/extensions/Xrender.h>
5922
5923int main(int argc, char **argv) {
5924#ifdef PictStandardA8
5925      return 0;
5926#else
5927      return 1;
5928#endif
5929}
5930               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
5931           fi
5932        else
5933           BUILD_TYPE="$BUILD_TYPE CAIRO"
5934	   dnl === compiler fails on pixman with 64bit architectures...===
5935	   if test "$build_cpu" != "x86_64"; then
5936	      BUILD_PIXMAN=YES
5937	   fi
5938           AC_MSG_RESULT([internal])
5939        fi
5940    else
5941	   AC_MSG_RESULT([no])
5942    fi
5943fi
5944
5945AC_SUBST(ENABLE_CAIRO)
5946AC_SUBST(BUILD_PIXMAN)
5947AC_SUBST(SYSTEM_CAIRO)
5948AC_SUBST(CAIRO_CFLAGS)
5949AC_SUBST(CAIRO_LIBS)
5950
5951ENABLE_CAIRO_CANVAS="FALSE"
5952if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
5953   ENABLE_CAIRO_CANVAS="TRUE"
5954fi
5955AC_SUBST(ENABLE_CAIRO_CANVAS)
5956
5957dnl ===================================================================
5958dnl Check whether the OpenGL libraries are available
5959dnl ===================================================================
5960
5961AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
5962ENABLE_OPENGL=
5963
5964if test "x$enable_opengl" != "xno" ; then
5965   AC_MSG_RESULT([yes])
5966   AC_CHECK_HEADER(GL/gl.h, [],
5967                   [AC_MSG_ERROR([OpenGL headers not found])], [])
5968   AC_CHECK_LIB(GL, main, [],
5969     [AC_MSG_ERROR(libGL not installed or functional)], [])
5970   AC_CHECK_LIB(GLU, main, [],
5971     [AC_MSG_ERROR(libGLU not installed or functional)], [])
5972   ENABLE_OPENGL=TRUE
5973else
5974   AC_MSG_RESULT([no])
5975fi
5976
5977AC_SUBST(ENABLE_OPENGL)
5978
5979
5980AC_MSG_CHECKING([whether to build the PDF Import extension])
5981if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
5982  AC_MSG_RESULT([yes])
5983  ENABLE_PDFIMPORT=YES
5984
5985  dnl ===================================================================
5986  dnl Check for system poppler
5987  dnl ===================================================================
5988  AC_MSG_CHECKING([whether to use system pdf backend])
5989  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
5990       test "$with_system_poppler" != "no"; then
5991      AC_MSG_RESULT([external])
5992      SYSTEM_POPPLER=YES
5993      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
5994  else
5995      AC_MSG_RESULT([no])
5996      SYSTEM_POPPLER=NO
5997      ENABLE_PDFIMPORT=NO
5998  fi
5999else
6000   AC_MSG_RESULT([no])
6001   ENABLE_PDFIMPORT=NO
6002fi
6003AC_SUBST(ENABLE_PDFIMPORT)
6004AC_SUBST(SYSTEM_POPPLER)
6005AC_SUBST(POPPLER_CFLAGS)
6006AC_SUBST(POPPLER_LIBS)
6007
6008AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6009if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6010  AC_MSG_RESULT([yes])
6011  AC_MSG_CHECKING([for swext module])
6012  if test -d ./swext; then
6013   AC_MSG_RESULT([OK])
6014  else
6015   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6016  fi
6017  ENABLE_MEDIAWIKI=YES
6018  BUILD_TYPE="$BUILD_TYPE SWEXT"
6019else
6020  AC_MSG_RESULT([no])
6021  ENABLE_MEDIAWIKI=NO
6022fi
6023AC_SUBST(ENABLE_MEDIAWIKI)
6024
6025if test "$ENABLE_MEDIAWIKI" = "YES"; then
6026  AC_MSG_CHECKING([which Servlet API Jar to use])
6027  if test -n "$with_system_servlet_api"; then
6028    AC_MSG_RESULT([external])
6029    SYSTEM_SERVLETAPI=YES
6030      if test -z "$SERVLETAPI_JAR"; then
6031	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6032      fi
6033      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6034             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6035  else
6036    AC_MSG_RESULT([internal])
6037    SYSTEM_SERVLETAPI=NO
6038    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6039  fi
6040fi
6041AC_SUBST(SYSTEM_SERVLETAPI)
6042AC_SUBST(SERVLETAPI_JAR)
6043
6044AC_MSG_CHECKING([whether to build the Report Builder extension])
6045if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6046  AC_MSG_RESULT([yes])
6047  ENABLE_REPORTBUILDER=YES
6048  SYSTEM_JFREEREPORT=YES
6049  AC_MSG_CHECKING([for reportbuilder module])
6050  if test -d ./reportbuilder; then
6051    AC_MSG_RESULT([OK])
6052  else
6053    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6054  fi
6055  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6056  AC_MSG_RESULT([external])
6057  if test -z $SAC_JAR; then
6058         SAC_JAR=/usr/share/java/sac.jar
6059  fi
6060  AC_CHECK_FILE($SAC_JAR, [],
6061         [AC_MSG_ERROR(sac.jar not found.)], [])
6062
6063  if test -z $LIBXML_JAR; then
6064    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6065      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6066      [
6067        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6068          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6069          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6070        )
6071      ]
6072    )
6073  else
6074    AC_CHECK_FILE($LIBXML_JAR, [],
6075         [AC_MSG_ERROR(libxml.jar not found.)], [])
6076  fi
6077
6078  if test -z $FLUTE_JAR; then
6079    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6080      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6081      [
6082        AC_CHECK_FILE(/usr/share/java/flute.jar,
6083          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6084          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6085        )
6086      ]
6087    )
6088  else
6089    AC_CHECK_FILE($FLUTE_JAR, [],
6090         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6091  fi
6092
6093  if test -z $JFREEREPORT_JAR; then
6094    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6095      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6096      [
6097        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6098          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6099          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6100        )
6101      ]
6102    )
6103  else
6104    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6105         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6106  fi
6107
6108  if test -z $LIBLAYOUT_JAR; then
6109    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6110      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6111      [
6112        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6113          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6114          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6115        )
6116      ]
6117    )
6118  else
6119    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6120         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6121  fi
6122
6123  if test -z $LIBLOADER_JAR; then
6124    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6125      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6126      [
6127        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6128          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6129          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6130        )
6131      ]
6132    )
6133  else
6134    AC_CHECK_FILE($LIBLOADER_JAR, [],
6135         [AC_MSG_ERROR(libloader.jar not found.)], [])
6136  fi
6137
6138  if test -z $LIBFORMULA_JAR; then
6139    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6140      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6141      [
6142        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6143          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6144          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6145        )
6146      ]
6147    )
6148  else
6149    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6150         [AC_MSG_ERROR(libformula.jar not found.)], [])
6151  fi
6152
6153  if test -z $LIBREPOSITORY_JAR; then
6154    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6155      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6156      [
6157        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6158          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6159          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6160        )
6161      ]
6162    )
6163  else
6164    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6165         [AC_MSG_ERROR(librepository.jar not found.)], [])
6166  fi
6167
6168  if test -z $LIBFONTS_JAR; then
6169    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6170      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6171      [
6172        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6173          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6174          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6175        )
6176      ]
6177    )
6178  else
6179    AC_CHECK_FILE($LIBFONTS_JAR, [],
6180         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6181  fi
6182
6183  if test -z $LIBSERIALIZER_JAR; then
6184    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6185      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6186      [
6187        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6188          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6189          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6190        )
6191      ]
6192    )
6193  else
6194    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6195         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6196  fi
6197
6198
6199  if test -z $LIBBASE_JAR; then
6200    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6201      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6202      [
6203        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6204          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6205          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6206        )
6207      ]
6208    )
6209  else
6210    AC_CHECK_FILE($LIBBASE_JAR, [],
6211         [AC_MSG_ERROR(libbase.jar not found.)], [])
6212  fi
6213  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6214else
6215  AC_MSG_RESULT([no])
6216  ENABLE_REPORTBUILDER=NO
6217fi
6218AC_SUBST(ENABLE_REPORTBUILDER)
6219AC_SUBST(SYSTEM_JFREEREPORT)
6220AC_SUBST(SAC_JAR)
6221AC_SUBST(LIBXML_JAR)
6222AC_SUBST(FLUTE_JAR)
6223AC_SUBST(JFREEREPORT_JAR)
6224AC_SUBST(LIBBASE_JAR)
6225AC_SUBST(LIBLAYOUT_JAR)
6226AC_SUBST(LIBLOADER_JAR)
6227AC_SUBST(LIBFORMULA_JAR)
6228AC_SUBST(LIBREPOSITORY_JAR)
6229AC_SUBST(LIBFONTS_JAR)
6230AC_SUBST(LIBSERIALIZER_JAR)
6231
6232# this has to be here because both the wiki publisher and the SRB use
6233# commons-logging
6234if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6235  AC_MSG_CHECKING([which Apache commons-* libs to use])
6236  if test "$with_system_apache_commons" = "yes"; then
6237    SYSTEM_APACHE_COMMONS=YES
6238    AC_MSG_RESULT([external])
6239    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6240      if test -z $COMMONS_CODEC_JAR; then
6241        AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
6242          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
6243          [
6244            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6245              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6246              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6247            )
6248          ]
6249        )
6250      else
6251        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6252             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6253      fi
6254
6255      if test -z $COMMONS_LANG_JAR; then
6256        AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
6257          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
6258          [
6259            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6260              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6261              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6262            )
6263          ]
6264        )
6265      else
6266        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6267             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6268      fi
6269
6270      if test -z $COMMONS_HTTPCLIENT_JAR; then
6271        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6272          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6273          [
6274            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6275              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6276              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6277            )
6278          ]
6279        )
6280      else
6281        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6282             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6283      fi
6284    fi
6285    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6286      if test -z $COMMONS_LOGGING_JAR; then
6287        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
6288          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
6289          [
6290            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6291              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6292              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6293            )
6294          ]
6295        )
6296      else
6297        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6298             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6299      fi
6300    fi
6301  else
6302    AC_MSG_RESULT([internal])
6303    SYSTEM_APACHE_COMMONS=NO
6304    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6305  fi
6306fi
6307AC_SUBST(SYSTEM_APACHE_COMMONS)
6308AC_SUBST(COMMONS_CODEC_JAR)
6309AC_SUBST(COMMONS_LANG_JAR)
6310AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6311AC_SUBST(COMMONS_LOGGING_JAR)
6312
6313dnl ===================================================================
6314dnl Check whether the Qt and KDE libraries are available.
6315dnl ===================================================================
6316
6317KDE_CFLAGS=""
6318KDE_LIBS=""
6319MOC="moc"
6320if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6321    dnl Search paths for Qt and KDE
6322    if test "$build_cpu" != "x86_64" ; then
6323        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"
6324        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"
6325    else
6326        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"
6327        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"
6328    fi
6329    if test -n "$QTDIR" ; then
6330        qt_incdirs="$QTDIR/include $qt_incdirs"
6331        if test "$build_cpu" != "x86_64" ; then
6332            qt_libdirs="$QTDIR/lib $qt_libdirs"
6333        else
6334            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6335        fi
6336    fi
6337    if test "$build_cpu" != "x86_64" ; then
6338        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"
6339        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"
6340    else
6341        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"
6342        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"
6343    fi
6344    if test -n "$KDEDIR" ; then
6345        kde_incdirs="$KDEDIR/include $kde_incdirs"
6346        if test "$build_cpu" != "x86_64" ; then
6347            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6348        else
6349            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6350        fi
6351    fi
6352
6353    dnl What to test
6354    qt_test_include="qstyle.h"
6355    qt_test_library="libqt-mt.so"
6356    kde_test_include="ksharedptr.h"
6357    kde_test_library="libkdeui.so"
6358
6359    dnl Check for Qt headers
6360    AC_MSG_CHECKING([for Qt headers])
6361    qt_incdir="no"
6362    for kde_check in $qt_incdirs ; do
6363        if test -r "$kde_check/$qt_test_include" ; then
6364            qt_incdir="$kde_check"
6365            break
6366        fi
6367    done
6368    AC_MSG_RESULT([$qt_incdir])
6369    if test "x$qt_incdir" = "xno" ; then
6370        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6371your Qt installation by exporting QTDIR before running "configure".])
6372    fi
6373
6374    dnl Check for Qt libraries
6375    AC_MSG_CHECKING([for Qt libraries])
6376    qt_libdir="no"
6377    for qt_check in $qt_libdirs ; do
6378        if test -r "$qt_check/$qt_test_library" ; then
6379            qt_libdir="$qt_check"
6380            break
6381        fi
6382    done
6383    AC_MSG_RESULT([$qt_libdir])
6384    if test "x$qt_libdir" = "xno" ; then
6385        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6386your Qt installation by exporting QTDIR before running "configure".])
6387    fi
6388
6389    dnl Check for Meta Object Compiler
6390    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6391    if test "$MOC" = "no" ; then
6392        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6393the root of your Qt installation by exporting QTDIR before running "configure".])
6394    fi
6395
6396    dnl Check for KDE headers
6397    AC_MSG_CHECKING([for KDE headers])
6398    kde_incdir="no"
6399    for kde_check in $kde_incdirs ; do
6400        if test -r "$kde_check/$kde_test_include" ; then
6401            kde_incdir="$kde_check"
6402            break
6403        fi
6404    done
6405    AC_MSG_RESULT([$kde_incdir])
6406    if test "x$kde_incdir" = "xno" ; then
6407        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6408your KDE installation by exporting KDEDIR before running "configure".])
6409    fi
6410
6411    dnl Check for KDE libraries
6412    AC_MSG_CHECKING([for KDE libraries])
6413    kde_libdir="no"
6414    for kde_check in $kde_libdirs ; do
6415        if test -r "$kde_check/$kde_test_library" ; then
6416            kde_libdir="$kde_check"
6417            break
6418        fi
6419    done
6420    AC_MSG_RESULT([$kde_libdir])
6421    if test "x$kde_libdir" = "xno" ; then
6422        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6423your KDE installation by exporting KDEDIR before running "configure".])
6424    fi
6425
6426    dnl Set the variables
6427    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6428    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6429fi
6430AC_SUBST(KDE_CFLAGS)
6431AC_SUBST(KDE_LIBS)
6432AC_SUBST(MOC)
6433
6434dnl ===================================================================
6435dnl KDE4 Integration
6436dnl ===================================================================
6437
6438KDE4_CFLAGS=""
6439KDE4_LIBS=""
6440MOC4="moc"
6441if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6442   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6443   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6444
6445   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6446   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6447
6448   if test "$build_cpu" = "x86_64" ; then
6449      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6450      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6451   fi
6452
6453   if test -n "$KDE4DIR" ; then
6454      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6455      if test "$build_cpu" != "x86_64" ; then
6456         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6457      else
6458         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6459      fi
6460   fi
6461
6462   qt_test_include="Qt/qobject.h"
6463   qt_test_library="libQtCore.so"
6464   kde_test_include="ksharedptr.h"
6465   kde_test_library="libkdeui.so"
6466
6467   AC_MSG_CHECKING([for Qt4 headers])
6468   qt_header_dir="no"
6469   for inc_dir in $qt_incdirs ; do
6470      if test -r "$inc_dir/$qt_test_include" ; then
6471         qt_header_dir="$inc_dir"
6472         break
6473      fi
6474   done
6475
6476   AC_MSG_RESULT([$qt_header_dir])
6477   if test "x$qt_header_dir" = "xno" ; then
6478      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6479   fi
6480
6481   AC_MSG_CHECKING([for Qt4 libraries])
6482   qt_lib_dir="no"
6483   for lib_dir in $qt_libdirs ; do
6484      if test -r "$lib_dir/$qt_test_library" ; then
6485         qt_lib_dir="$lib_dir"
6486         break
6487      fi
6488   done
6489
6490   AC_MSG_RESULT([$qt_lib_dir])
6491
6492   if test "x$qt_lib_dir" = "xno" ; then
6493      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6494   fi
6495
6496   dnl Check for Meta Object Compiler
6497   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6498   MOC4="$MOCQT4"
6499   if test "$MOC4" = "no" ; then
6500      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6501      if test "$MOC4" = "no" ; then
6502         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6503      fi
6504   fi
6505
6506   dnl Check for KDE4 headers
6507   AC_MSG_CHECKING([for KDE4 headers])
6508   kde_incdir="no"
6509   for kde_check in $kde_incdirs ; do
6510      if test -r "$kde_check/$kde_test_include" ; then
6511         kde_incdir="$kde_check"
6512         break
6513      fi
6514   done
6515   AC_MSG_RESULT([$kde_incdir])
6516   if test "x$kde_incdir" = "xno" ; then
6517      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6518   fi
6519
6520   dnl Check for KDE4 libraries
6521   AC_MSG_CHECKING([for KDE4 libraries])
6522   kde_libdir="no"
6523   for kde_check in $kde_libdirs ; do
6524      if test -r "$kde_check/$kde_test_library" ; then
6525         kde_libdir="$kde_check"
6526         break
6527      fi
6528   done
6529
6530   AC_MSG_RESULT([$kde_libdir])
6531   if test "x$kde_libdir" = "xno" ; then
6532      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6533   fi
6534
6535   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6536   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6537fi
6538AC_SUBST(KDE4_CFLAGS)
6539AC_SUBST(KDE4_LIBS)
6540AC_SUBST(MOC4)
6541
6542dnl ===================================================================
6543dnl Test for the enabling the lockdown pieces
6544dnl ===================================================================
6545AC_MSG_CHECKING([whether to enable the lockdown pieces])
6546ENABLE_LOCKDOWN=""
6547if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6548  ENABLE_LOCKDOWN=YES
6549  AC_MSG_RESULT([yes])
6550else
6551  AC_MSG_RESULT([no])
6552fi
6553AC_SUBST(ENABLE_LOCKDOWN)
6554
6555dnl ===================================================================
6556dnl Test whether to include Evolution 2 support
6557dnl ===================================================================
6558AC_MSG_CHECKING([whether to enable evolution 2 support])
6559if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6560   AC_MSG_RESULT([yes])
6561   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6562   ENABLE_EVOAB2="TRUE"
6563else
6564   ENABLE_EVOAB2=""
6565   AC_MSG_RESULT([no])
6566fi
6567AC_SUBST(ENABLE_EVOAB2)
6568AC_SUBST(GOBJECT_CFLAGS)
6569AC_SUBST(GOBJECT_LIBS)
6570
6571dnl ===================================================================
6572dnl Test whether to include KDE AB support
6573dnl ===================================================================
6574AC_MSG_CHECKING([whether to enable KDE address book support])
6575if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6576   AC_MSG_RESULT([yes])
6577   AC_LANG_PUSH([C++])
6578   save_CXXFLAGS=$CXXFLAGS
6579   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6580   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6581       AC_TRY_RUN([
6582#include <kdeversion.h>
6583
6584int main(int argc, char **argv) {
6585       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6586       else return 1;
6587}
6588       ], [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])])
6589   CXXFLAGS=$save_CXXFLAGS
6590   AC_LANG_POP([C++])
6591   ENABLE_KAB=TRUE
6592else
6593   AC_MSG_RESULT([no])
6594   ENABLE_KAB=
6595fi
6596AC_SUBST(ENABLE_KAB)
6597
6598dnl ===================================================================
6599dnl Test whether to include MathMLDTD
6600dnl ===================================================================
6601AC_MSG_CHECKING([whether to include MathMLDTD])
6602if test -n "$enable_mathmldtd"; then
6603  if test "$enable_mathmldtd" = "no"; then
6604    AC_MSG_RESULT([no])
6605    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6606  else
6607    AC_MSG_RESULT([yes])
6608    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6609  fi
6610else
6611  AC_MSG_RESULT([no])
6612  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6613fi
6614
6615dnl ===================================================================
6616dnl Test whether to include category-B fonts
6617dnl ===================================================================
6618WITH_CATB_FONTS=
6619AC_MSG_CHECKING([whether to include category B fonts])
6620if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
6621   AC_MSG_RESULT([yes])
6622   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
6623   WITH_CATB_FONTS=YES
6624   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
6625else
6626   AC_MSG_RESULT([no])
6627   WITH_CATB_FONTS=NO
6628fi
6629
6630dnl ===================================================================
6631dnl Test whether to include category-A fonts
6632dnl ===================================================================
6633WITH_CATA_FONTS=
6634AC_MSG_CHECKING([whether to include category A fonts])
6635if test "x$with_fonts" != "xno" ; then
6636  AC_MSG_RESULT([yes])
6637  WITH_CATA_FONTS=YES
6638  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
6639else
6640  AC_MSG_RESULT([no])
6641  WITH_CATA_FONTS=NO
6642  WITH_CATB_FONTS=NO
6643fi
6644
6645WITH_FONTS=NO
6646AC_MSG_CHECKING([whether any fonts are included])
6647if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
6648  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6649  WITH_FONTS=YES
6650  AC_MSG_RESULT([yes])
6651else
6652  AC_MSG_RESULT([no])
6653fi
6654
6655AC_SUBST(WITH_CATA_FONTS)
6656AC_SUBST(WITH_CATB_FONTS)
6657AC_SUBST(WITH_FONTS)
6658
6659dnl ===================================================================
6660dnl Test whether to include ppds
6661dnl ===================================================================
6662AC_MSG_CHECKING([whether to include PPDs])
6663if test "$with_ppds" != "no"; then
6664  AC_MSG_RESULT([yes])
6665else
6666  AC_MSG_RESULT([no])
6667  WITHOUT_PPDS=YES
6668  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6669fi
6670AC_SUBST(WITHOUT_PPDS)
6671
6672dnl ===================================================================
6673dnl Test whether to include afms
6674dnl ===================================================================
6675AC_MSG_CHECKING([whether to include AFMs])
6676if test "$with_afms" != "no"; then
6677  AC_MSG_RESULT([yes])
6678  BUILD_TYPE="$BUILD_TYPE AFMS"
6679else
6680  AC_MSG_RESULT([no])
6681  WITHOUT_AFMS=YES
6682  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6683fi
6684AC_SUBST(WITHOUT_AFMS)
6685
6686AC_SUBST(SCPDEFS)
6687
6688AC_MSG_CHECKING([whether and how to use Xinerama])
6689if test "$_os" = "Darwin"; then
6690   USE_XINERAMA=YES
6691   XINERAMA_LINK=dynamic
6692   AC_MSG_RESULT([yes])
6693elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6694   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6695      # we have both versions, let the user decide but use the dynamic one
6696      # per default
6697      USE_XINERAMA=YES
6698      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6699         XINERAMA_LINK=dynamic
6700      else
6701         XINERAMA_LINK=static
6702      fi
6703   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6704      # we have only the dynamic version
6705      USE_XINERAMA=YES
6706      XINERAMA_LINK=dynamic
6707   elif test -e "$XLIB/libXinerama.a"; then
6708      # static version
6709      if echo $build_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6710         USE_XINERAMA=YES
6711         XINERAMA_LINK=static
6712      else
6713         USE_XINERAMA=NO
6714         XINERAMA_LINK=none
6715      fi
6716   else
6717      # no Xinerama
6718      USE_XINERAMA=NO
6719      XINERAMA_LINK=none
6720   fi
6721   if test "$USE_XINERAMA" = "YES"; then
6722      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6723      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6724          [AC_MSG_ERROR(Xinerama header not found.)], [])
6725      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6726      if test "$_os" = "FreeBSD"; then
6727          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6728      fi
6729      if test "$_os" = "Linux"; then
6730          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6731      fi
6732      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6733          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6734   else
6735      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6736   fi
6737else
6738   AC_MSG_RESULT([no])
6739fi
6740AC_SUBST(USE_XINERAMA)
6741AC_SUBST(XINERAMA_LINK)
6742
6743dnl ===================================================================
6744dnl always rely on the system version of gdk-pixbuf
6745dnl ===================================================================
6746
6747SYSTEM_GDKPIXBUF=YES
6748AC_SUBST(SYSTEM_GDKPIXBUF)
6749
6750dnl ===================================================================
6751dnl always rely on the system version of glib
6752dnl ===================================================================
6753
6754SYSTEM_GLIB=YES
6755AC_SUBST(SYSTEM_GLIB)
6756
6757dnl ===================================================================
6758dnl always rely on the system version of gettext
6759dnl ===================================================================
6760
6761SYSTEM_GETTEXT=YES
6762AC_SUBST(SYSTEM_GETTEXT)
6763
6764if test "$_os" = "FreeBSD"; then
6765    LIBINTL_PREFIX=
6766    for dir in $CPPFLAGS; do
6767      if dir=`expr -- $dir : '-I\(.*\)'`; then
6768        if test -f "$dir/libintl.h" ; then
6769          LIBINTL_PREFIX=`dirname $dir`
6770        fi
6771      fi
6772    done
6773    AC_SUBST(LIBINTL_PREFIX)
6774fi
6775
6776dnl ===================================================================
6777dnl always rely on the system version of pango
6778dnl ===================================================================
6779
6780SYSTEM_PANGO=YES
6781AC_SUBST(SYSTEM_PANGO)
6782
6783dnl ===================================================================
6784dnl Test whether to build libpng or rely on the system version
6785dnl ===================================================================
6786AC_MSG_CHECKING([whether to build own version of libpng])
6787
6788case "$_os" in
6789	WINNT*) # Windows
6790	    SYSTEM_LIBPNG=NO
6791	    AC_MSG_RESULT([yes])
6792		;;
6793	Darwin*)
6794	    SYSTEM_LIBPNG=NO
6795	    AC_MSG_RESULT([yes])
6796	    ;;
6797   *)
6798   SYSTEM_LIBPNG=YES
6799   AC_MSG_RESULT([no])
6800   ;;
6801esac
6802AC_SUBST(SYSTEM_LIBPNG)
6803
6804dnl ===================================================================
6805dnl Test whether to build libjpeg or rely on the system version
6806dnl ===================================================================
6807dnl FIXME: this is currently because we have jpeg-6b for our filters
6808dnl        and jpeg-8 as dependency for librsvg
6809dnl        this should be unified into using only one version for both
6810
6811AC_MSG_CHECKING([whether to build own version of libjpeg])
6812
6813if test "$SYSTEM_JPEG" = "YES"; then
6814SYSTEM_LIBJPEG=YES
6815else
6816case "$_os" in
6817	WINNT*) # Windows
6818	    SYSTEM_LIBJPEG=NO
6819		;;
6820	Darwin*)
6821	    SYSTEM_LIBJPEG=NO
6822	    ;;
6823   *)
6824        SYSTEM_LIBJPEG=YES
6825        ;;
6826esac
6827fi
6828
6829if test "$SYSTEM_LIBJPEG" = "YES"; then
6830   AC_MSG_RESULT([no])
6831else
6832   AC_MSG_RESULT([yes])
6833fi
6834AC_SUBST(SYSTEM_LIBJPEG)
6835
6836dnl ===================================================================
6837dnl Test whether rat scan was requested and whether apache-rat is available
6838dnl ===================================================================
6839RAT_JAR=
6840AC_MSG_CHECKING([whether to trigger rat scan])
6841if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
6842    AC_MSG_RESULT([no])
6843else
6844    if test "$WITH_JAVA" = "no"; then
6845        AC_MSG_ERROR([no, java disabled, enable with --with-java])
6846    elif test "$enable_saxon" = "no"; then
6847        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
6848    elif test "$with_rat_scan" = "yes"; then
6849        AC_MSG_RESULT([yes, use pre-built library])
6850        RAT_JAR_HOME="BUILD"
6851        BUILD_TYPE="$BUILD_TYPE RAT"
6852    else
6853        AC_MSG_RESULT([yes, use pre-installed library])
6854        AC_MSG_CHECKING([whether apache-rat is available])
6855        if test -d "$with_rat_scan"; then
6856            RAT_JAR_HOME=$with_rat_scan
6857        else
6858            AC_MSG_ERROR([$with_rat_scan is not a directory])
6859        fi
6860    fi
6861fi
6862AC_SUBST(RAT_JAR_HOME)
6863
6864
6865dnl ===================================================================
6866dnl Test for the presence of Ant and that it works
6867dnl ===================================================================
6868
6869if test "$SOLAR_JAVA" != ""; then
6870ANT_HOME=; export ANT_HOME
6871WITH_ANT_HOME=; export WITH_ANT_HOME
6872if test -z "$with_ant_home"; then
6873   if test "$_os" = "OS2"; then
6874     AC_PATH_PROGS(ANT, ant.cmd)
6875   else
6876     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
6877   fi
6878else
6879   if test "$_os" = "WINNT"; then
6880      with_ant_home=`cygpath -u "$with_ant_home"`
6881   fi
6882   if test "$_os" = "OS2"; then
6883     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
6884   else
6885     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
6886   fi
6887   WITH_ANT_HOME=$with_ant_home
6888   ANT_HOME=$with_ant_home
6889fi
6890
6891if test -z "$ANT"; then
6892  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
6893else
6894  # resolve relative or absolute symlink
6895  while test -h "$ANT"; do
6896     a_cwd=`pwd`
6897     a_basename=`basename "$ANT"`
6898     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
6899     cd "`dirname "$ANT"`"
6900     cd "`dirname "$a_script"`"
6901     ANT="`pwd`"/"`basename "$a_script"`"
6902     cd "$a_cwd"
6903  done
6904
6905  if test "$_os" = "OS2"; then
6906    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
6907    export ANT_HOME
6908  fi
6909
6910  AC_MSG_CHECKING([if $ANT works])
6911cat > conftest.java << EOF
6912    public class conftest {
6913	int testmethod(int a, int b) {
6914            return a + b;
6915	}
6916    }
6917EOF
6918
6919cat > conftest.xml << EOF
6920    <project name="conftest" default="conftest">
6921	<target name="conftest">
6922            <javac srcdir="." includes="conftest.java">
6923	    </javac>
6924	</target>
6925    </project>
6926EOF
6927  oldJAVA_HOME=$JAVA_HOME
6928  if test "$JAVACISGCJ" = "yes"; then
6929    JAVA_HOME=; export JAVA_HOME
6930    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
6931  else
6932    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
6933  fi
6934  AC_TRY_EVAL(ant_cmd)
6935  if test $? = 0 && test -f ./conftest.class ; then
6936    AC_MSG_RESULT([Ant works])
6937    if test -z "$WITH_ANT_HOME"; then
6938        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
6939        if test -z "$ANT_HOME"; then
6940            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
6941        fi
6942    else
6943        ANT_HOME="$WITH_ANT_HOME"
6944    fi
6945  else
6946    echo "configure: Ant test failed" >&5
6947    cat conftest.java >&5
6948    cat conftest.xml >&5
6949    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
6950    ANT_HOME=""
6951    echo "Ant does not work - Some Java projects will not build!" >>warn
6952  fi
6953  JAVA_HOME=$oldJAVA_HOME
6954  rm -f conftest* core core.* *.core
6955fi
6956if test -z "$ANT_HOME"; then
6957   ANT_HOME="NO_ANT_HOME"
6958fi
6959AC_SUBST(ANT_HOME)
6960
6961dnl Checking for ant.jar
6962if test "$ANT_HOME" != "NO_ANT_HOME"; then
6963   AC_MSG_CHECKING([Ant lib directory])
6964   if test -f $ANT_HOME/lib/ant.jar; then
6965	  ANT_LIB="$ANT_HOME/lib"
6966   else
6967      if test -f $ANT_HOME/ant.jar; then
6968	     ANT_LIB="$ANT_HOME"
6969      else
6970          if test -f /usr/share/java/ant.jar; then
6971              ANT_LIB=/usr/share/java
6972          else
6973             if test -f /usr/share/ant-core/lib/ant.jar; then
6974                 ANT_LIB=/usr/share/ant-core/lib
6975             else
6976                if test -f $ANT_HOME/lib/ant/ant.jar; then
6977                    ANT_LIB="$ANT_HOME/lib/ant"
6978                else
6979                   if test -f /usr/share/lib/ant/ant.jar; then
6980                       ANT_LIB=/usr/share/lib/ant
6981                   else
6982                       AC_MSG_ERROR([Ant libraries not found!])
6983                   fi
6984                fi
6985             fi
6986          fi
6987      fi
6988   fi
6989   AC_MSG_RESULT([Ant lib directory found.])
6990fi
6991AC_SUBST(ANT_LIB)
6992fi
6993
6994ant_minver=1.6.0
6995# update for more extensions...
6996if test "$ENABLE_MEDIAWIKI" = "YES"; then
6997  ant_minver=1.7.0
6998fi
6999ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7000
7001AC_MSG_CHECKING([whether ant is >= $ant_minver])
7002ant_version=`$ANT -version | $AWK '{ print $4; }'`
7003ant_version_major=`echo $ant_version | cut -d. -f1`
7004ant_version_minor=`echo $ant_version | cut -d. -f2`
7005echo "configure: ant_version $ant_version " >&5
7006echo "configure: ant_version_major $ant_version_major " >&5
7007echo "configure: ant_version_minor $ant_version_minor " >&5
7008if test "$ant_version_major" -ge "2"; then
7009   AC_MSG_RESULT([yes, $ant_version])
7010elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7011   AC_MSG_RESULT([yes, $ant_version])
7012else
7013   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7014fi
7015
7016if test "$ENABLE_MEDIAWIKI" = "YES"; then
7017AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7018rm -rf confdir
7019mkdir confdir
7020cat > conftest.java << EOF
7021    public class conftest {
7022        int testmethod(int a, int b) {
7023            return a + b;
7024        }
7025    }
7026EOF
7027
7028cat > conftest.xml << EOF
7029    <project name="conftest" default="conftest">
7030        <target name="conftest" depends="copytest">
7031            <javac srcdir="." includes="conftest.java">
7032            </javac>
7033        </target>
7034        <target name="copytest">
7035             <copy todir="confdir">
7036                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7037                 <filterset/>
7038                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7039             </copy>
7040        </target>
7041    </project>
7042EOF
7043  if test "$JAVACISGCJ" = "yes"; then
7044    JAVA_HOME=; export JAVA_HOME
7045    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7046  else
7047    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7048  fi
7049  AC_TRY_EVAL(ant_cmd)
7050  if test $? = 0 && test -f ./conftest.class ; then
7051    AC_MSG_RESULT([yes])
7052    rm -rf confdir
7053  else
7054    echo "configure: Ant test failed" >&5
7055    cat conftest.java >&5
7056    cat conftest.xml >&5
7057    rm -rf confdir
7058    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7059  fi
7060fi
7061rm -f conftest* core core.* *.core
7062
7063OOO_JUNIT_JAR=
7064if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7065    AC_MSG_CHECKING([for JUnit 4])
7066    if test "$with_junit" = "yes"; then
7067        if test -e /usr/share/java/junit4.jar; then
7068            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7069        else
7070           if test -e /usr/share/lib/java/junit.jar; then
7071              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7072           else
7073              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7074           fi
7075        fi
7076    else
7077        OOO_JUNIT_JAR=$with_junit
7078    fi
7079    if test "$_os" = "WINNT"; then
7080        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7081    fi
7082    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7083        $GREP org/junit/Before.class > /dev/null 2>&5
7084    if test $? -eq 0; then
7085        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7086    else
7087        AC_MSG_RESULT([no])
7088        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7089location (/usr/share/java), specify its pathname via
7090--with-junit=..., or disable it via --without-junit])
7091    fi
7092fi
7093AC_SUBST(OOO_JUNIT_JAR)
7094
7095AC_MSG_CHECKING([which languages to be built])
7096WITH_LANG="$with_lang"
7097if test -z "$WITH_LANG"; then
7098   AC_MSG_RESULT([en-US])
7099else
7100   AC_MSG_RESULT([$WITH_LANG])
7101   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7102   BUILD_TYPE="$BUILD_TYPE L10N"
7103fi
7104AC_SUBST(WITH_LANG)
7105
7106AC_MSG_CHECKING([which languages have poor help localizations])
7107WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7108if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7109   AC_MSG_RESULT([none])
7110else
7111   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7112fi
7113AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7114
7115AC_MSG_CHECKING([which dictionaries to include])
7116if test -z "$with_dict"; then
7117   WITH_DICT=,ALL,
7118   AC_MSG_RESULT([ALL])
7119else
7120   WITH_DICT=","$with_dict","
7121   AC_MSG_RESULT([$with_dict])
7122fi
7123AC_SUBST(WITH_DICT)
7124
7125AC_MSG_CHECKING([for additional 'intro' bitmaps])
7126INTRO_BITMAPS=
7127if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7128   INTRO_BITMAPS=
7129   AC_MSG_RESULT([none])
7130else
7131   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7132      case "$bitmap" in
7133         *.bmp) ;;
7134         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .bmp files!]) ;;
7135      esac
7136      if test -n "$bitmap" ; then
7137         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7138      fi
7139   done
7140   AC_MSG_RESULT([$INTRO_BITMAPS])
7141fi
7142AC_SUBST(INTRO_BITMAPS)
7143
7144AC_MSG_CHECKING([for additional 'about' bitmaps])
7145ABOUT_BITMAPS=
7146if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7147   ABOUT_BITMAPS=
7148   AC_MSG_RESULT([none])
7149else
7150   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7151      case "$bitmap" in
7152         *.bmp) ;;
7153         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .bmp files!]) ;;
7154      esac
7155      if test -n "$bitmap" ; then
7156         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7157      fi
7158   done
7159   AC_MSG_RESULT([$ABOUT_BITMAPS])
7160fi
7161AC_SUBST(ABOUT_BITMAPS)
7162
7163OOO_VENDOR=
7164AC_MSG_CHECKING([for vendor])
7165if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7166   AC_MSG_RESULT([not set])
7167else
7168   OOO_VENDOR="$with_vendor"
7169   AC_MSG_RESULT([$OOO_VENDOR])
7170fi
7171AC_SUBST(OOO_VENDOR)
7172
7173UNIXWRAPPERNAME=
7174AC_MSG_CHECKING([for UNIX wrapper name])
7175if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7176   AC_MSG_RESULT([not set])
7177else
7178   UNIXWRAPPERNAME="$with_unix_wrapper"
7179   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7180fi
7181AC_SUBST(UNIXWRAPPERNAME)
7182
7183AC_MSG_CHECKING([whether to statically link to Gtk])
7184if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7185   ENABLE_STATIC_GTK="TRUE"
7186   AC_MSG_RESULT([yes])
7187else
7188   ENABLE_STATIC_GTK="FALSE"
7189   AC_MSG_RESULT([no])
7190fi
7191AC_SUBST(ENABLE_STATIC_GTK)
7192
7193AC_MSG_CHECKING([whether to use layout dialogs])
7194if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7195   ENABLE_LAYOUT="TRUE"
7196   AC_MSG_RESULT([yes])
7197else
7198   ENABLE_LAYOUT="FALSE"
7199   AC_MSG_RESULT([no])
7200fi
7201AC_SUBST(ENABLE_LAYOUT)
7202
7203# ===================================================================
7204# De- or increase default verbosity of build process
7205# ===================================================================
7206AC_MSG_CHECKING([build verbosity])
7207if test -n "$enable_verbose"; then
7208   if test "$enable_verbose" = "yes"; then
7209      VERBOSE="TRUE"
7210      AC_MSG_RESULT([high])
7211   fi
7212   if test "$enable_verbose" = "no"; then
7213      VERBOSE="FALSE"
7214      AC_MSG_RESULT([low])
7215   fi
7216else
7217   AC_MSG_RESULT([not set])
7218fi
7219AC_SUBST(VERBOSE)
7220
7221dnl ===================================================================
7222dnl Hook up OOos nodep environmental variable to automake's equivalent
7223dnl --enable-dependency-tracking configure option
7224dnl ===================================================================
7225AC_MSG_CHECKING([whether to enable dependency tracking])
7226if test "$enable_dependency_tracking" = "no"; then
7227    nodep=TRUE
7228    AC_MSG_RESULT([no])
7229else
7230    AC_MSG_RESULT([yes])
7231fi
7232AC_SUBST(nodep)
7233
7234dnl ===================================================================
7235dnl Setting up the environment.
7236dnl ===================================================================
7237echo "********************************************************************"
7238echo "*                                                                  *"
7239echo "*   Setting up the build environment variables.                    *"
7240echo "*                                                                  *"
7241echo "********************************************************************"
7242
7243if test -z "$COMPATH"; then
7244   AC_MSG_ERROR([No compiler found.])
7245fi
7246AC_SUBST(COMPATH)
7247AC_SUBST(CC_PATH)
7248
7249AC_MSG_CHECKING([solver path])
7250if test -z "$with_local_solver"; then
7251   LOCAL_SOLVER="DEFAULT"
7252   AC_MSG_RESULT([default])
7253else
7254   LOCAL_SOLVER=$with_local_solver
7255   AC_MSG_RESULT([$with_local_solver])
7256fi
7257AC_SUBST(LOCAL_SOLVER)
7258
7259AC_SUBST(BUILD_TYPE)
7260AC_SUBST(ADDITIONAL_REPOSITORIES)
7261
7262# make sure config.guess is +x; we execute config.guess, so it has to be so;
7263chmod +x ./config.guess
7264
7265# Create files from their *.in templates.
7266AC_CONFIG_FILES([set_soenv Makefile])
7267
7268AC_MSG_NOTICE([writing config.status])
7269AC_OUTPUT
7270
7271dnl Executing the set_soenv script to setup the environment variables.
7272chmod a+x set_soenv
7273if test -z "$enable_check_only"; then
7274   './set_soenv'
7275else
7276   echo
7277   echo Test Complete
7278   echo No environment file will be generated
7279   echo
7280   num_warnings=`wc -l warn`
7281   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7282   if test $_num -gt 0; then
7283      echo The following warning\(s\) were generated by configure
7284      echo ----------------------------------------------------
7285      echo
7286      cat warn
7287      echo
7288   else
7289      echo There were no warnings
7290   fi
7291   echo
7292fi
7293
7294