xref: /aoo41x/main/configure.ac (revision 3a8d6f30)
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=`date +"%Y-%m-%d %H:%M:%S (%a, %d %b %Y)"`
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        JAVAFLAGS="-source 1.5 -target 1.5"
3070        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3071        if test "$_os" = "WINNT"; then
3072          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3073        fi
3074        if test "$_os" = "OS2"; then
3075          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3076        fi
3077      fi
3078   else
3079      AC_MSG_ERROR([JAVA not found. You need at least jdk-1.5, or gcj-4])
3080   fi
3081else
3082   dnl Java disabled
3083   JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
3084fi
3085
3086dnl ===================================================================
3087dnl Checks for javac
3088dnl ===================================================================
3089if test "$SOLAR_JAVA" != ""; then
3090    if test "$JDK" = "gcj"; then
3091        javacompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
3092    else
3093        javacompiler="javac"
3094    fi
3095    if test "$_os" = "OS2"; then
3096      if test x`echo "$javacompiler" | grep -i '\.exe$'` = x; then
3097          javacompiler="${javacompiler}.exe"
3098      fi
3099    fi
3100    if test -z "$with_jdk_home"; then
3101        AC_PATH_PROG(JAVACOMPILER, $javacompiler)
3102    else
3103        _javac_path="$with_jdk_home/bin/$javacompiler"
3104        dnl Check if there is a java compiler at all.
3105        if test -x "$_javac_path"; then
3106            JAVACOMPILER=$_javac_path
3107        fi
3108    fi
3109    if test -z "$JAVACOMPILER"; then
3110      AC_MSG_ERROR([$javacompiler not found, please use --with-jdk-home])
3111    fi
3112    if test "$_os" = "WINNT"; then
3113       if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
3114          JAVACOMPILER="${JAVACOMPILER}.exe"
3115       fi
3116       JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
3117       JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
3118       JAVAFLAGS="-source 1.5 -target 1.5"
3119    fi
3120    if test "$_os" = "OS2"; then
3121       if test x`echo "$JAVACOMPILER" | grep -i '\.exe$'` = x; then
3122          JAVACOMPILER="${JAVACOMPILER}.exe"
3123       fi
3124    fi
3125
3126    if test `$JAVACOMPILER -version 2>&1 | grep -c "Eclipse Java Compiler"` -gt 0; then
3127        AC_MSG_CHECKING([re-checking JDK])
3128        JDK=gcj
3129        AC_MSG_RESULT([checked (ecj)])
3130        #TODO: what's to do here? some switch to do 1.5 compiling?
3131        JAVAFLAGS="-source 1.5 -target 1.5"
3132        _gij_longver="40200"
3133    fi
3134fi
3135
3136JAVACISGCJ=""
3137dnl ===================================================================
3138dnl Checks that javac is gcj
3139dnl ===================================================================
3140if test "$SOLAR_JAVA" != ""; then
3141    if test `$JAVACOMPILER --version 2>&1 | grep -c "GCC"` -gt 0; then
3142        JAVACISGCJ="yes"
3143    fi
3144fi
3145AC_SUBST(JAVACISGCJ)
3146
3147dnl ===================================================================
3148dnl Checks for javadoc
3149dnl ===================================================================
3150if test "$SOLAR_JAVA" != ""; then
3151    if test -z "$with_jdk_home"; then
3152        AC_PATH_PROG(JAVADOC, javadoc)
3153    else
3154        _javadoc_path="$with_jdk_home/bin/javadoc"
3155        if test "$_os" = "OS2"; then
3156          if test x`echo "$_javadoc_path" | grep -i '\.exe$'` = x; then
3157              _javadoc_path="${_javadoc_path}.exe"
3158          fi
3159        fi
3160        dnl Check if there is a javadoc at all.
3161        if test -x "$_javadoc_path"; then
3162            JAVADOC=$_javadoc_path
3163        else
3164            AC_PATH_PROG(JAVADOC, javadoc)
3165        fi
3166    fi
3167    if test -z "$JAVADOC"; then
3168      AC_MSG_ERROR([$_javadoc_path not found, please use --with-jdk-home])
3169    fi
3170    if test "$_os" = "WINNT"; then
3171        if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3172            JAVADOC="${JAVADOC}.exe"
3173        fi
3174        JAVADOC=`cygpath -d "$JAVADOC"`
3175        JAVADOC=`cygpath -u "$JAVADOC"`
3176    fi
3177    if test "$_os" = "OS2"; then
3178        if test x`echo "$JAVADOC" | grep -i '\.exe$'` = x; then
3179            JAVADOC="${JAVADOC}.exe"
3180        fi
3181    fi
3182fi
3183
3184if test "$SOLAR_JAVA" != ""; then
3185    dnl first check if we have been asked to autodetect JAVA_HOME with a recent gij
3186    if test "$JDK" = "gcj" -a -z "$JAVA_HOME"; then
3187      if test "x$with_jdk_home" = "x" -a "$_gij_longver" -ge "40200"; then
3188        cat > findhome.java <<_ACEOF
3189[import java.io.File;
3190
3191class findhome
3192{
3193    public static void main(String args[])
3194    {
3195        String jrelocation = System.getProperty("java.home");
3196        File jre = new File(jrelocation);
3197        System.out.println(jre.getParent());
3198    }
3199}]
3200_ACEOF
3201        AC_MSG_CHECKING([if javac works])
3202        javac_cmd="$JAVACOMPILER findhome.java 1>&2"
3203        AC_TRY_EVAL(javac_cmd)
3204        if test $? = 0 && test -f ./findhome.class ; then
3205          AC_MSG_RESULT([javac works])
3206        else
3207          echo "configure: javac test failed" >&5
3208          cat findhome.java >&5
3209          AC_MSG_ERROR([javac does not work - java projects will not build!])
3210        fi
3211
3212        AC_MSG_CHECKING([if gij knows its java.home])
3213        JAVA_HOME=`$JAVAINTERPRETER findhome`
3214        if test $? = 0 && test "$JAVA_HOME" != "" ; then
3215          AC_MSG_RESULT([$JAVA_HOME])
3216        else
3217          echo "configure: java test failed" >&5
3218          cat findhome.java >&5
3219          AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
3220        fi
3221      else
3222        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
3223      fi
3224    fi
3225
3226    dnl second sanity check JAVA_HOME if possible
3227    if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
3228      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
3229      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
3230         javac_link_f=`readlink -f "$JAVACOMPILER" 2>/dev/null`
3231         if test $? == 0 && test "$JAVACOMPILER" != "$javac_link_f"; then
3232          # try to recover first by looking whether we have a alternatives
3233          # system as in Debian or newer SuSEs where following /usr/bin/javac
3234          # over /etc/alternatives/javac leads to the right bindir where we
3235          # just need to strip a bit away to get a valid JAVA_HOME
3236          # Solaris 11 is even worse, because target is relative, so use -f
3237            JAVA_HOME="$javac_link_f"
3238         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
3239          # Darwin readlink(1) is so primitive it doesn't even support -f
3240          # maybe only one level of symlink (e.g. on Mac)
3241            JAVA_HOME=`readlink $JAVACOMPILER`
3242         else
3243          # else warn
3244          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
3245          AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
3246          echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
3247          echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
3248          fi
3249         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
3250         if test "$JAVA_HOME" != "/usr"; then
3251            if test "$_os" = "Darwin"; then
3252               dnl Leopard returns a non-suitable path with readlink - points to "Current" only
3253               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
3254               dnl Tiger already returns a JDK path..
3255               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
3256            else
3257               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
3258            fi
3259         fi
3260      fi
3261      # now check if $JAVA_HOME is really valid
3262      if test "$_os" = "Darwin"; then
3263         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
3264            JAVA_HOME_OK="NO"
3265         fi
3266      elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
3267         JAVA_HOME_OK="NO"
3268      fi
3269      if test "$JAVA_HOME_OK" = "NO"; then
3270         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
3271         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
3272         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
3273         echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
3274         echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
3275         echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
3276#         if test "$JDK" = "gcj"; then
3277#             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
3278#         fi
3279      fi
3280    fi
3281fi
3282
3283AWTLIB=
3284if test "$SOLAR_JAVA" != ""; then
3285   AC_MSG_CHECKING([for jawt lib name])
3286   if test "$JDK" = "gcj"; then
3287      save_CFLAGS=$CFLAGS
3288      save_LDFLAGS=$LDFLAGS
3289      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3290      LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
3291      exec 6>/dev/null # no output
3292      AC_CHECK_HEADER(jni.h, [],
3293                    [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
3294      AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
3295      exec 6>&1 # output on again
3296      CFLAGS=$save_CFLAGS
3297      LDFLAGS=$save_LDFLAGS
3298   fi
3299   # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
3300   # A workaround is to link also against libpmawt.so
3301   if test "$JDK" = "ibm" ; then
3302      save_CFLAGS=$CFLAGS
3303      save_LDFLAGS=$LDFLAGS
3304      save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
3305      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3306      LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
3307      LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
3308      export LD_LIBRARY_PATH
3309      exec 6>/dev/null # no output
3310      AC_CHECK_HEADER(jni.h, [],
3311                    [AC_MSG_ERROR([jni.h could not be found.])], [])
3312      AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
3313      if test -z "$AWTLIB"; then
3314         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
3315         AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
3316      fi
3317      exec 6>&1 # output on again
3318      CFLAGS=$save_CFLAGS
3319      LDFLAGS=$save_LDFLAGS
3320      LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
3321   fi
3322   if test -z "$AWTLIB"; then
3323      AWTLIB=-ljawt
3324   fi
3325   AC_MSG_RESULT([$AWTLIB])
3326   AC_SUBST(AWTLIB)
3327fi
3328
3329dnl ===================================================================
3330dnl Check for optional gcj for AOT
3331dnl ===================================================================
3332if test "$SOLAR_JAVA" != ""; then
3333  AC_MSG_CHECKING([whether to enable gcj aot compilation])
3334  if test -n "$enable_gcjaot" && test "$enable_gcjaot" != "no"; then
3335     AC_MSG_RESULT([yes])
3336     if test `echo $WITH_JAVA | grep -c "gij"` -eq 0; then
3337        gcjaot="gcj"
3338     else
3339        gcjaot=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g"`
3340     fi
3341     AC_MSG_RESULT([$gcjaot])
3342     if test -n "$with_jdk_home"; then
3343        _javac_path="$with_jdk_home/bin/$gcjaot"
3344        dnl Check if there is a gcj at all.
3345        if test -x "$_javac_path"; then
3346           JAVAAOTCOMPILER=$_javac_path
3347        fi
3348     fi
3349     if test -z "$JAVAAOTCOMPILER"; then
3350        AC_PATH_PROG(JAVAAOTCOMPILER, $gcjaot)
3351     fi
3352     if test -z "$JAVAAOTCOMPILER"; then
3353        AC_MSG_WARN([$gcjaot not found, please use --with-jdk-home])
3354     fi
3355  else
3356     AC_MSG_RESULT([no])
3357  fi
3358fi
3359
3360AC_SUBST(JAVA_HOME)
3361AC_SUBST(JDK)
3362AC_SUBST(JAVAFLAGS)
3363AC_SUBST(JAVAINTERPRETER)
3364AC_SUBST(JAVAIFLAGS)
3365AC_SUBST(JAVACOMPILER)
3366AC_SUBST(JAVAAOTCOMPILER)
3367AC_SUBST(JAVADOC)
3368
3369dnl ===================================================================
3370dnl Checks for specific files.
3371dnl ===================================================================
3372
3373dnl ===================================================================
3374dnl Checks for programs.
3375dnl ===================================================================
3376
3377AC_MSG_CHECKING([whether to enable EPM for packing])
3378if test "$enable_epm" = "yes"; then
3379   AC_MSG_RESULT([yes])
3380   dnl ===================================================================
3381   dnl Check for epm - not needed for windows
3382   dnl ===================================================================
3383   if test "$_os" != "WINNT"; then
3384      if test -n "$with_epm"; then
3385	      EPM=$with_epm
3386      else
3387         AC_PATH_PROG(EPM, epm, no)
3388      fi
3389
3390      # Override system epm and --with-epm if --with-epm-url is used.
3391      if test -n "$with_epm_url" ; then
3392         # At this moment we can not verify the URL or the content that we want to download.
3393       	 EPM_URL=$with_epm_url
3394       	 AC_MSG_RESULT([epm will be downloaded and compiled in bootstrap])
3395       	 EPM=
3396         echo "EPM will be built."
3397         BUILD_EPM=YES
3398         BUILD_TYPE="$BUILD_TYPE EPM"
3399      else
3400         if test "$EPM" = "no" ; then
3401	    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.])
3402	 else
3403	    # Gentoo has some epm which is something different...
3404            AC_MSG_CHECKING([whether the found epm is the right epm])
3405            if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
3406               AC_MSG_RESULT([yes])
3407            else
3408	       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.])
3409            fi
3410            AC_MSG_CHECKING([epm version])
3411            EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
3412	    if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
3413	       	    test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
3414               AC_MSG_RESULT([OK, >= 3.7])
3415               BUILD_EPM=NO
3416	    else
3417               AC_MSG_ERROR([too old. epm >= 3.7 is required.])
3418	    fi
3419      	 fi
3420      fi
3421   fi
3422
3423   # test which package format to use
3424   AC_MSG_CHECKING([which package format to use])
3425
3426   # defaults
3427   case "$_os" in
3428	OS2)
3429		PKGFORMAT=native
3430		;;
3431	Darwin)
3432		PKGFORMAT=dmg
3433		;;
3434	SunOS)
3435		PKGFORMAT=pkg
3436		;;
3437	Linux)
3438      # if building on Debian, default should be deb...
3439      if test -e /etc/debian_version; then
3440         PKGFORMAT=deb
3441      else
3442         PKGFORMAT=rpm
3443      fi
3444		;;
3445	AIX)
3446		PKGFORMAT=aix
3447		;;
3448	*BSD)
3449		PKGFORMAT=bsd
3450		;;
3451	OSF1)
3452		PKGFORMAT=setld
3453		;;
3454    WINNT)
3455        PKGFORMAT=msi
3456        ;;
3457	# we never should get here since we check the arciecture/os at the beginning,
3458	# but go sure...
3459	*)
3460		AC_MSG_ERROR([unknown system])
3461   esac
3462   if test -n "$with_package_format"; then
3463	for i in $with_package_format; do
3464		case "$i" in
3465			aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
3466			;;
3467		*)
3468			AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
3469aix - AIX software distribution
3470bsd - FreeBSD, NetBSD, or OpenBSD software distribution
3471depot or swinstall - HP-UX software distribution
3472deb - Debian software distribution
3473inst or tardist - IRIX software distribution
3474osx - MacOS X software distribution
3475pkg - Solaris software distribution
3476rpm - RedHat software distribution
3477setld - Tru64 (setld) software distribution
3478native - "Native" software distribution for the platform
3479portable - Portable software distribution
3480OOo additionally supports:
3481archive - .tar.gz or .zip
3482dmg - Mac OS X .dmg
3483installed - installation tree
3484msi - Windows .msi
3485			])
3486			;;
3487		esac
3488	done
3489	PKGFORMAT="$with_package_format"
3490   fi
3491   AC_MSG_RESULT([$PKGFORMAT])
3492   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
3493      AC_MSG_CHECKING([for rpm])
3494      for a in "$RPM" rpmbuild rpm; do
3495         $a --usage >/dev/null 2> /dev/null
3496         if test $? -eq 0; then
3497            RPM=$a
3498            break
3499         else
3500            $a --version >/dev/null 2> /dev/null
3501            if test $? -eq 0; then
3502               RPM=$a
3503               break
3504            fi
3505         fi
3506       done
3507       if test -z "$RPM" ; then
3508          AC_MSG_ERROR([not found])
3509       elif "$RPM" --usage 2>&1 | $EGREP -- -bb >/dev/null; then
3510          RPM_PATH=`which $RPM`
3511          AC_MSG_RESULT([$RPM_PATH])
3512       else
3513          AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
3514       fi
3515   fi
3516   if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
3517      AC_PATH_PROG(DPKG, dpkg, no)
3518      if test "$DPKG" = "no"; then
3519         AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
3520      fi
3521      AC_PATH_PROG(FAKEROOT, fakeroot, no)
3522      if test "$FAKEROOT" = "no"; then
3523         AC_MSG_WARN([fakeroot recommended for deb creation. Will try with getuid.so hack.])
3524      fi
3525   fi
3526   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
3527      echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3528      	if test "$EPM" != "no" && test "$EPM" != "internal"; then
3529           if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
3530               AC_MSG_CHECKING([whether epm is patched for OOos needs])
3531               if grep "Patched for Apache OpenOffice" $EPM >/dev/null 2>/dev/null; then
3532                  AC_MSG_RESULT([yes])
3533               else
3534                  AC_MSG_RESULT([no])
3535                  if echo "$PKGFORMAT" | grep -q rpm; then
3536                      _pt="rpm"
3537                      AC_MSG_WARN([the rpms will need to be installed with --nodeps])
3538                      echo "the rpms will need to be installed with --nodeps" >> warn
3539                  else
3540                      _pt="pkg"
3541                  fi
3542                  AC_MSG_WARN([the ${_pt}s will not be relocateable])
3543                  echo "the ${_pt}s will not be relocateable" >> warn
3544                  AC_MSG_WARN([if you want to make sure installation without --nodeps and
3545                  relocation will work, you need to patch your epm with the
3546                  patch in epm/epm-3.7.patch or build with
3547                  --with-epm=internal which will build a suitable epm])
3548               fi
3549           fi
3550        fi
3551   fi
3552   if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3553      AC_PATH_PROG(PKGMK, pkgmk, no)
3554      if test "$PKGMK" = "no"; then
3555         AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
3556      fi
3557   fi
3558   AC_SUBST(RPM)
3559   AC_SUBST(DPKG)
3560   AC_SUBST(FAKEROOT)
3561   AC_SUBST(PKGMK)
3562else
3563   AC_MSG_RESULT([no])
3564   BUILD_EPM=NO
3565   EPM=NO
3566   PKGFORMAT=native
3567fi
3568AC_SUBST(BUILD_EPM)
3569AC_SUBST(EPM_URL)
3570AC_SUBST(EPM)
3571AC_SUBST(PKGFORMAT)
3572
3573dnl ===================================================================
3574dnl Check for gperf
3575dnl ===================================================================
3576AC_PATH_PROG(GPERF, gperf)
3577if test -z "$with_gperf"; then
3578    AC_PATH_PROG(GPERF, gperf)
3579    if test -z "$GPERF"; then
3580       AC_MSG_ERROR([gperf not found but needed. Install it and/or specify --with-gperf=/path/to/it.])
3581    fi
3582else
3583  if test -x "$with_gperf"; then
3584    GPERF=$with_gperf
3585  else
3586    AC_MSG_ERROR([--with-gperf did not point to an executable])
3587  fi
3588fi
3589AC_MSG_CHECKING([gperf version])
3590if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
3591	AC_MSG_RESULT([OK])
3592   GPERF=$GPERF
3593else
3594	AC_MSG_ERROR([too old, you need at least 3.0.0])
3595fi
3596AC_SUBST(GPERF)
3597
3598dnl ===================================================================
3599dnl Check for building stax
3600dnl ===================================================================
3601AC_MSG_CHECKING([whether to build the stax])
3602if test -f "./stax/download/stax-1.2.0.jar"; then
3603   BUILD_STAX=NO
3604   AC_MSG_RESULT([no, will use the prebuilt stax/download/stax-1.2.0.jar])
3605else
3606   BUILD_STAX=YES
3607   AC_MSG_RESULT([yes])
3608fi
3609AC_SUBST(BUILD_STAX)
3610
3611dnl ===================================================================
3612dnl Check for building ODK
3613dnl ===================================================================
3614AC_MSG_CHECKING([whether to build the ODK])
3615if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
3616   AC_MSG_RESULT([yes])
3617   if test "$WITH_JAVA" != "no"; then
3618   AC_MSG_CHECKING([for external/unowinreg/unowinreg.dll])
3619   if ! test -f "./external/unowinreg/unowinreg.dll"; then
3620      HAVE_UNOWINREG_DLL=no
3621   else
3622      HAVE_UNOWINREG_DLL=yes
3623   fi
3624   if test "$HAVE_UNOWINREG_DLL" = "yes"; then
3625      AC_MSG_RESULT([found])
3626      BUILD_UNOWINREG=NO
3627   else
3628      if test "$_os" = "WINNT"; then
3629         AC_MSG_RESULT([not found, will be built])
3630      else
3631         AC_MSG_WARN([not found, will be cross-built using mingw32])
3632      fi
3633      BUILD_UNOWINREG=YES
3634   fi
3635   if test "$_os" != "WINNT" && test "$BUILD_UNOWINREG" = "YES"; then
3636      if test -z "$WITH_MINGWIN" || test "$WITH_MINGWIN" = "0"; then
3637         AC_MSG_ERROR([for rebuilding unowinreg.dll you need the mingw32 C++ compiler.
3638         Specify mingw32 g++ executable name with --with-mingwin.
3639         Or use prebuilt one from http://tools.openoffice.org/unowinreg_prebuild/680/ and
3640         put it into external/unowinreg using your browser or a command equivalent to:
3641         wget -O external/unowinreg/unowinreg.dll http://www.openoffice.org/tools/unowinreg_prebuild/680/unowinreg.dll])
3642      fi
3643      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3644         if ! test -x "$WITH_MINGWIN"; then MINGWCXX=false; else MINGWCXX=`basename $WITH_MINGWIN`; fi
3645      else
3646         AC_CHECK_TOOL(MINGWCXX, $WITH_MINGWIN, false)
3647      fi
3648      if test "$MINGWCXX" = "false"; then
3649         AC_MSG_ERROR(specified MinGW32 C++ cross-compiler not found. Install it or correct name.)
3650      fi
3651      AC_MSG_CHECKING(whether we are using the MinGW32 cross C++ compiler)
3652      if ! echo "`$MINGWCXX -dumpmachine`" | grep -q mingw32; then
3653         AC_MSG_ERROR(no)
3654      else
3655         AC_MSG_RESULT(yes)
3656      fi
3657      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3658         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
3659      else
3660         AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`, false)
3661      fi
3662      if test "$MINGWSTRIP" = "false"; then
3663         AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
3664      fi
3665      AC_LANG_PUSH([C++])
3666      save_CXX=$CXX
3667      save_CXXCPP=$CXXCPP
3668      CXX=$MINGWCXX
3669      CXXCPP="$MINGWCXX -E"
3670      save_CXXFLAGS=$CXXFLAGS
3671      save_CPPFLAGS=$CPPFLAGS
3672      CXXFLAGS="$CXXFLAGS -I$JAVA_HOME/include"
3673      CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include"
3674      # LIBS contains -lcrypt etc due to teh AC_CHECK_LIBS which obviously
3675      # do not make sense here (and 'd make the check fail)
3676      save_LIBS=$LIBS
3677      LIBS=""
3678      AC_HAVE_LIBRARY(kernel32)
3679      AC_HAVE_LIBRARY(advapi32)
3680      AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR([windows.h missing])])
3681      CXXFLAGS=$save_CXXFLAGS
3682      CPPFLAGS=$save_CPPFLAGS
3683      CXX=$save_CXX
3684      CXXCPP=$save_CXXCPP
3685      LIBS=$save_LIBS
3686      AC_LANG_POP([C++])
3687      fi
3688   fi
3689   BUILD_TYPE="$BUILD_TYPE ODK"
3690else
3691   AC_MSG_RESULT([no])
3692   BUILD_UNOWINREG=NO
3693fi
3694AC_SUBST(BUILD_UNOWINREG)
3695AC_SUBST(MINGWCXX)
3696AC_SUBST(MINGWSTRIP)
3697
3698dnl ===================================================================
3699dnl Check for system stdlibs
3700dnl ===================================================================
3701AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
3702if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
3703   test "$with_system_stdlibs" != "no"; then
3704   AC_MSG_RESULT([no])
3705   SYSTEM_STDLIBS=YES
3706else
3707   AC_MSG_RESULT([yes])
3708   SYSTEM_STDLIBS=NO
3709fi
3710AC_SUBST(SYSTEM_STDLIBS)
3711
3712dnl ===================================================================
3713dnl Check for system zlib
3714dnl ===================================================================
3715if test "$_os" = "Darwin" && test "$with_system_zlib" != "no"; then
3716   with_system_zlib=yes
3717fi
3718AC_MSG_CHECKING([which zlib to use])
3719if test -n "$with_system_zlib" -o -n "$with_system_libs" && \
3720	test "$with_system_zlib" != "no"; then
3721    AC_MSG_RESULT([external])
3722    SYSTEM_ZLIB=YES
3723    AC_CHECK_HEADER(zlib.h, [],
3724        [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
3725    AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
3726        [AC_MSG_ERROR(zlib not found or functional)], [])
3727else
3728    AC_MSG_RESULT([internal])
3729    SYSTEM_ZLIB=NO
3730    BUILD_TYPE="$BUILD_TYPE ZLIB"
3731fi
3732AC_SUBST(SYSTEM_ZLIB)
3733
3734dnl ===================================================================
3735dnl Check for system jpeg
3736dnl ===================================================================
3737AC_MSG_CHECKING([which jpeg to use])
3738if test -n "$with_system_jpeg" -o -n "$with_system_libs" && \
3739	test "$with_system_jpeg" != "no"; then
3740    AC_MSG_RESULT([external])
3741    SYSTEM_JPEG=YES
3742    AC_CHECK_HEADER(jpeglib.h, [],
3743        [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
3744    AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
3745	[AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
3746else
3747    AC_MSG_RESULT([internal])
3748    SYSTEM_JPEG=NO
3749    BUILD_TYPE="$BUILD_TYPE JPEG"
3750fi
3751AC_SUBST(SYSTEM_JPEG)
3752
3753dnl ===================================================================
3754dnl Check for system expat
3755dnl ===================================================================
3756AC_MSG_CHECKING([which expat to use])
3757if test -n "$with_system_expat" -o -n "$with_system_libs" && \
3758	test "$with_system_expat" != "no"; then
3759    AC_MSG_RESULT([external])
3760    SYSTEM_EXPAT=YES
3761    AC_CHECK_HEADER(expat.h, [],
3762        [AC_MSG_ERROR(expat.h not found. install expat)], [])
3763    AC_CHECK_LIB(expat, XML_ParserCreate, [],
3764	[AC_MSG_RESULT(expat library not found or functional.)], [])
3765else
3766    AC_MSG_RESULT([internal])
3767    SYSTEM_EXPAT=NO
3768    BUILD_TYPE="$BUILD_TYPE EXPAT"
3769fi
3770AC_SUBST(SYSTEM_EXPAT)
3771
3772dnl ===================================================================
3773dnl Check for system libwpd
3774dnl ===================================================================
3775AC_MSG_CHECKING([which libwpd to use])
3776if test -n "$with_system_libwpd" -o -n "$with_system_libs" && \
3777        test "$with_system_libwpd" != "no"; then
3778    AC_MSG_RESULT([external])
3779    SYSTEM_LIBWPD=YES
3780    PKG_CHECK_MODULES( LIBWPD, libwpd-0.8 )
3781else
3782    AC_MSG_RESULT([no])
3783    SYSTEM_LIBWPD=
3784fi
3785AC_SUBST(SYSTEM_LIBWPD)
3786AC_SUBST(LIBWPD_CFLAGS)
3787AC_SUBST(LIBWPD_LIBS)
3788
3789dnl ===================================================================
3790dnl Check for system cppunit
3791dnl ===================================================================
3792WITH_CPPUNIT=
3793AC_MSG_CHECKING([which cppunit to use])
3794if test -n "$with_system_cppunit" -o -n "$with_system_libs" && \
3795        test "$with_system_cppunit" != "no"; then
3796    SYSTEM_CPPUNIT=YES
3797    # might work for earlier, too but go sure:
3798    PKG_CHECK_MODULES( CPPUNIT,
3799                       cppunit >= 1.12.0,
3800                       WITH_CPPUNIT="YES",
3801                       WITH_CPPUNIT="")
3802    if test -n "$WITH_CPPUNIT"; then
3803       AC_MSG_RESULT([found system cppunit $CPPUNIT])
3804    else
3805       AC_MSG_WARN([dit not find system cppunit version 1.12.0 or later])
3806    fi
3807
3808else
3809    AC_MSG_WARN([not using cppunit])
3810    SYSTEM_CPPUNIT=NO
3811fi
3812AC_SUBST(SYSTEM_CPPUNIT)
3813AC_SUBST(CPPUNIT_CFLAGS)
3814AC_SUBST(CPPUNIT_LIBS)
3815AC_SUBST(WITH_CPPUNIT)
3816
3817dnl ===================================================================
3818dnl Check whether freetype is available
3819dnl ===================================================================
3820if test  "$test_freetype" = "yes"; then
3821   AC_MSG_CHECKING([whether freetype is available])
3822	PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
3823fi
3824AC_SUBST(FREETYPE_CFLAGS)
3825AC_SUBST(FREETYPE_LIBS)
3826
3827dnl ===================================================================
3828dnl Check whether freetype2 supports emboldening
3829dnl ===================================================================
3830if test  "$test_freetype" = "yes"; then
3831    save_CPPFLAGS="$CPPFLAGS"
3832    save_LDFLAGS="$LDFLAGS"
3833    save_LIBS="$LIBS"
3834    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
3835    LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
3836    AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
3837                 [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
3838    LDFLAGS="$save_LDFLAGS"
3839    CPPFLAGS="$save_CPPFLAGS"
3840    LIBS="$save_LIBS"
3841fi
3842AC_SUBST(USE_FT_EMBOLDEN)
3843
3844if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
3845   test "$with_system_libxslt" != "no"; then
3846    if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
3847      test "$with_system_libxml" = "no"; then
3848      # somehow AC_MSG_WARN won't work...
3849       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
3850       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
3851       with_system_libxml=yes
3852    fi
3853fi
3854if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
3855   test "$with_system_libxml" != "no"; then
3856    if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
3857      test "$with_system_libxslt" = "no"; then
3858      # somehow AC_MSG_WARN won't work...
3859       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
3860       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
3861       with_system_libxslt=yes
3862    fi
3863fi
3864
3865dnl ===================================================================
3866dnl Check for system libxslt
3867dnl ===================================================================
3868AC_MSG_CHECKING([which libxslt to use])
3869if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
3870       "$_os" = "Darwin" && \
3871   test "$with_system_libxslt" != "no"; then
3872   AC_MSG_RESULT([external])
3873   SYSTEM_LIBXSLT=YES
3874
3875	if test "$_os" != "Darwin"; then
3876		PKG_CHECK_MODULES(LIBXSLT, libxslt)
3877	else
3878		LIBXSLT_CFLAGS=`xslt-config --cflags`
3879		LIBXSLT_LIBS=`xslt-config --libs`
3880	fi
3881
3882   dnl Check for xsltproc
3883   AC_PATH_PROG(XSLTPROC, xsltproc, no)
3884   if test "$XSLTPROC" = "no"; then
3885      AC_MSG_ERROR([xsltproc is required])
3886   fi
3887else
3888   AC_MSG_RESULT([internal])
3889   SYSTEM_LIBXSLT=NO
3890   BUILD_TYPE="$BUILD_TYPE LIBXSLT"
3891fi
3892AC_SUBST(SYSTEM_LIBXSLT)
3893AC_SUBST(LIBXSLT_CFLAGS)
3894AC_SUBST(LIBXSLT_LIBS)
3895
3896
3897dnl ===================================================================
3898dnl Check for system libxml
3899dnl ===================================================================
3900AC_MSG_CHECKING([which libxml to use])
3901if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
3902            "$_os" = "Darwin" && \
3903	test "$with_system_libxml" != "no"; then
3904    AC_MSG_RESULT([external])
3905    SYSTEM_LIBXML=YES
3906    BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
3907
3908	if test "$_os" != "Darwin"; then
3909		PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
3910	else
3911		LIBXML_CFLAGS=`xml2-config --cflags`
3912		LIBXML_LIBS=`xml2-config --libs`
3913	fi
3914else
3915    AC_MSG_RESULT([internal])
3916    SYSTEM_LIBXML=NO
3917    BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
3918fi
3919AC_SUBST(SYSTEM_LIBXML)
3920AC_SUBST(LIBXML_CFLAGS)
3921AC_SUBST(LIBXML_LIBS)
3922
3923
3924dnl ===================================================================
3925dnl Checks for a MacOS platform SDK compatible with an OSX 10.7 deployment target
3926dnl ===================================================================
3927if test  "$_os" = "Darwin"; then
3928   sdk_target=10.7
3929   AC_MSG_CHECKING([checking SDK compatibility with OSX $sdk_target])
3930
3931   sdk_minor=`echo $sdk_target | cut -d"." -f2`
3932
3933   if test "$sdk_minor" -lt "7"; then
3934      AC_MSG_ERROR([SDK version < 10.7 is not longer supported])
3935   else
3936      MACOSX_DEPLOYMENT_TARGET=$sdk_target
3937
3938      sdk_found=`xcodebuild -showsdks | $EGREP "sdk macosx10.(7|8|9|10|11)" | sed -e "s/.*sdk //" | tail -n1`
3939      if test -z "$sdk_found"; then
3940         AC_MSG_ERROR([No SDK with OSX $sdk_target compatibility found])
3941      else
3942         AC_MSG_RESULT([yes, by using SDK $sdk_found])
3943      fi
3944
3945      sdk_path=`xcodebuild -version -sdk ${sdk_found} Path`
3946      AC_MSG_CHECKING([for $sdk_path])
3947      if test -d "$sdk_path"; then
3948         AC_MSG_RESULT([yes])
3949      else
3950         AC_MSG_ERROR([not found!])
3951      fi
3952
3953      MACOSX_SDK_PATH=$sdk_path
3954   fi
3955
3956fi
3957AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3958AC_SUBST(MACOSX_SDK_PATH)
3959
3960
3961dnl ===================================================================
3962dnl Check for system python
3963dnl ===================================================================
3964AC_MSG_CHECKING([which python to use])
3965if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
3966   with_system_python=yes
3967
3968   _python="/Library/Frameworks/Python.framework/Versions/Current/bin/python"
3969   if test ! -f $_python; then
3970   	  _python="/usr/bin/python"
3971   fi
3972   AC_MSG_RESULT([compiling against system python ($_python)])
3973
3974   _python_hexversion=`$_python -c "import sys; print(sys.hexversion);"`
3975
3976   dnl hex version of Python 2.7.1 = 34013680
3977   if test $_python_hexversion -ge 34013680 ; then
3978   	  _python_version=`$_python -c "import sys; print sys.version;" | head -c 3`
3979      AC_MSG_RESULT([compiling against system python (version $_python_version)])
3980
3981	  _python_ver=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
3982
3983	  if test -d "/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
3984	  	 PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
3985         elif test -d "$MACOSX_SDK_PATH/usr/include/python$_python_ver"; then
3986             PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/python$_python_ver"
3987	  else
3988             PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
3989	  fi
3990   else
3991		AC_MSG_ERROR([Python 2.7.1 or higher is required])
3992   fi
3993
3994   PYTHON_LIBS="-framework Python"
3995elif test -n "$with_system_python" -o -n "$with_system_libs" && \
3996	test "$with_system_python" != "no"; then
3997   with_system_python=yes
3998   AC_MSG_RESULT([external])
3999   AM_PATH_PYTHON([2.7])
4000
4001   python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
4002   python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4003   PYTHON_CFLAGS="-I$python_include"
4004   PYTHON_LIBS="-lpython$python_version"
4005fi
4006if test "$with_system_python" = "yes" ; then
4007   SYSTEM_PYTHON=YES
4008   dnl check if the headers really work:
4009   save_CPPFLAGS="$CPPFLAGS"
4010   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4011   AC_CHECK_HEADER(Python.h, [],
4012       [AC_MSG_ERROR(Python headers not found)], [])
4013   CPPFLAGS="$save_CPPFLAGS"
4014else
4015   SYSTEM_PYTHON=NO
4016   BUILD_TYPE="$BUILD_TYPE PYTHON"
4017   AC_MSG_RESULT([internal])
4018   # Embedded python dies without Home set
4019   if test "z$HOME" = "z"; then
4020      export HOME="";
4021   fi
4022   # bz2 tarball and bzip2 is not standard
4023   if test -z "$BZIP2"; then
4024	AC_PATH_PROG( BZIP2, bzip2)
4025	if test -z "$BZIP2"; then
4026   		AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
4027   	fi
4028   fi
4029fi
4030AC_SUBST(SYSTEM_PYTHON)
4031AC_SUBST(PYTHON_CFLAGS)
4032AC_SUBST(PYTHON_LIBS)
4033HOME=`echo $HOME | sed 's:\\\\:/:g'`
4034AC_SUBST(HOME)
4035
4036dnl ===================================================================
4037dnl Check for system lucene
4038dnl ===================================================================
4039AC_MSG_CHECKING([which lucene to use])
4040if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4041       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4042        AC_MSG_RESULT([external])
4043        SYSTEM_LUCENE=YES
4044        if test -z $LUCENE_CORE_JAR; then
4045          AC_CHECK_FILE(/usr/share/java/lucene-core-2.9.4.jar,
4046            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.9.4.jar ],
4047            [
4048              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4049                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4050                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4051                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4052                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4053                  )
4054                ]
4055              )
4056            ]
4057          )
4058        else
4059          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4060               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
4061        fi
4062
4063        if test -z $LUCENE_ANALYZERS_JAR; then
4064          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
4065            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
4066            [
4067              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
4068                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
4069                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
4070              )
4071            ]
4072          )
4073        else
4074          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4075               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
4076        fi
4077        AC_MSG_CHECKING([whether lucene is version 2.x])
4078        export LUCENE_CORE_JAR
4079        if $PERL -e 'use Archive::Zip;
4080            my $file = "$ENV{'LUCENE_CORE_JAR'}";
4081            my $zip = Archive::Zip->new( $file );
4082            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4083            if ( $mf =~ m/Specification-Version: 2.*/ ) {
4084                exit 0;
4085            } else {
4086                exit 1;
4087            }'; then
4088            AC_MSG_RESULT([yes])
4089         else
4090            AC_MSG_RESULT([no])
4091            AC_MSG_CHECKING([whether lucene is version 3.x])
4092
4093            if $PERL -e 'use Archive::Zip;
4094                my $file = "$ENV{'LUCENE_CORE_JAR'}";
4095                my $zip = Archive::Zip->new( $file );
4096                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4097                if ( $mf =~ m/Specification-Version: 3.*/ ) {
4098                    exit 0;
4099                } else {
4100                    exit 1;
4101                }'; then
4102                AC_MSG_RESULT([yes])
4103             else
4104                AC_MSG_ERROR([no, you need lucene 2 or 3])
4105             fi
4106         fi
4107
4108else
4109    AC_MSG_RESULT([internal])
4110    SYSTEM_LUCENE=NO
4111    BUILD_TYPE="$BUILD_TYPE LUCENE"
4112fi
4113AC_SUBST(SYSTEM_LUCENE)
4114AC_SUBST(LUCENE_CORE_JAR)
4115AC_SUBST(LUCENE_ANALYZERS_JAR)
4116
4117AC_MSG_CHECKING([whether to build the MySQL Connector extension])
4118if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
4119  AC_MSG_RESULT([yes])
4120  ENABLE_MYSQLC=YES
4121  AC_MSG_CHECKING([for mysqlc module])
4122  if test -d mysqlc; then
4123   AC_MSG_RESULT([OK])
4124  else
4125   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4126  fi
4127  BUILD_TYPE="$BUILD_TYPE MYSQLC"
4128else
4129  AC_MSG_RESULT([no])
4130  ENABLE_MYSQLC=NO
4131fi
4132AC_SUBST(ENABLE_MYSQLC)
4133
4134if test "$ENABLE_MYSQLC" = "YES"; then
4135dnl ===================================================================
4136dnl Check for system MySQL
4137dnl ===================================================================
4138AC_MSG_CHECKING([for mysql pre-requisites])
4139if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
4140       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
4141	AC_MSG_RESULT([external MySQL])
4142	SYSTEM_MYSQL=YES
4143	AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4144	AC_MSG_CHECKING([MySQL version])
4145	if test -z "$MYSQLCONFIG" -o ! -x "$MYSQLCONFIG" ; then
4146		AC_MSG_ERROR([can not find/execute mysql_config]);
4147	fi
4148	MYSQL_VERSION=`$MYSQLCONFIG --version`
4149	MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4150	if test "$MYSQL_MAJOR" -ge "5"; then
4151		AC_MSG_RESULT([OK])
4152	else
4153		AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4154	fi
4155	AC_MSG_CHECKING([for MySQL Client library])
4156	MYSQL_INC=`$MYSQLCONFIG --include`
4157	MYSQL_LIB=`$MYSQLCONFIG --libs`
4158	MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4159	AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4160else
4161    SYSTEM_MYSQL=NO
4162    if test -n "$with_libmysql_path"; then
4163        AC_MSG_RESULT([external Connector/C (libmysql)])
4164        LIBMYSQL=libmysql.so
4165        if test "$_os" = "Darwin"; then
4166            LIBMYSQL=libmysql.dylib
4167        elif test "$_os" = "WINNT"; then
4168            LIBMYSQL=libmysql.dll
4169        fi
4170        AC_MSG_CHECKING([for $LIBMYSQL])
4171        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4172            AC_MSG_RESULT([found.])
4173            LIBMYSQL_PATH=$with_libmysql_path
4174        else
4175            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4176        fi
4177    else
4178        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4179    fi
4180fi
4181AC_SUBST(SYSTEM_MYSQL)
4182AC_SUBST(MYSQL_INC)
4183AC_SUBST(MYSQL_LIB)
4184AC_SUBST(MYSQL_DEFINES)
4185AC_SUBST(LIBMYSQL_PATH)
4186
4187AC_LANG_PUSH([C++])
4188dnl ===================================================================
4189dnl Check for system MySQL C++ Connector
4190dnl ===================================================================
4191# FIXME!
4192# who thought this too-generic cppconn dir was a good idea?
4193AC_MSG_CHECKING([MySQL Connector/C++])
4194if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4195		test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4196	AC_MSG_RESULT([external])
4197	SYSTEM_MYSQL_CPPCONN=YES
4198        AC_LANG_PUSH([C++])
4199	AC_CHECK_HEADER(mysql_driver.h, [],
4200					[AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4201	AC_CHECK_LIB(mysqlcppconn, main, [],
4202					[AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4203   AC_MSG_CHECKING([version])
4204      AC_TRY_RUN([
4205#include <mysql_driver.h>
4206
4207int main(int argc, char **argv) {
4208	sql::Driver *driver;
4209	driver = get_driver_instance();
4210	if (driver->getMajorVersion() > 1 || \
4211	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4212	   (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4213        return 0;
4214      else
4215        return 1;
4216}
4217      ], [AC_MSG_RESULT(OK)], [AC_MSG_ERROR([not suitable, we need >= 1.0.6])])
4218        AC_LANG_POP([C++])
4219
4220else
4221	AC_MSG_RESULT([no])
4222	SYSTEM_MYSQL_CPPCONN=
4223fi
4224AC_LANG_POP([C++])
4225AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4226fi
4227
4228dnl ===================================================================
4229dnl Check for system hsqldb
4230dnl ===================================================================
4231AC_MSG_CHECKING([which hsqldb to use])
4232if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4233       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4234        AC_MSG_RESULT([external])
4235        SYSTEM_HSQLDB=YES
4236        if test -z $HSQLDB_JAR; then
4237               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4238        fi
4239        AC_CHECK_FILE($HSQLDB_JAR, [],
4240               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4241        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4242        export HSQLDB_JAR
4243        if $PERL -e 'use Archive::Zip;
4244            my $file = "$ENV{'HSQLDB_JAR'}";
4245            my $zip = Archive::Zip->new( $file );
4246            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4247            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4248               push @l, split(/\n/, $mf);
4249               foreach my $line (@l) {
4250                  if ($line =~ m/Specification-Version:/) {
4251                      ($t, $version) = split (/:/,$line);
4252                      $version =~ s/^\s//;
4253                      ($a, $b, $c, $d) = split (/\./,$version);
4254                      if ($c == "0" && $d > "8")  {
4255                          exit 0;
4256                      } else {
4257                          exit 1;
4258                      }
4259                  }
4260               }
4261            } else {
4262                exit 1;
4263            }'; then
4264            AC_MSG_RESULT([yes])
4265         else
4266            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
4267         fi
4268else
4269    AC_MSG_RESULT([internal])
4270    SYSTEM_HSQLDB=NO
4271    BUILD_TYPE="$BUILD_TYPE HSQLDB"
4272fi
4273AC_SUBST(SYSTEM_HSQLDB)
4274AC_SUBST(HSQLDB_JAR)
4275
4276dnl ===================================================================
4277dnl Check for system beanshell
4278dnl ===================================================================
4279ENABLE_BEANSHELL=YES
4280AC_MSG_CHECKING([which beanshell to use])
4281if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
4282       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
4283        AC_MSG_RESULT([external])
4284        SYSTEM_BSH=YES
4285        if test -z $BSH_JAR; then
4286               BSH_JAR=/usr/share/java/bsh.jar
4287        fi
4288        AC_CHECK_FILE($BSH_JAR, [],
4289               [AC_MSG_ERROR(bsh.jar not found.)], [])
4290elif test "x$enable_beanshell" = "xyes"; then
4291    AC_MSG_RESULT([internal])
4292    SYSTEM_BSH=NO
4293    BUILD_TYPE="$BUILD_TYPE BSH"
4294else
4295    AC_MSG_RESULT([none (disabled)])
4296    SYSTEM_BSH=NO
4297    ENABLE_BEANSHELL=NO
4298fi
4299AC_SUBST(SYSTEM_BSH)
4300AC_SUBST(BSH_JAR)
4301AC_SUBST(ENABLE_BEANSHELL)
4302
4303
4304dnl ===================================================================
4305dnl Check for saxon.  It can come from two different places:
4306dnl - pre-installed on the system.  This is checked when the --with-system-saxon
4307dnl   option is given to configure.
4308dnl   The exact place can be specified with the --with-saxon-jar=<path> option.
4309dnl - From the saxon tar ball in ext_sources/.  This is used when --enable-saxon
4310dnl   is given to configure but not any of --with-system-saxon or --with-saxon-jar.
4311dnl ===================================================================
4312DISABLE_SAXON=
4313AC_MSG_CHECKING([which saxon to use])
4314if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
4315       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
4316        AC_MSG_RESULT([external])
4317        SYSTEM_SAXON=YES
4318        if test -z $SAXON_JAR; then
4319          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4320            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4321            [
4322              AC_CHECK_FILE(/usr/share/java/saxon.jar,
4323                [ SAXON_JAR=/usr/share/java/saxon.jar ],
4324                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4325                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4326                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
4327                  )
4328                ]
4329              )
4330            ]
4331          )
4332        else
4333          AC_CHECK_FILE($SAXON_JAR, [],
4334               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
4335        fi
4336        if test -n "$SERIALIZER_JAR"; then
4337          AC_CHECK_FILE($SERIALIZER_JAR, [],
4338               [AC_MSG_ERROR(serializer.jar not found.)], [])
4339          AC_SUBST(SERIALIZER_JAR)
4340        fi
4341
4342dnl Saxon comes in two practically available versions, the out-of-date saxonb which
4343dnl supports the java extensions that OOo uses, and the up-to-date saxon he
4344dnl "home edition" version, which is crippled to not support those java extensions.
4345dnl And as an aside the he one also needs to be tweaked to include
4346dnl a META-INF/services to broadcast that it supports the jaxp transform factory
4347
4348        AC_MSG_CHECKING([if saxon works])
4349        cat > saxontest.java <<_ACEOF
4350[import javax.xml.transform.TransformerFactory;
4351import javax.xml.transform.Transformer;
4352import javax.xml.transform.stream.StreamSource;
4353import java.io.*;
4354
4355import net.sf.saxon.FeatureKeys;
4356
4357class saxontest {
4358    public static void main(String[] args) {
4359      System.setProperty("javax.xml.transform.TransformerFactory",
4360        "net.sf.saxon.TransformerFactoryImpl");
4361      try {
4362        TransformerFactory tfactory = TransformerFactory.newInstance();
4363	// some external saxons (Debian, Ubuntu, ...) have this disabled
4364	// per default
4365	tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
4366        System.out.println("TransformerFactory is" +
4367          tfactory.getClass().getName());
4368        Transformer transformer = tfactory.newTransformer(
4369          new StreamSource(new File(args[0])));
4370      } catch(Exception e){
4371        e.printStackTrace(System.err);
4372        System.exit(-1);
4373      }
4374      System.exit(0);
4375    }
4376}
4377]
4378_ACEOF
4379        cat > saxontest.xsl<<_ACEOF
4380[<?xml version="1.0" encoding="UTF-8"?>
4381<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4382 <xsl:template match="/">
4383  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
4384 </xsl:template>
4385</xsl:stylesheet>
4386]
4387_ACEOF
4388        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
4389        AC_TRY_EVAL(javac_cmd)
4390        if test $? = 0 && test -f ./saxontest.class ; then
4391            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
4392            AC_TRY_EVAL(java_cmd)
4393            if test $? = 0; then
4394              AC_MSG_RESULT([yes])
4395            else
4396              cat saxontest.java >&5
4397              AC_MSG_RESULT([no])
4398              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
4399            fi
4400        else
4401          AC_MSG_RESULT([no])
4402          cat saxontest.java >&5
4403          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
4404        fi
4405elif test "x$enable_saxon" = "xyes"; then
4406    AC_MSG_RESULT([internal])
4407    SYSTEM_SAXON=NO
4408    BUILD_TYPE="$BUILD_TYPE SAXON"
4409else
4410    AC_MSG_RESULT([none (disabled)])
4411    SYSTEM_SAXON=NO
4412    DISABLE_SAXON=YES
4413fi
4414AC_SUBST(SYSTEM_SAXON)
4415AC_SUBST(SAXON_JAR)
4416AC_SUBST(DISABLE_SAXON)
4417
4418
4419dnl ===================================================================
4420dnl Check for rhino
4421dnl ===================================================================
4422ENABLE_JAVASCRIPT=
4423AC_MSG_CHECKING([whether to enable support for JavaScript])
4424if test "x$enable_javascript" = "xyes"; then
4425   BUILD_TYPE="$BUILD_TYPE RHINO"
4426   AC_MSG_RESULT([yes])
4427   ENABLE_JAVASCRIPT=YES
4428else
4429   AC_MSG_RESULT([no])
4430   ENABLE_JAVASCRIPT=NO
4431fi
4432AC_SUBST(ENABLE_JAVASCRIPT)
4433
4434
4435dnl ===================================================================
4436dnl Check for system apr
4437dnl ===================================================================
4438SYSTEM_APR=NO
4439APR_CFLAGS=
4440APR_LIBS=
4441AC_MSG_CHECKING([which libapr to use])
4442if test "x$with_system_apr" = "xyes" -o -n "$with_system_libs"; then
4443    AC_MSG_RESULT([system])
4444    PKG_CHECK_MODULES([APR], [apr-1 >= 1.0])
4445    SYSTEM_APR=YES
4446else
4447    AC_MSG_RESULT([internal])
4448    SYSTEM_APR=NO
4449    BUILD_TYPE="$BUILD_TYPE APR"
4450fi
4451AC_SUBST(SYSTEM_APR)
4452AC_SUBST(APR_CFLAGS)
4453AC_SUBST(APR_LIBS)
4454
4455
4456dnl ===================================================================
4457dnl Check for system apr-util
4458dnl ===================================================================
4459SYSTEM_APR_UTIL=NO
4460APR_UTIL_CFLAGS=
4461APR_UTIL_LIBS=
4462AC_MSG_CHECKING([which libapr-util to use])
4463if test "x$with_system_apr_util" = "xyes" -o -n "$with_system_libs"; then
4464    AC_MSG_RESULT([system])
4465    PKG_CHECK_MODULES([APR_UTIL], [apr-util-1 >= 1.0])
4466    SYSTEM_APR_UTIL=YES
4467else
4468    AC_MSG_RESULT([internal])
4469    SYSTEM_APR_UTIL=NO
4470    BUILD_TYPE="$BUILD_TYPE APR_UTIL"
4471fi
4472AC_SUBST(SYSTEM_APR_UTIL)
4473AC_SUBST(APR_UTIL_CFLAGS)
4474AC_SUBST(APR_UTIL_LIBS)
4475
4476
4477dnl ===================================================================
4478dnl Check for system serf
4479dnl ===================================================================
4480SYSTEM_SERF=NO
4481SERF_CFLAGS=
4482SERF_LIBS=
4483AC_MSG_CHECKING([which libserf to use])
4484if test -n "$with_system_serf" -o -n "$with_system_libs" && \
4485  test "$with_system_serf" != "no"; then
4486    AC_MSG_RESULT([system])
4487    PKG_CHECK_MODULES([SERF], [serf-1 >= 1.1])
4488    SYSTEM_SERF=YES
4489else
4490    AC_MSG_RESULT([internal])
4491    SYSTEM_SERF=NO
4492    BUILD_TYPE="$BUILD_TYPE SERF"
4493fi
4494AC_SUBST(SYSTEM_SERF)
4495AC_SUBST(SERF_CFLAGS)
4496AC_SUBST(SERF_LIBS)
4497
4498
4499dnl ===================================================================
4500dnl Check for CoinMP
4501dnl ===================================================================
4502ENABLE_COINMP=
4503SYSTEM_COINMP=NO
4504COINMP_CFLAGS=
4505COINMP_LIBS=
4506AC_MSG_CHECKING([whether to enable support for CoinMP])
4507if test "x$enable_coinmp" = "xyes"; then
4508    BUILD_TYPE="$BUILD_TYPE COINMP"
4509    AC_MSG_RESULT([yes])
4510    ENABLE_COINMP=YES
4511
4512    dnl Check wether to use system or internal CoinMP
4513    AC_MSG_CHECKING([which coinmp to use])
4514    if test "x$with_system_coinmp" = "xyes" -o -n "$with_system_libs"; then
4515        AC_MSG_RESULT([system])
4516	PKG_CHECK_MODULES([COINMP], [coinmp])
4517        SYSTEM_COINMP=YES
4518        # some systems need this. Like Ubuntu....
4519        AC_CHECK_LIB(m, floor)
4520        AC_CHECK_LIB(dl, dlopen)
4521    else
4522        AC_MSG_RESULT([internal])
4523        SYSTEM_COINMP=NO
4524        BUILD_TYPE="$BUILD_TYPE COINMP"
4525    fi
4526else
4527    AC_MSG_RESULT([no])
4528    ENABLE_COINMP=NO
4529fi
4530AC_SUBST(ENABLE_COINMP)
4531AC_SUBST(SYSTEM_COINMP)
4532AC_SUBST(COINMP_CFLAGS)
4533AC_SUBST(COINMP_LIBS)
4534
4535
4536dnl ===================================================================
4537dnl Check for system curl
4538dnl ===================================================================
4539if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
4540   with_system_curl=yes
4541fi
4542AC_MSG_CHECKING([which curl to use])
4543if test -n "$with_system_curl" -o -n "$with_system_libs" && \
4544	test "$with_system_curl" != "no"; then
4545   AC_MSG_RESULT([external])
4546   SYSTEM_CURL=YES
4547
4548   AC_PATH_PROG( CURLCONFIG, curl-config)
4549   if test -z "$CURLCONFIG"; then
4550      AC_MSG_ERROR([install curl to run this script])
4551   fi
4552
4553   # check curl version
4554   AC_MSG_CHECKING([whether curl is >= 7.13.1])
4555   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
4556	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
4557	"`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
4558      AC_MSG_ERROR([no, you need at least curl 7.13,1])
4559   else
4560      AC_MSG_RESULT([yes])
4561   fi
4562   CURL_LIBS=`$CURLCONFIG --libs`
4563   CURL_CFLAGS=`$CURLCONFIG --cflags`
4564else
4565   AC_MSG_RESULT([internal])
4566   SYSTEM_CURL=NO
4567   BUILD_TYPE="$BUILD_TYPE CURL"
4568fi
4569AC_SUBST(SYSTEM_CURL)
4570AC_SUBST(CURL_CFLAGS)
4571AC_SUBST(CURL_LIBS)
4572
4573dnl ===================================================================
4574dnl Check for system mdds
4575dnl ===================================================================
4576AC_MSG_CHECKING([which mdds to use])
4577if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
4578	test "$with_system_mdds" != "no"; then
4579    AC_MSG_RESULT([external])
4580    SYSTEM_MDDS=YES
4581    AC_LANG_PUSH([C++])
4582    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
4583        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
4584    AC_LANG_POP([C++])
4585else
4586   AC_MSG_RESULT([internal])
4587   BUILD_TYPE="$BUILD_TYPE MDDS"
4588   SYSTEM_MDDS=NO
4589fi
4590AC_SUBST(SYSTEM_MDDS)
4591
4592dnl ===================================================================
4593dnl Check for system boost
4594dnl ===================================================================
4595AC_MSG_CHECKING([which boost to use])
4596if test -n "$with_system_boost" -o -n "$with_system_headers" && \
4597	test "$with_system_boost" != "no"; then
4598   AC_MSG_RESULT([external])
4599   SYSTEM_BOOST=YES
4600   AC_LANG_PUSH([C++])
4601   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
4602       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
4603   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
4604       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
4605   AC_CHECK_HEADER(boost/function.hpp, [],
4606       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
4607
4608   save_CXXFLAGS=$CXXFLAGS
4609   CXXFLAGS="$CXXFLAGS -fno-exceptions"
4610   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
4611   AC_TRY_COMPILE([#include <boost/function.hpp>
4612], [],
4613   ac_cv_cxx_boost_no_exceptons_broken=no, ac_cv_cxx_boost_no_exceptons_broken=yes)
4614
4615   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
4616	AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
4617   else
4618  	AC_MSG_RESULT([yes])
4619   fi
4620   CXXFLAGS=$save_CXXFLAGS
4621   AC_LANG_POP([C++])
4622else
4623   AC_MSG_RESULT([internal])
4624   BUILD_TYPE="$BUILD_TYPE BOOST"
4625   SYSTEM_BOOST=NO
4626fi
4627AC_SUBST(SYSTEM_BOOST)
4628
4629dnl ===================================================================
4630dnl Check for system vigra
4631dnl ===================================================================
4632AC_MSG_CHECKING([which vigra to use])
4633if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
4634	test "$with_system_vigra" != "no"; then
4635   AC_MSG_RESULT([external])
4636   SYSTEM_VIGRA=YES
4637   AC_LANG_PUSH([C++])
4638   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
4639       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
4640   AC_LANG_POP([C++])
4641else
4642   AC_MSG_RESULT([internal])
4643   BUILD_TYPE="$BUILD_TYPE VIGRA"
4644   SYSTEM_VIGRA=NO
4645fi
4646AC_SUBST(SYSTEM_VIGRA)
4647
4648dnl ===================================================================
4649dnl Check for system odbc
4650dnl ===================================================================
4651AC_MSG_CHECKING([which odbc headers to use])
4652if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
4653	test "$with_system_odbc_headers" != "no"; then
4654   AC_MSG_RESULT([external])
4655   SYSTEM_ODBC_HEADERS=YES
4656
4657   AC_CHECK_HEADER(sqlext.h, [],
4658      [AC_MSG_ERROR(odbc not found. install odbc)], [])
4659else
4660   AC_MSG_RESULT([internal])
4661   SYSTEM_ODBC_HEADERS=NO
4662   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
4663fi
4664AC_SUBST(SYSTEM_ODBC_HEADERS)
4665
4666AC_MSG_CHECKING([whether to build XML Security support])
4667if test "$enable_nss_module" = "no"; then
4668   AC_MSG_RESULT([no, since NSS disabled but needed])
4669else
4670   AC_MSG_RESULT([yes])
4671fi
4672
4673AC_MSG_CHECKING([whether to build LDAP configuration backend])
4674if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
4675   if test "$with_openldap" = "yes"; then
4676      AC_MSG_RESULT([yes])
4677      WITH_LDAP=YES
4678   else
4679      WITH_LDAP=NO
4680   fi
4681else
4682   AC_MSG_RESULT([no])
4683   WITH_LDAP=NO
4684fi
4685
4686if test "$WITH_LDAP" = "YES"; then
4687   dnl ===================================================================
4688   dnl Test whether we want to use the OpenLDAP LDAP SDK
4689   dnl ===================================================================
4690   AC_MSG_CHECKING([which LDAP SDK to use])
4691   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
4692  	   AC_MSG_RESULT([OpenLDAP])
4693	   WITH_OPENLDAP=YES
4694	   AC_CHECK_HEADERS(ldap.h, [],
4695		   [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
4696	   AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
4697		   [AC_MSG_ERROR(openldap lib not found or functional)], [])
4698	   # rumours say that OpenLDAP doesn't have that function. I looked and
4699	   # it has it. Test for it to be sure
4700         AC_CHECK_LIB(ldap, ldap_set_option, [],
4701                [AC_MSG_ERROR(openldap lib not found or functional)], [])
4702   fi
4703fi
4704AC_SUBST(WITH_LDAP)
4705AC_SUBST(WITH_OPENLDAP)
4706
4707AC_MSG_CHECKING([whether to build the internal NSS module])
4708if test "$enable_nss_module" != "no"; then
4709   ENABLE_NSS_MODULE="YES"
4710   BUILD_TYPE="$BUILD_TYPE NSS"
4711   AC_MSG_RESULT([yes])
4712   if test "$_os" = "WINNT"; then
4713      AC_MSG_CHECKING([for Mozilla build tooling])
4714      if test -z "$MOZILLABUILD" ; then
4715AC_MSG_ERROR([
4716Mozilla build tooling not found!
4717  It is required for NSS that is needed for AOO's security facilities.
4718  Either disable NSS using the option --disable-nss-module
4719  or use the --with-mozilla-build option after installing the tool obtained
4720  from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32])
4721      else
4722         if test \( "$WITH_MINGWIN" = "yes" \) ; then
4723            if test ! -d "$MOZILLABUILD" ; then
4724AC_MSG_ERROR([Mozilla build tooling incomplete!])
4725            else
4726               AC_MSG_RESULT([ok])
4727            fi
4728         else
4729            if test ! -d "$MOZILLABUILD/msys" ; then
4730AC_MSG_ERROR([Mozilla build tooling incomplete!])
4731            else
4732               AC_MSG_RESULT([ok])
4733            fi
4734         fi
4735      fi
4736   fi
4737else
4738   ENABLE_NSS_MODULE="NO"
4739   AC_MSG_RESULT([no])
4740fi
4741
4742AC_SUBST(ENABLE_NSS_MODULE)
4743AC_SUBST(MOZILLABUILD)
4744AC_SUBST(MOZ_INC)
4745
4746dnl ===================================================================
4747dnl Check for system sane
4748dnl ===================================================================
4749AC_MSG_CHECKING([which sane header to use])
4750if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
4751	test "$with_system_sane_header" != "no"; then
4752   AC_MSG_RESULT([external])
4753   SYSTEM_SANE_HEADER=YES
4754   AC_CHECK_HEADER(sane/sane.h, [],
4755      [AC_MSG_ERROR(sane not found. install sane)], [])
4756else
4757   AC_MSG_RESULT([internal])
4758   SYSTEM_SANE_HEADER=NO
4759   BUILD_TYPE="$BUILD_TYPE SANE"
4760fi
4761AC_SUBST(SYSTEM_SANE_HEADER)
4762
4763dnl ===================================================================
4764dnl Check for system icu
4765dnl ===================================================================
4766AC_MSG_CHECKING([which icu to use])
4767if test -n "$with_system_icu" -o -n "$with_system_libs" && \
4768	test "$with_system_icu" != "no"; then
4769   AC_MSG_RESULT([external])
4770   SYSTEM_ICU=YES
4771   AC_LANG_PUSH([C++])
4772   AC_MSG_CHECKING([for unicode/rbbi.h])
4773   AC_TRY_CPP(unicode/rbbi.h, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([icu headers not found.]))
4774   AC_LANG_POP([C++])
4775   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
4776   if test -z "$SYSTEM_GENBRK"; then
4777      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
4778   fi
4779   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
4780   if test -z "$SYSTEM_GENCCODE"; then
4781      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
4782   fi
4783   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
4784   if test -z "$SYSTEM_GENCMN"; then
4785      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
4786   fi
4787
4788   AC_PATH_PROG( ICUCONFIG, icu-config)
4789   AC_MSG_CHECKING([ICU version])
4790   if test "$_os" = "OS2"; then
4791      ICU_MAJOR=4
4792   else
4793      ICU_VERSION=`$ICUCONFIG --version`
4794      ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
4795      ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
4796      ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
4797   fi
4798
4799   if test "$ICU_MAJOR" -ge "4"; then
4800      AC_MSG_RESULT([OK])
4801   else
4802      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
4803   fi
4804
4805else
4806    AC_MSG_RESULT([internal])
4807    SYSTEM_ICU=NO
4808    BUILD_TYPE="$BUILD_TYPE ICU"
4809fi
4810AC_SUBST(SYSTEM_ICU)
4811AC_SUBST(SYSTEM_GENBRK)
4812AC_SUBST(SYSTEM_GENCCODE)
4813AC_SUBST(SYSTEM_GENCMN)
4814AC_SUBST(ICU_MAJOR)
4815AC_SUBST(ICU_MINOR)
4816AC_SUBST(ICU_MICRO)
4817
4818dnl ===================================================================
4819dnl Graphite
4820dnl ===================================================================
4821
4822ENABLE_GRAPHITE="FALSE"
4823AC_MSG_CHECKING([whether to enable graphite support])
4824if test "x$enable_graphite" = "xyes" -a \( "$_os" = "WINNT" -o "$_os" = "Linux" -o "$_os" = "FreeBSD" \) ; then
4825    AC_MSG_RESULT([yes])
4826    ENABLE_GRAPHITE="TRUE"
4827    AC_MSG_CHECKING([which graphite to use])
4828    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
4829        test "$with_system_graphite" != "no"; then
4830        AC_MSG_RESULT([external])
4831        SYSTEM_GRAPHITE=YES
4832        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
4833    else
4834        AC_MSG_RESULT([internal])
4835        SYSTEM_GRAPHITE=NO
4836        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
4837    fi
4838else
4839   AC_MSG_RESULT([no])
4840   ENABLE_GRAPHITE="FALSE"
4841fi
4842AC_SUBST(ENABLE_GRAPHITE)
4843AC_SUBST(SYSTEM_GRAPHITE)
4844AC_SUBST(GRAPHITE_LIBS)
4845AC_SUBST(GRAPHITE_CFLAGS)
4846
4847
4848dnl ===================================================================
4849dnl Checks for libraries.
4850dnl ===================================================================
4851dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
4852dnl See if we have the AppKit framework for building with Quartz graphics.
4853
4854if test  "$_os" = "Darwin"; then
4855   if test "x$with_x" = "xyes"; then
4856      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
4857   else
4858      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
4859      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
4860         AC_MSG_RESULT([yes])
4861         x_includes="no_x_includes"
4862         x_libraries="no_x_libraries"
4863         dnl disable some things used on other Unix versions but not on the aqua build
4864         enable_gtk=no
4865         enable_cups=no
4866         ENABLE_CUPS=""
4867         AC_SUBST(ENABLE_CUPS)
4868      else
4869         AC_MSG_ERROR([No AppKit.framewrok found])
4870      fi
4871   fi
4872fi
4873
4874dnl ***************************************
4875dnl testing for X libraries and includes...
4876dnl ***************************************
4877if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
4878   echo "Do Nothing for _os = Darwin"
4879   dnl Mac OS X using Aqua graphics. Don't check for X11.
4880   :
4881elif test "$_os" = "OS2" ; then
4882   echo "Do Nothing for _os = OS2. Don't check for X11."
4883   dnl OS/2 uses native graphics. Don't check for X11.
4884   :
4885elif test "$_os" != "WINNT" ; then
4886   AC_PATH_X
4887   AC_PATH_XTRA
4888   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
4889
4890   if test "x$x_includes" = "x"; then
4891     x_includes="default_x_includes"
4892   fi
4893   if test "x$x_libraries" = "x"; then
4894     x_libraries="default_x_libraries"
4895   fi
4896   dnl The variables $x_libraries and $x_includes are set.
4897   if test -z "$x_libraries"; then
4898      AC_MSG_ERROR([No X libraries found]) # Exit
4899   fi
4900   if test -z "$x_includes"; then
4901      AC_MSG_ERROR([No X includes found]) # Exit
4902   fi
4903   CFLAGS=$X_CFLAGS
4904   LDFLAGS="$X_LDFLAGS $X_LIBS"
4905   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
4906   dnl Check if the XauDisposeAuth symbol is provided by libXau.
4907   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
4908else
4909   x_includes="no_x_includes"
4910   x_libraries="no_x_libraries"
4911fi
4912if test -z "$x_includes"; then
4913   x_includes="no_x_includes"
4914fi
4915if test -z "$x_libraries"; then
4916   x_libraries="no_x_libraries"
4917fi
4918if test "$x_includes" = "default_x_includes"; then
4919   XINC="/usr/include"
4920else
4921   XINC="$x_includes"
4922fi
4923AC_SUBST(XINC)
4924if test "$x_libraries" = "default_x_libraries"; then
4925   XLIB=`$PKG_CONFIG --variable=libdir x11`
4926   if test "x$XLIB" = x; then
4927         XLIB="/usr/lib"
4928   fi
4929else
4930   XLIB="$x_libraries"
4931fi
4932AC_SUBST(XLIB)
4933AC_SUBST(XAU_LIBS)
4934
4935dnl ===================================================================
4936dnl Check if fontconfig/fontconfig.h is available
4937dnl ===================================================================
4938if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
4939    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
4940                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
4941    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
4942    AC_TRY_RUN([
4943#include <fontconfig/fontconfig.h>
4944
4945int main(int argc, char **argv) {
4946	if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
4947	else return 1;
4948}
4949], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])])
4950fi
4951
4952dnl ===================================================================
4953dnl Check for system Xrender
4954dnl ===================================================================
4955AC_MSG_CHECKING([whether to link to Xrender])
4956if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
4957   AC_MSG_RESULT([yes])
4958   XRENDER_LINK=YES
4959   with_system_xrender_headers=yes
4960else
4961   AC_MSG_RESULT([no, dynamically open it])
4962   XRENDER_LINK=NO
4963fi
4964AC_MSG_CHECKING([which Xrender headers to use])
4965if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
4966	test "$with_system_xrender_headers" != "no"; then
4967   AC_MSG_RESULT([external])
4968   SYSTEM_XRENDER_HEADERS=YES
4969   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
4970      [AC_MSG_ERROR(Xrender not found. install X)], [])
4971else
4972   AC_MSG_RESULT([internal])
4973   SYSTEM_XRENDER_HEADERS=NO
4974   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
4975fi
4976if test "$XRENDER_LINK" = "YES"; then
4977   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
4978      [AC_MSG_ERROR(libXrender not found or functional)], [])
4979fi
4980AC_SUBST(SYSTEM_XRENDER_HEADERS)
4981AC_SUBST(XRENDER_LINK)
4982
4983dnl ===================================================================
4984dnl Check for XRandr
4985dnl ===================================================================
4986AC_MSG_CHECKING([whether to enable RandR support])
4987if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
4988   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
4989	  XRANDR_DLOPEN="TRUE"
4990	  AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
4991   else
4992	  XRANDR_DLOPEN="FALSE"
4993      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
4994      if test "$ENABLE_RANDR" != "TRUE"; then
4995         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
4996                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
4997         XRANDR_CFLAGS=" "
4998         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
4999              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5000         XRANDR_LIBS="-lXrandr "
5001         ENABLE_RANDR="TRUE"
5002	     AC_MSG_RESULT([enabling RandR support])
5003      fi
5004   fi
5005else
5006   ENABLE_RANDR=""
5007   AC_MSG_RESULT([no])
5008fi
5009AC_SUBST(XRANDR_DLOPEN)
5010AC_SUBST(XRANDR_CFLAGS)
5011AC_SUBST(XRANDR_LIBS)
5012AC_SUBST(ENABLE_RANDR)
5013
5014dnl ===================================================================
5015dnl Check for system nss
5016dnl ===================================================================
5017AC_MSG_CHECKING([which libnss to use])
5018if test -n "$with_system_nss" -o -n "$with_system_libs" && test "$with_system_nss" != "no"; then
5019    AC_MSG_RESULT([external])
5020    PKG_CHECK_MODULES( NSS, nss )
5021    SYSTEM_NSS=YES
5022else
5023    AC_MSG_RESULT([internal])
5024    SYSTEM_NSS=NO
5025    BUILD_TYPE="$BUILD_TYPE NSS"
5026fi
5027AC_SUBST(SYSTEM_NSS)
5028AC_SUBST(NSS_CFLAGS)
5029AC_SUBST(NSS_LIBS)
5030
5031dnl ===================================================================
5032dnl Check for system openssl
5033dnl ===================================================================
5034if test "$_os" = "Darwin" && test "$with_system_openssl" != "no"; then
5035   with_system_openssl=yes
5036fi
5037AC_MSG_CHECKING([which libssl to use])
5038if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5039        test "$with_system_openssl" != "no"; then
5040    AC_MSG_RESULT([external])
5041    # Mac OS builds should get out without extra stuff is the Mac porters'
5042    # wish. And pkg-config is although Xcode ships a .pc for openssl
5043    if test "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
5044        OPENSSL_CFLAGS=
5045        OPENSSL_LIBS="-lssl -lcrypto"
5046    else
5047    	PKG_CHECK_MODULES( OPENSSL, openssl )
5048    fi
5049    SYSTEM_OPENSSL=YES
5050else
5051    AC_MSG_RESULT([internal])
5052    SYSTEM_OPENSSL=NO
5053    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5054fi
5055AC_SUBST(SYSTEM_OPENSSL)
5056AC_SUBST(OPENSSL_CFLAGS)
5057AC_SUBST(OPENSSL_LIBS)
5058
5059dnl ===================================================================
5060dnl Check for system redland
5061dnl ===================================================================
5062AC_MSG_CHECKING([which redland library to use])
5063if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5064	test "$with_system_redland" != "no"; then
5065	AC_MSG_RESULT([external])
5066	SYSTEM_REDLAND=YES
5067   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5068   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5069else
5070	AC_MSG_RESULT([internal])
5071	BUILD_TYPE="$BUILD_TYPE REDLAND"
5072	SYSTEM_REDLAND=NO
5073fi
5074AC_SUBST(SYSTEM_REDLAND)
5075AC_SUBST(REDLAND_CFLAGS)
5076AC_SUBST(REDLAND_LIBS)
5077
5078dnl ===================================================================
5079dnl Check for hunspell
5080dnl ===================================================================
5081AC_MSG_CHECKING([whether to build the Spell Checking component])
5082ENABLE_HUNSPELL=
5083
5084if test "x$enable_hunspell" != "xno" ; then
5085    AC_MSG_CHECKING([which libhunspell to use])
5086    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5087        test "$with_system_hunspell" != "no"; then
5088        AC_MSG_RESULT([external])
5089        SYSTEM_HUNSPELL=YES
5090        AC_LANG_PUSH([C++])
5091        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5092        if test "$HUNSPELL_PC" != "TRUE"; then
5093            AC_CHECK_HEADER(hunspell.hxx, [],
5094            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5095                [AC_MSG_ERROR(hunspell headers not found.)], [])
5096             ], [])
5097            AC_CHECK_LIB(hunspell, main, [],
5098            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5099            HUNSPELL_LIBS=-lhunspell
5100        fi
5101        AC_LANG_POP([C++])
5102    else
5103        AC_MSG_RESULT([internal])
5104        SYSTEM_HUNSPELL=NO
5105        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5106    fi
5107    ENABLE_HUNSPELL=YES
5108    AC_SUBST(SYSTEM_HUNSPELL)
5109    AC_SUBST(HUNSPELL_CFLAGS)
5110    AC_SUBST(HUNSPELL_LIBS)
5111else
5112    AC_MSG_RESULT([no])
5113fi
5114AC_SUBST(ENABLE_HUNSPELL)
5115
5116dnl ===================================================================
5117dnl Checking for libhyphen
5118dnl ===================================================================
5119AC_MSG_CHECKING([whether to build the Hyphenator component])
5120ENABLE_HYPHEN=
5121
5122if test "x$enable_hyphen" != "xno" ; then
5123    AC_MSG_CHECKING([which libhyphen to use])
5124    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5125        test "$with_system_hyphen" != "no"; then
5126        AC_MSG_RESULT([external])
5127        SYSTEM_HYPH=YES
5128        AC_CHECK_HEADER(hyphen.h, [],
5129        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5130        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5131        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5132        [#include <hyphen.h>])
5133        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5134            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5135        if test -z "$HYPHEN_LIB"; then
5136        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5137            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5138        fi
5139        if test -z "$HYPHEN_LIB"; then
5140        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5141            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5142        fi
5143    else
5144        AC_MSG_RESULT([internal])
5145        SYSTEM_HYPH=NO
5146        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5147    fi
5148    ENABLE_HYPHEN=YES
5149    AC_SUBST(SYSTEM_HYPH)
5150    AC_SUBST(HYPHEN_LIB)
5151else
5152    AC_MSG_RESULT([no])
5153fi
5154AC_SUBST(ENABLE_HYPHEN)
5155
5156
5157#dnl ===================================================================
5158#dnl Check whether we are allowed to bundle dictionaries and whether
5159#dnl hunspell is available.
5160#dnl ===================================================================
5161ENABLE_BUNDLED_DICTIONARIES=
5162if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5163   ENABLE_BUNDLED_DICTIONARIES=YES
5164fi
5165AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5166
5167
5168
5169dnl ===================================================================
5170dnl Checking for mythes
5171dnl ===================================================================
5172AC_MSG_CHECKING([which mythes to use])
5173if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5174   test "$with_system_mythes" != "no"; then
5175    AC_MSG_RESULT([external])
5176    SYSTEM_MYTHES=YES
5177    AC_LANG_PUSH([C++])
5178    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5179    if test "$MYTHES_PKGCONFIG" = "no"; then
5180        AC_CHECK_HEADER(mythes.hxx, [],
5181            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5182        AC_CHECK_LIB(mythes-1.2, main, [],
5183            [ MYTHES_FOUND=no], [])
5184 	if test "$MYTHES_FOUND" = "no"; then
5185            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5186                [ MYTHES_FOUND=no], [])
5187	fi
5188	if test "$MYTHES_FOUND" = "no"; then
5189		AC_MSG_ERROR([mythes library not found!.])
5190	fi
5191    fi
5192    AC_LANG_POP([C++])
5193else
5194    AC_MSG_RESULT([internal])
5195    SYSTEM_MYTHES=NO
5196    BUILD_TYPE="$BUILD_TYPE MYTHES"
5197fi
5198AC_SUBST(SYSTEM_MYTHES)
5199AC_SUBST(MYTHES_CFLAGS)
5200AC_SUBST(MYTHES_LIBS)
5201
5202
5203dnl ===================================================================
5204dnl Checking for libtextcat
5205dnl ===================================================================
5206AC_MSG_CHECKING([which libtextcat to use])
5207if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5208    AC_MSG_RESULT([external])
5209    SYSTEM_LIBTEXTCAT=YES
5210    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5211       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5212    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5213        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5214else
5215    AC_MSG_RESULT([internal])
5216    SYSTEM_LIBTEXTCAT=NO
5217    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5218fi
5219AC_SUBST(SYSTEM_LIBTEXTCAT)
5220
5221AC_MSG_CHECKING([which libtextcat data directory to use])
5222if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5223    if test "$with_system_libtextcat_data" = "yes"; then
5224        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5225    else
5226        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5227    fi
5228    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5229else
5230    AC_MSG_RESULT([internal])
5231    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5232fi
5233AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5234
5235dnl ***************************************
5236dnl testing libc version for Linux...
5237dnl ***************************************
5238if test "$_os" = "Linux"; then
5239   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5240   exec 6>/dev/null # no output
5241   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5242   exec 6>&1 # output on again
5243   if test "$HAVE_LIBC"; then
5244      AC_MSG_RESULT([yes])
5245   else
5246      AC_MSG_ERROR([no, upgrade libc])
5247   fi
5248fi
5249
5250if test "$_os" != "WNT"; then
5251  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5252  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5253  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5254	SYSTEM_LIBC=YES
5255  fi
5256else
5257  HAVE_GETOPT=NO
5258  HAVE_READDIR_R=NO
5259  SYSTEM_LIBC=YES
5260fi
5261AC_SUBST(HAVE_GETOPT)
5262AC_SUBST(HAVE_READDIR_R)
5263AC_SUBST(SYSTEM_LIBC)
5264
5265dnl =========================================
5266dnl Check for the Microsoft Platform SDK.
5267dnl =========================================
5268dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5269dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5270if test \( "$_os" = "WINNT" \) ; then
5271	AC_MSG_CHECKING([for PSDK files])
5272	if test -z "$with_psdk_home"; then
5273		# This first line will detect a February 2003 Microsoft Platform SDK
5274		PSDK_HOME=`./oowintool --psdk-home`
5275        # But there might be also an April 2005 PSDK, unfortunately MS changed
5276        # the registry entry. (we prefer the old version!?)
5277        if test -z "$PSDK_HOME"; then
5278          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5279        fi
5280            # normalize if found
5281            if test -n "$PSDK_HOME"; then
5282              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5283              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5284           fi
5285	else
5286           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5287	fi
5288        # Remove a possible trailing backslash
5289        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5290    # Problem with current PSDK (iz 49865)
5291    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5292        AC_MSG_ERROR([
5293
5294Some modules do not build correctly with MS Platform SDK - April 2005
5295Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5296Remove/rename/backup that file and restart configure. Details about this
5297problem can be found in issue 49856.])
5298    fi
5299# WIndows SDK has different headers
5300	if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5301		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5302		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5303		HAVE_PSDK_H="yes"
5304	else
5305		HAVE_PSDK_H="no"
5306	fi
5307	if test -f "$PSDK_HOME/lib/unicows.lib"; then
5308		HAVE_PSDK_LIB="yes"
5309	else
5310		HAVE_PSDK_LIB="no"
5311	fi
5312    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5313        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5314are installed or use --with-psdk-home .])
5315    fi
5316    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5317         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5318         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5319         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5320        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5321    fi
5322    AC_MSG_RESULT([SDK files found ...)])
5323dnl Check if this is the right SDK.
5324    if echo $PSDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
5325        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5326        WINDOWS_VISTA_PSDK=TRUE
5327    elif echo $PSDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
5328        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5329        WINDOWS_VISTA_PSDK=TRUE
5330    elif echo $PSDK_HOME | grep "v7.0" >/dev/null 2>/dev/null; then
5331        AC_MSG_RESULT([Found Windows SDK 7.0 ($PSDK_HOME)])
5332        WINDOWS_VISTA_PSDK=TRUE
5333    else
5334        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5335    fi
5336fi
5337AC_SUBST(PSDK_HOME)
5338AC_SUBST(WINDOWS_VISTA_PSDK)
5339
5340dnl =========================================
5341dnl Check for the Microsoft DirectX SDK.
5342dnl =========================================
5343if test \( "$_os" = "WINNT" \) ; then
5344    AC_MSG_CHECKING([for DirectX SDK files])
5345    if test -z "$with_directx_home"; then
5346        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5347        if test -n "$DXSDK_DIR"; then
5348            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5349            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5350        fi
5351        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5352        # the "DirectX SDK files not found" error later
5353    else
5354	DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5355    fi
5356    # Remove a possible trailing backslash
5357    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5358
5359    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5360        HAVE_DIRECTDRAW_H="yes"
5361    else
5362        HAVE_DIRECTDRAW_H="no"
5363    fi
5364    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5365        HAVE_DIRECTXSDK_H="yes"
5366    else
5367        HAVE_DIRECTXSDK_H="no"
5368    fi
5369
5370    # MS changed the location of the libraries with dec 2004 directx sdk
5371    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5372        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5373    else
5374        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5375    fi
5376    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5377        HAVE_DIRECTDRAW_LIB="yes"
5378    else
5379        HAVE_DIRECTDRAW_LIB="no"
5380    fi
5381    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5382        HAVE_DIRECTXSDK_LIB="yes"
5383    else
5384        HAVE_DIRECTXSDK_LIB="no"
5385    fi
5386
5387    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5388       ENABLE_DIRECT_DRAW="TRUE"
5389    fi
5390    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5391       HAVE_DIRECTXSDK="yes"
5392    else
5393       HAVE_DIRECTXSDK="no"
5394    fi
5395
5396    if test -n "$ENABLE_DIRECTX"; then
5397	    if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5398		    AC_MSG_RESULT([found])
5399	    else
5400		    AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5401	    fi
5402    else
5403		DIRECTXSDK_HOME=""
5404		AC_MSG_RESULT([disabled])
5405    fi
5406fi
5407AC_SUBST(ENABLE_DIRECT_DRAW)
5408AC_SUBST(DIRECTXSDK_HOME)
5409AC_SUBST(DIRECTXSDK_LIB)
5410
5411
5412dnl ============================================
5413dnl Check for ATL and MFC
5414dnl ============================================
5415if test \( "$_os" = "WINNT" \) ; then
5416    AC_MSG_CHECKING([for ATL and MFC])
5417    if test "$DISABLE_ATL" = "TRUE"; then
5418        AC_MSG_RESULT([ATL is disabled, nothing to check])
5419    else
5420        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
5421        if test -z "$with_atl_include_dir"; then
5422            ATL_INCLUDE=$COMPATH/atlmfc/include
5423        else
5424            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
5425        fi
5426        if test -z "$with_atl_lib_dir"; then
5427            ATL_LIB=$COMPATH/atlmfc/lib
5428	    ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
5429        else
5430            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
5431            ATL_LIB_X64=$ATL_LIB/../amd64
5432        fi
5433        if test -z "$with_mfc_include_dir"; then
5434            MFC_INCLUDE=$COMPATH/atlmfc/include
5435        else
5436            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
5437        fi
5438        if test -z "$with_mfc_lib_dir"; then
5439            MFC_LIB=$COMPATH/atlmfc/lib
5440        else
5441            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
5442        fi
5443
5444        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
5445        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
5446        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
5447        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
5448        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
5449
5450        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
5451        if test -f "$ATL_INCLUDE/atlbase.h"; then
5452            HAVE_ATL_H="yes"
5453        else
5454            HAVE_ATL_H="no"
5455        fi
5456        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
5457
5458        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
5459        if test -f "$MFC_INCLUDE/afx.h"; then
5460            HAVE_MFC_H="yes"
5461        else
5462            HAVE_MFC_H="no"
5463        fi
5464        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
5465
5466        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
5467        if test -f "$ATL_LIB/atls.lib"; then
5468            HAVE_ATL_LIB="yes"
5469            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
5470            if test -f "$ATL_LIB/atlthunk.lib"; then
5471                HAVE_ATLTHUNK="YES"
5472            else
5473                HAVE_ATLTHUNK="NO"
5474            fi
5475            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
5476        else
5477            HAVE_ATL_LIB="no"
5478        fi
5479        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
5480
5481        dnl TODO check also MFC libraries, they seem to have diferent names
5482        dnl mfc42.lib mfc90.lib
5483        if test -d "$MFC_LIB"; then
5484            HAVE_MFC_LIB="yes"
5485        else
5486            HAVE_MFC_LIB="no"
5487        fi
5488
5489        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
5490            ATL_INCLUDE=
5491            ATL_LIB=
5492            ATL_LIB_X64=
5493            MFC_INCLUDE=
5494            MFC_LIB=
5495            HAVE_ATL_LIB=
5496            dnl TODO shouldn't this be an error?
5497            DISABLE_ACTIVEX="TRUE"
5498            DISABLE_ATL="TRUE"
5499            AC_MSG_RESULT([ATL/MFC disabled])
5500        else
5501            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
5502            ATL_LIB=`cygpath -dm "$ATL_LIB"`
5503            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
5504            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
5505            MFC_LIB=`cygpath -dm "$MFC_LIB"`
5506            AC_MSG_RESULT([ATL/MFC enabled])
5507        fi
5508    fi
5509fi
5510AC_SUBST(ATL_INCLUDE)
5511AC_SUBST(ATL_LIB)
5512AC_SUBST(ATL_LIB_X64)
5513AC_SUBST(HAVE_ATLTHUNK)
5514AC_SUBST(MFC_INCLUDE)
5515AC_SUBST(MFC_LIB)
5516
5517
5518dnl ============================================
5519dnl Check for Nullsoft Scriptable Install System
5520dnl ============================================
5521NSIS_PATH=""
5522if test "$_os" = "WINNT" ; then
5523    AC_MSG_CHECKING([for NSIS])
5524    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5525    if test -n "$NSIS_PATH"; then
5526        NSIS_PATH=`dirname "$NSIS_PATH"`
5527    fi
5528    if test -n "$with_nsis_path"; then
5529        with_nsis_path=`cygpath -u "$with_nsis_path"`
5530    fi
5531    if test -e "$with_nsis_path/nsis.exe"; then
5532        NSIS_PATH="$with_nsis_path"
5533    fi
5534    nsistest=`./oowintool --nsis-dir`;
5535    if test -x "$nsistest/nsis.exe"; then
5536        NSIS_PATH="$nsistest"
5537    fi
5538    if test -z "$NSIS_PATH"; then
5539        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5540        echo "NSIS not found, no self contained installer will be build." >> warn
5541    else
5542        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5543        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5544        AC_MSG_RESULT([found ($NSIS_PATH)])
5545		AC_MSG_CHECKING([whether NSIS version is >= 3.*])
5546		nsis_version_string=`"$NSIS_PATH/makensis.exe" /VERSION | $SED -e s/^v//i`
5547        nsis_version_major=`echo $nsis_version_string | cut -d. -f1`
5548		nsis_version_minor=`echo $nsis_version_string | cut -d. -f2`
5549		if test "$nsis_version_major" -ge "3"; then
5550			AC_MSG_RESULT([found NSIS $nsis_version_major.$nsis_version_minor >= 3.*])
5551			AC_MSG_CHECKING([whether NSIS was compiled with Unicode support])
5552			if echo `"$NSIS_PATH/makensis.exe" /HDRINFO` | $EGREP  "\bNSIS_UNICODE_MAKENSIS\b" 2>&1 >/dev/null; then
5553				AC_MSG_RESULT([NSIS version compiled with Unicode support.])
5554			else
5555				NSIS_PATH=""
5556				AC_MSG_WARN([NSIS version compiled without Unicode support, no self contained installer will be build.])
5557			fi
5558		else
5559			NSIS_PATH=""
5560			AC_MSG_WARN([NSIS version found is < 3.*, no self contained installer will be build.])
5561		fi
5562    fi
5563fi
5564AC_SUBST(NSIS_PATH)
5565
5566dnl ***************************************
5567dnl testing bison and flex exist
5568dnl ***************************************
5569AC_PATH_PROG(BISON, bison)
5570if test -z "$BISON"; then
5571   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5572else
5573   AC_MSG_CHECKING([the bison version])
5574   _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5575    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5576    # Accept newer than 1.875 or older(equal) than 1.75
5577    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5578       if test "$_bison_version" = "1.875" ; then
5579          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5580          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5581       else
5582          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5583       fi
5584    else
5585       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5586    fi
5587fi
5588AC_PATH_PROG(FLEX, flex)
5589if test -z "$FLEX"; then
5590   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5591fi
5592dnl ***************************************
5593dnl testing that patch exists
5594dnl ***************************************
5595AC_PATH_PROG(PATCH, patch)
5596if test -z "$PATCH"; then
5597   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5598fi
5599
5600dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5601if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5602   if test -z "$with_gnu_patch"; then
5603      GNUPATCH=$PATCH
5604   else
5605      if test -x "$with_gnu_patch"; then
5606	      GNUPATCH=$with_gnu_patch
5607      else
5608         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5609      fi
5610   fi
5611
5612   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5613   if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
5614	   AC_MSG_RESULT([yes])
5615   else
5616      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5617   fi
5618fi
5619
5620dnl We also need to check for --with-gnu-cp
5621
5622if test -z "$with_gnu_cp"; then
5623   # check the place where the GNU stuff is hidden on Solaris...
5624   if test -x /usr/gnu/bin/cp; then
5625      GNUCP=/usr/gnu/bin/cp
5626   else
5627      AC_PATH_PROGS(GNUCP, gnucp cp)
5628   fi
5629   if test -z $GNUCP; then
5630      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5631   fi
5632else
5633   if test -x "$with_gnu_cp"; then
5634      GNUCP=$with_gnu_cp
5635   else
5636      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5637   fi
5638fi
5639
5640AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5641if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
5642   AC_MSG_RESULT([yes])
5643else
5644   AC_MSG_RESULT([no])
5645   GNUCP=''
5646fi
5647
5648if test -z "$GNUCP"; then
5649   if test "$_os" = "SunOS"; then
5650      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5651   else
5652      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5653   fi
5654fi
5655
5656AC_SUBST(GNUPATCH)
5657AC_SUBST(GNUCP)
5658
5659dnl ***************************************
5660dnl testing bash tools path on Windows
5661dnl ***************************************
5662if test "$_os" = "WINNT"; then
5663    CYGWIN_PATH=""
5664    AC_PATH_PROG(CYGWIN_PATH, bash)
5665    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5666fi
5667if test -z "$CYGWIN_PATH"; then
5668   CYGWIN_PATH="NO_CYGWIN"
5669fi
5670AC_SUBST(CYGWIN_PATH)
5671
5672dnl ***************************************
5673dnl testing ml.exe assembler path
5674dnl ***************************************
5675if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5676  AC_MSG_CHECKING([ml.exe assembler path])
5677  if test -n "$with_asm_home"; then
5678    with_asm_home=`cygpath -u "$with_asm_home"`
5679  fi
5680  if test ! -x "$with_asm_home/ml.exe"; then
5681    AC_PATH_PROG(ML_EXE, ml.exe)
5682    if test -z "$ML_EXE"; then
5683      if test -x "$with_cl_home/bin/ml.exe"; then
5684        with_asm_home=$with_cl_home/bin
5685        AC_MSG_RESULT([found ($with_asm_home)])
5686      else
5687        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5688      fi
5689    else
5690       with_asm_home="ASM_IN_PATH"
5691    fi
5692  fi
5693  AC_MSG_RESULT([$ASM_HOME])
5694else
5695  with_asm_home="NO_ASM_HOME"
5696fi
5697ASM_HOME="$with_asm_home"
5698AC_SUBST(ASM_HOME)
5699
5700dnl ***************************************
5701dnl testing nasm.exe assembler path
5702dnl ***************************************
5703if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes" -a "$SYSTEM_OPENSSL" = "NO"; then
5704  AC_MSG_CHECKING([nasm.exe assembler path])
5705  if test -n "$with_nasm_home"; then
5706    with_nasm_home=`cygpath -u "$with_nasm_home"`
5707  fi
5708  if test ! -x "$with_nasm_home/nasm.exe"; then
5709    AC_PATH_PROG(NASM_EXE, nasm.exe)
5710    if test -z "$NASM_EXE"; then
5711      with_nasm_home="NO_NASM_HOME"
5712      AC_MSG_ERROR([NASM is required to build on Windows, please install or use --with-nasm-home],,)
5713    else
5714      with_nasm_home="NASM_IN_PATH"
5715    fi
5716  fi
5717  AC_MSG_RESULT([$NASM_HOME])
5718else
5719  with_nasm_home="NO_NASM_HOME"
5720fi
5721NASM_HOME="$with_nasm_home"
5722AC_SUBST(NASM_HOME)
5723
5724dnl ===================================================================
5725dnl testing handle deprecated unzip switch
5726dnl ===================================================================
5727if test -z "$with_zip_home"; then
5728	with_zip_home="$with_unzip_home"
5729fi
5730dnl ===================================================================
5731dnl Zip will be found where you tell me to find it
5732dnl ===================================================================
5733if test -n "$with_zip_home" ; then
5734    if test "$_os" = "WINNT"; then
5735        with_zip_home=`cygpath -u "$with_zip_home"`
5736    fi
5737    ZIP="$with_zip_home/zip"
5738    UNZIP="$with_zip_home/unzip"
5739    ZIP_HOME="$with_zip_home"
5740else
5741    AC_PATH_PROG(ZIP, zip)
5742    AC_PATH_PROG(UNZIP, unzip)
5743    ZIP_HOME=`dirname "$ZIP"`
5744fi
5745dnl ===================================================================
5746dnl Zip must be available or else it is an error, all platforms
5747dnl ===================================================================
5748if test -z "$ZIP" -o -z "$UNZIP"; then
5749    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5750fi
5751
5752dnl ===================================================================
5753dnl Zip must be a specific type for different build types.
5754dnl ===================================================================
5755if test "$_os" = "WINNT"; then
5756    if test -n "`$ZIP -h | grep -i WinNT`" ; then
5757AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5758    fi
5759fi
5760AC_SUBST(ZIP_HOME)
5761
5762dnl ===================================================================
5763dnl Windows builds need dbghelp.dll in external/dbghelp/
5764dnl ===================================================================
5765if test "$_os" = "WINNT"; then
5766   AC_MSG_CHECKING([for dbghelp.dll])
5767   if test -x ./external/dbghelp/dbghelp.dll; then
5768      AC_MSG_RESULT([found and executable])
5769   else
5770      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5771Get it from the Microsoft site and put it into external/dbghelp.
5772(Note: Microsoft seems to enjoy changing the exact location of this file. You
5773may have to search Microsoft's website.) Last time it was seen at:
5774<http://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5775   fi
5776fi
5777
5778dnl ===================================================================
5779dnl Windows builds need vcredist_x*.exe in external/vcredist/
5780dnl ===================================================================
5781WITH_VC_REDIST=""
5782
5783if test "$_os" = "WINNT"; then
5784   AC_MSG_CHECKING([for vcredist_x86.exe])
5785   if test -x ./external/vcredist/vcredist_x86.exe; then
5786      AC_MSG_RESULT([found and executable])
5787   else
5788      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
5789Get it from the Microsoft site and put it into external/vcredist. You can try
5790to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5791   fi
5792   AC_MSG_CHECKING([for vcredist_x64.exe])
5793   if test -x ./external/vcredist/vcredist_x64.exe; then
5794      AC_MSG_RESULT([found and executable])
5795   else
5796      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
5797Get it from the Microsoft site and put it into external/vcredist. You can try
5798to download it from http://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5799   fi
5800   WITH_VC_REDIST=YES
5801   AC_SUBST(WITH_VC_REDIST)
5802fi
5803
5804dnl ===================================================================
5805dnl Windows builds - use oowintool to copy CRT dlls and manifest
5806dnl ===================================================================
5807if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5808       if ./oowintool --msvc-copy-dlls ./external/msvcp ; then
5809          :
5810       else
5811          AC_MSG_ERROR([oowintool failed to copy CRT])
5812       fi
5813fi
5814
5815dnl ===================================================================
5816dnl Windows builds need gdiplus.dll in external/gdiplus/
5817dnl ===================================================================
5818if test "$_os" = "WINNT"; then
5819   AC_MSG_CHECKING([for gdiplus.dll])
5820   if test -x ./external/gdiplus/gdiplus.dll; then
5821      AC_MSG_RESULT([found and executable])
5822   else
5823      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5824Get it from the Microsoft site and put it into external/gdiplus.
5825You may have to search Microsoft's website. Last time it was seen at:
5826<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5827   fi
5828fi
5829
5830dnl ===================================================================
5831dnl Windows builds need msvcr100.dll in external/msvcp100/
5832dnl ===================================================================
5833if test "$_os" = "WINNT"; then
5834   AC_MSG_CHECKING([for msvcr100.dll])
5835   if test -x ./external/msvcp100/msvcr100.dll; then
5836      AC_MSG_RESULT([found and executable])
5837   else
5838      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
5839Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
5840from the Microsoft site and put it into external/msvcp100.
5841You may have to search Microsoft's website. Last time it was seen at:
5842<http://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
5843   fi
5844fi
5845
5846dnl ===================================================================
5847dnl Test which vclplugs have to be built.
5848dnl ===================================================================
5849AC_MSG_CHECKING([which VCLplugs shall be built])
5850ENABLE_GTK=""
5851if test "x$enable_gtk" = "xyes"; then
5852    ENABLE_GTK="TRUE"
5853    R="gtk"
5854fi
5855AC_SUBST(ENABLE_GTK)
5856
5857ENABLE_KDE=""
5858if test "x$enable_kde" = "xyes"; then
5859    ENABLE_KDE="TRUE"
5860    R="$R kde"
5861fi
5862AC_SUBST(ENABLE_KDE)
5863
5864ENABLE_KDE4=""
5865if test "x$enable_kde4" = "xyes"; then
5866    ENABLE_KDE4="TRUE"
5867    R="$R kde4"
5868fi
5869AC_SUBST(ENABLE_KDE4)
5870
5871if test -z "$R"; then
5872	AC_MSG_RESULT([none])
5873else
5874	AC_MSG_RESULT([$R])
5875fi
5876
5877dnl ===================================================================
5878dnl GCONF check
5879dnl ===================================================================
5880
5881ENABLE_GCONF=""
5882AC_MSG_CHECKING([whether to enable GConf support])
5883if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5884    ENABLE_GCONF="TRUE"
5885    AC_MSG_RESULT([yes])
5886    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5887else
5888    AC_MSG_RESULT([no])
5889fi
5890AC_SUBST(ENABLE_GCONF)
5891
5892dnl ===================================================================
5893dnl Gnome VFS check
5894dnl ===================================================================
5895
5896ENABLE_GNOMEVFS=""
5897AC_MSG_CHECKING([whether to enable GNOME VFS support])
5898if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5899    ENABLE_GNOMEVFS="TRUE"
5900    AC_MSG_RESULT([yes])
5901    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5902    if test "$ENABLE_GCONF" != "TRUE"; then
5903        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5904    fi
5905else
5906    AC_MSG_RESULT([no])
5907fi
5908AC_SUBST(ENABLE_GNOMEVFS)
5909
5910dnl ===================================================================
5911dnl Check whether the gtk 2.0 libraries are available.
5912dnl ===================================================================
5913
5914GTK_CFLAGS=""
5915GTK_LIBS=""
5916ENABLE_SYSTRAY_GTK=""
5917ENABLE_DBUS=""
5918if test  "$test_gtk" = "yes"; then
5919
5920   if test "$ENABLE_GTK" = "TRUE" ; then
5921      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]))
5922      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]))
5923      BUILD_TYPE="$BUILD_TYPE GTK"
5924
5925      if test "x$enable_systray" = "xyes"; then
5926         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
5927                           [ENABLE_SYSTRAY_GTK="TRUE"
5928                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
5929                           [ENABLE_SYSTRAY_GTK=""])
5930      fi
5931
5932      AC_MSG_CHECKING([whether to enable DBUS support])
5933      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5934          ENABLE_DBUS="TRUE"
5935          AC_MSG_RESULT([yes])
5936          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5937      else
5938          AC_MSG_RESULT([no])
5939      fi
5940
5941      AC_MSG_CHECKING([whether to enable GIO support])
5942      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5943          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5944             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5945          fi
5946          ENABLE_GIO="TRUE"
5947          AC_MSG_RESULT([yes])
5948          PKG_CHECK_MODULES( GIO, gio-2.0 )
5949      else
5950          AC_MSG_RESULT([no])
5951      fi
5952
5953   fi
5954
5955fi
5956AC_SUBST(ENABLE_GIO)
5957AC_SUBST(ENABLE_DBUS)
5958AC_SUBST(ENABLE_SYSTRAY_GTK)
5959AC_SUBST(GTK_CFLAGS)
5960AC_SUBST(GTK_LIBS)
5961AC_SUBST(GTHREAD_CFLAGS)
5962AC_SUBST(GTHREAD_LIBS)
5963
5964dnl ===================================================================
5965dnl Check whether the GStreamer libraries are available.
5966dnl ===================================================================
5967
5968GSTREAMER_CFLAGS=""
5969GSTREAMER_LIBS=""
5970ENABLE_GSTREAMER=""
5971
5972if test "$test_gstreamer" = "yes"; then
5973    AC_MSG_CHECKING([whether to build the GStreamer media backend])
5974    if test "x$enable_gstreamer" != "xno" ; then
5975        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]))
5976        ENABLE_GSTREAMER="TRUE"
5977        AC_MSG_RESULT([yes])
5978    else
5979        AC_MSG_RESULT([no])
5980    fi
5981fi
5982AC_SUBST(ENABLE_GSTREAMER)
5983AC_SUBST(GSTREAMER_CFLAGS)
5984AC_SUBST(GSTREAMER_LIBS)
5985
5986dnl ===================================================================
5987dnl Check the ARM target
5988dnl ===================================================================
5989
5990if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
5991    # default value
5992    ARM_TARGET=ARMV4T
5993    AC_MSG_CHECKING([which ARM processor optimization to use])
5994    if test "$with_arm_target" -lt "6"; then
5995	ARM_TARGET=ARMV4T
5996    elif test "$with_arm_target" = "6"; then
5997	ARM_TARGET=ARMV6
5998    elif test "$with_arm_target" -gt "6"; then
5999	ARM_TARGET=ARMV7
6000    fi
6001    AC_MSG_RESULT([$ARM_TARGET])
6002    AC_SUBST(ARM_TARGET)
6003fi
6004
6005dnl ===================================================================
6006dnl Check whether the Cairo libraries are available.
6007dnl ===================================================================
6008
6009ENABLE_CAIRO=""
6010BUILD_PIXMAN=""
6011SYSTEM_CAIRO=""
6012
6013if test  "$test_cairo" = "yes"; then
6014
6015    AC_MSG_CHECKING([whether to use cairo])
6016    if test "x$enable_cairo" != "xno" ; then
6017        ENABLE_CAIRO="TRUE"
6018	AC_MSG_RESULT([yes])
6019        AC_MSG_CHECKING([which cairo to use])
6020        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6021           test "$with_system_cairo" != "no"; then
6022           AC_MSG_RESULT([external])
6023           SYSTEM_CAIRO=YES
6024
6025           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6026	   if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6027	      AC_MSG_ERROR([Cairo library requires fontconfig.])
6028	   fi
6029           if test "$with_system_xrender_headers" = "yes"; then
6030              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6031              AC_TRY_RUN([
6032#include <X11/extensions/Xrender.h>
6033
6034int main(int argc, char **argv) {
6035#ifdef PictStandardA8
6036      return 0;
6037#else
6038      return 1;
6039#endif
6040}
6041               ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, X headers too old.])])
6042           fi
6043        else
6044           BUILD_TYPE="$BUILD_TYPE CAIRO"
6045	   dnl === compiler fails on pixman with 64bit architectures...===
6046	   if test "$build_cpu" != "x86_64"; then
6047	      BUILD_PIXMAN=YES
6048	   fi
6049           AC_MSG_RESULT([internal])
6050        fi
6051    else
6052	   AC_MSG_RESULT([no])
6053    fi
6054fi
6055
6056AC_SUBST(ENABLE_CAIRO)
6057AC_SUBST(BUILD_PIXMAN)
6058AC_SUBST(SYSTEM_CAIRO)
6059AC_SUBST(CAIRO_CFLAGS)
6060AC_SUBST(CAIRO_LIBS)
6061
6062ENABLE_CAIRO_CANVAS="FALSE"
6063if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6064   ENABLE_CAIRO_CANVAS="TRUE"
6065fi
6066AC_SUBST(ENABLE_CAIRO_CANVAS)
6067
6068dnl ===================================================================
6069dnl Check whether the OpenGL libraries are available
6070dnl ===================================================================
6071
6072AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6073ENABLE_OPENGL=
6074
6075if test "x$enable_opengl" != "xno" ; then
6076   AC_MSG_RESULT([yes])
6077   AC_CHECK_HEADER(GL/gl.h, [],
6078                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6079   AC_CHECK_LIB(GL, main, [],
6080     [AC_MSG_ERROR(libGL not installed or functional)], [])
6081   AC_CHECK_LIB(GLU, main, [],
6082     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6083   ENABLE_OPENGL=TRUE
6084else
6085   AC_MSG_RESULT([no])
6086fi
6087
6088AC_SUBST(ENABLE_OPENGL)
6089
6090
6091AC_MSG_CHECKING([whether to build the PDF Import extension])
6092if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6093  AC_MSG_RESULT([yes])
6094  ENABLE_PDFIMPORT=YES
6095
6096  dnl ===================================================================
6097  dnl Check for system poppler
6098  dnl ===================================================================
6099  AC_MSG_CHECKING([whether to use system pdf backend])
6100  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6101       test "$with_system_poppler" != "no"; then
6102      AC_MSG_RESULT([external])
6103      SYSTEM_POPPLER=YES
6104      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6105  else
6106      AC_MSG_RESULT([no])
6107      SYSTEM_POPPLER=NO
6108      ENABLE_PDFIMPORT=NO
6109  fi
6110else
6111   AC_MSG_RESULT([no])
6112   ENABLE_PDFIMPORT=NO
6113fi
6114AC_SUBST(ENABLE_PDFIMPORT)
6115AC_SUBST(SYSTEM_POPPLER)
6116AC_SUBST(POPPLER_CFLAGS)
6117AC_SUBST(POPPLER_LIBS)
6118
6119AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6120if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test  "$WITH_JAVA" != "no"; then
6121  AC_MSG_RESULT([yes])
6122  AC_MSG_CHECKING([for swext module])
6123  if test -d ./swext; then
6124   AC_MSG_RESULT([OK])
6125  else
6126   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6127  fi
6128  ENABLE_MEDIAWIKI=YES
6129  BUILD_TYPE="$BUILD_TYPE SWEXT"
6130else
6131  AC_MSG_RESULT([no])
6132  ENABLE_MEDIAWIKI=NO
6133fi
6134AC_SUBST(ENABLE_MEDIAWIKI)
6135
6136if test "$ENABLE_MEDIAWIKI" = "YES"; then
6137  AC_MSG_CHECKING([which Servlet API Jar to use])
6138  if test -n "$with_system_servlet_api"; then
6139    AC_MSG_RESULT([external])
6140    SYSTEM_SERVLETAPI=YES
6141      if test -z "$SERVLETAPI_JAR"; then
6142	SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6143      fi
6144      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6145             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6146  else
6147    AC_MSG_RESULT([internal])
6148    SYSTEM_SERVLETAPI=NO
6149    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6150  fi
6151fi
6152AC_SUBST(SYSTEM_SERVLETAPI)
6153AC_SUBST(SERVLETAPI_JAR)
6154
6155AC_MSG_CHECKING([whether to build the Report Builder extension])
6156if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6157  AC_MSG_RESULT([yes])
6158  ENABLE_REPORTBUILDER=YES
6159  SYSTEM_JFREEREPORT=YES
6160  AC_MSG_CHECKING([for reportbuilder module])
6161  if test -d ./reportbuilder; then
6162    AC_MSG_RESULT([OK])
6163  else
6164    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6165  fi
6166  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6167  AC_MSG_RESULT([external])
6168  if test -z $SAC_JAR; then
6169         SAC_JAR=/usr/share/java/sac.jar
6170  fi
6171  AC_CHECK_FILE($SAC_JAR, [],
6172         [AC_MSG_ERROR(sac.jar not found.)], [])
6173
6174  if test -z $LIBXML_JAR; then
6175    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6176      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6177      [
6178        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6179          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6180          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6181        )
6182      ]
6183    )
6184  else
6185    AC_CHECK_FILE($LIBXML_JAR, [],
6186         [AC_MSG_ERROR(libxml.jar not found.)], [])
6187  fi
6188
6189  if test -z $FLUTE_JAR; then
6190    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6191      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6192      [
6193        AC_CHECK_FILE(/usr/share/java/flute.jar,
6194          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6195          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6196        )
6197      ]
6198    )
6199  else
6200    AC_CHECK_FILE($FLUTE_JAR, [],
6201         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6202  fi
6203
6204  if test -z $JFREEREPORT_JAR; then
6205    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6206      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6207      [
6208        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6209          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6210          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6211        )
6212      ]
6213    )
6214  else
6215    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6216         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6217  fi
6218
6219  if test -z $LIBLAYOUT_JAR; then
6220    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6221      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6222      [
6223        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6224          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6225          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6226        )
6227      ]
6228    )
6229  else
6230    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6231         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6232  fi
6233
6234  if test -z $LIBLOADER_JAR; then
6235    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6236      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6237      [
6238        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6239          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6240          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6241        )
6242      ]
6243    )
6244  else
6245    AC_CHECK_FILE($LIBLOADER_JAR, [],
6246         [AC_MSG_ERROR(libloader.jar not found.)], [])
6247  fi
6248
6249  if test -z $LIBFORMULA_JAR; then
6250    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6251      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6252      [
6253        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6254          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6255          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6256        )
6257      ]
6258    )
6259  else
6260    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6261         [AC_MSG_ERROR(libformula.jar not found.)], [])
6262  fi
6263
6264  if test -z $LIBREPOSITORY_JAR; then
6265    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6266      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6267      [
6268        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6269          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6270          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6271        )
6272      ]
6273    )
6274  else
6275    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6276         [AC_MSG_ERROR(librepository.jar not found.)], [])
6277  fi
6278
6279  if test -z $LIBFONTS_JAR; then
6280    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6281      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6282      [
6283        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6284          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6285          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6286        )
6287      ]
6288    )
6289  else
6290    AC_CHECK_FILE($LIBFONTS_JAR, [],
6291         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6292  fi
6293
6294  if test -z $LIBSERIALIZER_JAR; then
6295    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6296      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6297      [
6298        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6299          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6300          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6301        )
6302      ]
6303    )
6304  else
6305    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6306         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6307  fi
6308
6309
6310  if test -z $LIBBASE_JAR; then
6311    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6312      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6313      [
6314        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6315          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6316          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6317        )
6318      ]
6319    )
6320  else
6321    AC_CHECK_FILE($LIBBASE_JAR, [],
6322         [AC_MSG_ERROR(libbase.jar not found.)], [])
6323  fi
6324  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6325else
6326  AC_MSG_RESULT([no])
6327  ENABLE_REPORTBUILDER=NO
6328fi
6329AC_SUBST(ENABLE_REPORTBUILDER)
6330AC_SUBST(SYSTEM_JFREEREPORT)
6331AC_SUBST(SAC_JAR)
6332AC_SUBST(LIBXML_JAR)
6333AC_SUBST(FLUTE_JAR)
6334AC_SUBST(JFREEREPORT_JAR)
6335AC_SUBST(LIBBASE_JAR)
6336AC_SUBST(LIBLAYOUT_JAR)
6337AC_SUBST(LIBLOADER_JAR)
6338AC_SUBST(LIBFORMULA_JAR)
6339AC_SUBST(LIBREPOSITORY_JAR)
6340AC_SUBST(LIBFONTS_JAR)
6341AC_SUBST(LIBSERIALIZER_JAR)
6342
6343# this has to be here because both the wiki publisher and the SRB use
6344# commons-logging
6345if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6346  AC_MSG_CHECKING([which Apache commons-* libs to use])
6347  if test "$with_system_apache_commons" = "yes"; then
6348    SYSTEM_APACHE_COMMONS=YES
6349    AC_MSG_RESULT([external])
6350    if test "$ENABLE_MEDIAWIKI" = "YES"; then
6351      if test -z $COMMONS_CODEC_JAR; then
6352        AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
6353          [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
6354          [
6355            AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6356              [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6357              [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6358            )
6359          ]
6360        )
6361      else
6362        AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6363             [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6364      fi
6365
6366      if test -z $COMMONS_LANG_JAR; then
6367        AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
6368          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
6369          [
6370            AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6371              [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6372              [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6373            )
6374          ]
6375        )
6376      else
6377        AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6378             [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6379      fi
6380
6381      if test -z $COMMONS_HTTPCLIENT_JAR; then
6382        AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6383          [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6384          [
6385            AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6386              [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6387              [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6388            )
6389          ]
6390        )
6391      else
6392        AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6393             [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6394      fi
6395    fi
6396    if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6397      if test -z $COMMONS_LOGGING_JAR; then
6398        AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
6399          [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
6400          [
6401            AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6402              [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6403              [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6404            )
6405          ]
6406        )
6407      else
6408        AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6409             [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6410      fi
6411    fi
6412  else
6413    AC_MSG_RESULT([internal])
6414    SYSTEM_APACHE_COMMONS=NO
6415    BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6416  fi
6417fi
6418AC_SUBST(SYSTEM_APACHE_COMMONS)
6419AC_SUBST(COMMONS_CODEC_JAR)
6420AC_SUBST(COMMONS_LANG_JAR)
6421AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6422AC_SUBST(COMMONS_LOGGING_JAR)
6423
6424dnl ===================================================================
6425dnl Check whether the Qt and KDE libraries are available.
6426dnl ===================================================================
6427
6428KDE_CFLAGS=""
6429KDE_LIBS=""
6430MOC="moc"
6431if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6432    dnl Search paths for Qt and KDE
6433    if test "$build_cpu" != "x86_64" ; then
6434        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"
6435        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"
6436    else
6437        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"
6438        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"
6439    fi
6440    if test -n "$QTDIR" ; then
6441        qt_incdirs="$QTDIR/include $qt_incdirs"
6442        if test "$build_cpu" != "x86_64" ; then
6443            qt_libdirs="$QTDIR/lib $qt_libdirs"
6444        else
6445            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6446        fi
6447    fi
6448    if test "$build_cpu" != "x86_64" ; then
6449        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"
6450        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"
6451    else
6452        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"
6453        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"
6454    fi
6455    if test -n "$KDEDIR" ; then
6456        kde_incdirs="$KDEDIR/include $kde_incdirs"
6457        if test "$build_cpu" != "x86_64" ; then
6458            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6459        else
6460            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6461        fi
6462    fi
6463
6464    dnl What to test
6465    qt_test_include="qstyle.h"
6466    qt_test_library="libqt-mt.so"
6467    kde_test_include="ksharedptr.h"
6468    kde_test_library="libkdeui.so"
6469
6470    dnl Check for Qt headers
6471    AC_MSG_CHECKING([for Qt headers])
6472    qt_incdir="no"
6473    for kde_check in $qt_incdirs ; do
6474        if test -r "$kde_check/$qt_test_include" ; then
6475            qt_incdir="$kde_check"
6476            break
6477        fi
6478    done
6479    AC_MSG_RESULT([$qt_incdir])
6480    if test "x$qt_incdir" = "xno" ; then
6481        AC_MSG_ERROR([Qt headers not found.  Please specify the root of
6482your Qt installation by exporting QTDIR before running "configure".])
6483    fi
6484
6485    dnl Check for Qt libraries
6486    AC_MSG_CHECKING([for Qt libraries])
6487    qt_libdir="no"
6488    for qt_check in $qt_libdirs ; do
6489        if test -r "$qt_check/$qt_test_library" ; then
6490            qt_libdir="$qt_check"
6491            break
6492        fi
6493    done
6494    AC_MSG_RESULT([$qt_libdir])
6495    if test "x$qt_libdir" = "xno" ; then
6496        AC_MSG_ERROR([Qt libraries not found.  Please specify the root of
6497your Qt installation by exporting QTDIR before running "configure".])
6498    fi
6499
6500    dnl Check for Meta Object Compiler
6501    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6502    if test "$MOC" = "no" ; then
6503        AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
6504the root of your Qt installation by exporting QTDIR before running "configure".])
6505    fi
6506
6507    dnl Check for KDE headers
6508    AC_MSG_CHECKING([for KDE headers])
6509    kde_incdir="no"
6510    for kde_check in $kde_incdirs ; do
6511        if test -r "$kde_check/$kde_test_include" ; then
6512            kde_incdir="$kde_check"
6513            break
6514        fi
6515    done
6516    AC_MSG_RESULT([$kde_incdir])
6517    if test "x$kde_incdir" = "xno" ; then
6518        AC_MSG_ERROR([KDE headers not found.  Please specify the root of
6519your KDE installation by exporting KDEDIR before running "configure".])
6520    fi
6521
6522    dnl Check for KDE libraries
6523    AC_MSG_CHECKING([for KDE libraries])
6524    kde_libdir="no"
6525    for kde_check in $kde_libdirs ; do
6526        if test -r "$kde_check/$kde_test_library" ; then
6527            kde_libdir="$kde_check"
6528            break
6529        fi
6530    done
6531    AC_MSG_RESULT([$kde_libdir])
6532    if test "x$kde_libdir" = "xno" ; then
6533        AC_MSG_ERROR([KDE libraries not found.  Please specify the root of
6534your KDE installation by exporting KDEDIR before running "configure".])
6535    fi
6536
6537    dnl Set the variables
6538    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6539    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6540fi
6541AC_SUBST(KDE_CFLAGS)
6542AC_SUBST(KDE_LIBS)
6543AC_SUBST(MOC)
6544
6545dnl ===================================================================
6546dnl KDE4 Integration
6547dnl ===================================================================
6548
6549KDE4_CFLAGS=""
6550KDE4_LIBS=""
6551MOC4="moc"
6552if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6553   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6554   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6555
6556   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6557   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6558
6559   if test "$build_cpu" = "x86_64" ; then
6560      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6561      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6562   fi
6563
6564   if test -n "$KDE4DIR" ; then
6565      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6566      if test "$build_cpu" != "x86_64" ; then
6567         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6568      else
6569         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6570      fi
6571   fi
6572
6573   qt_test_include="Qt/qobject.h"
6574   qt_test_library="libQtCore.so"
6575   kde_test_include="ksharedptr.h"
6576   kde_test_library="libkdeui.so"
6577
6578   AC_MSG_CHECKING([for Qt4 headers])
6579   qt_header_dir="no"
6580   for inc_dir in $qt_incdirs ; do
6581      if test -r "$inc_dir/$qt_test_include" ; then
6582         qt_header_dir="$inc_dir"
6583         break
6584      fi
6585   done
6586
6587   AC_MSG_RESULT([$qt_header_dir])
6588   if test "x$qt_header_dir" = "xno" ; then
6589      AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6590   fi
6591
6592   AC_MSG_CHECKING([for Qt4 libraries])
6593   qt_lib_dir="no"
6594   for lib_dir in $qt_libdirs ; do
6595      if test -r "$lib_dir/$qt_test_library" ; then
6596         qt_lib_dir="$lib_dir"
6597         break
6598      fi
6599   done
6600
6601   AC_MSG_RESULT([$qt_lib_dir])
6602
6603   if test "x$qt_lib_dir" = "xno" ; then
6604      AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6605   fi
6606
6607   dnl Check for Meta Object Compiler
6608   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6609   MOC4="$MOCQT4"
6610   if test "$MOC4" = "no" ; then
6611      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6612      if test "$MOC4" = "no" ; then
6613         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6614      fi
6615   fi
6616
6617   dnl Check for KDE4 headers
6618   AC_MSG_CHECKING([for KDE4 headers])
6619   kde_incdir="no"
6620   for kde_check in $kde_incdirs ; do
6621      if test -r "$kde_check/$kde_test_include" ; then
6622         kde_incdir="$kde_check"
6623         break
6624      fi
6625   done
6626   AC_MSG_RESULT([$kde_incdir])
6627   if test "x$kde_incdir" = "xno" ; then
6628      AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6629   fi
6630
6631   dnl Check for KDE4 libraries
6632   AC_MSG_CHECKING([for KDE4 libraries])
6633   kde_libdir="no"
6634   for kde_check in $kde_libdirs ; do
6635      if test -r "$kde_check/$kde_test_library" ; then
6636         kde_libdir="$kde_check"
6637         break
6638      fi
6639   done
6640
6641   AC_MSG_RESULT([$kde_libdir])
6642   if test "x$kde_libdir" = "xno" ; then
6643      AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6644   fi
6645
6646   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6647   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6648fi
6649AC_SUBST(KDE4_CFLAGS)
6650AC_SUBST(KDE4_LIBS)
6651AC_SUBST(MOC4)
6652
6653dnl ===================================================================
6654dnl Test for the enabling the lockdown pieces
6655dnl ===================================================================
6656AC_MSG_CHECKING([whether to enable the lockdown pieces])
6657ENABLE_LOCKDOWN=""
6658if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6659  ENABLE_LOCKDOWN=YES
6660  AC_MSG_RESULT([yes])
6661else
6662  AC_MSG_RESULT([no])
6663fi
6664AC_SUBST(ENABLE_LOCKDOWN)
6665
6666dnl ===================================================================
6667dnl Test whether to include Evolution 2 support
6668dnl ===================================================================
6669AC_MSG_CHECKING([whether to enable evolution 2 support])
6670if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6671   AC_MSG_RESULT([yes])
6672   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6673   ENABLE_EVOAB2="TRUE"
6674else
6675   ENABLE_EVOAB2=""
6676   AC_MSG_RESULT([no])
6677fi
6678AC_SUBST(ENABLE_EVOAB2)
6679AC_SUBST(GOBJECT_CFLAGS)
6680AC_SUBST(GOBJECT_LIBS)
6681
6682dnl ===================================================================
6683dnl Test whether to include KDE AB support
6684dnl ===================================================================
6685AC_MSG_CHECKING([whether to enable KDE address book support])
6686if test "$enable_kdeab" = "yes" && test "$enable_kde" = "yes"; then
6687   AC_MSG_RESULT([yes])
6688   AC_LANG_PUSH([C++])
6689   save_CXXFLAGS=$CXXFLAGS
6690   CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
6691   AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
6692       AC_TRY_RUN([
6693#include <kdeversion.h>
6694
6695int main(int argc, char **argv) {
6696       if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
6697       else return 1;
6698}
6699       ], [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])])
6700   CXXFLAGS=$save_CXXFLAGS
6701   AC_LANG_POP([C++])
6702   ENABLE_KAB=TRUE
6703else
6704   AC_MSG_RESULT([no])
6705   ENABLE_KAB=
6706fi
6707AC_SUBST(ENABLE_KAB)
6708
6709dnl ===================================================================
6710dnl Test whether to include MathMLDTD
6711dnl ===================================================================
6712AC_MSG_CHECKING([whether to include MathMLDTD])
6713if test -n "$enable_mathmldtd"; then
6714  if test "$enable_mathmldtd" = "no"; then
6715    AC_MSG_RESULT([no])
6716    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6717  else
6718    AC_MSG_RESULT([yes])
6719    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6720  fi
6721else
6722  AC_MSG_RESULT([no])
6723  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6724fi
6725
6726dnl ===================================================================
6727dnl Test whether to include category-B fonts
6728dnl ===================================================================
6729WITH_CATB_FONTS=
6730AC_MSG_CHECKING([whether to include category B fonts])
6731if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
6732   AC_MSG_RESULT([yes])
6733   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
6734   WITH_CATB_FONTS=YES
6735   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
6736else
6737   AC_MSG_RESULT([no])
6738   WITH_CATB_FONTS=NO
6739fi
6740
6741dnl ===================================================================
6742dnl Test whether to include category-A fonts
6743dnl ===================================================================
6744WITH_CATA_FONTS=
6745AC_MSG_CHECKING([whether to include category A fonts])
6746if test "x$with_fonts" != "xno" ; then
6747  AC_MSG_RESULT([yes])
6748  WITH_CATA_FONTS=YES
6749  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
6750else
6751  AC_MSG_RESULT([no])
6752  WITH_CATA_FONTS=NO
6753  WITH_CATB_FONTS=NO
6754fi
6755
6756WITH_FONTS=NO
6757AC_MSG_CHECKING([whether any fonts are included])
6758if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
6759  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6760  WITH_FONTS=YES
6761  AC_MSG_RESULT([yes])
6762else
6763  AC_MSG_RESULT([no])
6764fi
6765
6766AC_SUBST(WITH_CATA_FONTS)
6767AC_SUBST(WITH_CATB_FONTS)
6768AC_SUBST(WITH_FONTS)
6769
6770dnl ===================================================================
6771dnl Test whether to include ppds
6772dnl ===================================================================
6773AC_MSG_CHECKING([whether to include PPDs])
6774if test "$with_ppds" != "no"; then
6775  AC_MSG_RESULT([yes])
6776else
6777  AC_MSG_RESULT([no])
6778  WITHOUT_PPDS=YES
6779  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6780fi
6781AC_SUBST(WITHOUT_PPDS)
6782
6783dnl ===================================================================
6784dnl Test whether to include afms
6785dnl ===================================================================
6786AC_MSG_CHECKING([whether to include AFMs])
6787if test "$with_afms" != "no"; then
6788  AC_MSG_RESULT([yes])
6789  BUILD_TYPE="$BUILD_TYPE AFMS"
6790else
6791  AC_MSG_RESULT([no])
6792  WITHOUT_AFMS=YES
6793  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6794fi
6795AC_SUBST(WITHOUT_AFMS)
6796
6797AC_SUBST(SCPDEFS)
6798
6799AC_MSG_CHECKING([whether and how to use Xinerama])
6800if test "$_os" = "Darwin"; then
6801   USE_XINERAMA=YES
6802   XINERAMA_LINK=dynamic
6803   AC_MSG_RESULT([yes])
6804elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6805   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6806      # we have both versions, let the user decide but use the dynamic one
6807      # per default
6808      USE_XINERAMA=YES
6809      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6810         XINERAMA_LINK=dynamic
6811      else
6812         XINERAMA_LINK=static
6813      fi
6814   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6815      # we have only the dynamic version
6816      USE_XINERAMA=YES
6817      XINERAMA_LINK=dynamic
6818   elif test -e "$XLIB/libXinerama.a"; then
6819      # static version
6820      if echo $build_cpu | grep -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6821         USE_XINERAMA=YES
6822         XINERAMA_LINK=static
6823      else
6824         USE_XINERAMA=NO
6825         XINERAMA_LINK=none
6826      fi
6827   else
6828      # no Xinerama
6829      USE_XINERAMA=NO
6830      XINERAMA_LINK=none
6831   fi
6832   if test "$USE_XINERAMA" = "YES"; then
6833      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6834      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6835          [AC_MSG_ERROR(Xinerama header not found.)], [])
6836      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6837      if test "$_os" = "FreeBSD"; then
6838          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6839      fi
6840      if test "$_os" = "Linux"; then
6841          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6842      fi
6843      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6844          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6845   else
6846      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6847   fi
6848else
6849   AC_MSG_RESULT([no])
6850fi
6851AC_SUBST(USE_XINERAMA)
6852AC_SUBST(XINERAMA_LINK)
6853
6854dnl ===================================================================
6855dnl always rely on the system version of gdk-pixbuf
6856dnl ===================================================================
6857
6858SYSTEM_GDKPIXBUF=YES
6859AC_SUBST(SYSTEM_GDKPIXBUF)
6860
6861dnl ===================================================================
6862dnl always rely on the system version of glib
6863dnl ===================================================================
6864
6865SYSTEM_GLIB=YES
6866AC_SUBST(SYSTEM_GLIB)
6867
6868dnl ===================================================================
6869dnl always rely on the system version of gettext
6870dnl ===================================================================
6871
6872SYSTEM_GETTEXT=YES
6873AC_SUBST(SYSTEM_GETTEXT)
6874
6875if test "$_os" = "FreeBSD"; then
6876    LIBINTL_PREFIX=
6877    for dir in $CPPFLAGS; do
6878      if dir=`expr -- $dir : '-I\(.*\)'`; then
6879        if test -f "$dir/libintl.h" ; then
6880          LIBINTL_PREFIX=`dirname $dir`
6881        fi
6882      fi
6883    done
6884    AC_SUBST(LIBINTL_PREFIX)
6885fi
6886
6887dnl ===================================================================
6888dnl always rely on the system version of pango
6889dnl ===================================================================
6890
6891SYSTEM_PANGO=YES
6892AC_SUBST(SYSTEM_PANGO)
6893
6894dnl ===================================================================
6895dnl Test whether to build libpng or rely on the system version
6896dnl ===================================================================
6897AC_MSG_CHECKING([whether to build own version of libpng])
6898
6899case "$_os" in
6900	WINNT*) # Windows
6901	    SYSTEM_LIBPNG=NO
6902	    AC_MSG_RESULT([yes])
6903		;;
6904	Darwin*)
6905	    SYSTEM_LIBPNG=NO
6906	    AC_MSG_RESULT([yes])
6907	    ;;
6908   *)
6909   SYSTEM_LIBPNG=YES
6910   AC_MSG_RESULT([no])
6911   ;;
6912esac
6913AC_SUBST(SYSTEM_LIBPNG)
6914
6915dnl ===================================================================
6916dnl Test whether to build libjpeg or rely on the system version
6917dnl ===================================================================
6918dnl FIXME: this is currently because we have jpeg-6b for our filters
6919dnl        and jpeg-8 as dependency for librsvg
6920dnl        this should be unified into using only one version for both
6921
6922AC_MSG_CHECKING([whether to build own version of libjpeg])
6923
6924if test "$SYSTEM_JPEG" = "YES"; then
6925SYSTEM_LIBJPEG=YES
6926else
6927case "$_os" in
6928	WINNT*) # Windows
6929	    SYSTEM_LIBJPEG=NO
6930		;;
6931	Darwin*)
6932	    SYSTEM_LIBJPEG=NO
6933	    ;;
6934   *)
6935        SYSTEM_LIBJPEG=YES
6936        ;;
6937esac
6938fi
6939
6940if test "$SYSTEM_LIBJPEG" = "YES"; then
6941   AC_MSG_RESULT([no])
6942else
6943   AC_MSG_RESULT([yes])
6944fi
6945AC_SUBST(SYSTEM_LIBJPEG)
6946
6947dnl ===================================================================
6948dnl Test whether rat scan was requested and whether apache-rat is available
6949dnl ===================================================================
6950RAT_JAR=
6951AC_MSG_CHECKING([whether to trigger rat scan])
6952if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
6953    AC_MSG_RESULT([no])
6954else
6955    if test "$WITH_JAVA" = "no"; then
6956        AC_MSG_ERROR([no, java disabled, enable with --with-java])
6957    elif test "$enable_saxon" = "no"; then
6958        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
6959    elif test "$with_rat_scan" = "yes"; then
6960        AC_MSG_RESULT([yes, use pre-built library])
6961        RAT_JAR_HOME="BUILD"
6962        BUILD_TYPE="$BUILD_TYPE RAT"
6963    else
6964        AC_MSG_RESULT([yes, use pre-installed library])
6965        AC_MSG_CHECKING([whether apache-rat is available])
6966        if test -d "$with_rat_scan"; then
6967            RAT_JAR_HOME=$with_rat_scan
6968        else
6969            AC_MSG_ERROR([$with_rat_scan is not a directory])
6970        fi
6971    fi
6972fi
6973AC_SUBST(RAT_JAR_HOME)
6974
6975
6976dnl ===================================================================
6977dnl Test for the presence of Ant and that it works
6978dnl ===================================================================
6979
6980if test "$SOLAR_JAVA" != ""; then
6981ANT_HOME=; export ANT_HOME
6982WITH_ANT_HOME=; export WITH_ANT_HOME
6983if test -z "$with_ant_home"; then
6984   if test "$_os" = "OS2"; then
6985     AC_PATH_PROGS(ANT, ant.cmd)
6986   else
6987     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
6988   fi
6989else
6990   if test "$_os" = "WINNT"; then
6991      with_ant_home=`cygpath -u "$with_ant_home"`
6992   fi
6993   if test "$_os" = "OS2"; then
6994     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
6995   else
6996     AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
6997   fi
6998   WITH_ANT_HOME=$with_ant_home
6999   ANT_HOME=$with_ant_home
7000fi
7001
7002if test -z "$ANT"; then
7003  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
7004else
7005  # resolve relative or absolute symlink
7006  while test -h "$ANT"; do
7007     a_cwd=`pwd`
7008     a_basename=`basename "$ANT"`
7009     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7010     cd "`dirname "$ANT"`"
7011     cd "`dirname "$a_script"`"
7012     ANT="`pwd`"/"`basename "$a_script"`"
7013     cd "$a_cwd"
7014  done
7015
7016  if test "$_os" = "OS2"; then
7017    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7018    export ANT_HOME
7019  fi
7020
7021  AC_MSG_CHECKING([if $ANT works])
7022cat > conftest.java << EOF
7023    public class conftest {
7024	int testmethod(int a, int b) {
7025            return a + b;
7026	}
7027    }
7028EOF
7029
7030cat > conftest.xml << EOF
7031    <project name="conftest" default="conftest">
7032	<target name="conftest">
7033            <javac srcdir="." includes="conftest.java">
7034	    </javac>
7035	</target>
7036    </project>
7037EOF
7038  oldJAVA_HOME=$JAVA_HOME
7039  if test "$JAVACISGCJ" = "yes"; then
7040    JAVA_HOME=; export JAVA_HOME
7041    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7042  else
7043    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7044  fi
7045  AC_TRY_EVAL(ant_cmd)
7046  if test $? = 0 && test -f ./conftest.class ; then
7047    AC_MSG_RESULT([Ant works])
7048    if test -z "$WITH_ANT_HOME"; then
7049        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7050        if test -z "$ANT_HOME"; then
7051            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7052        fi
7053    else
7054        ANT_HOME="$WITH_ANT_HOME"
7055    fi
7056  else
7057    echo "configure: Ant test failed" >&5
7058    cat conftest.java >&5
7059    cat conftest.xml >&5
7060    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7061    ANT_HOME=""
7062    echo "Ant does not work - Some Java projects will not build!" >>warn
7063  fi
7064  JAVA_HOME=$oldJAVA_HOME
7065  rm -f conftest* core core.* *.core
7066fi
7067if test -z "$ANT_HOME"; then
7068   ANT_HOME="NO_ANT_HOME"
7069fi
7070AC_SUBST(ANT_HOME)
7071
7072dnl Checking for ant.jar
7073if test "$ANT_HOME" != "NO_ANT_HOME"; then
7074   AC_MSG_CHECKING([Ant lib directory])
7075   if test -f $ANT_HOME/lib/ant.jar; then
7076	  ANT_LIB="$ANT_HOME/lib"
7077   else
7078      if test -f $ANT_HOME/ant.jar; then
7079	     ANT_LIB="$ANT_HOME"
7080      else
7081          if test -f /usr/share/java/ant.jar; then
7082              ANT_LIB=/usr/share/java
7083          else
7084             if test -f /usr/share/ant-core/lib/ant.jar; then
7085                 ANT_LIB=/usr/share/ant-core/lib
7086             else
7087                if test -f $ANT_HOME/lib/ant/ant.jar; then
7088                    ANT_LIB="$ANT_HOME/lib/ant"
7089                else
7090                   if test -f /usr/share/lib/ant/ant.jar; then
7091                       ANT_LIB=/usr/share/lib/ant
7092                   else
7093                       AC_MSG_ERROR([Ant libraries not found!])
7094                   fi
7095                fi
7096             fi
7097          fi
7098      fi
7099   fi
7100   AC_MSG_RESULT([Ant lib directory found.])
7101fi
7102AC_SUBST(ANT_LIB)
7103fi
7104
7105ant_minver=1.6.0
7106# update for more extensions...
7107if test "$ENABLE_MEDIAWIKI" = "YES"; then
7108  ant_minver=1.7.0
7109fi
7110ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7111
7112AC_MSG_CHECKING([whether ant is >= $ant_minver])
7113ant_version=`$ANT -version | $AWK '{ print $4; }'`
7114ant_version_major=`echo $ant_version | cut -d. -f1`
7115ant_version_minor=`echo $ant_version | cut -d. -f2`
7116echo "configure: ant_version $ant_version " >&5
7117echo "configure: ant_version_major $ant_version_major " >&5
7118echo "configure: ant_version_minor $ant_version_minor " >&5
7119if test "$ant_version_major" -ge "2"; then
7120   AC_MSG_RESULT([yes, $ant_version])
7121elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7122   AC_MSG_RESULT([yes, $ant_version])
7123else
7124   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7125fi
7126
7127if test "$ENABLE_MEDIAWIKI" = "YES"; then
7128AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7129rm -rf confdir
7130mkdir confdir
7131cat > conftest.java << EOF
7132    public class conftest {
7133        int testmethod(int a, int b) {
7134            return a + b;
7135        }
7136    }
7137EOF
7138
7139cat > conftest.xml << EOF
7140    <project name="conftest" default="conftest">
7141        <target name="conftest" depends="copytest">
7142            <javac srcdir="." includes="conftest.java">
7143            </javac>
7144        </target>
7145        <target name="copytest">
7146             <copy todir="confdir">
7147                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7148                 <filterset/>
7149                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7150             </copy>
7151        </target>
7152    </project>
7153EOF
7154  if test "$JAVACISGCJ" = "yes"; then
7155    JAVA_HOME=; export JAVA_HOME
7156    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7157  else
7158    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7159  fi
7160  AC_TRY_EVAL(ant_cmd)
7161  if test $? = 0 && test -f ./conftest.class ; then
7162    AC_MSG_RESULT([yes])
7163    rm -rf confdir
7164  else
7165    echo "configure: Ant test failed" >&5
7166    cat conftest.java >&5
7167    cat conftest.xml >&5
7168    rm -rf confdir
7169    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7170  fi
7171fi
7172rm -f conftest* core core.* *.core
7173
7174OOO_JUNIT_JAR=
7175if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7176    AC_MSG_CHECKING([for JUnit 4])
7177    if test "$with_junit" = "yes"; then
7178        if test -e /usr/share/java/junit4.jar; then
7179            OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7180        else
7181           if test -e /usr/share/lib/java/junit.jar; then
7182              OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7183           else
7184              OOO_JUNIT_JAR=/usr/share/java/junit.jar
7185           fi
7186        fi
7187    else
7188        OOO_JUNIT_JAR=$with_junit
7189    fi
7190    if test "$_os" = "WINNT"; then
7191        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7192    fi
7193    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
7194        grep org/junit/Before.class > /dev/null 2>&5
7195    if test $? -eq 0; then
7196        AC_MSG_RESULT([$OOO_JUNIT_JAR])
7197    else
7198        AC_MSG_RESULT([no])
7199        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7200location (/usr/share/java), specify its pathname via
7201--with-junit=..., or disable it via --without-junit])
7202    fi
7203fi
7204AC_SUBST(OOO_JUNIT_JAR)
7205
7206AC_MSG_CHECKING([which languages to be built])
7207WITH_LANG="$with_lang"
7208if test -z "$WITH_LANG"; then
7209   AC_MSG_RESULT([en-US])
7210else
7211   AC_MSG_RESULT([$WITH_LANG])
7212   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7213   BUILD_TYPE="$BUILD_TYPE L10N"
7214fi
7215AC_SUBST(WITH_LANG)
7216
7217AC_MSG_CHECKING([which languages have poor help localizations])
7218WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7219if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7220   AC_MSG_RESULT([none])
7221else
7222   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7223fi
7224AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7225
7226AC_MSG_CHECKING([which dictionaries to include])
7227if test -z "$with_dict"; then
7228   WITH_DICT=,ALL,
7229   AC_MSG_RESULT([ALL])
7230else
7231   WITH_DICT=","$with_dict","
7232   AC_MSG_RESULT([$with_dict])
7233fi
7234AC_SUBST(WITH_DICT)
7235
7236AC_MSG_CHECKING([for additional 'intro' bitmaps])
7237INTRO_BITMAPS=
7238if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7239   INTRO_BITMAPS=
7240   AC_MSG_RESULT([none])
7241else
7242   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7243      case "$bitmap" in
7244         *.png) ;;
7245         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .png files!]) ;;
7246      esac
7247      if test -n "$bitmap" ; then
7248         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7249      fi
7250   done
7251   AC_MSG_RESULT([$INTRO_BITMAPS])
7252fi
7253AC_SUBST(INTRO_BITMAPS)
7254
7255AC_MSG_CHECKING([for additional 'about' bitmaps])
7256ABOUT_BITMAPS=
7257if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7258   ABOUT_BITMAPS=
7259   AC_MSG_RESULT([none])
7260else
7261   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7262      case "$bitmap" in
7263         *.png) ;;
7264         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .png files!]) ;;
7265      esac
7266      if test -n "$bitmap" ; then
7267         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7268      fi
7269   done
7270   AC_MSG_RESULT([$ABOUT_BITMAPS])
7271fi
7272AC_SUBST(ABOUT_BITMAPS)
7273
7274OOO_VENDOR=
7275AC_MSG_CHECKING([for vendor])
7276if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7277   AC_MSG_RESULT([not set])
7278else
7279   OOO_VENDOR="$with_vendor"
7280   AC_MSG_RESULT([$OOO_VENDOR])
7281fi
7282AC_SUBST(OOO_VENDOR)
7283
7284UNIXWRAPPERNAME=
7285AC_MSG_CHECKING([for UNIX wrapper name])
7286if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes" ; then
7287   AC_MSG_RESULT([not set])
7288else
7289   UNIXWRAPPERNAME="$with_unix_wrapper"
7290   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7291fi
7292AC_SUBST(UNIXWRAPPERNAME)
7293
7294AC_MSG_CHECKING([whether to statically link to Gtk])
7295if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7296   ENABLE_STATIC_GTK="TRUE"
7297   AC_MSG_RESULT([yes])
7298else
7299   ENABLE_STATIC_GTK="FALSE"
7300   AC_MSG_RESULT([no])
7301fi
7302AC_SUBST(ENABLE_STATIC_GTK)
7303
7304AC_MSG_CHECKING([whether to use layout dialogs])
7305if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7306   ENABLE_LAYOUT="TRUE"
7307   AC_MSG_RESULT([yes])
7308else
7309   ENABLE_LAYOUT="FALSE"
7310   AC_MSG_RESULT([no])
7311fi
7312AC_SUBST(ENABLE_LAYOUT)
7313
7314# ===================================================================
7315# De- or increase default verbosity of build process
7316# ===================================================================
7317AC_MSG_CHECKING([build verbosity])
7318if test -n "$enable_verbose"; then
7319   if test "$enable_verbose" = "yes"; then
7320      VERBOSE="TRUE"
7321      AC_MSG_RESULT([high])
7322   fi
7323   if test "$enable_verbose" = "no"; then
7324      VERBOSE="FALSE"
7325      AC_MSG_RESULT([low])
7326   fi
7327else
7328   AC_MSG_RESULT([not set])
7329fi
7330AC_SUBST(VERBOSE)
7331
7332dnl ===================================================================
7333dnl Hook up OOos nodep environmental variable to automake's equivalent
7334dnl --enable-dependency-tracking configure option
7335dnl ===================================================================
7336AC_MSG_CHECKING([whether to enable dependency tracking])
7337if test "$enable_dependency_tracking" = "no"; then
7338    nodep=TRUE
7339    AC_MSG_RESULT([no])
7340else
7341    AC_MSG_RESULT([yes])
7342fi
7343AC_SUBST(nodep)
7344
7345dnl ===================================================================
7346dnl Setting up the environment.
7347dnl ===================================================================
7348echo "********************************************************************"
7349echo "*                                                                  *"
7350echo "*   Setting up the build environment variables.                    *"
7351echo "*                                                                  *"
7352echo "********************************************************************"
7353
7354if test -z "$COMPATH"; then
7355   AC_MSG_ERROR([No compiler found.])
7356fi
7357AC_SUBST(COMPATH)
7358AC_SUBST(CC_PATH)
7359
7360AC_MSG_CHECKING([solver path])
7361if test -z "$with_local_solver"; then
7362   LOCAL_SOLVER="DEFAULT"
7363   AC_MSG_RESULT([default])
7364else
7365   LOCAL_SOLVER=$with_local_solver
7366   AC_MSG_RESULT([$with_local_solver])
7367fi
7368AC_SUBST(LOCAL_SOLVER)
7369
7370AC_SUBST(BUILD_TYPE)
7371AC_SUBST(ADDITIONAL_REPOSITORIES)
7372
7373# make sure config.guess is +x; we execute config.guess, so it has to be so;
7374chmod +x ./config.guess
7375
7376# Create files from their *.in templates.
7377AC_CONFIG_FILES([set_soenv Makefile])
7378
7379AC_MSG_NOTICE([writing config.status])
7380AC_OUTPUT
7381
7382dnl Executing the set_soenv script to setup the environment variables.
7383chmod a+x set_soenv
7384if test -z "$enable_check_only"; then
7385   './set_soenv'
7386else
7387   echo
7388   echo Test Complete
7389   echo No environment file will be generated
7390   echo
7391   num_warnings=`wc -l warn`
7392   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7393   if test $_num -gt 0; then
7394      echo The following warning\(s\) were generated by configure
7395      echo ----------------------------------------------------
7396      echo
7397      cat warn
7398      echo
7399   else
7400      echo There were no warnings
7401   fi
7402   echo
7403fi
7404