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