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