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