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