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