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