xref: /aoo4110/main/configure.ac (revision b1cdbd2c)
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=yes)
312AC_ARG_ENABLE(gio,
313[  --enable-gio            Determines whether to use the GIO support
314],,enable_gio=no)
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    # Mac OS builds should get out without extra stuff is the Mac porters'
5022    # wish. And pkg-config is although Xcode ships a .pc for openssl
5023    if test "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
5024        OPENSSL_CFLAGS=
5025        OPENSSL_LIBS="-lssl -lcrypto"
5026    else
5027    	PKG_CHECK_MODULES( OPENSSL, openssl )
5028    fi
5029    SYSTEM_OPENSSL=YES
5030else
5031    AC_MSG_RESULT([internal])
5032    SYSTEM_OPENSSL=NO
5033    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5034fi
5035AC_SUBST(SYSTEM_OPENSSL)
5036AC_SUBST(OPENSSL_CFLAGS)
5037AC_SUBST(OPENSSL_LIBS)
5038
5039dnl ===================================================================
5040dnl Check for system redland
5041dnl ===================================================================
5042AC_MSG_CHECKING([which redland library to use])
5043if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5044	test "$with_system_redland" != "no"; then
5045	AC_MSG_RESULT([external])
5046	SYSTEM_REDLAND=YES
5047   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5048   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5049else
5050	AC_MSG_RESULT([internal])
5051	BUILD_TYPE="$BUILD_TYPE REDLAND"
5052	SYSTEM_REDLAND=NO
5053fi
5054AC_SUBST(SYSTEM_REDLAND)
5055AC_SUBST(REDLAND_CFLAGS)
5056AC_SUBST(REDLAND_LIBS)
5057
5058dnl ===================================================================
5059dnl Check for hunspell
5060dnl ===================================================================
5061AC_MSG_CHECKING([whether to build the Spell Checking component])
5062ENABLE_HUNSPELL=
5063
5064if test "x$enable_hunspell" != "xno" ; then
5065    AC_MSG_CHECKING([which libhunspell to use])
5066    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5067        test "$with_system_hunspell" != "no"; then
5068        AC_MSG_RESULT([external])
5069        SYSTEM_HUNSPELL=YES
5070        AC_LANG_PUSH([C++])
5071        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5072        if test "$HUNSPELL_PC" != "TRUE"; then
5073            AC_CHECK_HEADER(hunspell.hxx, [],
5074            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5075                [AC_MSG_ERROR(hunspell headers not found.)], [])
5076             ], [])
5077            AC_CHECK_LIB(hunspell, main, [],
5078            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5079            HUNSPELL_LIBS=-lhunspell
5080        fi
5081        AC_LANG_POP([C++])
5082    else
5083        AC_MSG_RESULT([internal])
5084        SYSTEM_HUNSPELL=NO
5085        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5086    fi
5087    ENABLE_HUNSPELL=YES
5088    AC_SUBST(SYSTEM_HUNSPELL)
5089    AC_SUBST(HUNSPELL_CFLAGS)
5090    AC_SUBST(HUNSPELL_LIBS)
5091else
5092    AC_MSG_RESULT([no])
5093fi
5094AC_SUBST(ENABLE_HUNSPELL)
5095
5096dnl ===================================================================
5097dnl Checking for libhyphen
5098dnl ===================================================================
5099AC_MSG_CHECKING([whether to build the Hyphenator component])
5100ENABLE_HYPHEN=
5101
5102if test "x$enable_hyphen" != "xno" ; then
5103    AC_MSG_CHECKING([which libhyphen to use])
5104    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5105        test "$with_system_hyphen" != "no"; then
5106        AC_MSG_RESULT([external])
5107        SYSTEM_HYPH=YES
5108        AC_CHECK_HEADER(hyphen.h, [],
5109        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5110        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5111        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5112        [#include <hyphen.h>])
5113        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5114            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5115        if test -z "$HYPHEN_LIB"; then
5116        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5117            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5118        fi
5119        if test -z "$HYPHEN_LIB"; then
5120        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5121            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5122        fi
5123    else
5124        AC_MSG_RESULT([internal])
5125        SYSTEM_HYPH=NO
5126        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5127    fi
5128    ENABLE_HYPHEN=YES
5129    AC_SUBST(SYSTEM_HYPH)
5130    AC_SUBST(HYPHEN_LIB)
5131else
5132    AC_MSG_RESULT([no])
5133fi
5134AC_SUBST(ENABLE_HYPHEN)
5135
5136
5137#dnl ===================================================================
5138#dnl Check whether we are allowed to bundle dictionaries and whether
5139#dnl hunspell is available.
5140#dnl ===================================================================
5141ENABLE_BUNDLED_DICTIONARIES=
5142if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5143   ENABLE_BUNDLED_DICTIONARIES=YES
5144fi
5145AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5146
5147
5148
5149dnl ===================================================================
5150dnl Checking for mythes
5151dnl ===================================================================
5152AC_MSG_CHECKING([which mythes to use])
5153if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5154   test "$with_system_mythes" != "no"; then
5155    AC_MSG_RESULT([external])
5156    SYSTEM_MYTHES=YES
5157    AC_LANG_PUSH([C++])
5158    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5159    if test "$MYTHES_PKGCONFIG" = "no"; then
5160        AC_CHECK_HEADER(mythes.hxx, [],
5161            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5162        AC_CHECK_LIB(mythes-1.2, main, [],
5163            [ MYTHES_FOUND=no], [])
5164 	if test "$MYTHES_FOUND" = "no"; then
5165            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5166                [ MYTHES_FOUND=no], [])
5167	fi
5168	if test "$MYTHES_FOUND" = "no"; then
5169		AC_MSG_ERROR([mythes library not found!.])
5170	fi
5171    fi
5172    AC_LANG_POP([C++])
5173else
5174    AC_MSG_RESULT([internal])
5175    SYSTEM_MYTHES=NO
5176    BUILD_TYPE="$BUILD_TYPE MYTHES"
5177fi
5178AC_SUBST(SYSTEM_MYTHES)
5179AC_SUBST(MYTHES_CFLAGS)
5180AC_SUBST(MYTHES_LIBS)
5181
5182
5183dnl ===================================================================
5184dnl Checking for libtextcat
5185dnl ===================================================================
5186AC_MSG_CHECKING([which libtextcat to use])
5187if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5188    AC_MSG_RESULT([external])
5189    SYSTEM_LIBTEXTCAT=YES
5190    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5191       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5192    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5193        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5194else
5195    AC_MSG_RESULT([internal])
5196    SYSTEM_LIBTEXTCAT=NO
5197    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5198fi
5199AC_SUBST(SYSTEM_LIBTEXTCAT)
5200
5201AC_MSG_CHECKING([which libtextcat data directory to use])
5202if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5203    if test "$with_system_libtextcat_data" = "yes"; then
5204        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5205    else
5206        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5207    fi
5208    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5209else
5210    AC_MSG_RESULT([internal])
5211    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5212fi
5213AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5214
5215dnl ***************************************
5216dnl testing libc version for Linux...
5217dnl ***************************************
5218if test "$_os" = "Linux"; then
5219   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5220   exec 6>/dev/null # no output
5221   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5222   exec 6>&1 # output on again
5223   if test "$HAVE_LIBC"; then
5224      AC_MSG_RESULT([yes])
5225   else
5226      AC_MSG_ERROR([no, upgrade libc])
5227   fi
5228fi
5229
5230if test "$_os" != "WNT"; then
5231  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5232  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5233  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5234	SYSTEM_LIBC=YES
5235  fi
5236else
5237  HAVE_GETOPT=NO
5238  HAVE_READDIR_R=NO
5239  SYSTEM_LIBC=YES
5240fi
5241AC_SUBST(HAVE_GETOPT)
5242AC_SUBST(HAVE_READDIR_R)
5243AC_SUBST(SYSTEM_LIBC)
5244
5245dnl =========================================
5246dnl Check for the Microsoft Platform SDK.
5247dnl =========================================
5248dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5249dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5250if test \( "$_os" = "WINNT" \) ; then
5251	AC_MSG_CHECKING([for PSDK files])
5252	if test -z "$with_psdk_home"; then
5253		# This first line will detect a February 2003 Microsoft Platform SDK
5254		PSDK_HOME=`./oowintool --psdk-home`
5255        # But there might be also an April 2005 PSDK, unfortunately MS changed
5256        # the registry entry. (we prefer the old version!?)
5257        if test -z "$PSDK_HOME"; then
5258          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5259        fi
5260            # normalize if found
5261            if test -n "$PSDK_HOME"; then
5262              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5263              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5264           fi
5265	else
5266           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5267	fi
5268        # Remove a possible trailing backslash
5269        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5270    # Problem with current PSDK (iz 49865)
5271    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5272        AC_MSG_ERROR([
5273
5274Some modules do not build correctly with MS Platform SDK - April 2005
5275Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5276Remove/rename/backup that file and restart configure. Details about this
5277problem can be found in issue 49856.])
5278    fi
5279# WIndows SDK has different headers
5280	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5281		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5282		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5283		HAVE_PSDK_H="yes"
5284	else
5285		HAVE_PSDK_H="no"
5286	fi
5287	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5288		HAVE_PSDK_LIB="yes"
5289	else
5290		HAVE_PSDK_LIB="no"
5291	fi
5292    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5293        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5294are installed or use --with-psdk-home .])
5295    fi
5296    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5297         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5298         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5299         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5300        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5301    fi
5302    AC_MSG_RESULT([SDK files found ...)])
5303dnl Check if this is the right SDK.
5304    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5305        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5306        WINDOWS_VISTA_PSDK=TRUE
5307    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5308        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5309        WINDOWS_VISTA_PSDK=TRUE
5310    elif echo $PSDK_HOME | grep "v7.0" >/dev/null 2>/dev/null; then
5311        AC_MSG_RESULT([Found Windows SDK 7.0 ($PSDK_HOME)])
5312        WINDOWS_VISTA_PSDK=TRUE
5313    else
5314        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5315    fi
5316fi
5317AC_SUBST(PSDK_HOME)
5318AC_SUBST(WINDOWS_VISTA_PSDK)
5319
5320dnl =========================================
5321dnl Check for the Microsoft DirectX SDK.
5322dnl =========================================
5323if test \( "$_os" = "WINNT" \) ; then
5324    AC_MSG_CHECKING([for DirectX SDK files])
5325    if test -z "$with_directx_home"; then
5326        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5327        if test -n "$DXSDK_DIR"; then
5328            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5329            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5330        fi
5331        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5332        # the "DirectX SDK files not found" error later
5333    else
5334	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5335    fi
5336    # Remove a possible trailing backslash
5337    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5338
5339    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5340        HAVE_DIRECTDRAW_H="yes"
5341    else
5342        HAVE_DIRECTDRAW_H="no"
5343    fi
5344    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5345        HAVE_DIRECTXSDK_H="yes"
5346    else
5347        HAVE_DIRECTXSDK_H="no"
5348    fi
5349
5350    # MS changed the location of the libraries with dec 2004 directx sdk
5351    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5352        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5353    else
5354        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5355    fi
5356    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5357        HAVE_DIRECTDRAW_LIB="yes"
5358    else
5359        HAVE_DIRECTDRAW_LIB="no"
5360    fi
5361    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5362        HAVE_DIRECTXSDK_LIB="yes"
5363    else
5364        HAVE_DIRECTXSDK_LIB="no"
5365    fi
5366
5367    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5368       ENABLE_DIRECT_DRAW="TRUE"
5369    fi
5370    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5371       HAVE_DIRECTXSDK="yes"
5372    else
5373       HAVE_DIRECTXSDK="no"
5374    fi
5375
5376    if test -n "$ENABLE_DIRECTX"; then
5377	    if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5378		    AC_MSG_RESULT([found])
5379	    else
5380		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5381	    fi
5382    else
5383		DIRECTXSDK_HOME=""
5384		AC_MSG_RESULT([disabled])
5385    fi
5386fi
5387AC_SUBST(ENABLE_DIRECT_DRAW)
5388AC_SUBST(DIRECTXSDK_HOME)
5389AC_SUBST(DIRECTXSDK_LIB)
5390
5391
5392dnl ============================================
5393dnl Check for ATL and MFC
5394dnl ============================================
5395if test \( "$_os" = "WINNT" \) ; then
5396    AC_MSG_CHECKING([for ATL and MFC])
5397    if test "$DISABLE_ATL" = "TRUE"; then
5398        AC_MSG_RESULT([ATL is disabled, nothing to check])
5399    else
5400        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
5401        if test -z "$with_atl_include_dir"; then
5402            ATL_INCLUDE=$COMPATH/atlmfc/include
5403        else
5404            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
5405        fi
5406        if test -z "$with_atl_lib_dir"; then
5407            ATL_LIB=$COMPATH/atlmfc/lib
5408	    ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
5409        else
5410            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
5411            ATL_LIB_X64=$ATL_LIB/../amd64
5412        fi
5413        if test -z "$with_mfc_include_dir"; then
5414            MFC_INCLUDE=$COMPATH/atlmfc/include
5415        else
5416            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
5417        fi
5418        if test -z "$with_mfc_lib_dir"; then
5419            MFC_LIB=$COMPATH/atlmfc/lib
5420        else
5421            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
5422        fi
5423
5424        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
5425        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
5426        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
5427        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
5428        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
5429
5430        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
5431        if test -f "$ATL_INCLUDE/atlbase.h"; then
5432            HAVE_ATL_H="yes"
5433        else
5434            HAVE_ATL_H="no"
5435        fi
5436        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
5437
5438        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
5439        if test -f "$MFC_INCLUDE/afx.h"; then
5440            HAVE_MFC_H="yes"
5441        else
5442            HAVE_MFC_H="no"
5443        fi
5444        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
5445
5446        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
5447        if test -f "$ATL_LIB/atls.lib"; then
5448            HAVE_ATL_LIB="yes"
5449            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
5450            if test -f "$ATL_LIB/atlthunk.lib"; then
5451                HAVE_ATLTHUNK="YES"
5452            else
5453                HAVE_ATLTHUNK="NO"
5454            fi
5455            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
5456        else
5457            HAVE_ATL_LIB="no"
5458        fi
5459        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
5460
5461        dnl TODO check also MFC libraries, they seem to have diferent names
5462        dnl mfc42.lib mfc90.lib
5463        if test -d "$MFC_LIB"; then
5464            HAVE_MFC_LIB="yes"
5465        else
5466            HAVE_MFC_LIB="no"
5467        fi
5468
5469        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
5470            ATL_INCLUDE=
5471            ATL_LIB=
5472            ATL_LIB_X64=
5473            MFC_INCLUDE=
5474            MFC_LIB=
5475            HAVE_ATL_LIB=
5476            dnl TODO shouldn't this be an error?
5477            DISABLE_ACTIVEX="TRUE"
5478            DISABLE_ATL="TRUE"
5479            AC_MSG_RESULT([ATL/MFC disabled])
5480        else
5481            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
5482            ATL_LIB=`cygpath -dm "$ATL_LIB"`
5483            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
5484            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
5485            MFC_LIB=`cygpath -dm "$MFC_LIB"`
5486            AC_MSG_RESULT([ATL/MFC enabled])
5487        fi
5488    fi
5489fi
5490AC_SUBST(ATL_INCLUDE)
5491AC_SUBST(ATL_LIB)
5492AC_SUBST(ATL_LIB_X64)
5493AC_SUBST(HAVE_ATLTHUNK)
5494AC_SUBST(MFC_INCLUDE)
5495AC_SUBST(MFC_LIB)
5496
5497
5498dnl ============================================
5499dnl Check for Nullsoft Scriptable Install System
5500dnl ============================================
5501NSIS_PATH=""
5502if test "$_os" = "WINNT" ; then
5503    AC_MSG_CHECKING([for NSIS])
5504    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5505    if test -n "$NSIS_PATH"; then
5506        NSIS_PATH=`dirname "$NSIS_PATH"`
5507    fi
5508    if test -n "$with_nsis_path"; then
5509        with_nsis_path=`cygpath -u "$with_nsis_path"`
5510    fi
5511    if test -e "$with_nsis_path/nsis.exe"; then
5512        NSIS_PATH="$with_nsis_path"
5513    fi
5514    nsistest=`./oowintool --nsis-dir`;
5515    if test -x "$nsistest/nsis.exe"; then
5516        NSIS_PATH="$nsistest"
5517    fi
5518    if test -z "$NSIS_PATH"; then
5519        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5520        echo "NSIS not found, no self contained installer will be build." >> warn
5521    else
5522        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5523        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5524        AC_MSG_RESULT([found ($NSIS_PATH)])
5525		AC_MSG_CHECKING([whether NSIS version is >= 3.*])
5526		nsis_version_string=`"$NSIS_PATH/makensis.exe" /VERSION | $SED -e s/^v//i`
5527        nsis_version_major=`echo $nsis_version_string | cut -d. -f1`
5528		nsis_version_minor=`echo $nsis_version_string | cut -d. -f2`
5529		if test "$nsis_version_major" -ge "3"; then
5530			AC_MSG_RESULT([found NSIS $nsis_version_major.$nsis_version_minor >= 3.*])
5531			AC_MSG_CHECKING([whether NSIS was compiled with Unicode support])
5532			if echo `"$NSIS_PATH/makensis.exe" /HDRINFO` | $EGREP  "\bNSIS_UNICODE_MAKENSIS\b" 2>&1 >/dev/null; then
5533				AC_MSG_RESULT([NSIS version compiled with Unicode support.])
5534			else
5535				NSIS_PATH=""
5536				AC_MSG_WARN([NSIS version compiled without Unicode support, no self contained installer will be build.])
5537			fi
5538		else
5539			NSIS_PATH=""
5540			AC_MSG_WARN([NSIS version found is < 3.*, no self contained installer will be build.])
5541		fi
5542    fi
5543fi
5544AC_SUBST(NSIS_PATH)
5545
5546dnl ***************************************
5547dnl testing bison and flex exist
5548dnl ***************************************
5549AC_PATH_PROG(BISON, bison)
5550if test -z "$BISON"; then
5551   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5552else
5553   AC_MSG_CHECKING([the bison version])
5554   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5555    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5556    # Accept newer than 1.875 or older(equal) than 1.75
5557    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5558       if test "$_bison_version" = "1.875" ; then
5559          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5560          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5561       else
5562          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5563       fi
5564    else
5565       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5566    fi
5567fi
5568AC_PATH_PROG(FLEX, flex)
5569if test -z "$FLEX"; then
5570   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5571fi
5572dnl ***************************************
5573dnl testing that patch exists
5574dnl ***************************************
5575AC_PATH_PROG(PATCH, patch)
5576if test -z "$PATCH"; then
5577   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5578fi
5579
5580dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5581if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5582   if test -z "$with_gnu_patch"; then
5583      GNUPATCH=$PATCH
5584   else
5585      if test -x "$with_gnu_patch"; then
5586	      GNUPATCH=$with_gnu_patch
5587      else
5588         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5589      fi
5590   fi
5591
5592   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5593   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5594	   AC_MSG_RESULT([yes])
5595   else
5596      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5597   fi
5598fi
5599
5600dnl We also need to check for --with-gnu-cp
5601
5602if test -z "$with_gnu_cp"; then
5603   # check the place where the GNU stuff is hidden on Solaris...
5604   if test -x /usr/gnu/bin/cp; then
5605      GNUCP=/usr/gnu/bin/cp
5606   else
5607      AC_PATH_PROGS(GNUCP, gnucp cp)
5608   fi
5609   if test -z $GNUCP; then
5610      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5611   fi
5612else
5613   if test -x "$with_gnu_cp"; then
5614      GNUCP=$with_gnu_cp
5615   else
5616      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5617   fi
5618fi
5619
5620AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5621if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5622   AC_MSG_RESULT([yes])
5623else
5624   AC_MSG_RESULT([no])
5625   GNUCP=''
5626fi
5627
5628if test -z "$GNUCP"; then
5629   if test "$_os" = "SunOS"; then
5630      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5631   else
5632      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5633   fi
5634fi
5635
5636AC_SUBST(GNUPATCH)
5637AC_SUBST(GNUCP)
5638
5639dnl ***************************************
5640dnl testing bash tools path on Windows
5641dnl ***************************************
5642if test "$_os" = "WINNT"; then
5643    CYGWIN_PATH=""
5644    AC_PATH_PROG(CYGWIN_PATH, bash)
5645    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5646fi
5647if test -z "$CYGWIN_PATH"; then
5648   CYGWIN_PATH="NO_CYGWIN"
5649fi
5650AC_SUBST(CYGWIN_PATH)
5651
5652dnl ***************************************
5653dnl testing ml.exe assembler path
5654dnl ***************************************
5655if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5656  AC_MSG_CHECKING([ml.exe assembler path])
5657  if test -n "$with_asm_home"; then
5658    with_asm_home=`cygpath -u "$with_asm_home"`
5659  fi
5660  if test ! -x "$with_asm_home/ml.exe"; then
5661    AC_PATH_PROG(ML_EXE, ml.exe)
5662    if test -z "$ML_EXE"; then
5663      if test -x "$with_cl_home/bin/ml.exe"; then
5664        with_asm_home=$with_cl_home/bin
5665        AC_MSG_RESULT([found ($with_asm_home)])
5666      else
5667        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5668      fi
5669    else
5670       with_asm_home="ASM_IN_PATH"
5671    fi
5672  fi
5673  AC_MSG_RESULT([$ASM_HOME])
5674else
5675  with_asm_home="NO_ASM_HOME"
5676fi
5677ASM_HOME="$with_asm_home"
5678AC_SUBST(ASM_HOME)
5679
5680dnl ***************************************
5681dnl testing nasm.exe assembler path
5682dnl ***************************************
5683if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes" -a "$SYSTEM_OPENSSL" = "NO"; then
5684  AC_MSG_CHECKING([nasm.exe assembler path])
5685  if test -n "$with_nasm_home"; then
5686    with_nasm_home=`cygpath -u "$with_nasm_home"`
5687  fi
5688  if test ! -x "$with_nasm_home/nasm.exe"; then
5689    AC_PATH_PROG(NASM_EXE, nasm.exe)
5690    if test -z "$NASM_EXE"; then
5691      with_nasm_home="NO_NASM_HOME"
5692      AC_MSG_ERROR([NASM is required to build on Windows, please install or use --with-nasm-home],,)
5693    else
5694      with_nasm_home="NASM_IN_PATH"
5695    fi
5696  fi
5697  AC_MSG_RESULT([$NASM_HOME])
5698else
5699  with_nasm_home="NO_NASM_HOME"
5700fi
5701NASM_HOME="$with_nasm_home"
5702AC_SUBST(NASM_HOME)
5703
5704dnl ===================================================================
5705dnl testing handle deprecated unzip switch
5706dnl ===================================================================
5707if test -z "$with_zip_home"; then
5708	with_zip_home="$with_unzip_home"
5709fi
5710dnl ===================================================================
5711dnl Zip will be found where you tell me to find it
5712dnl ===================================================================
5713if test -n "$with_zip_home" ; then
5714    if test "$_os" = "WINNT"; then
5715        with_zip_home=`cygpath -u "$with_zip_home"`
5716    fi
5717    ZIP="$with_zip_home/zip"
5718    UNZIP="$with_zip_home/unzip"
5719    ZIP_HOME="$with_zip_home"
5720else
5721    AC_PATH_PROG(ZIP, zip)
5722    AC_PATH_PROG(UNZIP, unzip)
5723    ZIP_HOME=`dirname "$ZIP"`
5724fi
5725dnl ===================================================================
5726dnl Zip must be available or else it is an error, all platforms
5727dnl ===================================================================
5728if test -z "$ZIP" -o -z "$UNZIP"; then
5729    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5730fi
5731
5732dnl ===================================================================
5733dnl Zip must be a specific type for different build types.
5734dnl ===================================================================
5735if test "$_os" = "WINNT"; then
5736    if test -n "`$ZIP -h | grep -i WinNT`" ; then
5737AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5738    fi
5739fi
5740AC_SUBST(ZIP_HOME)
5741
5742dnl ===================================================================
5743dnl Windows builds need dbghelp.dll in external/dbghelp/
5744dnl ===================================================================
5745if test "$_os" = "WINNT"; then
5746   AC_MSG_CHECKING([for dbghelp.dll])
5747   if test -x ./external/dbghelp/dbghelp.dll; then
5748      AC_MSG_RESULT([found and executable])
5749   else
5750      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5751Get it from the Microsoft site and put it into external/dbghelp.
5752(Note: Microsoft seems to enjoy changing the exact location of this file. You
5753may have to search Microsoft's website.) Last time it was seen at:
5754<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5755   fi
5756fi
5757
5758dnl ===================================================================
5759dnl Windows builds need vcredist_x*.exe in external/vcredist/
5760dnl ===================================================================
5761WITH_VC_REDIST=""
5762
5763if test "$_os" = "WINNT"; then
5764   AC_MSG_CHECKING([for vcredist_x86.exe])
5765   if test -x ./external/vcredist/vcredist_x86.exe; then
5766      AC_MSG_RESULT([found and executable])
5767   else
5768      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
5769Get it from the Microsoft site and put it into external/vcredist. You can try
5770to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5771   fi
5772   AC_MSG_CHECKING([for vcredist_x64.exe])
5773   if test -x ./external/vcredist/vcredist_x64.exe; then
5774      AC_MSG_RESULT([found and executable])
5775   else
5776      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
5777Get it from the Microsoft site and put it into external/vcredist. You can try
5778to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5779   fi
5780   WITH_VC_REDIST=YES
5781   AC_SUBST(WITH_VC_REDIST)
5782fi
5783
5784dnl ===================================================================
5785dnl Windows builds - use oowintool to copy CRT dlls and manifest
5786dnl ===================================================================
5787if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5788       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5789          :
5790       else
5791          AC_MSG_ERROR([oowintool failed to copy CRT])
5792       fi
5793fi
5794
5795dnl ===================================================================
5796dnl Windows builds need gdiplus.dll in external/gdiplus/
5797dnl ===================================================================
5798if test "$_os" = "WINNT"; then
5799   AC_MSG_CHECKING([for gdiplus.dll])
5800   if test -x ./external/gdiplus/gdiplus.dll; then
5801      AC_MSG_RESULT([found and executable])
5802   else
5803      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5804Get it from the Microsoft site and put it into external/gdiplus.
5805You may have to search Microsoft's website. Last time it was seen at:
5806<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5807   fi
5808fi
5809
5810dnl ===================================================================
5811dnl Windows builds need msvcr100.dll in external/msvcp100/
5812dnl ===================================================================
5813if test "$_os" = "WINNT"; then
5814   AC_MSG_CHECKING([for msvcr100.dll])
5815   if test -x ./external/msvcp100/msvcr100.dll; then
5816      AC_MSG_RESULT([found and executable])
5817   else
5818      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
5819Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
5820from the Microsoft site and put it into external/msvcp100.
5821You may have to search Microsoft's website. Last time it was seen at:
5822<http://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
5823   fi
5824fi
5825
5826dnl ===================================================================
5827dnl Test which vclplugs have to be built.
5828dnl ===================================================================
5829AC_MSG_CHECKING([which VCLplugs shall be built])
5830ENABLE_GTK=""
5831if test "x$enable_gtk" = "xyes"; then
5832    ENABLE_GTK="TRUE"
5833    R="gtk"
5834fi
5835AC_SUBST(ENABLE_GTK)
5836
5837ENABLE_KDE=""
5838if test "x$enable_kde" = "xyes"; then
5839    ENABLE_KDE="TRUE"
5840    R="$R kde"
5841fi
5842AC_SUBST(ENABLE_KDE)
5843
5844ENABLE_KDE4=""
5845if test "x$enable_kde4" = "xyes"; then
5846    ENABLE_KDE4="TRUE"
5847    R="$R kde4"
5848fi
5849AC_SUBST(ENABLE_KDE4)
5850
5851if test -z "$R"; then
5852	AC_MSG_RESULT([none])
5853else
5854	AC_MSG_RESULT([$R])
5855fi
5856
5857dnl ===================================================================
5858dnl GCONF check
5859dnl ===================================================================
5860
5861ENABLE_GCONF=""
5862AC_MSG_CHECKING([whether to enable GConf support])
5863if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5864    ENABLE_GCONF="TRUE"
5865    AC_MSG_RESULT([yes])
5866    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5867else
5868    AC_MSG_RESULT([no])
5869fi
5870AC_SUBST(ENABLE_GCONF)
5871
5872dnl ===================================================================
5873dnl Gnome VFS check
5874dnl ===================================================================
5875
5876ENABLE_GNOMEVFS=""
5877AC_MSG_CHECKING([whether to enable GNOME VFS support])
5878if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5879    ENABLE_GNOMEVFS="TRUE"
5880    AC_MSG_RESULT([yes])
5881    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5882    if test "$ENABLE_GCONF" != "TRUE"; then
5883        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5884    fi
5885else
5886    AC_MSG_RESULT([no])
5887fi
5888AC_SUBST(ENABLE_GNOMEVFS)
5889
5890dnl ===================================================================
5891dnl Check whether the gtk 2.0 libraries are available.
5892dnl ===================================================================
5893
5894GTK_CFLAGS=""
5895GTK_LIBS=""
5896ENABLE_SYSTRAY_GTK=""
5897ENABLE_DBUS=""
5898if test  "$test_gtk" = "yes"; then
5899
5900   if test "$ENABLE_GTK" = "TRUE" ; then
5901      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]))
5902      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]))
5903      BUILD_TYPE="$BUILD_TYPE GTK"
5904
5905      if test "x$enable_systray" = "xyes"; then
5906         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
5907                           [ENABLE_SYSTRAY_GTK="TRUE"
5908                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
5909                           [ENABLE_SYSTRAY_GTK=""])
5910      fi
5911
5912      AC_MSG_CHECKING([whether to enable DBUS support])
5913      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5914          ENABLE_DBUS="TRUE"
5915          AC_MSG_RESULT([yes])
5916          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5917      else
5918          AC_MSG_RESULT([no])
5919      fi
5920
5921      AC_MSG_CHECKING([whether to enable GIO support])
5922      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5923          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5924             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5925          fi
5926          ENABLE_GIO="TRUE"
5927          AC_MSG_RESULT([yes])
5928          PKG_CHECK_MODULES( GIO, gio-2.0 )
5929      else
5930          AC_MSG_RESULT([no])
5931      fi
5932
5933   fi
5934
5935fi
5936AC_SUBST(ENABLE_GIO)
5937AC_SUBST(ENABLE_DBUS)
5938AC_SUBST(ENABLE_SYSTRAY_GTK)
5939AC_SUBST(GTK_CFLAGS)
5940AC_SUBST(GTK_LIBS)
5941AC_SUBST(GTHREAD_CFLAGS)
5942AC_SUBST(GTHREAD_LIBS)
5943
5944dnl ===================================================================
5945dnl Check whether the GStreamer libraries are available.
5946dnl ===================================================================
5947
5948GSTREAMER_CFLAGS=""
5949GSTREAMER_LIBS=""
5950ENABLE_GSTREAMER=""
5951
5952if test "$test_gstreamer" = "yes"; then
5953    AC_MSG_CHECKING([whether to build the GStreamer media backend])
5954    if test "x$enable_gstreamer" != "xno" ; then
5955        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]))
5956        ENABLE_GSTREAMER="TRUE"
5957        AC_MSG_RESULT([yes])
5958    else
5959        AC_MSG_RESULT([no])
5960    fi
5961fi
5962AC_SUBST(ENABLE_GSTREAMER)
5963AC_SUBST(GSTREAMER_CFLAGS)
5964AC_SUBST(GSTREAMER_LIBS)
5965
5966dnl ===================================================================
5967dnl Check the ARM target
5968dnl ===================================================================
5969
5970if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
5971    # default value
5972    ARM_TARGET=ARMV4T
5973    AC_MSG_CHECKING([which ARM processor optimization to use])
5974    if test "$with_arm_target" -lt "6"; then
5975	ARM_TARGET=ARMV4T
5976    elif test "$with_arm_target" = "6"; then
5977	ARM_TARGET=ARMV6
5978    elif test "$with_arm_target" -gt "6"; then
5979	ARM_TARGET=ARMV7
5980    fi
5981    AC_MSG_RESULT([$ARM_TARGET])
5982    AC_SUBST(ARM_TARGET)
5983fi
5984
5985dnl ===================================================================
5986dnl Check whether the Cairo libraries are available.
5987dnl ===================================================================
5988
5989ENABLE_CAIRO=""
5990BUILD_PIXMAN=""
5991SYSTEM_CAIRO=""
5992
5993if test  "$test_cairo" = "yes"; then
5994
5995    AC_MSG_CHECKING([whether to use cairo])
5996    if test "x$enable_cairo" != "xno" ; then
5997        ENABLE_CAIRO="TRUE"
5998	AC_MSG_RESULT([yes])
5999        AC_MSG_CHECKING([which cairo to use])
6000        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6001           test "$with_system_cairo" != "no"; then
6002           AC_MSG_RESULT([external])
6003           SYSTEM_CAIRO=YES
6004
6005           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6006	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6007	      AC_MSG_ERROR([Cairo library requires fontconfig.])
6008	   fi
6009           if test "$with_system_xrender_headers" = "yes"; then
6010              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6011              AC_TRY_RUN([
6012#include <X11/extensions/Xrender.h>
6013
6014int main(int argc, char **argv) {
6015#ifdef PictStandardA8
6016      return 0;
6017#else
6018      return 1;
6019#endif
6020}
6021               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
6022           fi
6023        else
6024           BUILD_TYPE="$BUILD_TYPE CAIRO"
6025	   dnl === compiler fails on pixman with 64bit architectures...===
6026	   if test "$build_cpu" != "x86_64"; then
6027	      BUILD_PIXMAN=YES
6028	   fi
6029           AC_MSG_RESULT([internal])
6030        fi
6031    else
6032	   AC_MSG_RESULT([no])
6033    fi
6034fi
6035
6036AC_SUBST(ENABLE_CAIRO)
6037AC_SUBST(BUILD_PIXMAN)
6038AC_SUBST(SYSTEM_CAIRO)
6039AC_SUBST(CAIRO_CFLAGS)
6040AC_SUBST(CAIRO_LIBS)
6041
6042ENABLE_CAIRO_CANVAS="FALSE"
6043if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6044   ENABLE_CAIRO_CANVAS="TRUE"
6045fi
6046AC_SUBST(ENABLE_CAIRO_CANVAS)
6047
6048dnl ===================================================================
6049dnl Check whether the OpenGL libraries are available
6050dnl ===================================================================
6051
6052AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6053ENABLE_OPENGL=
6054
6055if test "x$enable_opengl" != "xno" ; then
6056   AC_MSG_RESULT([yes])
6057   AC_CHECK_HEADER(GL/gl.h, [],
6058                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6059   AC_CHECK_LIB(GL, main, [],
6060     [AC_MSG_ERROR(libGL not installed or functional)], [])
6061   AC_CHECK_LIB(GLU, main, [],
6062     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6063   ENABLE_OPENGL=TRUE
6064else
6065   AC_MSG_RESULT([no])
6066fi
6067
6068AC_SUBST(ENABLE_OPENGL)
6069
6070
6071AC_MSG_CHECKING([whether to build the PDF Import extension])
6072if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6073  AC_MSG_RESULT([yes])
6074  ENABLE_PDFIMPORT=YES
6075
6076  dnl ===================================================================
6077  dnl Check for system poppler
6078  dnl ===================================================================
6079  AC_MSG_CHECKING([whether to use system pdf backend])
6080  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6081       test "$with_system_poppler" != "no"; then
6082      AC_MSG_RESULT([external])
6083      SYSTEM_POPPLER=YES
6084      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6085  else
6086      AC_MSG_RESULT([no])
6087      SYSTEM_POPPLER=NO
6088      ENABLE_PDFIMPORT=NO
6089  fi
6090else
6091   AC_MSG_RESULT([no])
6092   ENABLE_PDFIMPORT=NO
6093fi
6094AC_SUBST(ENABLE_PDFIMPORT)
6095AC_SUBST(SYSTEM_POPPLER)
6096AC_SUBST(POPPLER_CFLAGS)
6097AC_SUBST(POPPLER_LIBS)
6098
6099AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6100if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6101  AC_MSG_RESULT([yes])
6102  AC_MSG_CHECKING([for swext module])
6103  if test -d ./swext; then
6104   AC_MSG_RESULT([OK])
6105  else
6106   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6107  fi
6108  ENABLE_MEDIAWIKI=YES
6109  BUILD_TYPE="$BUILD_TYPE SWEXT"
6110else
6111  AC_MSG_RESULT([no])
6112  ENABLE_MEDIAWIKI=NO
6113fi
6114AC_SUBST(ENABLE_MEDIAWIKI)
6115
6116if test "$ENABLE_MEDIAWIKI" = "YES"; then
6117  AC_MSG_CHECKING([which Servlet API Jar to use])
6118  if test -n "$with_system_servlet_api"; then
6119    AC_MSG_RESULT([external])
6120    SYSTEM_SERVLETAPI=YES
6121      if test -z "$SERVLETAPI_JAR"; then
6122	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6123      fi
6124      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6125             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6126  else
6127    AC_MSG_RESULT([internal])
6128    SYSTEM_SERVLETAPI=NO
6129    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6130  fi
6131fi
6132AC_SUBST(SYSTEM_SERVLETAPI)
6133AC_SUBST(SERVLETAPI_JAR)
6134
6135AC_MSG_CHECKING([whether to build the Report Builder extension])
6136if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6137  AC_MSG_RESULT([yes])
6138  ENABLE_REPORTBUILDER=YES
6139  SYSTEM_JFREEREPORT=YES
6140  AC_MSG_CHECKING([for reportbuilder module])
6141  if test -d ./reportbuilder; then
6142    AC_MSG_RESULT([OK])
6143  else
6144    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6145  fi
6146  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6147  AC_MSG_RESULT([external])
6148  if test -z $SAC_JAR; then
6149         SAC_JAR=/usr/share/java/sac.jar
6150  fi
6151  AC_CHECK_FILE($SAC_JAR, [],
6152         [AC_MSG_ERROR(sac.jar not found.)], [])
6153
6154  if test -z $LIBXML_JAR; then
6155    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6156      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6157      [
6158        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6159          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6160          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6161        )
6162      ]
6163    )
6164  else
6165    AC_CHECK_FILE($LIBXML_JAR, [],
6166         [AC_MSG_ERROR(libxml.jar not found.)], [])
6167  fi
6168
6169  if test -z $FLUTE_JAR; then
6170    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6171      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6172      [
6173        AC_CHECK_FILE(/usr/share/java/flute.jar,
6174          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6175          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6176        )
6177      ]
6178    )
6179  else
6180    AC_CHECK_FILE($FLUTE_JAR, [],
6181         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6182  fi
6183
6184  if test -z $JFREEREPORT_JAR; then
6185    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6186      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6187      [
6188        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6189          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6190          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6191        )
6192      ]
6193    )
6194  else
6195    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6196         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6197  fi
6198
6199  if test -z $LIBLAYOUT_JAR; then
6200    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6201      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6202      [
6203        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6204          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6205          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6206        )
6207      ]
6208    )
6209  else
6210    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6211         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6212  fi
6213
6214  if test -z $LIBLOADER_JAR; then
6215    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6216      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6217      [
6218        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6219          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6220          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6221        )
6222      ]
6223    )
6224  else
6225    AC_CHECK_FILE($LIBLOADER_JAR, [],
6226         [AC_MSG_ERROR(libloader.jar not found.)], [])
6227  fi
6228
6229  if test -z $LIBFORMULA_JAR; then
6230    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6231      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6232      [
6233        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6234          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6235          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6236        )
6237      ]
6238    )
6239  else
6240    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6241         [AC_MSG_ERROR(libformula.jar not found.)], [])
6242  fi
6243
6244  if test -z $LIBREPOSITORY_JAR; then
6245    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6246      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6247      [
6248        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6249          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6250          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6251        )
6252      ]
6253    )
6254  else
6255    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6256         [AC_MSG_ERROR(librepository.jar not found.)], [])
6257  fi
6258
6259  if test -z $LIBFONTS_JAR; then
6260    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6261      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6262      [
6263        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6264          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6265          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6266        )
6267      ]
6268    )
6269  else
6270    AC_CHECK_FILE($LIBFONTS_JAR, [],
6271         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6272  fi
6273
6274  if test -z $LIBSERIALIZER_JAR; then
6275    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6276      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6277      [
6278        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6279          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6280          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6281        )
6282      ]
6283    )
6284  else
6285    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6286         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6287  fi
6288
6289
6290  if test -z $LIBBASE_JAR; then
6291    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6292      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6293      [
6294        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6295          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6296          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6297        )
6298      ]
6299    )
6300  else
6301    AC_CHECK_FILE($LIBBASE_JAR, [],
6302         [AC_MSG_ERROR(libbase.jar not found.)], [])
6303  fi
6304  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6305else
6306  AC_MSG_RESULT([no])
6307  ENABLE_REPORTBUILDER=NO
6308fi
6309AC_SUBST(ENABLE_REPORTBUILDER)
6310AC_SUBST(SYSTEM_JFREEREPORT)
6311AC_SUBST(SAC_JAR)
6312AC_SUBST(LIBXML_JAR)
6313AC_SUBST(FLUTE_JAR)
6314AC_SUBST(JFREEREPORT_JAR)
6315AC_SUBST(LIBBASE_JAR)
6316AC_SUBST(LIBLAYOUT_JAR)
6317AC_SUBST(LIBLOADER_JAR)
6318AC_SUBST(LIBFORMULA_JAR)
6319AC_SUBST(LIBREPOSITORY_JAR)
6320AC_SUBST(LIBFONTS_JAR)
6321AC_SUBST(LIBSERIALIZER_JAR)
6322
6323# this has to be here because both the wiki publisher and the SRB use
6324# commons-logging
6325if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6326  AC_MSG_CHECKING([which Apache commons-* libs to use])
6327  if test "$with_system_apache_commons" = "yes"; then
6328    SYSTEM_APACHE_COMMONS=YES
6329    AC_MSG_RESULT([external])
6330    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6331      if test -z $COMMONS_CODEC_JAR; then
6332        AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
6333          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
6334          [
6335            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6336              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6337              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6338            )
6339          ]
6340        )
6341      else
6342        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6343             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6344      fi
6345
6346      if test -z $COMMONS_LANG_JAR; then
6347        AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
6348          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
6349          [
6350            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6351              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6352              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6353            )
6354          ]
6355        )
6356      else
6357        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6358             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6359      fi
6360
6361      if test -z $COMMONS_HTTPCLIENT_JAR; then
6362        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6363          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6364          [
6365            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6366              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6367              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6368            )
6369          ]
6370        )
6371      else
6372        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6373             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6374      fi
6375    fi
6376    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6377      if test -z $COMMONS_LOGGING_JAR; then
6378        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
6379          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
6380          [
6381            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6382              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6383              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6384            )
6385          ]
6386        )
6387      else
6388        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6389             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6390      fi
6391    fi
6392  else
6393    AC_MSG_RESULT([internal])
6394    SYSTEM_APACHE_COMMONS=NO
6395    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6396  fi
6397fi
6398AC_SUBST(SYSTEM_APACHE_COMMONS)
6399AC_SUBST(COMMONS_CODEC_JAR)
6400AC_SUBST(COMMONS_LANG_JAR)
6401AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6402AC_SUBST(COMMONS_LOGGING_JAR)
6403
6404dnl ===================================================================
6405dnl Check whether the Qt and KDE libraries are available.
6406dnl ===================================================================
6407
6408KDE_CFLAGS=""
6409KDE_LIBS=""
6410MOC="moc"
6411if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6412    dnl Search paths for Qt and KDE
6413    if test "$build_cpu" != "x86_64" ; then
6414        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"
6415        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"
6416    else
6417        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"
6418        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"
6419    fi
6420    if test -n "$QTDIR" ; then
6421        qt_incdirs="$QTDIR/include $qt_incdirs"
6422        if test "$build_cpu" != "x86_64" ; then
6423            qt_libdirs="$QTDIR/lib $qt_libdirs"
6424        else
6425            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6426        fi
6427    fi
6428    if test "$build_cpu" != "x86_64" ; then
6429        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"
6430        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"
6431    else
6432        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"
6433        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"
6434    fi
6435    if test -n "$KDEDIR" ; then
6436        kde_incdirs="$KDEDIR/include $kde_incdirs"
6437        if test "$build_cpu" != "x86_64" ; then
6438            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6439        else
6440            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6441        fi
6442    fi
6443
6444    dnl What to test
6445    qt_test_include="qstyle.h"
6446    qt_test_library="libqt-mt.so"
6447    kde_test_include="ksharedptr.h"
6448    kde_test_library="libkdeui.so"
6449
6450    dnl Check for Qt headers
6451    AC_MSG_CHECKING([for Qt headers])
6452    qt_incdir="no"
6453    for kde_check in $qt_incdirs ; do
6454        if test -r "$kde_check/$qt_test_include" ; then
6455            qt_incdir="$kde_check"
6456            break
6457        fi
6458    done
6459    AC_MSG_RESULT([$qt_incdir])
6460    if test "x$qt_incdir" = "xno" ; then
6461        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6462your Qt installation by exporting QTDIR before running "configure".])
6463    fi
6464
6465    dnl Check for Qt libraries
6466    AC_MSG_CHECKING([for Qt libraries])
6467    qt_libdir="no"
6468    for qt_check in $qt_libdirs ; do
6469        if test -r "$qt_check/$qt_test_library" ; then
6470            qt_libdir="$qt_check"
6471            break
6472        fi
6473    done
6474    AC_MSG_RESULT([$qt_libdir])
6475    if test "x$qt_libdir" = "xno" ; then
6476        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6477your Qt installation by exporting QTDIR before running "configure".])
6478    fi
6479
6480    dnl Check for Meta Object Compiler
6481    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6482    if test "$MOC" = "no" ; then
6483        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6484the root of your Qt installation by exporting QTDIR before running "configure".])
6485    fi
6486
6487    dnl Check for KDE headers
6488    AC_MSG_CHECKING([for KDE headers])
6489    kde_incdir="no"
6490    for kde_check in $kde_incdirs ; do
6491        if test -r "$kde_check/$kde_test_include" ; then
6492            kde_incdir="$kde_check"
6493            break
6494        fi
6495    done
6496    AC_MSG_RESULT([$kde_incdir])
6497    if test "x$kde_incdir" = "xno" ; then
6498        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6499your KDE installation by exporting KDEDIR before running "configure".])
6500    fi
6501
6502    dnl Check for KDE libraries
6503    AC_MSG_CHECKING([for KDE libraries])
6504    kde_libdir="no"
6505    for kde_check in $kde_libdirs ; do
6506        if test -r "$kde_check/$kde_test_library" ; then
6507            kde_libdir="$kde_check"
6508            break
6509        fi
6510    done
6511    AC_MSG_RESULT([$kde_libdir])
6512    if test "x$kde_libdir" = "xno" ; then
6513        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6514your KDE installation by exporting KDEDIR before running "configure".])
6515    fi
6516
6517    dnl Set the variables
6518    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6519    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6520fi
6521AC_SUBST(KDE_CFLAGS)
6522AC_SUBST(KDE_LIBS)
6523AC_SUBST(MOC)
6524
6525dnl ===================================================================
6526dnl KDE4 Integration
6527dnl ===================================================================
6528
6529KDE4_CFLAGS=""
6530KDE4_LIBS=""
6531MOC4="moc"
6532if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6533   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6534   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6535
6536   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6537   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6538
6539   if test "$build_cpu" = "x86_64" ; then
6540      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6541      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6542   fi
6543
6544   if test -n "$KDE4DIR" ; then
6545      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6546      if test "$build_cpu" != "x86_64" ; then
6547         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6548      else
6549         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6550      fi
6551   fi
6552
6553   qt_test_include="Qt/qobject.h"
6554   qt_test_library="libQtCore.so"
6555   kde_test_include="ksharedptr.h"
6556   kde_test_library="libkdeui.so"
6557
6558   AC_MSG_CHECKING([for Qt4 headers])
6559   qt_header_dir="no"
6560   for inc_dir in $qt_incdirs ; do
6561      if test -r "$inc_dir/$qt_test_include" ; then
6562         qt_header_dir="$inc_dir"
6563         break
6564      fi
6565   done
6566
6567   AC_MSG_RESULT([$qt_header_dir])
6568   if test "x$qt_header_dir" = "xno" ; then
6569      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6570   fi
6571
6572   AC_MSG_CHECKING([for Qt4 libraries])
6573   qt_lib_dir="no"
6574   for lib_dir in $qt_libdirs ; do
6575      if test -r "$lib_dir/$qt_test_library" ; then
6576         qt_lib_dir="$lib_dir"
6577         break
6578      fi
6579   done
6580
6581   AC_MSG_RESULT([$qt_lib_dir])
6582
6583   if test "x$qt_lib_dir" = "xno" ; then
6584      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6585   fi
6586
6587   dnl Check for Meta Object Compiler
6588   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6589   MOC4="$MOCQT4"
6590   if test "$MOC4" = "no" ; then
6591      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6592      if test "$MOC4" = "no" ; then
6593         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6594      fi
6595   fi
6596
6597   dnl Check for KDE4 headers
6598   AC_MSG_CHECKING([for KDE4 headers])
6599   kde_incdir="no"
6600   for kde_check in $kde_incdirs ; do
6601      if test -r "$kde_check/$kde_test_include" ; then
6602         kde_incdir="$kde_check"
6603         break
6604      fi
6605   done
6606   AC_MSG_RESULT([$kde_incdir])
6607   if test "x$kde_incdir" = "xno" ; then
6608      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6609   fi
6610
6611   dnl Check for KDE4 libraries
6612   AC_MSG_CHECKING([for KDE4 libraries])
6613   kde_libdir="no"
6614   for kde_check in $kde_libdirs ; do
6615      if test -r "$kde_check/$kde_test_library" ; then
6616         kde_libdir="$kde_check"
6617         break
6618      fi
6619   done
6620
6621   AC_MSG_RESULT([$kde_libdir])
6622   if test "x$kde_libdir" = "xno" ; then
6623      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6624   fi
6625
6626   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6627   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6628fi
6629AC_SUBST(KDE4_CFLAGS)
6630AC_SUBST(KDE4_LIBS)
6631AC_SUBST(MOC4)
6632
6633dnl ===================================================================
6634dnl Test for the enabling the lockdown pieces
6635dnl ===================================================================
6636AC_MSG_CHECKING([whether to enable the lockdown pieces])
6637ENABLE_LOCKDOWN=""
6638if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6639  ENABLE_LOCKDOWN=YES
6640  AC_MSG_RESULT([yes])
6641else
6642  AC_MSG_RESULT([no])
6643fi
6644AC_SUBST(ENABLE_LOCKDOWN)
6645
6646dnl ===================================================================
6647dnl Test whether to include Evolution 2 support
6648dnl ===================================================================
6649AC_MSG_CHECKING([whether to enable evolution 2 support])
6650if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6651   AC_MSG_RESULT([yes])
6652   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6653   ENABLE_EVOAB2="TRUE"
6654else
6655   ENABLE_EVOAB2=""
6656   AC_MSG_RESULT([no])
6657fi
6658AC_SUBST(ENABLE_EVOAB2)
6659AC_SUBST(GOBJECT_CFLAGS)
6660AC_SUBST(GOBJECT_LIBS)
6661
6662dnl ===================================================================
6663dnl Test whether to include KDE AB support
6664dnl ===================================================================
6665AC_MSG_CHECKING([whether to enable KDE address book support])
6666if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6667   AC_MSG_RESULT([yes])
6668   AC_LANG_PUSH([C++])
6669   save_CXXFLAGS=$CXXFLAGS
6670   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6671   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6672       AC_TRY_RUN([
6673#include <kdeversion.h>
6674
6675int main(int argc, char **argv) {
6676       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6677       else return 1;
6678}
6679       ], [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])])
6680   CXXFLAGS=$save_CXXFLAGS
6681   AC_LANG_POP([C++])
6682   ENABLE_KAB=TRUE
6683else
6684   AC_MSG_RESULT([no])
6685   ENABLE_KAB=
6686fi
6687AC_SUBST(ENABLE_KAB)
6688
6689dnl ===================================================================
6690dnl Test whether to include MathMLDTD
6691dnl ===================================================================
6692AC_MSG_CHECKING([whether to include MathMLDTD])
6693if test -n "$enable_mathmldtd"; then
6694  if test "$enable_mathmldtd" = "no"; then
6695    AC_MSG_RESULT([no])
6696    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6697  else
6698    AC_MSG_RESULT([yes])
6699    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6700  fi
6701else
6702  AC_MSG_RESULT([no])
6703  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6704fi
6705
6706dnl ===================================================================
6707dnl Test whether to include category-B fonts
6708dnl ===================================================================
6709WITH_CATB_FONTS=
6710AC_MSG_CHECKING([whether to include category B fonts])
6711if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
6712   AC_MSG_RESULT([yes])
6713   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
6714   WITH_CATB_FONTS=YES
6715   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
6716else
6717   AC_MSG_RESULT([no])
6718   WITH_CATB_FONTS=NO
6719fi
6720
6721dnl ===================================================================
6722dnl Test whether to include category-A fonts
6723dnl ===================================================================
6724WITH_CATA_FONTS=
6725AC_MSG_CHECKING([whether to include category A fonts])
6726if test "x$with_fonts" != "xno" ; then
6727  AC_MSG_RESULT([yes])
6728  WITH_CATA_FONTS=YES
6729  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
6730else
6731  AC_MSG_RESULT([no])
6732  WITH_CATA_FONTS=NO
6733  WITH_CATB_FONTS=NO
6734fi
6735
6736WITH_FONTS=NO
6737AC_MSG_CHECKING([whether any fonts are included])
6738if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
6739  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6740  WITH_FONTS=YES
6741  AC_MSG_RESULT([yes])
6742else
6743  AC_MSG_RESULT([no])
6744fi
6745
6746AC_SUBST(WITH_CATA_FONTS)
6747AC_SUBST(WITH_CATB_FONTS)
6748AC_SUBST(WITH_FONTS)
6749
6750dnl ===================================================================
6751dnl Test whether to include ppds
6752dnl ===================================================================
6753AC_MSG_CHECKING([whether to include PPDs])
6754if test "$with_ppds" != "no"; then
6755  AC_MSG_RESULT([yes])
6756else
6757  AC_MSG_RESULT([no])
6758  WITHOUT_PPDS=YES
6759  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6760fi
6761AC_SUBST(WITHOUT_PPDS)
6762
6763dnl ===================================================================
6764dnl Test whether to include afms
6765dnl ===================================================================
6766AC_MSG_CHECKING([whether to include AFMs])
6767if test "$with_afms" != "no"; then
6768  AC_MSG_RESULT([yes])
6769  BUILD_TYPE="$BUILD_TYPE AFMS"
6770else
6771  AC_MSG_RESULT([no])
6772  WITHOUT_AFMS=YES
6773  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6774fi
6775AC_SUBST(WITHOUT_AFMS)
6776
6777AC_SUBST(SCPDEFS)
6778
6779AC_MSG_CHECKING([whether and how to use Xinerama])
6780if test "$_os" = "Darwin"; then
6781   USE_XINERAMA=YES
6782   XINERAMA_LINK=dynamic
6783   AC_MSG_RESULT([yes])
6784elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6785   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6786      # we have both versions, let the user decide but use the dynamic one
6787      # per default
6788      USE_XINERAMA=YES
6789      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6790         XINERAMA_LINK=dynamic
6791      else
6792         XINERAMA_LINK=static
6793      fi
6794   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6795      # we have only the dynamic version
6796      USE_XINERAMA=YES
6797      XINERAMA_LINK=dynamic
6798   elif test -e "$XLIB/libXinerama.a"; then
6799      # static version
6800      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6801         USE_XINERAMA=YES
6802         XINERAMA_LINK=static
6803      else
6804         USE_XINERAMA=NO
6805         XINERAMA_LINK=none
6806      fi
6807   else
6808      # no Xinerama
6809      USE_XINERAMA=NO
6810      XINERAMA_LINK=none
6811   fi
6812   if test "$USE_XINERAMA" = "YES"; then
6813      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6814      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6815          [AC_MSG_ERROR(Xinerama header not found.)], [])
6816      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6817      if test "$_os" = "FreeBSD"; then
6818          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6819      fi
6820      if test "$_os" = "Linux"; then
6821          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6822      fi
6823      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6824          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6825   else
6826      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6827   fi
6828else
6829   AC_MSG_RESULT([no])
6830fi
6831AC_SUBST(USE_XINERAMA)
6832AC_SUBST(XINERAMA_LINK)
6833
6834dnl ===================================================================
6835dnl always rely on the system version of gdk-pixbuf
6836dnl ===================================================================
6837
6838SYSTEM_GDKPIXBUF=YES
6839AC_SUBST(SYSTEM_GDKPIXBUF)
6840
6841dnl ===================================================================
6842dnl always rely on the system version of glib
6843dnl ===================================================================
6844
6845SYSTEM_GLIB=YES
6846AC_SUBST(SYSTEM_GLIB)
6847
6848dnl ===================================================================
6849dnl always rely on the system version of gettext
6850dnl ===================================================================
6851
6852SYSTEM_GETTEXT=YES
6853AC_SUBST(SYSTEM_GETTEXT)
6854
6855if test "$_os" = "FreeBSD"; then
6856    LIBINTL_PREFIX=
6857    for dir in $CPPFLAGS; do
6858      if dir=`expr -- $dir : '-I\(.*\)'`; then
6859        if test -f "$dir/libintl.h" ; then
6860          LIBINTL_PREFIX=`dirname $dir`
6861        fi
6862      fi
6863    done
6864    AC_SUBST(LIBINTL_PREFIX)
6865fi
6866
6867dnl ===================================================================
6868dnl always rely on the system version of pango
6869dnl ===================================================================
6870
6871SYSTEM_PANGO=YES
6872AC_SUBST(SYSTEM_PANGO)
6873
6874dnl ===================================================================
6875dnl Test whether to build libpng or rely on the system version
6876dnl ===================================================================
6877AC_MSG_CHECKING([whether to build own version of libpng])
6878
6879case "$_os" in
6880	WINNT*) # Windows
6881	    SYSTEM_LIBPNG=NO
6882	    AC_MSG_RESULT([yes])
6883		;;
6884	Darwin*)
6885	    SYSTEM_LIBPNG=NO
6886	    AC_MSG_RESULT([yes])
6887	    ;;
6888   *)
6889   SYSTEM_LIBPNG=YES
6890   AC_MSG_RESULT([no])
6891   ;;
6892esac
6893AC_SUBST(SYSTEM_LIBPNG)
6894
6895dnl ===================================================================
6896dnl Test whether to build libjpeg or rely on the system version
6897dnl ===================================================================
6898dnl FIXME: this is currently because we have jpeg-6b for our filters
6899dnl        and jpeg-8 as dependency for librsvg
6900dnl        this should be unified into using only one version for both
6901
6902AC_MSG_CHECKING([whether to build own version of libjpeg])
6903
6904if test "$SYSTEM_JPEG" = "YES"; then
6905SYSTEM_LIBJPEG=YES
6906else
6907case "$_os" in
6908	WINNT*) # Windows
6909	    SYSTEM_LIBJPEG=NO
6910		;;
6911	Darwin*)
6912	    SYSTEM_LIBJPEG=NO
6913	    ;;
6914   *)
6915        SYSTEM_LIBJPEG=YES
6916        ;;
6917esac
6918fi
6919
6920if test "$SYSTEM_LIBJPEG" = "YES"; then
6921   AC_MSG_RESULT([no])
6922else
6923   AC_MSG_RESULT([yes])
6924fi
6925AC_SUBST(SYSTEM_LIBJPEG)
6926
6927dnl ===================================================================
6928dnl Test whether rat scan was requested and whether apache-rat is available
6929dnl ===================================================================
6930RAT_JAR=
6931AC_MSG_CHECKING([whether to trigger rat scan])
6932if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
6933    AC_MSG_RESULT([no])
6934else
6935    if test "$WITH_JAVA" = "no"; then
6936        AC_MSG_ERROR([no, java disabled, enable with --with-java])
6937    elif test "$enable_saxon" = "no"; then
6938        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
6939    elif test "$with_rat_scan" = "yes"; then
6940        AC_MSG_RESULT([yes, use pre-built library])
6941        RAT_JAR_HOME="BUILD"
6942        BUILD_TYPE="$BUILD_TYPE RAT"
6943    else
6944        AC_MSG_RESULT([yes, use pre-installed library])
6945        AC_MSG_CHECKING([whether apache-rat is available])
6946        if test -d "$with_rat_scan"; then
6947            RAT_JAR_HOME=$with_rat_scan
6948        else
6949            AC_MSG_ERROR([$with_rat_scan is not a directory])
6950        fi
6951    fi
6952fi
6953AC_SUBST(RAT_JAR_HOME)
6954
6955
6956dnl ===================================================================
6957dnl Test for the presence of Ant and that it works
6958dnl ===================================================================
6959
6960if test "$SOLAR_JAVA" != ""; then
6961ANT_HOME=; export ANT_HOME
6962WITH_ANT_HOME=; export WITH_ANT_HOME
6963if test -z "$with_ant_home"; then
6964   if test "$_os" = "OS2"; then
6965     AC_PATH_PROGS(ANT, ant.cmd)
6966   else
6967     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
6968   fi
6969else
6970   if test "$_os" = "WINNT"; then
6971      with_ant_home=`cygpath -u "$with_ant_home"`
6972   fi
6973   if test "$_os" = "OS2"; then
6974     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
6975   else
6976     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
6977   fi
6978   WITH_ANT_HOME=$with_ant_home
6979   ANT_HOME=$with_ant_home
6980fi
6981
6982if test -z "$ANT"; then
6983  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
6984else
6985  # resolve relative or absolute symlink
6986  while test -h "$ANT"; do
6987     a_cwd=`pwd`
6988     a_basename=`basename "$ANT"`
6989     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
6990     cd "`dirname "$ANT"`"
6991     cd "`dirname "$a_script"`"
6992     ANT="`pwd`"/"`basename "$a_script"`"
6993     cd "$a_cwd"
6994  done
6995
6996  if test "$_os" = "OS2"; then
6997    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
6998    export ANT_HOME
6999  fi
7000
7001  AC_MSG_CHECKING([if $ANT works])
7002cat > conftest.java << EOF
7003    public class conftest {
7004	int testmethod(int a, int b) {
7005            return a + b;
7006	}
7007    }
7008EOF
7009
7010cat > conftest.xml << EOF
7011    <project name="conftest" default="conftest">
7012	<target name="conftest">
7013            <javac srcdir="." includes="conftest.java">
7014	    </javac>
7015	</target>
7016    </project>
7017EOF
7018  oldJAVA_HOME=$JAVA_HOME
7019  if test "$JAVACISGCJ" = "yes"; then
7020    JAVA_HOME=; export JAVA_HOME
7021    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7022  else
7023    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7024  fi
7025  AC_TRY_EVAL(ant_cmd)
7026  if test $? = 0 && test -f ./conftest.class ; then
7027    AC_MSG_RESULT([Ant works])
7028    if test -z "$WITH_ANT_HOME"; then
7029        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7030        if test -z "$ANT_HOME"; then
7031            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7032        fi
7033    else
7034        ANT_HOME="$WITH_ANT_HOME"
7035    fi
7036  else
7037    echo "configure: Ant test failed" >&5
7038    cat conftest.java >&5
7039    cat conftest.xml >&5
7040    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7041    ANT_HOME=""
7042    echo "Ant does not work - Some Java projects will not build!" >>warn
7043  fi
7044  JAVA_HOME=$oldJAVA_HOME
7045  rm -f conftest* core core.* *.core
7046fi
7047if test -z "$ANT_HOME"; then
7048   ANT_HOME="NO_ANT_HOME"
7049fi
7050AC_SUBST(ANT_HOME)
7051
7052dnl Checking for ant.jar
7053if test "$ANT_HOME" != "NO_ANT_HOME"; then
7054   AC_MSG_CHECKING([Ant lib directory])
7055   if test -f $ANT_HOME/lib/ant.jar; then
7056	  ANT_LIB="$ANT_HOME/lib"
7057   else
7058      if test -f $ANT_HOME/ant.jar; then
7059	     ANT_LIB="$ANT_HOME"
7060      else
7061          if test -f /usr/share/java/ant.jar; then
7062              ANT_LIB=/usr/share/java
7063          else
7064             if test -f /usr/share/ant-core/lib/ant.jar; then
7065                 ANT_LIB=/usr/share/ant-core/lib
7066             else
7067                if test -f $ANT_HOME/lib/ant/ant.jar; then
7068                    ANT_LIB="$ANT_HOME/lib/ant"
7069                else
7070                   if test -f /usr/share/lib/ant/ant.jar; then
7071                       ANT_LIB=/usr/share/lib/ant
7072                   else
7073                       AC_MSG_ERROR([Ant libraries not found!])
7074                   fi
7075                fi
7076             fi
7077          fi
7078      fi
7079   fi
7080   AC_MSG_RESULT([Ant lib directory found.])
7081fi
7082AC_SUBST(ANT_LIB)
7083fi
7084
7085ant_minver=1.6.0
7086# update for more extensions...
7087if test "$ENABLE_MEDIAWIKI" = "YES"; then
7088  ant_minver=1.7.0
7089fi
7090ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7091
7092AC_MSG_CHECKING([whether ant is >= $ant_minver])
7093ant_version=`$ANT -version | $AWK '{ print $4; }'`
7094ant_version_major=`echo $ant_version | cut -d. -f1`
7095ant_version_minor=`echo $ant_version | cut -d. -f2`
7096echo "configure: ant_version $ant_version " >&5
7097echo "configure: ant_version_major $ant_version_major " >&5
7098echo "configure: ant_version_minor $ant_version_minor " >&5
7099if test "$ant_version_major" -ge "2"; then
7100   AC_MSG_RESULT([yes, $ant_version])
7101elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7102   AC_MSG_RESULT([yes, $ant_version])
7103else
7104   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7105fi
7106
7107if test "$ENABLE_MEDIAWIKI" = "YES"; then
7108AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7109rm -rf confdir
7110mkdir confdir
7111cat > conftest.java << EOF
7112    public class conftest {
7113        int testmethod(int a, int b) {
7114            return a + b;
7115        }
7116    }
7117EOF
7118
7119cat > conftest.xml << EOF
7120    <project name="conftest" default="conftest">
7121        <target name="conftest" depends="copytest">
7122            <javac srcdir="." includes="conftest.java">
7123            </javac>
7124        </target>
7125        <target name="copytest">
7126             <copy todir="confdir">
7127                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7128                 <filterset/>
7129                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7130             </copy>
7131        </target>
7132    </project>
7133EOF
7134  if test "$JAVACISGCJ" = "yes"; then
7135    JAVA_HOME=; export JAVA_HOME
7136    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7137  else
7138    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7139  fi
7140  AC_TRY_EVAL(ant_cmd)
7141  if test $? = 0 && test -f ./conftest.class ; then
7142    AC_MSG_RESULT([yes])
7143    rm -rf confdir
7144  else
7145    echo "configure: Ant test failed" >&5
7146    cat conftest.java >&5
7147    cat conftest.xml >&5
7148    rm -rf confdir
7149    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7150  fi
7151fi
7152rm -f conftest* core core.* *.core
7153
7154OOO_JUNIT_JAR=
7155if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7156    AC_MSG_CHECKING([for JUnit 4])
7157    if test "$with_junit" = "yes"; then
7158        if test -e /usr/share/java/junit4.jar; then
7159            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7160        else
7161           if test -e /usr/share/lib/java/junit.jar; then
7162              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7163           else
7164              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7165           fi
7166        fi
7167    else
7168        OOO_JUNIT_JAR=$with_junit
7169    fi
7170    if test "$_os" = "WINNT"; then
7171        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7172    fi
7173    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7174        grep org/junit/Before.class > /dev/null 2>&5
7175    if test $? -eq 0; then
7176        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7177    else
7178        AC_MSG_RESULT([no])
7179        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7180location (/usr/share/java), specify its pathname via
7181--with-junit=..., or disable it via --without-junit])
7182    fi
7183fi
7184AC_SUBST(OOO_JUNIT_JAR)
7185
7186AC_MSG_CHECKING([which languages to be built])
7187WITH_LANG="$with_lang"
7188if test -z "$WITH_LANG"; then
7189   AC_MSG_RESULT([en-US])
7190else
7191   AC_MSG_RESULT([$WITH_LANG])
7192   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7193   BUILD_TYPE="$BUILD_TYPE L10N"
7194fi
7195AC_SUBST(WITH_LANG)
7196
7197AC_MSG_CHECKING([which languages have poor help localizations])
7198WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7199if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7200   AC_MSG_RESULT([none])
7201else
7202   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7203fi
7204AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7205
7206AC_MSG_CHECKING([which dictionaries to include])
7207if test -z "$with_dict"; then
7208   WITH_DICT=,ALL,
7209   AC_MSG_RESULT([ALL])
7210else
7211   WITH_DICT=","$with_dict","
7212   AC_MSG_RESULT([$with_dict])
7213fi
7214AC_SUBST(WITH_DICT)
7215
7216AC_MSG_CHECKING([for additional 'intro' bitmaps])
7217INTRO_BITMAPS=
7218if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7219   INTRO_BITMAPS=
7220   AC_MSG_RESULT([none])
7221else
7222   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7223      case "$bitmap" in
7224         *.png) ;;
7225         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .png files!]) ;;
7226      esac
7227      if test -n "$bitmap" ; then
7228         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7229      fi
7230   done
7231   AC_MSG_RESULT([$INTRO_BITMAPS])
7232fi
7233AC_SUBST(INTRO_BITMAPS)
7234
7235AC_MSG_CHECKING([for additional 'about' bitmaps])
7236ABOUT_BITMAPS=
7237if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7238   ABOUT_BITMAPS=
7239   AC_MSG_RESULT([none])
7240else
7241   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7242      case "$bitmap" in
7243         *.png) ;;
7244         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .png files!]) ;;
7245      esac
7246      if test -n "$bitmap" ; then
7247         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7248      fi
7249   done
7250   AC_MSG_RESULT([$ABOUT_BITMAPS])
7251fi
7252AC_SUBST(ABOUT_BITMAPS)
7253
7254OOO_VENDOR=
7255AC_MSG_CHECKING([for vendor])
7256if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7257   AC_MSG_RESULT([not set])
7258else
7259   OOO_VENDOR="$with_vendor"
7260   AC_MSG_RESULT([$OOO_VENDOR])
7261fi
7262AC_SUBST(OOO_VENDOR)
7263
7264UNIXWRAPPERNAME=
7265AC_MSG_CHECKING([for UNIX wrapper name])
7266if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7267   AC_MSG_RESULT([not set])
7268else
7269   UNIXWRAPPERNAME="$with_unix_wrapper"
7270   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7271fi
7272AC_SUBST(UNIXWRAPPERNAME)
7273
7274AC_MSG_CHECKING([whether to statically link to Gtk])
7275if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7276   ENABLE_STATIC_GTK="TRUE"
7277   AC_MSG_RESULT([yes])
7278else
7279   ENABLE_STATIC_GTK="FALSE"
7280   AC_MSG_RESULT([no])
7281fi
7282AC_SUBST(ENABLE_STATIC_GTK)
7283
7284AC_MSG_CHECKING([whether to use layout dialogs])
7285if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7286   ENABLE_LAYOUT="TRUE"
7287   AC_MSG_RESULT([yes])
7288else
7289   ENABLE_LAYOUT="FALSE"
7290   AC_MSG_RESULT([no])
7291fi
7292AC_SUBST(ENABLE_LAYOUT)
7293
7294# ===================================================================
7295# De- or increase default verbosity of build process
7296# ===================================================================
7297AC_MSG_CHECKING([build verbosity])
7298if test -n "$enable_verbose"; then
7299   if test "$enable_verbose" = "yes"; then
7300      VERBOSE="TRUE"
7301      AC_MSG_RESULT([high])
7302   fi
7303   if test "$enable_verbose" = "no"; then
7304      VERBOSE="FALSE"
7305      AC_MSG_RESULT([low])
7306   fi
7307else
7308   AC_MSG_RESULT([not set])
7309fi
7310AC_SUBST(VERBOSE)
7311
7312dnl ===================================================================
7313dnl Hook up OOos nodep environmental variable to automake's equivalent
7314dnl --enable-dependency-tracking configure option
7315dnl ===================================================================
7316AC_MSG_CHECKING([whether to enable dependency tracking])
7317if test "$enable_dependency_tracking" = "no"; then
7318    nodep=TRUE
7319    AC_MSG_RESULT([no])
7320else
7321    AC_MSG_RESULT([yes])
7322fi
7323AC_SUBST(nodep)
7324
7325dnl ===================================================================
7326dnl Setting up the environment.
7327dnl ===================================================================
7328echo "********************************************************************"
7329echo "*                                                                  *"
7330echo "*   Setting up the build environment variables.                    *"
7331echo "*                                                                  *"
7332echo "********************************************************************"
7333
7334if test -z "$COMPATH"; then
7335   AC_MSG_ERROR([No compiler found.])
7336fi
7337AC_SUBST(COMPATH)
7338AC_SUBST(CC_PATH)
7339
7340AC_MSG_CHECKING([solver path])
7341if test -z "$with_local_solver"; then
7342   LOCAL_SOLVER="DEFAULT"
7343   AC_MSG_RESULT([default])
7344else
7345   LOCAL_SOLVER=$with_local_solver
7346   AC_MSG_RESULT([$with_local_solver])
7347fi
7348AC_SUBST(LOCAL_SOLVER)
7349
7350AC_SUBST(BUILD_TYPE)
7351AC_SUBST(ADDITIONAL_REPOSITORIES)
7352
7353# make sure config.guess is +x; we execute config.guess, so it has to be so;
7354chmod +x ./config.guess
7355
7356# Create files from their *.in templates.
7357AC_CONFIG_FILES([set_soenv Makefile])
7358
7359AC_MSG_NOTICE([writing config.status])
7360AC_OUTPUT
7361
7362dnl Executing the set_soenv script to setup the environment variables.
7363chmod a+x set_soenv
7364if test -z "$enable_check_only"; then
7365   './set_soenv'
7366else
7367   echo
7368   echo Test Complete
7369   echo No environment file will be generated
7370   echo
7371   num_warnings=`wc -l warn`
7372   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7373   if test $_num -gt 0; then
7374      echo The following warning\(s\) were generated by configure
7375      echo ----------------------------------------------------
7376      echo
7377      cat warn
7378      echo
7379   else
7380      echo There were no warnings
7381   fi
7382   echo
7383fi
7384