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