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