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