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