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