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