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