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