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