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