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