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