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