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