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