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