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