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