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