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