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