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