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