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