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