xref: /aoo42x/main/configure.ac (revision e3bd0393)
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   _python_hexversion=`$_python -c "import sys; print(sys.hexversion);"`
4052
4053   dnl hex version of Python 2.7.1 = 34013680
4054   if test $_python_hexversion -ge 34013680 ; then
4055      AC_MSG_RESULT([compiling against system python (version $_python_version)])
4056
4057	  _python_ver=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4058
4059   	  PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4060   else
4061		AC_MSG_ERROR([Python 2.7.1 or higher is required])
4062   fi
4063
4064   PYTHON_LIBS="-framework Python"
4065elif test -n "$with_system_python" -o -n "$with_system_libs" && \
4066	test "$with_system_python" != "no"; then
4067   with_system_python=yes
4068   AC_MSG_RESULT([external])
4069   AM_PATH_PYTHON([2.3])
4070
4071   python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
4072   python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4073   PYTHON_CFLAGS="-I$python_include"
4074   PYTHON_LIBS="-lpython$python_version"
4075fi
4076if test "$with_system_python" = "yes" ; then
4077   SYSTEM_PYTHON=YES
4078   dnl check if the headers really work:
4079   save_CPPFLAGS="$CPPFLAGS"
4080   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4081   AC_CHECK_HEADER(Python.h, [],
4082       [AC_MSG_ERROR(Python headers not found)], [])
4083   CPPFLAGS="$save_CPPFLAGS"
4084else
4085   SYSTEM_PYTHON=NO
4086   BUILD_TYPE="$BUILD_TYPE PYTHON"
4087   AC_MSG_RESULT([internal])
4088   # Embedded python dies without Home set
4089   if test "z$HOME" = "z"; then
4090      export HOME="";
4091   fi
4092   # bz2 tarball and bzip2 is not standard
4093   if test -z "$BZIP2"; then
4094	AC_PATH_PROG( BZIP2, bzip2)
4095	if test -z "$BZIP2"; then
4096   		AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
4097   	fi
4098   fi
4099fi
4100AC_SUBST(SYSTEM_PYTHON)
4101AC_SUBST(PYTHON_CFLAGS)
4102AC_SUBST(PYTHON_LIBS)
4103HOME=`echo $HOME | sed 's:\\\\:/:g'`
4104AC_SUBST(HOME)
4105
4106dnl ===================================================================
4107dnl Check for system lucene
4108dnl ===================================================================
4109AC_MSG_CHECKING([which lucene to use])
4110if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4111       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4112        AC_MSG_RESULT([external])
4113        SYSTEM_LUCENE=YES
4114        if test -z $LUCENE_CORE_JAR; then
4115          AC_CHECK_FILE(/usr/share/java/lucene-core-2.9.4.jar,
4116            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.9.4.jar ],
4117            [
4118              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4119                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4120                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4121                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4122                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4123                  )
4124                ]
4125              )
4126            ]
4127          )
4128        else
4129          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4130               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
4131        fi
4132
4133        if test -z $LUCENE_ANALYZERS_JAR; then
4134          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
4135            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
4136            [
4137              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
4138                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
4139                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
4140              )
4141            ]
4142          )
4143        else
4144          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4145               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
4146        fi
4147        AC_MSG_CHECKING([whether lucene is version 2.x])
4148        export LUCENE_CORE_JAR
4149        if $PERL -e 'use Archive::Zip;
4150            my $file = "$ENV{'LUCENE_CORE_JAR'}";
4151            my $zip = Archive::Zip->new( $file );
4152            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4153            if ( $mf =~ m/Specification-Version: 2.*/ ) {
4154                exit 0;
4155            } else {
4156                exit 1;
4157            }'; then
4158            AC_MSG_RESULT([yes])
4159         else
4160            AC_MSG_RESULT([no])
4161            AC_MSG_CHECKING([whether lucene is version 3.x])
4162
4163            if $PERL -e 'use Archive::Zip;
4164                my $file = "$ENV{'LUCENE_CORE_JAR'}";
4165                my $zip = Archive::Zip->new( $file );
4166                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4167                if ( $mf =~ m/Specification-Version: 3.*/ ) {
4168                    exit 0;
4169                } else {
4170                    exit 1;
4171                }'; then
4172                AC_MSG_RESULT([yes])
4173             else
4174                AC_MSG_ERROR([no, you need lucene 2 or 3])
4175             fi
4176         fi
4177
4178else
4179    AC_MSG_RESULT([internal])
4180    SYSTEM_LUCENE=NO
4181    BUILD_TYPE="$BUILD_TYPE LUCENE"
4182fi
4183AC_SUBST(SYSTEM_LUCENE)
4184AC_SUBST(LUCENE_CORE_JAR)
4185AC_SUBST(LUCENE_ANALYZERS_JAR)
4186
4187AC_MSG_CHECKING([whether to build the MySQL Connector extension])
4188if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
4189  AC_MSG_RESULT([yes])
4190  ENABLE_MYSQLC=YES
4191  AC_MSG_CHECKING([for mysqlc module])
4192  if test -d mysqlc; then
4193   AC_MSG_RESULT([OK])
4194  else
4195   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4196  fi
4197  BUILD_TYPE="$BUILD_TYPE MYSQLC"
4198else
4199  AC_MSG_RESULT([no])
4200  ENABLE_MYSQLC=NO
4201fi
4202AC_SUBST(ENABLE_MYSQLC)
4203
4204if test "$ENABLE_MYSQLC" = "YES"; then
4205dnl ===================================================================
4206dnl Check for system MySQL
4207dnl ===================================================================
4208AC_MSG_CHECKING([for mysql pre-requisites])
4209if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
4210       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
4211	AC_MSG_RESULT([external MySQL])
4212	SYSTEM_MYSQL=YES
4213	AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4214	AC_MSG_CHECKING([MySQL version])
4215	if test -z "$MYSQLCONFIG" -o ! -x "$MYSQLCONFIG" ; then
4216		AC_MSG_ERROR([can not find/execute mysql_config]);
4217	fi
4218	MYSQL_VERSION=`$MYSQLCONFIG --version`
4219	MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4220	if test "$MYSQL_MAJOR" -ge "5"; then
4221		AC_MSG_RESULT([OK])
4222	else
4223		AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4224	fi
4225	AC_MSG_CHECKING([for MySQL Client library])
4226	MYSQL_INC=`$MYSQLCONFIG --include`
4227	MYSQL_LIB=`$MYSQLCONFIG --libs`
4228	MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4229	AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4230else
4231    SYSTEM_MYSQL=NO
4232    if test -n "$with_libmysql_path"; then
4233        AC_MSG_RESULT([external Connector/C (libmysql)])
4234        LIBMYSQL=libmysql.so
4235        if test "$_os" = "Darwin"; then
4236            LIBMYSQL=libmysql.dylib
4237        elif test "$_os" = "WINNT"; then
4238            LIBMYSQL=libmysql.dll
4239        fi
4240        AC_MSG_CHECKING([for $LIBMYSQL])
4241        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4242            AC_MSG_RESULT([found.])
4243            LIBMYSQL_PATH=$with_libmysql_path
4244        else
4245            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4246        fi
4247    else
4248        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4249    fi
4250fi
4251AC_SUBST(SYSTEM_MYSQL)
4252AC_SUBST(MYSQL_INC)
4253AC_SUBST(MYSQL_LIB)
4254AC_SUBST(MYSQL_DEFINES)
4255AC_SUBST(LIBMYSQL_PATH)
4256
4257AC_LANG_PUSH([C++])
4258dnl ===================================================================
4259dnl Check for system MySQL C++ Connector
4260dnl ===================================================================
4261# FIXME!
4262# who thought this too-generic cppconn dir was a good idea?
4263AC_MSG_CHECKING([MySQL Connector/C++])
4264if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4265		test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4266	AC_MSG_RESULT([external])
4267	SYSTEM_MYSQL_CPPCONN=YES
4268        AC_LANG_PUSH([C++])
4269	AC_CHECK_HEADER(mysql_driver.h, [],
4270					[AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4271	AC_CHECK_LIB(mysqlcppconn, main, [],
4272					[AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4273   AC_MSG_CHECKING([version])
4274      AC_TRY_RUN([
4275#include <mysql_driver.h>
4276
4277int main(int argc, char **argv) {
4278	sql::Driver *driver;
4279	driver = get_driver_instance();
4280	if (driver->getMajorVersion() > 1 || \
4281	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4282	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4283        return 0;
4284      else
4285        return 1;
4286}
4287      ], [AC_MSG_RESULT(OK)], [AC_MSG_ERROR([not suitable, we need >= 1.0.6])])
4288        AC_LANG_POP([C++])
4289
4290else
4291	AC_MSG_RESULT([no])
4292	SYSTEM_MYSQL_CPPCONN=
4293fi
4294AC_LANG_POP([C++])
4295AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4296fi
4297
4298dnl ===================================================================
4299dnl Check for system hsqldb
4300dnl ===================================================================
4301AC_MSG_CHECKING([which hsqldb to use])
4302if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4303       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4304        AC_MSG_RESULT([external])
4305        SYSTEM_HSQLDB=YES
4306        if test -z $HSQLDB_JAR; then
4307               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4308        fi
4309        AC_CHECK_FILE($HSQLDB_JAR, [],
4310               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4311        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4312        export HSQLDB_JAR
4313        if $PERL -e 'use Archive::Zip;
4314            my $file = "$ENV{'HSQLDB_JAR'}";
4315            my $zip = Archive::Zip->new( $file );
4316            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4317            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4318               push @l, split(/\n/, $mf);
4319               foreach my $line (@l) {
4320                  if ($line =~ m/Specification-Version:/) {
4321                      ($t, $version) = split (/:/,$line);
4322                      $version =~ s/^\s//;
4323                      ($a, $b, $c, $d) = split (/\./,$version);
4324                      if ($c == "0" && $d > "8")  {
4325                          exit 0;
4326                      } else {
4327                          exit 1;
4328                      }
4329                  }
4330               }
4331            } else {
4332                exit 1;
4333            }'; then
4334            AC_MSG_RESULT([yes])
4335         else
4336            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
4337         fi
4338else
4339    AC_MSG_RESULT([internal])
4340    SYSTEM_HSQLDB=NO
4341    BUILD_TYPE="$BUILD_TYPE HSQLDB"
4342fi
4343AC_SUBST(SYSTEM_HSQLDB)
4344AC_SUBST(HSQLDB_JAR)
4345
4346dnl ===================================================================
4347dnl Check for system beanshell
4348dnl ===================================================================
4349ENABLE_BEANSHELL=YES
4350AC_MSG_CHECKING([which beanshell to use])
4351if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
4352       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
4353        AC_MSG_RESULT([external])
4354        SYSTEM_BSH=YES
4355        if test -z $BSH_JAR; then
4356               BSH_JAR=/usr/share/java/bsh.jar
4357        fi
4358        AC_CHECK_FILE($BSH_JAR, [],
4359               [AC_MSG_ERROR(bsh.jar not found.)], [])
4360elif test "x$enable_beanshell" = "xyes"; then
4361    AC_MSG_RESULT([internal])
4362    SYSTEM_BSH=NO
4363    BUILD_TYPE="$BUILD_TYPE BSH"
4364else
4365    AC_MSG_RESULT([none (disabled)])
4366    SYSTEM_BSH=NO
4367    ENABLE_BEANSHELL=NO
4368fi
4369AC_SUBST(SYSTEM_BSH)
4370AC_SUBST(BSH_JAR)
4371AC_SUBST(ENABLE_BEANSHELL)
4372
4373
4374dnl ===================================================================
4375dnl Check for saxon.  It can come from two different places:
4376dnl - pre-installed on the system.  This is checked when the --with-system-saxon
4377dnl   option is given to configure.
4378dnl   The exact place can be specified with the --with-saxon-jar=<path> option.
4379dnl - From the saxon tar ball in ext_sources/.  This is used when --enable-saxon
4380dnl   is given to configure but not any of --with-system-saxon or --with-saxon-jar.
4381dnl ===================================================================
4382DISABLE_SAXON=
4383AC_MSG_CHECKING([which saxon to use])
4384if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
4385       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
4386        AC_MSG_RESULT([external])
4387        SYSTEM_SAXON=YES
4388        if test -z $SAXON_JAR; then
4389          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4390            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4391            [
4392              AC_CHECK_FILE(/usr/share/java/saxon.jar,
4393                [ SAXON_JAR=/usr/share/java/saxon.jar ],
4394                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4395                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4396                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
4397                  )
4398                ]
4399              )
4400            ]
4401          )
4402        else
4403          AC_CHECK_FILE($SAXON_JAR, [],
4404               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
4405        fi
4406        if test -n "$SERIALIZER_JAR"; then
4407          AC_CHECK_FILE($SERIALIZER_JAR, [],
4408               [AC_MSG_ERROR(serializer.jar not found.)], [])
4409          AC_SUBST(SERIALIZER_JAR)
4410        fi
4411
4412dnl Saxon comes in two practically available versions, the out-of-date saxonb which
4413dnl supports the java extensions that OOo uses, and the up-to-date saxon he
4414dnl "home edition" version, which is crippled to not support those java extensions.
4415dnl And as an aside the he one also needs to be tweaked to include
4416dnl a META-INF/services to broadcast that it supports the jaxp transform factory
4417
4418        AC_MSG_CHECKING([if saxon works])
4419        cat > saxontest.java <<_ACEOF
4420[import javax.xml.transform.TransformerFactory;
4421import javax.xml.transform.Transformer;
4422import javax.xml.transform.stream.StreamSource;
4423import java.io.*;
4424
4425import net.sf.saxon.FeatureKeys;
4426
4427class saxontest {
4428    public static void main(String[] args) {
4429      System.setProperty("javax.xml.transform.TransformerFactory",
4430        "net.sf.saxon.TransformerFactoryImpl");
4431      try {
4432        TransformerFactory tfactory = TransformerFactory.newInstance();
4433	// some external saxons (Debian, Ubuntu, ...) have this disabled
4434	// per default
4435	tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
4436        System.out.println("TransformerFactory is" +
4437          tfactory.getClass().getName());
4438        Transformer transformer = tfactory.newTransformer(
4439          new StreamSource(new File(args[0])));
4440      } catch(Exception e){
4441        e.printStackTrace(System.err);
4442        System.exit(-1);
4443      }
4444      System.exit(0);
4445    }
4446}
4447]
4448_ACEOF
4449        cat > saxontest.xsl<<_ACEOF
4450[<?xml version="1.0" encoding="UTF-8"?>
4451<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4452 <xsl:template match="/">
4453  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
4454 </xsl:template>
4455</xsl:stylesheet>
4456]
4457_ACEOF
4458        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
4459        AC_TRY_EVAL(javac_cmd)
4460        if test $? = 0 && test -f ./saxontest.class ; then
4461            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
4462            AC_TRY_EVAL(java_cmd)
4463            if test $? = 0; then
4464              AC_MSG_RESULT([yes])
4465            else
4466              cat saxontest.java >&5
4467              AC_MSG_RESULT([no])
4468              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
4469            fi
4470        else
4471          AC_MSG_RESULT([no])
4472          cat saxontest.java >&5
4473          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
4474        fi
4475elif test "x$enable_saxon" = "xyes"; then
4476    AC_MSG_RESULT([internal])
4477    SYSTEM_SAXON=NO
4478    BUILD_TYPE="$BUILD_TYPE SAXON"
4479else
4480    AC_MSG_RESULT([none (disabled)])
4481    SYSTEM_SAXON=NO
4482    DISABLE_SAXON=YES
4483fi
4484AC_SUBST(SYSTEM_SAXON)
4485AC_SUBST(SAXON_JAR)
4486AC_SUBST(DISABLE_SAXON)
4487
4488
4489dnl ===================================================================
4490dnl Check for rhino
4491dnl ===================================================================
4492ENABLE_JAVASCRIPT=
4493AC_MSG_CHECKING([whether to enable support for JavaScript])
4494if test "x$enable_javascript" = "xyes"; then
4495   BUILD_TYPE="$BUILD_TYPE RHINO"
4496   AC_MSG_RESULT([yes])
4497   ENABLE_JAVASCRIPT=YES
4498else
4499   AC_MSG_RESULT([no])
4500   ENABLE_JAVASCRIPT=NO
4501fi
4502AC_SUBST(ENABLE_JAVASCRIPT)
4503
4504
4505dnl ===================================================================
4506dnl Check for system apr
4507dnl ===================================================================
4508SYSTEM_APR=NO
4509APR_CFLAGS=
4510APR_LIBS=
4511AC_MSG_CHECKING([which libapr to use])
4512if test "x$with_system_apr" = "xyes" -o -n "$with_system_libs"; then
4513    AC_MSG_RESULT([system])
4514    PKG_CHECK_MODULES([APR], [apr-1 >= 1.0])
4515    SYSTEM_APR=YES
4516else
4517    AC_MSG_RESULT([internal])
4518    SYSTEM_APR=NO
4519    BUILD_TYPE="$BUILD_TYPE APR"
4520fi
4521AC_SUBST(SYSTEM_APR)
4522AC_SUBST(APR_CFLAGS)
4523AC_SUBST(APR_LIBS)
4524
4525
4526dnl ===================================================================
4527dnl Check for system apr-util
4528dnl ===================================================================
4529SYSTEM_APR_UTIL=NO
4530APR_UTIL_CFLAGS=
4531APR_UTIL_LIBS=
4532AC_MSG_CHECKING([which libapr-util to use])
4533if test "x$with_system_apr_util" = "xyes" -o -n "$with_system_libs"; then
4534    AC_MSG_RESULT([system])
4535    PKG_CHECK_MODULES([APR_UTIL], [apr-util-1 >= 1.0])
4536    SYSTEM_APR_UTIL=YES
4537else
4538    AC_MSG_RESULT([internal])
4539    SYSTEM_APR_UTIL=NO
4540    BUILD_TYPE="$BUILD_TYPE APR_UTIL"
4541fi
4542AC_SUBST(SYSTEM_APR_UTIL)
4543AC_SUBST(APR_UTIL_CFLAGS)
4544AC_SUBST(APR_UTIL_LIBS)
4545
4546
4547dnl ===================================================================
4548dnl Check for system serf
4549dnl ===================================================================
4550SYSTEM_SERF=NO
4551SERF_CFLAGS=
4552SERF_LIBS=
4553AC_MSG_CHECKING([which libserf to use])
4554if test -n "$with_system_serf" -o -n "$with_system_libs" && \
4555  test "$with_system_serf" != "no"; then
4556    AC_MSG_RESULT([system])
4557    PKG_CHECK_MODULES([SERF], [serf-1 >= 1.1])
4558    SYSTEM_SERF=YES
4559else
4560    AC_MSG_RESULT([internal])
4561    SYSTEM_SERF=NO
4562    BUILD_TYPE="$BUILD_TYPE SERF"
4563fi
4564AC_SUBST(SYSTEM_SERF)
4565AC_SUBST(SERF_CFLAGS)
4566AC_SUBST(SERF_LIBS)
4567
4568
4569dnl ===================================================================
4570dnl Check for CoinMP
4571dnl ===================================================================
4572ENABLE_COINMP=
4573SYSTEM_COINMP=NO
4574COINMP_CFLAGS=
4575COINMP_LIBS=
4576AC_MSG_CHECKING([whether to enable support for CoinMP])
4577if test "x$enable_coinmp" = "xyes"; then
4578    BUILD_TYPE="$BUILD_TYPE COINMP"
4579    AC_MSG_RESULT([yes])
4580    ENABLE_COINMP=YES
4581
4582    dnl Check wether to use system or internal CoinMP
4583    AC_MSG_CHECKING([which coinmp to use])
4584    if test "x$with_system_coinmp" = "xyes" -o -n "$with_system_libs"; then
4585        AC_MSG_RESULT([system])
4586	PKG_CHECK_MODULES([COINMP], [coinmp])
4587        SYSTEM_COINMP=YES
4588        # some systems need this. Like Ubuntu....
4589        AC_CHECK_LIB(m, floor)
4590        AC_CHECK_LIB(dl, dlopen)
4591    else
4592        AC_MSG_RESULT([internal])
4593        SYSTEM_COINMP=NO
4594        BUILD_TYPE="$BUILD_TYPE COINMP"
4595    fi
4596else
4597    AC_MSG_RESULT([no])
4598    ENABLE_COINMP=NO
4599fi
4600AC_SUBST(ENABLE_COINMP)
4601AC_SUBST(SYSTEM_COINMP)
4602AC_SUBST(COINMP_CFLAGS)
4603AC_SUBST(COINMP_LIBS)
4604
4605
4606dnl ===================================================================
4607dnl Check for system curl
4608dnl ===================================================================
4609if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
4610   with_system_curl=yes
4611fi
4612AC_MSG_CHECKING([which curl to use])
4613if test -n "$with_system_curl" -o -n "$with_system_libs" && \
4614	test "$with_system_curl" != "no"; then
4615   AC_MSG_RESULT([external])
4616   SYSTEM_CURL=YES
4617
4618   AC_PATH_PROG( CURLCONFIG, curl-config)
4619   if test -z "$CURLCONFIG"; then
4620      AC_MSG_ERROR([install curl to run this script])
4621   fi
4622
4623   # check curl version
4624   AC_MSG_CHECKING([whether curl is >= 7.13.1])
4625   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
4626	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
4627	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
4628      AC_MSG_ERROR([no, you need at least curl 7.13,1])
4629   else
4630      AC_MSG_RESULT([yes])
4631   fi
4632   CURL_LIBS=`$CURLCONFIG --libs`
4633   CURL_CFLAGS=`$CURLCONFIG --cflags`
4634else
4635   AC_MSG_RESULT([internal])
4636   SYSTEM_CURL=NO
4637   BUILD_TYPE="$BUILD_TYPE CURL"
4638fi
4639AC_SUBST(SYSTEM_CURL)
4640AC_SUBST(CURL_CFLAGS)
4641AC_SUBST(CURL_LIBS)
4642
4643dnl ===================================================================
4644dnl Check for system mdds
4645dnl ===================================================================
4646AC_MSG_CHECKING([which mdds to use])
4647if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
4648	test "$with_system_mdds" != "no"; then
4649    AC_MSG_RESULT([external])
4650    SYSTEM_MDDS=YES
4651    AC_LANG_PUSH([C++])
4652    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
4653        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
4654    AC_LANG_POP([C++])
4655else
4656   AC_MSG_RESULT([internal])
4657   BUILD_TYPE="$BUILD_TYPE MDDS"
4658   SYSTEM_MDDS=NO
4659fi
4660AC_SUBST(SYSTEM_MDDS)
4661
4662dnl ===================================================================
4663dnl Check for system boost
4664dnl ===================================================================
4665AC_MSG_CHECKING([which boost to use])
4666if test -n "$with_system_boost" -o -n "$with_system_headers" && \
4667	test "$with_system_boost" != "no"; then
4668   AC_MSG_RESULT([external])
4669   SYSTEM_BOOST=YES
4670   AC_LANG_PUSH([C++])
4671   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
4672       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
4673   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
4674       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
4675   AC_CHECK_HEADER(boost/function.hpp, [],
4676       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
4677
4678   save_CXXFLAGS=$CXXFLAGS
4679   CXXFLAGS="$CXXFLAGS -fno-exceptions"
4680   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
4681   AC_TRY_COMPILE([#include <boost/function.hpp>
4682], [],
4683   ac_cv_cxx_boost_no_exceptons_broken=no, ac_cv_cxx_boost_no_exceptons_broken=yes)
4684
4685   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
4686	AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
4687   else
4688  	AC_MSG_RESULT([yes])
4689   fi
4690   CXXFLAGS=$save_CXXFLAGS
4691   AC_LANG_POP([C++])
4692else
4693   AC_MSG_RESULT([internal])
4694   BUILD_TYPE="$BUILD_TYPE BOOST"
4695   SYSTEM_BOOST=NO
4696fi
4697AC_SUBST(SYSTEM_BOOST)
4698
4699dnl ===================================================================
4700dnl Check for system vigra
4701dnl ===================================================================
4702AC_MSG_CHECKING([which vigra to use])
4703if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
4704	test "$with_system_vigra" != "no"; then
4705   AC_MSG_RESULT([external])
4706   SYSTEM_VIGRA=YES
4707   AC_LANG_PUSH([C++])
4708   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
4709       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
4710   AC_LANG_POP([C++])
4711else
4712   AC_MSG_RESULT([internal])
4713   BUILD_TYPE="$BUILD_TYPE VIGRA"
4714   SYSTEM_VIGRA=NO
4715fi
4716AC_SUBST(SYSTEM_VIGRA)
4717
4718dnl ===================================================================
4719dnl Check for system odbc
4720dnl ===================================================================
4721AC_MSG_CHECKING([which odbc headers to use])
4722if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
4723	test "$with_system_odbc_headers" != "no"; then
4724   AC_MSG_RESULT([external])
4725   SYSTEM_ODBC_HEADERS=YES
4726
4727   AC_CHECK_HEADER(sqlext.h, [],
4728      [AC_MSG_ERROR(odbc not found. install odbc)], [])
4729else
4730   AC_MSG_RESULT([internal])
4731   SYSTEM_ODBC_HEADERS=NO
4732   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
4733fi
4734AC_SUBST(SYSTEM_ODBC_HEADERS)
4735
4736AC_MSG_CHECKING([whether to build XML Security support])
4737if test "$enable_nss_module" = "no"; then
4738   AC_MSG_RESULT([no, since NSS disabled but needed])
4739else
4740   AC_MSG_RESULT([yes])
4741fi
4742
4743AC_MSG_CHECKING([whether to build LDAP configuration backend])
4744if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
4745   if test "$with_openldap" = "yes"; then
4746      AC_MSG_RESULT([yes])
4747      WITH_LDAP=YES
4748   else
4749      WITH_LDAP=NO
4750   fi
4751else
4752   AC_MSG_RESULT([no])
4753   WITH_LDAP=NO
4754fi
4755
4756if test "$WITH_LDAP" = "YES"; then
4757   dnl ===================================================================
4758   dnl Test whether we want to use the OpenLDAP LDAP SDK
4759   dnl ===================================================================
4760   AC_MSG_CHECKING([which LDAP SDK to use])
4761   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
4762  	   AC_MSG_RESULT([OpenLDAP])
4763	   WITH_OPENLDAP=YES
4764	   AC_CHECK_HEADERS(ldap.h, [],
4765		   [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
4766	   AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
4767		   [AC_MSG_ERROR(openldap lib not found or functional)], [])
4768	   # rumours say that OpenLDAP doesn't have that function. I looked and
4769	   # it has it. Test for it to be sure
4770         AC_CHECK_LIB(ldap, ldap_set_option, [],
4771                [AC_MSG_ERROR(openldap lib not found or functional)], [])
4772   fi
4773fi
4774AC_SUBST(WITH_LDAP)
4775AC_SUBST(WITH_OPENLDAP)
4776
4777AC_MSG_CHECKING([whether to build the internal NSS module])
4778if test "$enable_nss_module" != "no"; then
4779   ENABLE_NSS_MODULE="YES"
4780   BUILD_TYPE="$BUILD_TYPE NSS"
4781   AC_MSG_RESULT([yes])
4782   if test "$_os" = "WINNT"; then
4783      AC_MSG_CHECKING([for Mozilla build tooling])
4784      if test -z "$MOZILLABUILD" ; then
4785AC_MSG_ERROR([
4786Mozilla build tooling not found!
4787  It is required for NSS that is needed for AOO's security facilities.
4788  Either disable NSS using the option --disable-nss-module
4789  or use the --with-mozilla-build option after installing the tool obtained
4790  from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
4791      else
4792         if test \( "$WITH_MINGWIN" = "yes" \) ; then
4793            if test ! -d "$MOZILLABUILD" ; then
4794AC_MSG_ERROR([Mozilla build tooling incomplete!])
4795            else
4796               AC_MSG_RESULT([ok])
4797            fi
4798         else
4799            if test ! -d "$MOZILLABUILD/moztools" \
4800               -o ! -d "$MOZILLABUILD/msys" ; then
4801AC_MSG_ERROR([Mozilla build tooling incomplete!])
4802            else
4803               AC_MSG_RESULT([ok])
4804            fi
4805         fi
4806      fi
4807   fi
4808else
4809   ENABLE_NSS_MODULE="NO"
4810   AC_MSG_RESULT([no])
4811fi
4812
4813AC_SUBST(ENABLE_NSS_MODULE)
4814AC_SUBST(MOZILLABUILD)
4815AC_SUBST(MOZ_INC)
4816
4817dnl ===================================================================
4818dnl Check for system sane
4819dnl ===================================================================
4820AC_MSG_CHECKING([which sane header to use])
4821if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
4822	test "$with_system_sane_header" != "no"; then
4823   AC_MSG_RESULT([external])
4824   SYSTEM_SANE_HEADER=YES
4825   AC_CHECK_HEADER(sane/sane.h, [],
4826      [AC_MSG_ERROR(sane not found. install sane)], [])
4827else
4828   AC_MSG_RESULT([internal])
4829   SYSTEM_SANE_HEADER=NO
4830   BUILD_TYPE="$BUILD_TYPE SANE"
4831fi
4832AC_SUBST(SYSTEM_SANE_HEADER)
4833
4834dnl ===================================================================
4835dnl Check for system icu
4836dnl ===================================================================
4837AC_MSG_CHECKING([which icu to use])
4838if test -n "$with_system_icu" -o -n "$with_system_libs" && \
4839	test "$with_system_icu" != "no"; then
4840   AC_MSG_RESULT([external])
4841   SYSTEM_ICU=YES
4842   AC_LANG_PUSH([C++])
4843   AC_MSG_CHECKING([for unicode/rbbi.h])
4844   AC_TRY_CPP(unicode/rbbi.h, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([icu headers not found.]))
4845   AC_LANG_POP([C++])
4846   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
4847   if test -z "$SYSTEM_GENBRK"; then
4848      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
4849   fi
4850   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
4851   if test -z "$SYSTEM_GENCCODE"; then
4852      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
4853   fi
4854   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
4855   if test -z "$SYSTEM_GENCMN"; then
4856      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
4857   fi
4858
4859   AC_PATH_PROG( ICUCONFIG, icu-config)
4860   AC_MSG_CHECKING([ICU version])
4861   if test "$_os" = "OS2"; then
4862      ICU_MAJOR=4
4863   else
4864      ICU_VERSION=`$ICUCONFIG --version`
4865      ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
4866      ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
4867      ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
4868   fi
4869
4870   if test "$ICU_MAJOR" -ge "4"; then
4871      AC_MSG_RESULT([OK])
4872   else
4873      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
4874   fi
4875
4876else
4877    AC_MSG_RESULT([internal])
4878    SYSTEM_ICU=NO
4879    BUILD_TYPE="$BUILD_TYPE ICU"
4880fi
4881AC_SUBST(SYSTEM_ICU)
4882AC_SUBST(SYSTEM_GENBRK)
4883AC_SUBST(SYSTEM_GENCCODE)
4884AC_SUBST(SYSTEM_GENCMN)
4885AC_SUBST(ICU_MAJOR)
4886AC_SUBST(ICU_MINOR)
4887AC_SUBST(ICU_MICRO)
4888
4889dnl ===================================================================
4890dnl Graphite
4891dnl ===================================================================
4892
4893ENABLE_GRAPHITE="FALSE"
4894AC_MSG_CHECKING([whether to enable graphite support])
4895if test "x$enable_graphite" = "xyes" -a \( "$_os" = "WINNT" -o "$_os" = "Linux" -o "$_os" = "FreeBSD" \) ; then
4896    AC_MSG_RESULT([yes])
4897    ENABLE_GRAPHITE="TRUE"
4898    AC_MSG_CHECKING([which graphite to use])
4899    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
4900        test "$with_system_graphite" != "no"; then
4901        AC_MSG_RESULT([external])
4902        SYSTEM_GRAPHITE=YES
4903        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
4904    else
4905        AC_MSG_RESULT([internal])
4906        SYSTEM_GRAPHITE=NO
4907        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
4908    fi
4909else
4910   AC_MSG_RESULT([no])
4911   ENABLE_GRAPHITE="FALSE"
4912fi
4913AC_SUBST(ENABLE_GRAPHITE)
4914AC_SUBST(SYSTEM_GRAPHITE)
4915AC_SUBST(GRAPHITE_LIBS)
4916AC_SUBST(GRAPHITE_CFLAGS)
4917
4918dnl ===================================================================
4919dnl Checks for libraries.
4920dnl ===================================================================
4921dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
4922dnl See if we have the AppKit framework for building with Quartz graphics.
4923
4924if test  "$_os" = "Darwin"; then
4925   if test "x$with_x" = "xyes"; then
4926      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
4927   else
4928      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
4929      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
4930         AC_MSG_RESULT([yes])
4931         x_includes="no_x_includes"
4932         x_libraries="no_x_libraries"
4933         dnl disable some things used on other Unix versions but not on the aqua build
4934         enable_gtk=no
4935         enable_cups=no
4936         ENABLE_CUPS=""
4937         AC_SUBST(ENABLE_CUPS)
4938      else
4939         AC_MSG_ERROR([No AppKit.framewrok found])
4940      fi
4941   fi
4942fi
4943
4944dnl ***************************************
4945dnl testing for X libraries and includes...
4946dnl ***************************************
4947if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
4948   echo "Do Nothing for _os = Darwin"
4949   dnl Mac OS X using Aqua graphics. Don't check for X11.
4950   :
4951elif test "$_os" = "OS2" ; then
4952   echo "Do Nothing for _os = OS2. Don't check for X11."
4953   dnl OS/2 uses native graphics. Don't check for X11.
4954   :
4955elif test "$_os" != "WINNT" ; then
4956   AC_PATH_X
4957   AC_PATH_XTRA
4958   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
4959
4960   if test "x$x_includes" = "x"; then
4961     x_includes="default_x_includes"
4962   fi
4963   if test "x$x_libraries" = "x"; then
4964     x_libraries="default_x_libraries"
4965   fi
4966   dnl The variables $x_libraries and $x_includes are set.
4967   if test -z "$x_libraries"; then
4968      AC_MSG_ERROR([No X libraries found]) # Exit
4969   fi
4970   if test -z "$x_includes"; then
4971      AC_MSG_ERROR([No X includes found]) # Exit
4972   fi
4973   CFLAGS=$X_CFLAGS
4974   LDFLAGS="$X_LDFLAGS $X_LIBS"
4975   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
4976   dnl Check if the XauDisposeAuth symbol is provided by libXau.
4977   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
4978else
4979   x_includes="no_x_includes"
4980   x_libraries="no_x_libraries"
4981fi
4982if test -z "$x_includes"; then
4983   x_includes="no_x_includes"
4984fi
4985if test -z "$x_libraries"; then
4986   x_libraries="no_x_libraries"
4987fi
4988if test "$x_includes" = "default_x_includes"; then
4989   XINC="/usr/include"
4990else
4991   XINC="$x_includes"
4992fi
4993AC_SUBST(XINC)
4994if test "$x_libraries" = "default_x_libraries"; then
4995   XLIB=`$PKG_CONFIG --variable=libdir x11`
4996   if test "x$XLIB" = x; then
4997         XLIB="/usr/lib"
4998   fi
4999else
5000   XLIB="$x_libraries"
5001fi
5002AC_SUBST(XLIB)
5003AC_SUBST(XAU_LIBS)
5004
5005dnl ===================================================================
5006dnl Check if fontconfig/fontconfig.h is available
5007dnl ===================================================================
5008if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
5009    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
5010                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
5011    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
5012    AC_TRY_RUN([
5013#include <fontconfig/fontconfig.h>
5014
5015int main(int argc, char **argv) {
5016	if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
5017	else return 1;
5018}
5019], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])])
5020fi
5021
5022dnl ===================================================================
5023dnl Check for system Xrender
5024dnl ===================================================================
5025AC_MSG_CHECKING([whether to link to Xrender])
5026if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
5027   AC_MSG_RESULT([yes])
5028   XRENDER_LINK=YES
5029   with_system_xrender_headers=yes
5030else
5031   AC_MSG_RESULT([no, dynamically open it])
5032   XRENDER_LINK=NO
5033fi
5034AC_MSG_CHECKING([which Xrender headers to use])
5035if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
5036	test "$with_system_xrender_headers" != "no"; then
5037   AC_MSG_RESULT([external])
5038   SYSTEM_XRENDER_HEADERS=YES
5039   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
5040      [AC_MSG_ERROR(Xrender not found. install X)], [])
5041else
5042   AC_MSG_RESULT([internal])
5043   SYSTEM_XRENDER_HEADERS=NO
5044   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
5045fi
5046if test "$XRENDER_LINK" = "YES"; then
5047   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
5048      [AC_MSG_ERROR(libXrender not found or functional)], [])
5049fi
5050AC_SUBST(SYSTEM_XRENDER_HEADERS)
5051AC_SUBST(XRENDER_LINK)
5052
5053dnl ===================================================================
5054dnl Check for XRandr
5055dnl ===================================================================
5056AC_MSG_CHECKING([whether to enable RandR support])
5057if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5058   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5059	  XRANDR_DLOPEN="TRUE"
5060	  AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5061   else
5062	  XRANDR_DLOPEN="FALSE"
5063      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5064      if test "$ENABLE_RANDR" != "TRUE"; then
5065         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5066                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5067         XRANDR_CFLAGS=" "
5068         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5069              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5070         XRANDR_LIBS="-lXrandr "
5071         ENABLE_RANDR="TRUE"
5072	     AC_MSG_RESULT([enabling RandR support])
5073      fi
5074   fi
5075else
5076   ENABLE_RANDR=""
5077   AC_MSG_RESULT([no])
5078fi
5079AC_SUBST(XRANDR_DLOPEN)
5080AC_SUBST(XRANDR_CFLAGS)
5081AC_SUBST(XRANDR_LIBS)
5082AC_SUBST(ENABLE_RANDR)
5083
5084dnl ===================================================================
5085dnl Check for system nss
5086dnl ===================================================================
5087AC_MSG_CHECKING([which libnss to use])
5088if test -n "$with_system_nss" -o -n "$with_system_libs" && test "$with_system_nss" != "no"; then
5089    AC_MSG_RESULT([external])
5090    PKG_CHECK_MODULES( NSS, nss )
5091    SYSTEM_NSS=YES
5092else
5093    AC_MSG_RESULT([internal])
5094    SYSTEM_NSS=NO
5095    BUILD_TYPE="$BUILD_TYPE NSS"
5096fi
5097AC_SUBST(SYSTEM_NSS)
5098AC_SUBST(NSS_CFLAGS)
5099AC_SUBST(NSS_LIBS)
5100
5101dnl ===================================================================
5102dnl Check for system openssl
5103dnl ===================================================================
5104if test "$_os" = "Darwin" && test "$with_system_openssl" != "no"; then
5105   with_system_openssl=yes
5106fi
5107AC_MSG_CHECKING([which libssl to use])
5108if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5109        test "$with_system_openssl" != "no"; then
5110    AC_MSG_RESULT([external])
5111    # Mac OS builds should get out without extra stuff is the Mac porters'
5112    # wish. And pkg-config is although Xcode ships a .pc for openssl
5113    if test "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
5114        OPENSSL_CFLAGS=
5115        OPENSSL_LIBS="-lssl -lcrypto"
5116    else
5117    	PKG_CHECK_MODULES( OPENSSL, openssl )
5118    fi
5119    SYSTEM_OPENSSL=YES
5120else
5121    AC_MSG_RESULT([internal])
5122    SYSTEM_OPENSSL=NO
5123    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5124fi
5125AC_SUBST(SYSTEM_OPENSSL)
5126AC_SUBST(OPENSSL_CFLAGS)
5127AC_SUBST(OPENSSL_LIBS)
5128
5129dnl ===================================================================
5130dnl Check for system redland
5131dnl ===================================================================
5132AC_MSG_CHECKING([which redland library to use])
5133if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5134	test "$with_system_redland" != "no"; then
5135	AC_MSG_RESULT([external])
5136	SYSTEM_REDLAND=YES
5137   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5138   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5139else
5140	AC_MSG_RESULT([internal])
5141	BUILD_TYPE="$BUILD_TYPE REDLAND"
5142	SYSTEM_REDLAND=NO
5143fi
5144AC_SUBST(SYSTEM_REDLAND)
5145AC_SUBST(REDLAND_CFLAGS)
5146AC_SUBST(REDLAND_LIBS)
5147
5148dnl ===================================================================
5149dnl Check for hunspell
5150dnl ===================================================================
5151AC_MSG_CHECKING([whether to build the Spell Checking component])
5152ENABLE_HUNSPELL=
5153
5154if test "x$enable_hunspell" != "xno" ; then
5155    AC_MSG_CHECKING([which libhunspell to use])
5156    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5157        test "$with_system_hunspell" != "no"; then
5158        AC_MSG_RESULT([external])
5159        SYSTEM_HUNSPELL=YES
5160        AC_LANG_PUSH([C++])
5161        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5162        if test "$HUNSPELL_PC" != "TRUE"; then
5163            AC_CHECK_HEADER(hunspell.hxx, [],
5164            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5165                [AC_MSG_ERROR(hunspell headers not found.)], [])
5166             ], [])
5167            AC_CHECK_LIB(hunspell, main, [],
5168            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5169            HUNSPELL_LIBS=-lhunspell
5170        fi
5171        AC_LANG_POP([C++])
5172    else
5173        AC_MSG_RESULT([internal])
5174        SYSTEM_HUNSPELL=NO
5175        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5176    fi
5177    ENABLE_HUNSPELL=YES
5178    AC_SUBST(SYSTEM_HUNSPELL)
5179    AC_SUBST(HUNSPELL_CFLAGS)
5180    AC_SUBST(HUNSPELL_LIBS)
5181else
5182    AC_MSG_RESULT([no])
5183fi
5184AC_SUBST(ENABLE_HUNSPELL)
5185
5186dnl ===================================================================
5187dnl Checking for libhyphen
5188dnl ===================================================================
5189AC_MSG_CHECKING([whether to build the Hyphenator component])
5190ENABLE_HYPHEN=
5191
5192if test "x$enable_hyphen" != "xno" ; then
5193    AC_MSG_CHECKING([which libhyphen to use])
5194    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5195        test "$with_system_hyphen" != "no"; then
5196        AC_MSG_RESULT([external])
5197        SYSTEM_HYPH=YES
5198        AC_CHECK_HEADER(hyphen.h, [],
5199        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5200        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5201        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5202        [#include <hyphen.h>])
5203        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5204            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5205        if test -z "$HYPHEN_LIB"; then
5206        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5207            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5208        fi
5209        if test -z "$HYPHEN_LIB"; then
5210        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5211            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5212        fi
5213    else
5214        AC_MSG_RESULT([internal])
5215        SYSTEM_HYPH=NO
5216        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5217    fi
5218    ENABLE_HYPHEN=YES
5219    AC_SUBST(SYSTEM_HYPH)
5220    AC_SUBST(HYPHEN_LIB)
5221else
5222    AC_MSG_RESULT([no])
5223fi
5224AC_SUBST(ENABLE_HYPHEN)
5225
5226
5227#dnl ===================================================================
5228#dnl Check whether we are allowed to bundle dictionaries and whether
5229#dnl hunspell is available.
5230#dnl ===================================================================
5231ENABLE_BUNDLED_DICTIONARIES=
5232if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5233   ENABLE_BUNDLED_DICTIONARIES=YES
5234fi
5235AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5236
5237
5238
5239dnl ===================================================================
5240dnl Checking for mythes
5241dnl ===================================================================
5242AC_MSG_CHECKING([which mythes to use])
5243if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5244   test "$with_system_mythes" != "no"; then
5245    AC_MSG_RESULT([external])
5246    SYSTEM_MYTHES=YES
5247    AC_LANG_PUSH([C++])
5248    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5249    if test "$MYTHES_PKGCONFIG" = "no"; then
5250        AC_CHECK_HEADER(mythes.hxx, [],
5251            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5252        AC_CHECK_LIB(mythes-1.2, main, [],
5253            [ MYTHES_FOUND=no], [])
5254 	if test "$MYTHES_FOUND" = "no"; then
5255            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5256                [ MYTHES_FOUND=no], [])
5257	fi
5258	if test "$MYTHES_FOUND" = "no"; then
5259		AC_MSG_ERROR([mythes library not found!.])
5260	fi
5261    fi
5262    AC_LANG_POP([C++])
5263else
5264    AC_MSG_RESULT([internal])
5265    SYSTEM_MYTHES=NO
5266    BUILD_TYPE="$BUILD_TYPE MYTHES"
5267fi
5268AC_SUBST(SYSTEM_MYTHES)
5269AC_SUBST(MYTHES_CFLAGS)
5270AC_SUBST(MYTHES_LIBS)
5271
5272
5273dnl ===================================================================
5274dnl Checking for libtextcat
5275dnl ===================================================================
5276AC_MSG_CHECKING([which libtextcat to use])
5277if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5278    AC_MSG_RESULT([external])
5279    SYSTEM_LIBTEXTCAT=YES
5280    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5281       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5282    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5283        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5284else
5285    AC_MSG_RESULT([internal])
5286    SYSTEM_LIBTEXTCAT=NO
5287    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5288fi
5289AC_SUBST(SYSTEM_LIBTEXTCAT)
5290
5291AC_MSG_CHECKING([which libtextcat data directory to use])
5292if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5293    if test "$with_system_libtextcat_data" = "yes"; then
5294        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5295    else
5296        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5297    fi
5298    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5299else
5300    AC_MSG_RESULT([internal])
5301    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5302fi
5303AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5304
5305dnl ***************************************
5306dnl testing libc version for Linux...
5307dnl ***************************************
5308if test "$_os" = "Linux"; then
5309   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5310   exec 6>/dev/null # no output
5311   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5312   exec 6>&1 # output on again
5313   if test "$HAVE_LIBC"; then
5314      AC_MSG_RESULT([yes])
5315   else
5316      AC_MSG_ERROR([no, upgrade libc])
5317   fi
5318fi
5319
5320if test "$_os" != "WNT"; then
5321  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5322  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5323  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5324	SYSTEM_LIBC=YES
5325  fi
5326else
5327  HAVE_GETOPT=NO
5328  HAVE_READDIR_R=NO
5329  SYSTEM_LIBC=YES
5330fi
5331AC_SUBST(HAVE_GETOPT)
5332AC_SUBST(HAVE_READDIR_R)
5333AC_SUBST(SYSTEM_LIBC)
5334
5335dnl =========================================
5336dnl Check for the Microsoft Platform SDK.
5337dnl =========================================
5338dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5339dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5340if test \( "$_os" = "WINNT" \) ; then
5341	AC_MSG_CHECKING([for PSDK files])
5342	if test -z "$with_psdk_home"; then
5343		# This first line will detect a February 2003 Microsoft Platform SDK
5344		PSDK_HOME=`./oowintool --psdk-home`
5345        # But there might be also an April 2005 PSDK, unfortunately MS changed
5346        # the registry entry. (we prefer the old version!?)
5347        if test -z "$PSDK_HOME"; then
5348          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5349        fi
5350            # normalize if found
5351            if test -n "$PSDK_HOME"; then
5352              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5353              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5354           fi
5355	else
5356           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5357	fi
5358        # Remove a possible trailing backslash
5359        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5360    # Problem with current PSDK (iz 49865)
5361    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5362        AC_MSG_ERROR([
5363
5364Some modules do not build correctly with MS Platform SDK - April 2005
5365Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5366Remove/rename/backup that file and restart configure. Details about this
5367problem can be found in issue 49856.])
5368    fi
5369# WIndows SDK has different headers
5370	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5371		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5372		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5373		HAVE_PSDK_H="yes"
5374	else
5375		HAVE_PSDK_H="no"
5376	fi
5377	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5378		HAVE_PSDK_LIB="yes"
5379	else
5380		HAVE_PSDK_LIB="no"
5381	fi
5382    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5383        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5384are installed or use --with-psdk-home .])
5385    fi
5386    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5387         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5388         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5389         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5390        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5391    fi
5392    AC_MSG_RESULT([SDK files found ...)])
5393dnl Check if this is the right SDK.
5394    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5395        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5396        WINDOWS_VISTA_PSDK=TRUE
5397    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5398        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5399        WINDOWS_VISTA_PSDK=TRUE
5400    elif echo $PSDK_HOME | grep "v7.0" >/dev/null 2>/dev/null; then
5401        AC_MSG_RESULT([Found Windows SDK 7.0 ($PSDK_HOME)])
5402        WINDOWS_VISTA_PSDK=TRUE
5403    else
5404        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5405    fi
5406fi
5407AC_SUBST(PSDK_HOME)
5408AC_SUBST(WINDOWS_VISTA_PSDK)
5409
5410dnl =========================================
5411dnl Check for the Microsoft DirectX SDK.
5412dnl =========================================
5413if test \( "$_os" = "WINNT" \) ; then
5414    AC_MSG_CHECKING([for DirectX SDK files])
5415    if test -z "$with_directx_home"; then
5416        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5417        if test -n "$DXSDK_DIR"; then
5418            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5419            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5420        fi
5421        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5422        # the "DirectX SDK files not found" error later
5423    else
5424	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5425    fi
5426    # Remove a possible trailing backslash
5427    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5428
5429    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5430        HAVE_DIRECTDRAW_H="yes"
5431    else
5432        HAVE_DIRECTDRAW_H="no"
5433    fi
5434    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5435        HAVE_DIRECTXSDK_H="yes"
5436    else
5437        HAVE_DIRECTXSDK_H="no"
5438    fi
5439
5440    # MS changed the location of the libraries with dec 2004 directx sdk
5441    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5442        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5443    else
5444        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5445    fi
5446    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5447        HAVE_DIRECTDRAW_LIB="yes"
5448    else
5449        HAVE_DIRECTDRAW_LIB="no"
5450    fi
5451    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5452        HAVE_DIRECTXSDK_LIB="yes"
5453    else
5454        HAVE_DIRECTXSDK_LIB="no"
5455    fi
5456
5457    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5458       ENABLE_DIRECT_DRAW="TRUE"
5459    fi
5460    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5461       HAVE_DIRECTXSDK="yes"
5462    else
5463       HAVE_DIRECTXSDK="no"
5464    fi
5465
5466    if test -n "$ENABLE_DIRECTX"; then
5467	    if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5468		    AC_MSG_RESULT([found])
5469	    else
5470		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5471	    fi
5472    else
5473		DIRECTXSDK_HOME=""
5474		AC_MSG_RESULT([disabled])
5475    fi
5476fi
5477AC_SUBST(ENABLE_DIRECT_DRAW)
5478AC_SUBST(DIRECTXSDK_HOME)
5479AC_SUBST(DIRECTXSDK_LIB)
5480
5481
5482dnl ============================================
5483dnl Check for ATL and MFC
5484dnl ============================================
5485if test \( "$_os" = "WINNT" \) ; then
5486    AC_MSG_CHECKING([for ATL and MFC])
5487    if test "$DISABLE_ATL" = "TRUE"; then
5488        AC_MSG_RESULT([ATL is disabled, nothing to check])
5489    else
5490        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
5491        if test -z "$with_atl_include_dir"; then
5492            ATL_INCLUDE=$COMPATH/atlmfc/include
5493        else
5494            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
5495        fi
5496        if test -z "$with_atl_lib_dir"; then
5497            ATL_LIB=$COMPATH/atlmfc/lib
5498	    ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
5499        else
5500            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
5501            ATL_LIB_X64=$ATL_LIB/../amd64
5502        fi
5503        if test -z "$with_mfc_include_dir"; then
5504            MFC_INCLUDE=$COMPATH/atlmfc/include
5505        else
5506            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
5507        fi
5508        if test -z "$with_mfc_lib_dir"; then
5509            MFC_LIB=$COMPATH/atlmfc/lib
5510        else
5511            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
5512        fi
5513
5514        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
5515        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
5516        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
5517        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
5518        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
5519
5520        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
5521        if test -f "$ATL_INCLUDE/atlbase.h"; then
5522            HAVE_ATL_H="yes"
5523        else
5524            HAVE_ATL_H="no"
5525        fi
5526        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
5527
5528        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
5529        if test -f "$MFC_INCLUDE/afx.h"; then
5530            HAVE_MFC_H="yes"
5531        else
5532            HAVE_MFC_H="no"
5533        fi
5534        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
5535
5536        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
5537        if test -f "$ATL_LIB/atls.lib"; then
5538            HAVE_ATL_LIB="yes"
5539            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
5540            if test -f "$ATL_LIB/atlthunk.lib"; then
5541                HAVE_ATLTHUNK="YES"
5542            else
5543                HAVE_ATLTHUNK="NO"
5544            fi
5545            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
5546        else
5547            HAVE_ATL_LIB="no"
5548        fi
5549        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
5550
5551        dnl TODO check also MFC libraries, they seem to have diferent names
5552        dnl mfc42.lib mfc90.lib
5553        if test -d "$MFC_LIB"; then
5554            HAVE_MFC_LIB="yes"
5555        else
5556            HAVE_MFC_LIB="no"
5557        fi
5558
5559        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
5560            ATL_INCLUDE=
5561            ATL_LIB=
5562            ATL_LIB_X64=
5563            MFC_INCLUDE=
5564            MFC_LIB=
5565            HAVE_ATL_LIB=
5566            dnl TODO shouldn't this be an error?
5567            DISABLE_ACTIVEX="TRUE"
5568            DISABLE_ATL="TRUE"
5569            AC_MSG_RESULT([ATL/MFC disabled])
5570        else
5571            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
5572            ATL_LIB=`cygpath -dm "$ATL_LIB"`
5573            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
5574            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
5575            MFC_LIB=`cygpath -dm "$MFC_LIB"`
5576            AC_MSG_RESULT([ATL/MFC enabled])
5577        fi
5578    fi
5579fi
5580AC_SUBST(ATL_INCLUDE)
5581AC_SUBST(ATL_LIB)
5582AC_SUBST(ATL_LIB_X64)
5583AC_SUBST(HAVE_ATLTHUNK)
5584AC_SUBST(MFC_INCLUDE)
5585AC_SUBST(MFC_LIB)
5586
5587
5588dnl ============================================
5589dnl Check for Nullsoft Scriptable Install System
5590dnl ============================================
5591NSIS_PATH=""
5592if test "$_os" = "WINNT" ; then
5593    AC_MSG_CHECKING([for NSIS])
5594    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5595    if test -n "$NSIS_PATH"; then
5596        NSIS_PATH=`dirname "$NSIS_PATH"`
5597    fi
5598    if test -n "$with_nsis_path"; then
5599        with_nsis_path=`cygpath -u "$with_nsis_path"`
5600    fi
5601    if test -e "$with_nsis_path/nsis.exe"; then
5602        NSIS_PATH="$with_nsis_path"
5603    fi
5604    nsistest=`./oowintool --nsis-dir`;
5605    if test -x "$nsistest/nsis.exe"; then
5606        NSIS_PATH="$nsistest"
5607    fi
5608    if test -z "$NSIS_PATH"; then
5609        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5610        echo "NSIS not found, no self contained installer will be build." >> warn
5611    else
5612        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5613        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5614        AC_MSG_RESULT([found ($NSIS_PATH)])
5615    fi
5616fi
5617AC_SUBST(NSIS_PATH)
5618
5619dnl ***************************************
5620dnl testing bison and flex exist
5621dnl ***************************************
5622AC_PATH_PROG(BISON, bison)
5623if test -z "$BISON"; then
5624   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5625else
5626   AC_MSG_CHECKING([the bison version])
5627   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5628    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5629    # Accept newer than 1.875 or older(equal) than 1.75
5630    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5631       if test "$_bison_version" = "1.875" ; then
5632          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5633          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5634       else
5635          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5636       fi
5637    else
5638       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5639    fi
5640fi
5641AC_PATH_PROG(FLEX, flex)
5642if test -z "$FLEX"; then
5643   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5644fi
5645dnl ***************************************
5646dnl testing that patch exists
5647dnl ***************************************
5648AC_PATH_PROG(PATCH, patch)
5649if test -z "$PATCH"; then
5650   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5651fi
5652
5653dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5654if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5655   if test -z "$with_gnu_patch"; then
5656      GNUPATCH=$PATCH
5657   else
5658      if test -x "$with_gnu_patch"; then
5659	      GNUPATCH=$with_gnu_patch
5660      else
5661         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5662      fi
5663   fi
5664
5665   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5666   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5667	   AC_MSG_RESULT([yes])
5668   else
5669      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5670   fi
5671fi
5672
5673dnl We also need to check for --with-gnu-cp
5674
5675if test -z "$with_gnu_cp"; then
5676   # check the place where the GNU stuff is hidden on Solaris...
5677   if test -x /usr/gnu/bin/cp; then
5678      GNUCP=/usr/gnu/bin/cp
5679   else
5680      AC_PATH_PROGS(GNUCP, gnucp cp)
5681   fi
5682   if test -z $GNUCP; then
5683      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5684   fi
5685else
5686   if test -x "$with_gnu_cp"; then
5687      GNUCP=$with_gnu_cp
5688   else
5689      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5690   fi
5691fi
5692
5693AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5694if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5695   AC_MSG_RESULT([yes])
5696else
5697   AC_MSG_RESULT([no])
5698   GNUCP=''
5699fi
5700
5701if test -z "$GNUCP"; then
5702   if test "$_os" = "SunOS"; then
5703      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5704   else
5705      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5706   fi
5707fi
5708
5709AC_SUBST(GNUPATCH)
5710AC_SUBST(GNUCP)
5711
5712dnl ***************************************
5713dnl testing bash tools path on Windows
5714dnl ***************************************
5715if test "$_os" = "WINNT"; then
5716    CYGWIN_PATH=""
5717    AC_PATH_PROG(CYGWIN_PATH, bash)
5718    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5719fi
5720if test -z "$CYGWIN_PATH"; then
5721   CYGWIN_PATH="NO_CYGWIN"
5722fi
5723AC_SUBST(CYGWIN_PATH)
5724
5725dnl ***************************************
5726dnl testing ml.exe assembler path
5727dnl ***************************************
5728if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5729  AC_MSG_CHECKING([ml.exe assembler path])
5730  if test -n "$with_asm_home"; then
5731    with_asm_home=`cygpath -u "$with_asm_home"`
5732  fi
5733  if test ! -x "$with_asm_home/ml.exe"; then
5734    AC_PATH_PROG(ML_EXE, ml.exe)
5735    if test -z "$ML_EXE"; then
5736      if test -x "$with_cl_home/bin/ml.exe"; then
5737        with_asm_home=$with_cl_home/bin
5738        AC_MSG_RESULT([found ($with_asm_home)])
5739      else
5740        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5741      fi
5742    else
5743       with_asm_home="ASM_IN_PATH"
5744    fi
5745  fi
5746  AC_MSG_RESULT([$ASM_HOME])
5747else
5748  with_asm_home="NO_ASM_HOME"
5749fi
5750ASM_HOME="$with_asm_home"
5751AC_SUBST(ASM_HOME)
5752
5753dnl ===================================================================
5754dnl testing handle deprecated unzip switch
5755dnl ===================================================================
5756if test -z "$with_zip_home"; then
5757	with_zip_home="$with_unzip_home"
5758fi
5759dnl ===================================================================
5760dnl Zip will be found where you tell me to find it
5761dnl ===================================================================
5762if test -n "$with_zip_home" ; then
5763    if test "$_os" = "WINNT"; then
5764        with_zip_home=`cygpath -u "$with_zip_home"`
5765    fi
5766    ZIP="$with_zip_home/zip"
5767    UNZIP="$with_zip_home/unzip"
5768    ZIP_HOME="$with_zip_home"
5769else
5770    AC_PATH_PROG(ZIP, zip)
5771    AC_PATH_PROG(UNZIP, unzip)
5772    ZIP_HOME=`dirname "$ZIP"`
5773fi
5774dnl ===================================================================
5775dnl Zip must be available or else it is an error, all platforms
5776dnl ===================================================================
5777if test -z "$ZIP" -o -z "$UNZIP"; then
5778    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5779fi
5780
5781dnl ===================================================================
5782dnl Zip must be a specific type for different build types.
5783dnl ===================================================================
5784if test "$_os" = "WINNT"; then
5785    if test -n "`$ZIP -h | grep -i WinNT`" ; then
5786AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5787    fi
5788fi
5789AC_SUBST(ZIP_HOME)
5790
5791dnl ===================================================================
5792dnl Windows builds need dbghelp.dll in external/dbghelp/
5793dnl ===================================================================
5794if test "$_os" = "WINNT"; then
5795   AC_MSG_CHECKING([for dbghelp.dll])
5796   if test -x ./external/dbghelp/dbghelp.dll; then
5797      AC_MSG_RESULT([found and executable])
5798   else
5799      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5800Get it from the Microsoft site and put it into external/dbghelp.
5801(Note: Microsoft seems to enjoy changing the exact location of this file. You
5802may have to search Microsoft's website.) Last time it was seen at:
5803<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5804   fi
5805fi
5806
5807dnl ===================================================================
5808dnl Windows builds need vcredist_x*.exe in external/vcredist/
5809dnl ===================================================================
5810WITH_VC_REDIST=""
5811
5812if test "$_os" = "WINNT"; then
5813   AC_MSG_CHECKING([for vcredist_x86.exe])
5814   if test -x ./external/vcredist/vcredist_x86.exe; then
5815      AC_MSG_RESULT([found and executable])
5816   else
5817      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
5818Get it from the Microsoft site and put it into external/vcredist. You can try
5819to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5820   fi
5821   AC_MSG_CHECKING([for vcredist_x64.exe])
5822   if test -x ./external/vcredist/vcredist_x64.exe; then
5823      AC_MSG_RESULT([found and executable])
5824   else
5825      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
5826Get it from the Microsoft site and put it into external/vcredist. You can try
5827to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5828   fi
5829   WITH_VC_REDIST=YES
5830   AC_SUBST(WITH_VC_REDIST)
5831fi
5832
5833dnl ===================================================================
5834dnl Windows builds - use oowintool to copy CRT dlls and manifest
5835dnl ===================================================================
5836if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5837       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5838          :
5839       else
5840          AC_MSG_ERROR([oowintool failed to copy CRT])
5841       fi
5842fi
5843
5844dnl ===================================================================
5845dnl Windows builds need gdiplus.dll in external/gdiplus/
5846dnl ===================================================================
5847if test "$_os" = "WINNT"; then
5848   AC_MSG_CHECKING([for gdiplus.dll])
5849   if test -x ./external/gdiplus/gdiplus.dll; then
5850      AC_MSG_RESULT([found and executable])
5851   else
5852      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5853Get it from the Microsoft site and put it into external/gdiplus.
5854You may have to search Microsoft's website. Last time it was seen at:
5855<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5856   fi
5857fi
5858
5859dnl ===================================================================
5860dnl Windows builds need msvcr100.dll in external/msvcp100/
5861dnl ===================================================================
5862if test "$_os" = "WINNT"; then
5863   AC_MSG_CHECKING([for msvcr100.dll])
5864   if test -x ./external/msvcp100/msvcr100.dll; then
5865      AC_MSG_RESULT([found and executable])
5866   else
5867      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
5868Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
5869from the Microsoft site and put it into external/msvcp100.
5870You may have to search Microsoft's website. Last time it was seen at:
5871<http://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
5872   fi
5873fi
5874
5875dnl ===================================================================
5876dnl Test which vclplugs have to be built.
5877dnl ===================================================================
5878AC_MSG_CHECKING([which VCLplugs shall be built])
5879ENABLE_GTK=""
5880if test "x$enable_gtk" = "xyes"; then
5881    ENABLE_GTK="TRUE"
5882    R="gtk"
5883fi
5884AC_SUBST(ENABLE_GTK)
5885
5886ENABLE_KDE=""
5887if test "x$enable_kde" = "xyes"; then
5888    ENABLE_KDE="TRUE"
5889    R="$R kde"
5890fi
5891AC_SUBST(ENABLE_KDE)
5892
5893ENABLE_KDE4=""
5894if test "x$enable_kde4" = "xyes"; then
5895    ENABLE_KDE4="TRUE"
5896    R="$R kde4"
5897fi
5898AC_SUBST(ENABLE_KDE4)
5899
5900if test -z "$R"; then
5901	AC_MSG_RESULT([none])
5902else
5903	AC_MSG_RESULT([$R])
5904fi
5905
5906dnl ===================================================================
5907dnl GCONF check
5908dnl ===================================================================
5909
5910ENABLE_GCONF=""
5911AC_MSG_CHECKING([whether to enable GConf support])
5912if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5913    ENABLE_GCONF="TRUE"
5914    AC_MSG_RESULT([yes])
5915    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5916else
5917    AC_MSG_RESULT([no])
5918fi
5919AC_SUBST(ENABLE_GCONF)
5920
5921dnl ===================================================================
5922dnl Gnome VFS check
5923dnl ===================================================================
5924
5925ENABLE_GNOMEVFS=""
5926AC_MSG_CHECKING([whether to enable GNOME VFS support])
5927if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5928    ENABLE_GNOMEVFS="TRUE"
5929    AC_MSG_RESULT([yes])
5930    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5931    if test "$ENABLE_GCONF" != "TRUE"; then
5932        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5933    fi
5934else
5935    AC_MSG_RESULT([no])
5936fi
5937AC_SUBST(ENABLE_GNOMEVFS)
5938
5939dnl ===================================================================
5940dnl Check whether the gtk 2.0 libraries are available.
5941dnl ===================================================================
5942
5943GTK_CFLAGS=""
5944GTK_LIBS=""
5945ENABLE_SYSTRAY_GTK=""
5946ENABLE_DBUS=""
5947if test  "$test_gtk" = "yes"; then
5948
5949   if test "$ENABLE_GTK" = "TRUE" ; then
5950      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]))
5951      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]))
5952      BUILD_TYPE="$BUILD_TYPE GTK"
5953
5954      if test "x$enable_systray" = "xyes"; then
5955         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
5956                           [ENABLE_SYSTRAY_GTK="TRUE"
5957                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
5958                           [ENABLE_SYSTRAY_GTK=""])
5959      fi
5960
5961      AC_MSG_CHECKING([whether to enable DBUS support])
5962      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5963          ENABLE_DBUS="TRUE"
5964          AC_MSG_RESULT([yes])
5965          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5966      else
5967          AC_MSG_RESULT([no])
5968      fi
5969
5970      AC_MSG_CHECKING([whether to enable GIO support])
5971      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5972          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5973             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5974          fi
5975          ENABLE_GIO="TRUE"
5976          AC_MSG_RESULT([yes])
5977          PKG_CHECK_MODULES( GIO, gio-2.0 )
5978      else
5979          AC_MSG_RESULT([no])
5980      fi
5981
5982   fi
5983
5984fi
5985AC_SUBST(ENABLE_GIO)
5986AC_SUBST(ENABLE_DBUS)
5987AC_SUBST(ENABLE_SYSTRAY_GTK)
5988AC_SUBST(GTK_CFLAGS)
5989AC_SUBST(GTK_LIBS)
5990AC_SUBST(GTHREAD_CFLAGS)
5991AC_SUBST(GTHREAD_LIBS)
5992
5993dnl ===================================================================
5994dnl Check whether the GStreamer libraries are available.
5995dnl ===================================================================
5996
5997GSTREAMER_CFLAGS=""
5998GSTREAMER_LIBS=""
5999ENABLE_GSTREAMER=""
6000
6001if test "$test_gstreamer" = "yes"; then
6002    AC_MSG_CHECKING([whether to build the GStreamer media backend])
6003    if test "x$enable_gstreamer" != "xno" ; then
6004        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]))
6005        ENABLE_GSTREAMER="TRUE"
6006        AC_MSG_RESULT([yes])
6007    else
6008        AC_MSG_RESULT([no])
6009    fi
6010fi
6011AC_SUBST(ENABLE_GSTREAMER)
6012AC_SUBST(GSTREAMER_CFLAGS)
6013AC_SUBST(GSTREAMER_LIBS)
6014
6015dnl ===================================================================
6016dnl Check the ARM target
6017dnl ===================================================================
6018
6019if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
6020    # default value
6021    ARM_TARGET=ARMV4T
6022    AC_MSG_CHECKING([which ARM processor optimization to use])
6023    if test "$with_arm_target" -lt "6"; then
6024	ARM_TARGET=ARMV4T
6025    elif test "$with_arm_target" = "6"; then
6026	ARM_TARGET=ARMV6
6027    elif test "$with_arm_target" -gt "6"; then
6028	ARM_TARGET=ARMV7
6029    fi
6030    AC_MSG_RESULT([$ARM_TARGET])
6031    AC_SUBST(ARM_TARGET)
6032fi
6033
6034dnl ===================================================================
6035dnl Check whether the Cairo libraries are available.
6036dnl ===================================================================
6037
6038ENABLE_CAIRO=""
6039BUILD_PIXMAN=""
6040SYSTEM_CAIRO=""
6041
6042if test  "$test_cairo" = "yes"; then
6043
6044    AC_MSG_CHECKING([whether to use cairo])
6045    if test "x$enable_cairo" != "xno" ; then
6046        ENABLE_CAIRO="TRUE"
6047	AC_MSG_RESULT([yes])
6048        AC_MSG_CHECKING([which cairo to use])
6049        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6050           test "$with_system_cairo" != "no"; then
6051           AC_MSG_RESULT([external])
6052           SYSTEM_CAIRO=YES
6053
6054           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6055	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6056	      AC_MSG_ERROR([Cairo library requires fontconfig.])
6057	   fi
6058           if test "$with_system_xrender_headers" = "yes"; then
6059              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6060              AC_TRY_RUN([
6061#include <X11/extensions/Xrender.h>
6062
6063int main(int argc, char **argv) {
6064#ifdef PictStandardA8
6065      return 0;
6066#else
6067      return 1;
6068#endif
6069}
6070               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
6071           fi
6072        else
6073           BUILD_TYPE="$BUILD_TYPE CAIRO"
6074	   dnl === compiler fails on pixman with 64bit architectures...===
6075	   if test "$build_cpu" != "x86_64"; then
6076	      BUILD_PIXMAN=YES
6077	   fi
6078           AC_MSG_RESULT([internal])
6079        fi
6080    else
6081	   AC_MSG_RESULT([no])
6082    fi
6083fi
6084
6085AC_SUBST(ENABLE_CAIRO)
6086AC_SUBST(BUILD_PIXMAN)
6087AC_SUBST(SYSTEM_CAIRO)
6088AC_SUBST(CAIRO_CFLAGS)
6089AC_SUBST(CAIRO_LIBS)
6090
6091ENABLE_CAIRO_CANVAS="FALSE"
6092if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6093   ENABLE_CAIRO_CANVAS="TRUE"
6094fi
6095AC_SUBST(ENABLE_CAIRO_CANVAS)
6096
6097dnl ===================================================================
6098dnl Check whether the OpenGL libraries are available
6099dnl ===================================================================
6100
6101AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6102ENABLE_OPENGL=
6103
6104if test "x$enable_opengl" != "xno" ; then
6105   AC_MSG_RESULT([yes])
6106   AC_CHECK_HEADER(GL/gl.h, [],
6107                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6108   AC_CHECK_LIB(GL, main, [],
6109     [AC_MSG_ERROR(libGL not installed or functional)], [])
6110   AC_CHECK_LIB(GLU, main, [],
6111     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6112   ENABLE_OPENGL=TRUE
6113else
6114   AC_MSG_RESULT([no])
6115fi
6116
6117AC_SUBST(ENABLE_OPENGL)
6118
6119
6120AC_MSG_CHECKING([whether to build the PDF Import extension])
6121if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6122  AC_MSG_RESULT([yes])
6123  ENABLE_PDFIMPORT=YES
6124
6125  dnl ===================================================================
6126  dnl Check for system poppler
6127  dnl ===================================================================
6128  AC_MSG_CHECKING([whether to use system pdf backend])
6129  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6130       test "$with_system_poppler" != "no"; then
6131      AC_MSG_RESULT([external])
6132      SYSTEM_POPPLER=YES
6133      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6134  else
6135      AC_MSG_RESULT([no])
6136      SYSTEM_POPPLER=NO
6137      ENABLE_PDFIMPORT=NO
6138  fi
6139else
6140   AC_MSG_RESULT([no])
6141   ENABLE_PDFIMPORT=NO
6142fi
6143AC_SUBST(ENABLE_PDFIMPORT)
6144AC_SUBST(SYSTEM_POPPLER)
6145AC_SUBST(POPPLER_CFLAGS)
6146AC_SUBST(POPPLER_LIBS)
6147
6148AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6149if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6150  AC_MSG_RESULT([yes])
6151  AC_MSG_CHECKING([for swext module])
6152  if test -d ./swext; then
6153   AC_MSG_RESULT([OK])
6154  else
6155   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6156  fi
6157  ENABLE_MEDIAWIKI=YES
6158  BUILD_TYPE="$BUILD_TYPE SWEXT"
6159else
6160  AC_MSG_RESULT([no])
6161  ENABLE_MEDIAWIKI=NO
6162fi
6163AC_SUBST(ENABLE_MEDIAWIKI)
6164
6165if test "$ENABLE_MEDIAWIKI" = "YES"; then
6166  AC_MSG_CHECKING([which Servlet API Jar to use])
6167  if test -n "$with_system_servlet_api"; then
6168    AC_MSG_RESULT([external])
6169    SYSTEM_SERVLETAPI=YES
6170      if test -z "$SERVLETAPI_JAR"; then
6171	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6172      fi
6173      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6174             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6175  else
6176    AC_MSG_RESULT([internal])
6177    SYSTEM_SERVLETAPI=NO
6178    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6179  fi
6180fi
6181AC_SUBST(SYSTEM_SERVLETAPI)
6182AC_SUBST(SERVLETAPI_JAR)
6183
6184AC_MSG_CHECKING([whether to build the Report Builder extension])
6185if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6186  AC_MSG_RESULT([yes])
6187  ENABLE_REPORTBUILDER=YES
6188  SYSTEM_JFREEREPORT=YES
6189  AC_MSG_CHECKING([for reportbuilder module])
6190  if test -d ./reportbuilder; then
6191    AC_MSG_RESULT([OK])
6192  else
6193    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6194  fi
6195  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6196  AC_MSG_RESULT([external])
6197  if test -z $SAC_JAR; then
6198         SAC_JAR=/usr/share/java/sac.jar
6199  fi
6200  AC_CHECK_FILE($SAC_JAR, [],
6201         [AC_MSG_ERROR(sac.jar not found.)], [])
6202
6203  if test -z $LIBXML_JAR; then
6204    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6205      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6206      [
6207        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6208          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6209          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6210        )
6211      ]
6212    )
6213  else
6214    AC_CHECK_FILE($LIBXML_JAR, [],
6215         [AC_MSG_ERROR(libxml.jar not found.)], [])
6216  fi
6217
6218  if test -z $FLUTE_JAR; then
6219    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6220      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6221      [
6222        AC_CHECK_FILE(/usr/share/java/flute.jar,
6223          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6224          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6225        )
6226      ]
6227    )
6228  else
6229    AC_CHECK_FILE($FLUTE_JAR, [],
6230         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6231  fi
6232
6233  if test -z $JFREEREPORT_JAR; then
6234    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6235      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6236      [
6237        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6238          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6239          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6240        )
6241      ]
6242    )
6243  else
6244    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6245         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6246  fi
6247
6248  if test -z $LIBLAYOUT_JAR; then
6249    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6250      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6251      [
6252        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6253          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6254          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6255        )
6256      ]
6257    )
6258  else
6259    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6260         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6261  fi
6262
6263  if test -z $LIBLOADER_JAR; then
6264    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6265      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6266      [
6267        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6268          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6269          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6270        )
6271      ]
6272    )
6273  else
6274    AC_CHECK_FILE($LIBLOADER_JAR, [],
6275         [AC_MSG_ERROR(libloader.jar not found.)], [])
6276  fi
6277
6278  if test -z $LIBFORMULA_JAR; then
6279    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6280      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6281      [
6282        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6283          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6284          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6285        )
6286      ]
6287    )
6288  else
6289    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6290         [AC_MSG_ERROR(libformula.jar not found.)], [])
6291  fi
6292
6293  if test -z $LIBREPOSITORY_JAR; then
6294    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6295      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6296      [
6297        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6298          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6299          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6300        )
6301      ]
6302    )
6303  else
6304    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6305         [AC_MSG_ERROR(librepository.jar not found.)], [])
6306  fi
6307
6308  if test -z $LIBFONTS_JAR; then
6309    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6310      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6311      [
6312        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6313          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6314          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6315        )
6316      ]
6317    )
6318  else
6319    AC_CHECK_FILE($LIBFONTS_JAR, [],
6320         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6321  fi
6322
6323  if test -z $LIBSERIALIZER_JAR; then
6324    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6325      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6326      [
6327        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6328          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6329          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6330        )
6331      ]
6332    )
6333  else
6334    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6335         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6336  fi
6337
6338
6339  if test -z $LIBBASE_JAR; then
6340    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6341      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6342      [
6343        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6344          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6345          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6346        )
6347      ]
6348    )
6349  else
6350    AC_CHECK_FILE($LIBBASE_JAR, [],
6351         [AC_MSG_ERROR(libbase.jar not found.)], [])
6352  fi
6353  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6354else
6355  AC_MSG_RESULT([no])
6356  ENABLE_REPORTBUILDER=NO
6357fi
6358AC_SUBST(ENABLE_REPORTBUILDER)
6359AC_SUBST(SYSTEM_JFREEREPORT)
6360AC_SUBST(SAC_JAR)
6361AC_SUBST(LIBXML_JAR)
6362AC_SUBST(FLUTE_JAR)
6363AC_SUBST(JFREEREPORT_JAR)
6364AC_SUBST(LIBBASE_JAR)
6365AC_SUBST(LIBLAYOUT_JAR)
6366AC_SUBST(LIBLOADER_JAR)
6367AC_SUBST(LIBFORMULA_JAR)
6368AC_SUBST(LIBREPOSITORY_JAR)
6369AC_SUBST(LIBFONTS_JAR)
6370AC_SUBST(LIBSERIALIZER_JAR)
6371
6372# this has to be here because both the wiki publisher and the SRB use
6373# commons-logging
6374if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6375  AC_MSG_CHECKING([which Apache commons-* libs to use])
6376  if test "$with_system_apache_commons" = "yes"; then
6377    SYSTEM_APACHE_COMMONS=YES
6378    AC_MSG_RESULT([external])
6379    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6380      if test -z $COMMONS_CODEC_JAR; then
6381        AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
6382          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
6383          [
6384            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6385              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6386              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6387            )
6388          ]
6389        )
6390      else
6391        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6392             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6393      fi
6394
6395      if test -z $COMMONS_LANG_JAR; then
6396        AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
6397          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
6398          [
6399            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6400              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6401              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6402            )
6403          ]
6404        )
6405      else
6406        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6407             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6408      fi
6409
6410      if test -z $COMMONS_HTTPCLIENT_JAR; then
6411        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6412          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6413          [
6414            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6415              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6416              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6417            )
6418          ]
6419        )
6420      else
6421        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6422             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6423      fi
6424    fi
6425    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6426      if test -z $COMMONS_LOGGING_JAR; then
6427        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
6428          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
6429          [
6430            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6431              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6432              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6433            )
6434          ]
6435        )
6436      else
6437        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6438             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6439      fi
6440    fi
6441  else
6442    AC_MSG_RESULT([internal])
6443    SYSTEM_APACHE_COMMONS=NO
6444    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6445  fi
6446fi
6447AC_SUBST(SYSTEM_APACHE_COMMONS)
6448AC_SUBST(COMMONS_CODEC_JAR)
6449AC_SUBST(COMMONS_LANG_JAR)
6450AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6451AC_SUBST(COMMONS_LOGGING_JAR)
6452
6453dnl ===================================================================
6454dnl Check whether the Qt and KDE libraries are available.
6455dnl ===================================================================
6456
6457KDE_CFLAGS=""
6458KDE_LIBS=""
6459MOC="moc"
6460if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6461    dnl Search paths for Qt and KDE
6462    if test "$build_cpu" != "x86_64" ; then
6463        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"
6464        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"
6465    else
6466        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"
6467        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"
6468    fi
6469    if test -n "$QTDIR" ; then
6470        qt_incdirs="$QTDIR/include $qt_incdirs"
6471        if test "$build_cpu" != "x86_64" ; then
6472            qt_libdirs="$QTDIR/lib $qt_libdirs"
6473        else
6474            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6475        fi
6476    fi
6477    if test "$build_cpu" != "x86_64" ; then
6478        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"
6479        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"
6480    else
6481        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"
6482        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"
6483    fi
6484    if test -n "$KDEDIR" ; then
6485        kde_incdirs="$KDEDIR/include $kde_incdirs"
6486        if test "$build_cpu" != "x86_64" ; then
6487            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6488        else
6489            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6490        fi
6491    fi
6492
6493    dnl What to test
6494    qt_test_include="qstyle.h"
6495    qt_test_library="libqt-mt.so"
6496    kde_test_include="ksharedptr.h"
6497    kde_test_library="libkdeui.so"
6498
6499    dnl Check for Qt headers
6500    AC_MSG_CHECKING([for Qt headers])
6501    qt_incdir="no"
6502    for kde_check in $qt_incdirs ; do
6503        if test -r "$kde_check/$qt_test_include" ; then
6504            qt_incdir="$kde_check"
6505            break
6506        fi
6507    done
6508    AC_MSG_RESULT([$qt_incdir])
6509    if test "x$qt_incdir" = "xno" ; then
6510        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6511your Qt installation by exporting QTDIR before running "configure".])
6512    fi
6513
6514    dnl Check for Qt libraries
6515    AC_MSG_CHECKING([for Qt libraries])
6516    qt_libdir="no"
6517    for qt_check in $qt_libdirs ; do
6518        if test -r "$qt_check/$qt_test_library" ; then
6519            qt_libdir="$qt_check"
6520            break
6521        fi
6522    done
6523    AC_MSG_RESULT([$qt_libdir])
6524    if test "x$qt_libdir" = "xno" ; then
6525        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6526your Qt installation by exporting QTDIR before running "configure".])
6527    fi
6528
6529    dnl Check for Meta Object Compiler
6530    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6531    if test "$MOC" = "no" ; then
6532        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6533the root of your Qt installation by exporting QTDIR before running "configure".])
6534    fi
6535
6536    dnl Check for KDE headers
6537    AC_MSG_CHECKING([for KDE headers])
6538    kde_incdir="no"
6539    for kde_check in $kde_incdirs ; do
6540        if test -r "$kde_check/$kde_test_include" ; then
6541            kde_incdir="$kde_check"
6542            break
6543        fi
6544    done
6545    AC_MSG_RESULT([$kde_incdir])
6546    if test "x$kde_incdir" = "xno" ; then
6547        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6548your KDE installation by exporting KDEDIR before running "configure".])
6549    fi
6550
6551    dnl Check for KDE libraries
6552    AC_MSG_CHECKING([for KDE libraries])
6553    kde_libdir="no"
6554    for kde_check in $kde_libdirs ; do
6555        if test -r "$kde_check/$kde_test_library" ; then
6556            kde_libdir="$kde_check"
6557            break
6558        fi
6559    done
6560    AC_MSG_RESULT([$kde_libdir])
6561    if test "x$kde_libdir" = "xno" ; then
6562        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6563your KDE installation by exporting KDEDIR before running "configure".])
6564    fi
6565
6566    dnl Set the variables
6567    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6568    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6569fi
6570AC_SUBST(KDE_CFLAGS)
6571AC_SUBST(KDE_LIBS)
6572AC_SUBST(MOC)
6573
6574dnl ===================================================================
6575dnl KDE4 Integration
6576dnl ===================================================================
6577
6578KDE4_CFLAGS=""
6579KDE4_LIBS=""
6580MOC4="moc"
6581if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6582   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6583   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6584
6585   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6586   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6587
6588   if test "$build_cpu" = "x86_64" ; then
6589      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6590      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6591   fi
6592
6593   if test -n "$KDE4DIR" ; then
6594      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6595      if test "$build_cpu" != "x86_64" ; then
6596         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6597      else
6598         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6599      fi
6600   fi
6601
6602   qt_test_include="Qt/qobject.h"
6603   qt_test_library="libQtCore.so"
6604   kde_test_include="ksharedptr.h"
6605   kde_test_library="libkdeui.so"
6606
6607   AC_MSG_CHECKING([for Qt4 headers])
6608   qt_header_dir="no"
6609   for inc_dir in $qt_incdirs ; do
6610      if test -r "$inc_dir/$qt_test_include" ; then
6611         qt_header_dir="$inc_dir"
6612         break
6613      fi
6614   done
6615
6616   AC_MSG_RESULT([$qt_header_dir])
6617   if test "x$qt_header_dir" = "xno" ; then
6618      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6619   fi
6620
6621   AC_MSG_CHECKING([for Qt4 libraries])
6622   qt_lib_dir="no"
6623   for lib_dir in $qt_libdirs ; do
6624      if test -r "$lib_dir/$qt_test_library" ; then
6625         qt_lib_dir="$lib_dir"
6626         break
6627      fi
6628   done
6629
6630   AC_MSG_RESULT([$qt_lib_dir])
6631
6632   if test "x$qt_lib_dir" = "xno" ; then
6633      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6634   fi
6635
6636   dnl Check for Meta Object Compiler
6637   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6638   MOC4="$MOCQT4"
6639   if test "$MOC4" = "no" ; then
6640      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6641      if test "$MOC4" = "no" ; then
6642         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6643      fi
6644   fi
6645
6646   dnl Check for KDE4 headers
6647   AC_MSG_CHECKING([for KDE4 headers])
6648   kde_incdir="no"
6649   for kde_check in $kde_incdirs ; do
6650      if test -r "$kde_check/$kde_test_include" ; then
6651         kde_incdir="$kde_check"
6652         break
6653      fi
6654   done
6655   AC_MSG_RESULT([$kde_incdir])
6656   if test "x$kde_incdir" = "xno" ; then
6657      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6658   fi
6659
6660   dnl Check for KDE4 libraries
6661   AC_MSG_CHECKING([for KDE4 libraries])
6662   kde_libdir="no"
6663   for kde_check in $kde_libdirs ; do
6664      if test -r "$kde_check/$kde_test_library" ; then
6665         kde_libdir="$kde_check"
6666         break
6667      fi
6668   done
6669
6670   AC_MSG_RESULT([$kde_libdir])
6671   if test "x$kde_libdir" = "xno" ; then
6672      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6673   fi
6674
6675   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6676   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6677fi
6678AC_SUBST(KDE4_CFLAGS)
6679AC_SUBST(KDE4_LIBS)
6680AC_SUBST(MOC4)
6681
6682dnl ===================================================================
6683dnl Test for the enabling the lockdown pieces
6684dnl ===================================================================
6685AC_MSG_CHECKING([whether to enable the lockdown pieces])
6686ENABLE_LOCKDOWN=""
6687if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6688  ENABLE_LOCKDOWN=YES
6689  AC_MSG_RESULT([yes])
6690else
6691  AC_MSG_RESULT([no])
6692fi
6693AC_SUBST(ENABLE_LOCKDOWN)
6694
6695dnl ===================================================================
6696dnl Test whether to include Evolution 2 support
6697dnl ===================================================================
6698AC_MSG_CHECKING([whether to enable evolution 2 support])
6699if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6700   AC_MSG_RESULT([yes])
6701   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6702   ENABLE_EVOAB2="TRUE"
6703else
6704   ENABLE_EVOAB2=""
6705   AC_MSG_RESULT([no])
6706fi
6707AC_SUBST(ENABLE_EVOAB2)
6708AC_SUBST(GOBJECT_CFLAGS)
6709AC_SUBST(GOBJECT_LIBS)
6710
6711dnl ===================================================================
6712dnl Test whether to include KDE AB support
6713dnl ===================================================================
6714AC_MSG_CHECKING([whether to enable KDE address book support])
6715if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6716   AC_MSG_RESULT([yes])
6717   AC_LANG_PUSH([C++])
6718   save_CXXFLAGS=$CXXFLAGS
6719   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6720   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6721       AC_TRY_RUN([
6722#include <kdeversion.h>
6723
6724int main(int argc, char **argv) {
6725       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6726       else return 1;
6727}
6728       ], [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])])
6729   CXXFLAGS=$save_CXXFLAGS
6730   AC_LANG_POP([C++])
6731   ENABLE_KAB=TRUE
6732else
6733   AC_MSG_RESULT([no])
6734   ENABLE_KAB=
6735fi
6736AC_SUBST(ENABLE_KAB)
6737
6738dnl ===================================================================
6739dnl Test whether to include MathMLDTD
6740dnl ===================================================================
6741AC_MSG_CHECKING([whether to include MathMLDTD])
6742if test -n "$enable_mathmldtd"; then
6743  if test "$enable_mathmldtd" = "no"; then
6744    AC_MSG_RESULT([no])
6745    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6746  else
6747    AC_MSG_RESULT([yes])
6748    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6749  fi
6750else
6751  AC_MSG_RESULT([no])
6752  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6753fi
6754
6755dnl ===================================================================
6756dnl Test whether to include category-B fonts
6757dnl ===================================================================
6758WITH_CATB_FONTS=
6759AC_MSG_CHECKING([whether to include category B fonts])
6760if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
6761   AC_MSG_RESULT([yes])
6762   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
6763   WITH_CATB_FONTS=YES
6764   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
6765else
6766   AC_MSG_RESULT([no])
6767   WITH_CATB_FONTS=NO
6768fi
6769
6770dnl ===================================================================
6771dnl Test whether to include category-A fonts
6772dnl ===================================================================
6773WITH_CATA_FONTS=
6774AC_MSG_CHECKING([whether to include category A fonts])
6775if test "x$with_fonts" != "xno" ; then
6776  AC_MSG_RESULT([yes])
6777  WITH_CATA_FONTS=YES
6778  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
6779else
6780  AC_MSG_RESULT([no])
6781  WITH_CATA_FONTS=NO
6782  WITH_CATB_FONTS=NO
6783fi
6784
6785WITH_FONTS=NO
6786AC_MSG_CHECKING([whether any fonts are included])
6787if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
6788  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6789  WITH_FONTS=YES
6790  AC_MSG_RESULT([yes])
6791else
6792  AC_MSG_RESULT([no])
6793fi
6794
6795AC_SUBST(WITH_CATA_FONTS)
6796AC_SUBST(WITH_CATB_FONTS)
6797AC_SUBST(WITH_FONTS)
6798
6799dnl ===================================================================
6800dnl Test whether to include ppds
6801dnl ===================================================================
6802AC_MSG_CHECKING([whether to include PPDs])
6803if test "$with_ppds" != "no"; then
6804  AC_MSG_RESULT([yes])
6805else
6806  AC_MSG_RESULT([no])
6807  WITHOUT_PPDS=YES
6808  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6809fi
6810AC_SUBST(WITHOUT_PPDS)
6811
6812dnl ===================================================================
6813dnl Test whether to include afms
6814dnl ===================================================================
6815AC_MSG_CHECKING([whether to include AFMs])
6816if test "$with_afms" != "no"; then
6817  AC_MSG_RESULT([yes])
6818  BUILD_TYPE="$BUILD_TYPE AFMS"
6819else
6820  AC_MSG_RESULT([no])
6821  WITHOUT_AFMS=YES
6822  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6823fi
6824AC_SUBST(WITHOUT_AFMS)
6825
6826AC_SUBST(SCPDEFS)
6827
6828AC_MSG_CHECKING([whether and how to use Xinerama])
6829if test "$_os" = "Darwin"; then
6830   USE_XINERAMA=YES
6831   XINERAMA_LINK=dynamic
6832   AC_MSG_RESULT([yes])
6833elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6834   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6835      # we have both versions, let the user decide but use the dynamic one
6836      # per default
6837      USE_XINERAMA=YES
6838      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6839         XINERAMA_LINK=dynamic
6840      else
6841         XINERAMA_LINK=static
6842      fi
6843   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6844      # we have only the dynamic version
6845      USE_XINERAMA=YES
6846      XINERAMA_LINK=dynamic
6847   elif test -e "$XLIB/libXinerama.a"; then
6848      # static version
6849      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6850         USE_XINERAMA=YES
6851         XINERAMA_LINK=static
6852      else
6853         USE_XINERAMA=NO
6854         XINERAMA_LINK=none
6855      fi
6856   else
6857      # no Xinerama
6858      USE_XINERAMA=NO
6859      XINERAMA_LINK=none
6860   fi
6861   if test "$USE_XINERAMA" = "YES"; then
6862      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6863      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6864          [AC_MSG_ERROR(Xinerama header not found.)], [])
6865      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6866      if test "$_os" = "FreeBSD"; then
6867          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6868      fi
6869      if test "$_os" = "Linux"; then
6870          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6871      fi
6872      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6873          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6874   else
6875      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6876   fi
6877else
6878   AC_MSG_RESULT([no])
6879fi
6880AC_SUBST(USE_XINERAMA)
6881AC_SUBST(XINERAMA_LINK)
6882
6883dnl ===================================================================
6884dnl always rely on the system version of gdk-pixbuf
6885dnl ===================================================================
6886
6887SYSTEM_GDKPIXBUF=YES
6888AC_SUBST(SYSTEM_GDKPIXBUF)
6889
6890dnl ===================================================================
6891dnl always rely on the system version of glib
6892dnl ===================================================================
6893
6894SYSTEM_GLIB=YES
6895AC_SUBST(SYSTEM_GLIB)
6896
6897dnl ===================================================================
6898dnl always rely on the system version of gettext
6899dnl ===================================================================
6900
6901SYSTEM_GETTEXT=YES
6902AC_SUBST(SYSTEM_GETTEXT)
6903
6904dnl ===================================================================
6905dnl always rely on the system version of pango
6906dnl ===================================================================
6907
6908SYSTEM_PANGO=YES
6909AC_SUBST(SYSTEM_PANGO)
6910
6911dnl ===================================================================
6912dnl Test whether to build libpng or rely on the system version
6913dnl ===================================================================
6914AC_MSG_CHECKING([whether to build own version of libpng])
6915
6916case "$_os" in
6917	WINNT*) # Windows
6918	    SYSTEM_LIBPNG=NO
6919	    AC_MSG_RESULT([yes])
6920		;;
6921	Darwin*)
6922	    SYSTEM_LIBPNG=NO
6923	    AC_MSG_RESULT([yes])
6924	    ;;
6925   *)
6926   SYSTEM_LIBPNG=YES
6927   AC_MSG_RESULT([no])
6928   ;;
6929esac
6930AC_SUBST(SYSTEM_LIBPNG)
6931
6932dnl ===================================================================
6933dnl Test whether to build libjpeg or rely on the system version
6934dnl ===================================================================
6935dnl FIXME: this is currently because we have jpeg-6b for our filters
6936dnl        and jpeg-8 as dependency for librsvg
6937dnl        this should be unified into using only one version for both
6938
6939AC_MSG_CHECKING([whether to build own version of libjpeg])
6940
6941if test "$SYSTEM_JPEG" = "YES"; then
6942SYSTEM_LIBJPEG=YES
6943else
6944case "$_os" in
6945	WINNT*) # Windows
6946	    SYSTEM_LIBJPEG=NO
6947		;;
6948	Darwin*)
6949	    SYSTEM_LIBJPEG=NO
6950	    ;;
6951   *)
6952        SYSTEM_LIBJPEG=YES
6953        ;;
6954esac
6955fi
6956
6957if test "$SYSTEM_LIBJPEG" = "YES"; then
6958   AC_MSG_RESULT([no])
6959else
6960   AC_MSG_RESULT([yes])
6961fi
6962AC_SUBST(SYSTEM_LIBJPEG)
6963
6964dnl ===================================================================
6965dnl Test whether rat scan was requested and whether apache-rat is available
6966dnl ===================================================================
6967RAT_JAR=
6968AC_MSG_CHECKING([whether to trigger rat scan])
6969if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
6970    AC_MSG_RESULT([no])
6971else
6972    if test "$WITH_JAVA" = "no"; then
6973        AC_MSG_ERROR([no, java disabled, enable with --with-java])
6974    elif test "$enable_saxon" = "no"; then
6975        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
6976    elif test "$with_rat_scan" = "yes"; then
6977        AC_MSG_RESULT([yes, use pre-built library])
6978        RAT_JAR_HOME="BUILD"
6979        BUILD_TYPE="$BUILD_TYPE RAT"
6980    else
6981        AC_MSG_RESULT([yes, use pre-installed library])
6982        AC_MSG_CHECKING([whether apache-rat is available])
6983        if test -d "$with_rat_scan"; then
6984            RAT_JAR_HOME=$with_rat_scan
6985        else
6986            AC_MSG_ERROR([$with_rat_scan is not a directory])
6987        fi
6988    fi
6989fi
6990AC_SUBST(RAT_JAR_HOME)
6991
6992
6993dnl ===================================================================
6994dnl Test for the presence of Ant and that it works
6995dnl ===================================================================
6996
6997if test "$SOLAR_JAVA" != ""; then
6998ANT_HOME=; export ANT_HOME
6999WITH_ANT_HOME=; export WITH_ANT_HOME
7000if test -z "$with_ant_home"; then
7001   if test "$_os" = "OS2"; then
7002     AC_PATH_PROGS(ANT, ant.cmd)
7003   else
7004     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
7005   fi
7006else
7007   if test "$_os" = "WINNT"; then
7008      with_ant_home=`cygpath -u "$with_ant_home"`
7009   fi
7010   if test "$_os" = "OS2"; then
7011     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
7012   else
7013     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
7014   fi
7015   WITH_ANT_HOME=$with_ant_home
7016   ANT_HOME=$with_ant_home
7017fi
7018
7019if test -z "$ANT"; then
7020  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
7021else
7022  # resolve relative or absolute symlink
7023  while test -h "$ANT"; do
7024     a_cwd=`pwd`
7025     a_basename=`basename "$ANT"`
7026     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7027     cd "`dirname "$ANT"`"
7028     cd "`dirname "$a_script"`"
7029     ANT="`pwd`"/"`basename "$a_script"`"
7030     cd "$a_cwd"
7031  done
7032
7033  if test "$_os" = "OS2"; then
7034    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7035    export ANT_HOME
7036  fi
7037
7038  AC_MSG_CHECKING([if $ANT works])
7039cat > conftest.java << EOF
7040    public class conftest {
7041	int testmethod(int a, int b) {
7042            return a + b;
7043	}
7044    }
7045EOF
7046
7047cat > conftest.xml << EOF
7048    <project name="conftest" default="conftest">
7049	<target name="conftest">
7050            <javac srcdir="." includes="conftest.java">
7051	    </javac>
7052	</target>
7053    </project>
7054EOF
7055  oldJAVA_HOME=$JAVA_HOME
7056  if test "$JAVACISGCJ" = "yes"; then
7057    JAVA_HOME=; export JAVA_HOME
7058    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7059  else
7060    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7061  fi
7062  AC_TRY_EVAL(ant_cmd)
7063  if test $? = 0 && test -f ./conftest.class ; then
7064    AC_MSG_RESULT([Ant works])
7065    if test -z "$WITH_ANT_HOME"; then
7066        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7067        if test -z "$ANT_HOME"; then
7068            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7069        fi
7070    else
7071        ANT_HOME="$WITH_ANT_HOME"
7072    fi
7073  else
7074    echo "configure: Ant test failed" >&5
7075    cat conftest.java >&5
7076    cat conftest.xml >&5
7077    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7078    ANT_HOME=""
7079    echo "Ant does not work - Some Java projects will not build!" >>warn
7080  fi
7081  JAVA_HOME=$oldJAVA_HOME
7082  rm -f conftest* core core.* *.core
7083fi
7084if test -z "$ANT_HOME"; then
7085   ANT_HOME="NO_ANT_HOME"
7086fi
7087AC_SUBST(ANT_HOME)
7088
7089dnl Checking for ant.jar
7090if test "$ANT_HOME" != "NO_ANT_HOME"; then
7091   AC_MSG_CHECKING([Ant lib directory])
7092   if test -f $ANT_HOME/lib/ant.jar; then
7093	  ANT_LIB="$ANT_HOME/lib"
7094   else
7095      if test -f $ANT_HOME/ant.jar; then
7096	     ANT_LIB="$ANT_HOME"
7097      else
7098          if test -f /usr/share/java/ant.jar; then
7099              ANT_LIB=/usr/share/java
7100          else
7101             if test -f /usr/share/ant-core/lib/ant.jar; then
7102                 ANT_LIB=/usr/share/ant-core/lib
7103             else
7104                if test -f $ANT_HOME/lib/ant/ant.jar; then
7105                    ANT_LIB="$ANT_HOME/lib/ant"
7106                else
7107                   if test -f /usr/share/lib/ant/ant.jar; then
7108                       ANT_LIB=/usr/share/lib/ant
7109                   else
7110                       AC_MSG_ERROR([Ant libraries not found!])
7111                   fi
7112                fi
7113             fi
7114          fi
7115      fi
7116   fi
7117   AC_MSG_RESULT([Ant lib directory found.])
7118fi
7119AC_SUBST(ANT_LIB)
7120fi
7121
7122ant_minver=1.6.0
7123# update for more extensions...
7124if test "$ENABLE_MEDIAWIKI" = "YES"; then
7125  ant_minver=1.7.0
7126fi
7127ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7128
7129AC_MSG_CHECKING([whether ant is >= $ant_minver])
7130ant_version=`$ANT -version | $AWK '{ print $4; }'`
7131ant_version_major=`echo $ant_version | cut -d. -f1`
7132ant_version_minor=`echo $ant_version | cut -d. -f2`
7133echo "configure: ant_version $ant_version " >&5
7134echo "configure: ant_version_major $ant_version_major " >&5
7135echo "configure: ant_version_minor $ant_version_minor " >&5
7136if test "$ant_version_major" -ge "2"; then
7137   AC_MSG_RESULT([yes, $ant_version])
7138elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7139   AC_MSG_RESULT([yes, $ant_version])
7140else
7141   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7142fi
7143
7144if test "$ENABLE_MEDIAWIKI" = "YES"; then
7145AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7146rm -rf confdir
7147mkdir confdir
7148cat > conftest.java << EOF
7149    public class conftest {
7150        int testmethod(int a, int b) {
7151            return a + b;
7152        }
7153    }
7154EOF
7155
7156cat > conftest.xml << EOF
7157    <project name="conftest" default="conftest">
7158        <target name="conftest" depends="copytest">
7159            <javac srcdir="." includes="conftest.java">
7160            </javac>
7161        </target>
7162        <target name="copytest">
7163             <copy todir="confdir">
7164                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7165                 <filterset/>
7166                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7167             </copy>
7168        </target>
7169    </project>
7170EOF
7171  if test "$JAVACISGCJ" = "yes"; then
7172    JAVA_HOME=; export JAVA_HOME
7173    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7174  else
7175    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7176  fi
7177  AC_TRY_EVAL(ant_cmd)
7178  if test $? = 0 && test -f ./conftest.class ; then
7179    AC_MSG_RESULT([yes])
7180    rm -rf confdir
7181  else
7182    echo "configure: Ant test failed" >&5
7183    cat conftest.java >&5
7184    cat conftest.xml >&5
7185    rm -rf confdir
7186    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7187  fi
7188fi
7189rm -f conftest* core core.* *.core
7190
7191OOO_JUNIT_JAR=
7192if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7193    AC_MSG_CHECKING([for JUnit 4])
7194    if test "$with_junit" = "yes"; then
7195        if test -e /usr/share/java/junit4.jar; then
7196            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7197        else
7198           if test -e /usr/share/lib/java/junit.jar; then
7199              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7200           else
7201              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7202           fi
7203        fi
7204    else
7205        OOO_JUNIT_JAR=$with_junit
7206    fi
7207    if test "$_os" = "WINNT"; then
7208        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7209    fi
7210    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7211        grep org/junit/Before.class > /dev/null 2>&5
7212    if test $? -eq 0; then
7213        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7214    else
7215        AC_MSG_RESULT([no])
7216        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7217location (/usr/share/java), specify its pathname via
7218--with-junit=..., or disable it via --without-junit])
7219    fi
7220fi
7221AC_SUBST(OOO_JUNIT_JAR)
7222
7223AC_MSG_CHECKING([which languages to be built])
7224WITH_LANG="$with_lang"
7225if test -z "$WITH_LANG"; then
7226   AC_MSG_RESULT([en-US])
7227else
7228   AC_MSG_RESULT([$WITH_LANG])
7229   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7230   BUILD_TYPE="$BUILD_TYPE L10N"
7231fi
7232AC_SUBST(WITH_LANG)
7233
7234AC_MSG_CHECKING([which languages have poor help localizations])
7235WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7236if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7237   AC_MSG_RESULT([none])
7238else
7239   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7240fi
7241AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7242
7243AC_MSG_CHECKING([which dictionaries to include])
7244if test -z "$with_dict"; then
7245   WITH_DICT=,ALL,
7246   AC_MSG_RESULT([ALL])
7247else
7248   WITH_DICT=","$with_dict","
7249   AC_MSG_RESULT([$with_dict])
7250fi
7251AC_SUBST(WITH_DICT)
7252
7253AC_MSG_CHECKING([for additional 'intro' bitmaps])
7254INTRO_BITMAPS=
7255if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7256   INTRO_BITMAPS=
7257   AC_MSG_RESULT([none])
7258else
7259   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7260      case "$bitmap" in
7261         *.bmp) ;;
7262         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .bmp files!]) ;;
7263      esac
7264      if test -n "$bitmap" ; then
7265         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7266      fi
7267   done
7268   AC_MSG_RESULT([$INTRO_BITMAPS])
7269fi
7270AC_SUBST(INTRO_BITMAPS)
7271
7272AC_MSG_CHECKING([for additional 'about' bitmaps])
7273ABOUT_BITMAPS=
7274if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7275   ABOUT_BITMAPS=
7276   AC_MSG_RESULT([none])
7277else
7278   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7279      case "$bitmap" in
7280         *.bmp) ;;
7281         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .bmp files!]) ;;
7282      esac
7283      if test -n "$bitmap" ; then
7284         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7285      fi
7286   done
7287   AC_MSG_RESULT([$ABOUT_BITMAPS])
7288fi
7289AC_SUBST(ABOUT_BITMAPS)
7290
7291OOO_VENDOR=
7292AC_MSG_CHECKING([for vendor])
7293if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7294   AC_MSG_RESULT([not set])
7295else
7296   OOO_VENDOR="$with_vendor"
7297   AC_MSG_RESULT([$OOO_VENDOR])
7298fi
7299AC_SUBST(OOO_VENDOR)
7300
7301UNIXWRAPPERNAME=
7302AC_MSG_CHECKING([for UNIX wrapper name])
7303if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7304   AC_MSG_RESULT([not set])
7305else
7306   UNIXWRAPPERNAME="$with_unix_wrapper"
7307   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7308fi
7309AC_SUBST(UNIXWRAPPERNAME)
7310
7311AC_MSG_CHECKING([whether to statically link to Gtk])
7312if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7313   ENABLE_STATIC_GTK="TRUE"
7314   AC_MSG_RESULT([yes])
7315else
7316   ENABLE_STATIC_GTK="FALSE"
7317   AC_MSG_RESULT([no])
7318fi
7319AC_SUBST(ENABLE_STATIC_GTK)
7320
7321AC_MSG_CHECKING([whether to use layout dialogs])
7322if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7323   ENABLE_LAYOUT="TRUE"
7324   AC_MSG_RESULT([yes])
7325else
7326   ENABLE_LAYOUT="FALSE"
7327   AC_MSG_RESULT([no])
7328fi
7329AC_SUBST(ENABLE_LAYOUT)
7330
7331# ===================================================================
7332# De- or increase default verbosity of build process
7333# ===================================================================
7334AC_MSG_CHECKING([build verbosity])
7335if test -n "$enable_verbose"; then
7336   if test "$enable_verbose" = "yes"; then
7337      VERBOSE="TRUE"
7338      AC_MSG_RESULT([high])
7339   fi
7340   if test "$enable_verbose" = "no"; then
7341      VERBOSE="FALSE"
7342      AC_MSG_RESULT([low])
7343   fi
7344else
7345   AC_MSG_RESULT([not set])
7346fi
7347AC_SUBST(VERBOSE)
7348
7349dnl ===================================================================
7350dnl Hook up OOos nodep environmental variable to automake's equivalent
7351dnl --enable-dependency-tracking configure option
7352dnl ===================================================================
7353AC_MSG_CHECKING([whether to enable dependency tracking])
7354if test "$enable_dependency_tracking" = "no"; then
7355    nodep=TRUE
7356    AC_MSG_RESULT([no])
7357else
7358    AC_MSG_RESULT([yes])
7359fi
7360AC_SUBST(nodep)
7361
7362dnl ===================================================================
7363dnl Setting up the environment.
7364dnl ===================================================================
7365echo "********************************************************************"
7366echo "*                                                                  *"
7367echo "*   Setting up the build environment variables.                    *"
7368echo "*                                                                  *"
7369echo "********************************************************************"
7370
7371if test -z "$COMPATH"; then
7372   AC_MSG_ERROR([No compiler found.])
7373fi
7374AC_SUBST(COMPATH)
7375
7376AC_MSG_CHECKING([solver path])
7377if test -z "$with_local_solver"; then
7378   LOCAL_SOLVER="DEFAULT"
7379   AC_MSG_RESULT([default])
7380else
7381   LOCAL_SOLVER=$with_local_solver
7382   AC_MSG_RESULT([$with_local_solver])
7383fi
7384AC_SUBST(LOCAL_SOLVER)
7385
7386AC_SUBST(BUILD_TYPE)
7387AC_SUBST(ADDITIONAL_REPOSITORIES)
7388
7389# make sure config.guess is +x; we execute config.guess, so it has to be so;
7390chmod +x ./config.guess
7391
7392# Create files from their *.in templates.
7393AC_CONFIG_FILES([set_soenv Makefile])
7394
7395AC_MSG_NOTICE([writing config.status])
7396AC_OUTPUT
7397
7398dnl Executing the set_soenv script to setup the environment variables.
7399chmod a+x set_soenv
7400if test -z "$enable_check_only"; then
7401   './set_soenv'
7402else
7403   echo
7404   echo Test Complete
7405   echo No environment file will be generated
7406   echo
7407   num_warnings=`wc -l warn`
7408   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7409   if test $_num -gt 0; then
7410      echo The following warning\(s\) were generated by configure
7411      echo ----------------------------------------------------
7412      echo
7413      cat warn
7414      echo
7415   else
7416      echo There were no warnings
7417   fi
7418   echo
7419fi
7420