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