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