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