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