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