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