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