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