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