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