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