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