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