xref: /trunk/main/configure.ac (revision 3e6a53ec4966bc78e4eb80339b6629fb1dcd11be)
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   _python_ver=`$_python -c "import sysconfig; print(sysconfig.get_config_var('VERSION'));"`
4107
4108   dnl Locate the headers. Prefer the framework/SDK locations, but fall back
4109   dnl to whatever include dir the interpreter itself reports (this is what
4110   dnl makes Homebrew and other non-framework installs work).
4111   if test -d "/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
4112        PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4113   elif test -d "$MACOSX_SDK_PATH/usr/include/python$_python_ver"; then
4114       PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/python$_python_ver"
4115   elif test -d "$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
4116       PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4117   else
4118       _python_inc=`$_python -c "import sysconfig; print(sysconfig.get_path('include'));"`
4119       PYTHON_CFLAGS="-I$_python_inc"
4120   fi
4121
4122   dnl A framework build links against the Python framework; any other
4123   dnl install (Homebrew, etc.) links against libpython in its LIBDIR.
4124   case "$_python" in
4125       /Library/Frameworks/Python.framework/*|*/System/Library/Frameworks/Python.framework/*)
4126           PYTHON_LIBS="-framework Python"
4127           ;;
4128       *)
4129           _python_libdir=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
4130           PYTHON_LIBS="-L$_python_libdir -lpython$_python_ver"
4131           ;;
4132   esac
4133elif test -n "$with_system_python" -o -n "$with_system_libs" && \
4134    test "$with_system_python" != "no"; then
4135   with_system_python=yes
4136   AC_MSG_RESULT([external])
4137   AM_PATH_PYTHON([3.11])
4138
4139   python_include=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'));"`
4140   python_version=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_var('VERSION'));"`
4141   # Python 3.8 and later distinguish building Python modules from linking to the libpython:
4142   # (https://bugs.python.org/issue36721)
4143   if test "$python_version" -lt "3.8"; then
4144       PKG_CHECK_MODULES(PYTHON, python-$python_version, PYTHON_PC="TRUE", PYTHON_PC="" )
4145   else
4146       PKG_CHECK_MODULES(PYTHON, python-$python_version-embed, PYTHON_PC="TRUE", PYTHON_PC="" )
4147   fi
4148   if test "$PYTHON_PC" != "TRUE"; then
4149       PYTHON_CFLAGS="-I$python_include"
4150       PYTHON_LIBS="-lpython$python_version"
4151   fi
4152fi
4153if test "$with_system_python" = "yes" ; then
4154   SYSTEM_PYTHON=YES
4155   dnl check if the headers really work:
4156   save_CPPFLAGS="$CPPFLAGS"
4157   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4158   AC_CHECK_HEADER(Python.h, [],
4159       [AC_MSG_ERROR(Python headers not found)], [])
4160   CPPFLAGS="$save_CPPFLAGS"
4161else
4162   SYSTEM_PYTHON=NO
4163   BUILD_TYPE="$BUILD_TYPE PYTHON"
4164   AC_MSG_RESULT([internal])
4165   # Embedded python dies without Home set
4166   if test "z$HOME" = "z"; then
4167      export HOME="";
4168   fi
4169   # bz2 tarball and bzip2 is not standard
4170   if test -z "$BZIP2"; then
4171    AC_PATH_PROG( BZIP2, bzip2)
4172    if test -z "$BZIP2"; then
4173        AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
4174    fi
4175   fi
4176fi
4177AC_SUBST(SYSTEM_PYTHON)
4178AC_SUBST(PYTHON_CFLAGS)
4179AC_SUBST(PYTHON_LIBS)
4180HOME=`echo $HOME | sed 's:\\\\:/:g'`
4181AC_SUBST(HOME)
4182
4183dnl ===================================================================
4184dnl Check for system lucene
4185dnl ===================================================================
4186AC_MSG_CHECKING([which lucene to use])
4187if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4188       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4189        AC_MSG_RESULT([external])
4190        SYSTEM_LUCENE=YES
4191        if test -z $LUCENE_CORE_JAR; then
4192          AC_CHECK_FILE(/usr/share/java/lucene-core-2.9.4.jar,
4193            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.9.4.jar ],
4194            [
4195              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4196                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4197                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4198                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4199                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4200                  )
4201                ]
4202              )
4203            ]
4204          )
4205        else
4206          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4207               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
4208        fi
4209
4210        if test -z $LUCENE_ANALYZERS_JAR; then
4211          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
4212            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
4213            [
4214              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
4215                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
4216                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
4217              )
4218            ]
4219          )
4220        else
4221          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4222               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
4223        fi
4224        AC_MSG_CHECKING([whether lucene is version 2.x])
4225        export LUCENE_CORE_JAR
4226        if $PERL -e 'use Archive::Zip;
4227            my $file = "$ENV{'LUCENE_CORE_JAR'}";
4228            my $zip = Archive::Zip->new( $file );
4229            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4230            if ( $mf =~ m/Specification-Version: 2.*/ ) {
4231                exit 0;
4232            } else {
4233                exit 1;
4234            }'; then
4235            AC_MSG_RESULT([yes])
4236         else
4237            AC_MSG_RESULT([no])
4238            AC_MSG_CHECKING([whether lucene is version 3.x])
4239
4240            if $PERL -e 'use Archive::Zip;
4241                my $file = "$ENV{'LUCENE_CORE_JAR'}";
4242                my $zip = Archive::Zip->new( $file );
4243                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4244                if ( $mf =~ m/Specification-Version: 3.*/ ) {
4245                    exit 0;
4246                } else {
4247                    exit 1;
4248                }'; then
4249                AC_MSG_RESULT([yes])
4250             else
4251                AC_MSG_ERROR([no, you need lucene 2 or 3])
4252             fi
4253         fi
4254
4255else
4256    AC_MSG_RESULT([internal])
4257    SYSTEM_LUCENE=NO
4258    BUILD_TYPE="$BUILD_TYPE LUCENE"
4259fi
4260AC_SUBST(SYSTEM_LUCENE)
4261AC_SUBST(LUCENE_CORE_JAR)
4262AC_SUBST(LUCENE_ANALYZERS_JAR)
4263
4264AC_MSG_CHECKING([whether to build the MySQL Connector extension])
4265if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
4266  AC_MSG_RESULT([yes])
4267  ENABLE_MYSQLC=YES
4268  AC_MSG_CHECKING([for mysqlc module])
4269  if test -d mysqlc; then
4270   AC_MSG_RESULT([OK])
4271  else
4272   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4273  fi
4274  BUILD_TYPE="$BUILD_TYPE MYSQLC"
4275else
4276  AC_MSG_RESULT([no])
4277  ENABLE_MYSQLC=NO
4278fi
4279AC_SUBST(ENABLE_MYSQLC)
4280
4281if test "$ENABLE_MYSQLC" = "YES"; then
4282dnl ===================================================================
4283dnl Check for system MySQL
4284dnl ===================================================================
4285AC_MSG_CHECKING([for mysql pre-requisites])
4286if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
4287       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
4288    AC_MSG_RESULT([external MySQL])
4289    SYSTEM_MYSQL=YES
4290    AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4291    AC_MSG_CHECKING([MySQL version])
4292    if test -z "$MYSQLCONFIG" -o ! -x "$MYSQLCONFIG" ; then
4293        AC_MSG_ERROR([can not find/execute mysql_config]);
4294    fi
4295    MYSQL_VERSION=`$MYSQLCONFIG --version`
4296    MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4297    if test "$MYSQL_MAJOR" -ge "5"; then
4298        AC_MSG_RESULT([OK])
4299    else
4300        AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4301    fi
4302    AC_MSG_CHECKING([for MySQL Client library])
4303    MYSQL_INC=`$MYSQLCONFIG --include`
4304    MYSQL_LIB=`$MYSQLCONFIG --libs`
4305    MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4306    AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4307else
4308    SYSTEM_MYSQL=NO
4309    if test -n "$with_libmysql_path"; then
4310        AC_MSG_RESULT([external Connector/C (libmysql)])
4311        LIBMYSQL=libmysql.so
4312        if test "$_os" = "Darwin"; then
4313            LIBMYSQL=libmysql.dylib
4314        elif test "$_os" = "WINNT"; then
4315            LIBMYSQL=libmysql.dll
4316        fi
4317        AC_MSG_CHECKING([for $LIBMYSQL])
4318        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4319            AC_MSG_RESULT([found.])
4320            LIBMYSQL_PATH=$with_libmysql_path
4321        else
4322            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4323        fi
4324    else
4325        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4326    fi
4327fi
4328AC_SUBST(SYSTEM_MYSQL)
4329AC_SUBST(MYSQL_INC)
4330AC_SUBST(MYSQL_LIB)
4331AC_SUBST(MYSQL_DEFINES)
4332AC_SUBST(LIBMYSQL_PATH)
4333
4334AC_LANG_PUSH([C++])
4335dnl ===================================================================
4336dnl Check for system MySQL C++ Connector
4337dnl ===================================================================
4338# FIXME!
4339# who thought this too-generic cppconn dir was a good idea?
4340AC_MSG_CHECKING([MySQL Connector/C++])
4341if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4342        test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4343    AC_MSG_RESULT([external])
4344    SYSTEM_MYSQL_CPPCONN=YES
4345        AC_LANG_PUSH([C++])
4346    AC_CHECK_HEADER(mysql_driver.h, [],
4347                    [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4348    AC_CHECK_LIB(mysqlcppconn, main, [],
4349                    [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4350   AC_MSG_CHECKING([version])
4351      AC_RUN_IFELSE([AC_LANG_SOURCE([[
4352#include <mysql_driver.h>
4353
4354int main(int argc, char **argv) {
4355    sql::Driver *driver;
4356    driver = get_driver_instance();
4357    if (driver->getMajorVersion() > 1 || \
4358       (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4359       (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4360        return 0;
4361      else
4362        return 1;
4363}
4364      ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
4365        AC_LANG_POP([C++])
4366
4367else
4368    AC_MSG_RESULT([no])
4369    SYSTEM_MYSQL_CPPCONN=
4370fi
4371AC_LANG_POP([C++])
4372AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4373fi
4374
4375dnl ===================================================================
4376dnl Check for system hsqldb
4377dnl ===================================================================
4378AC_MSG_CHECKING([which hsqldb to use])
4379if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4380       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4381        AC_MSG_RESULT([external])
4382        SYSTEM_HSQLDB=YES
4383        if test -z $HSQLDB_JAR; then
4384               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4385        fi
4386        AC_CHECK_FILE($HSQLDB_JAR, [],
4387               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4388        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4389        export HSQLDB_JAR
4390        if $PERL -e 'use Archive::Zip;
4391            my $file = "$ENV{'HSQLDB_JAR'}";
4392            my $zip = Archive::Zip->new( $file );
4393            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4394            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4395               push @l, split(/\n/, $mf);
4396               foreach my $line (@l) {
4397                  if ($line =~ m/Specification-Version:/) {
4398                      ($t, $version) = split (/:/,$line);
4399                      $version =~ s/^\s//;
4400                      ($a, $b, $c, $d) = split (/\./,$version);
4401                      if ($c == "0" && $d > "8")  {
4402                          exit 0;
4403                      } else {
4404                          exit 1;
4405                      }
4406                  }
4407               }
4408            } else {
4409                exit 1;
4410            }'; then
4411            AC_MSG_RESULT([yes])
4412         else
4413            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
4414         fi
4415else
4416    AC_MSG_RESULT([internal])
4417    SYSTEM_HSQLDB=NO
4418    BUILD_TYPE="$BUILD_TYPE HSQLDB"
4419fi
4420AC_SUBST(SYSTEM_HSQLDB)
4421AC_SUBST(HSQLDB_JAR)
4422
4423dnl ===================================================================
4424dnl Check for system beanshell
4425dnl ===================================================================
4426ENABLE_BEANSHELL=YES
4427AC_MSG_CHECKING([which beanshell to use])
4428if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
4429       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
4430        AC_MSG_RESULT([external])
4431        SYSTEM_BSH=YES
4432        if test -z $BSH_JAR; then
4433               BSH_JAR=/usr/share/java/bsh.jar
4434        fi
4435        AC_CHECK_FILE($BSH_JAR, [],
4436               [AC_MSG_ERROR(bsh.jar not found.)], [])
4437elif test "x$enable_beanshell" = "xyes"; then
4438    AC_MSG_RESULT([internal])
4439    SYSTEM_BSH=NO
4440    BUILD_TYPE="$BUILD_TYPE BSH"
4441else
4442    AC_MSG_RESULT([none (disabled)])
4443    SYSTEM_BSH=NO
4444    ENABLE_BEANSHELL=NO
4445fi
4446AC_SUBST(SYSTEM_BSH)
4447AC_SUBST(BSH_JAR)
4448AC_SUBST(ENABLE_BEANSHELL)
4449
4450
4451dnl ===================================================================
4452dnl Check for saxon. It can come from two different places:
4453dnl - pre-installed on the system. This is checked when the --with-system-saxon
4454dnl   option is given to configure.
4455dnl   The exact place can be specified with the --with-saxon-jar=<path> option.
4456dnl - From the saxon tar ball in ext_sources/. This is used when --enable-saxon
4457dnl   is given to configure but not any of --with-system-saxon or --with-saxon-jar.
4458dnl ===================================================================
4459DISABLE_SAXON=
4460AC_MSG_CHECKING([which saxon to use])
4461if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
4462       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
4463        AC_MSG_RESULT([external])
4464        SYSTEM_SAXON=YES
4465        if test -z $SAXON_JAR; then
4466          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4467            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4468            [
4469              AC_CHECK_FILE(/usr/share/java/saxon.jar,
4470                [ SAXON_JAR=/usr/share/java/saxon.jar ],
4471                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4472                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4473                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
4474                  )
4475                ]
4476              )
4477            ]
4478          )
4479        else
4480          AC_CHECK_FILE($SAXON_JAR, [],
4481               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
4482        fi
4483        if test -n "$SERIALIZER_JAR"; then
4484          AC_CHECK_FILE($SERIALIZER_JAR, [],
4485               [AC_MSG_ERROR(serializer.jar not found.)], [])
4486          AC_SUBST(SERIALIZER_JAR)
4487        fi
4488
4489dnl Saxon comes in two practically available versions, the out-of-date saxonb which
4490dnl supports the java extensions that AOO uses, and the up-to-date saxon he
4491dnl "home edition" version, which is crippled to not support those java extensions.
4492dnl And as an aside the he one also needs to be tweaked to include
4493dnl a META-INF/services to broadcast that it supports the jaxp transform factory
4494
4495        AC_MSG_CHECKING([if saxon works])
4496        cat > saxontest.java <<_ACEOF
4497[import javax.xml.transform.TransformerFactory;
4498import javax.xml.transform.Transformer;
4499import javax.xml.transform.stream.StreamSource;
4500import java.io.*;
4501
4502import net.sf.saxon.FeatureKeys;
4503
4504class saxontest {
4505    public static void main(String[] args) {
4506      System.setProperty("javax.xml.transform.TransformerFactory",
4507        "net.sf.saxon.TransformerFactoryImpl");
4508      try {
4509        TransformerFactory tfactory = TransformerFactory.newInstance();
4510    // some external saxons (Debian, Ubuntu, ...) have this disabled
4511    // per default
4512    tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
4513        System.out.println("TransformerFactory is" +
4514          tfactory.getClass().getName());
4515        Transformer transformer = tfactory.newTransformer(
4516          new StreamSource(new File(args[0])));
4517      } catch(Exception e){
4518        e.printStackTrace(System.err);
4519        System.exit(-1);
4520      }
4521      System.exit(0);
4522    }
4523}
4524]
4525_ACEOF
4526        cat > saxontest.xsl<<_ACEOF
4527[<?xml version="1.0" encoding="UTF-8"?>
4528<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4529 <xsl:template match="/">
4530  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
4531 </xsl:template>
4532</xsl:stylesheet>
4533]
4534_ACEOF
4535        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
4536        AC_TRY_EVAL(javac_cmd)
4537        if test $? = 0 && test -f ./saxontest.class ; then
4538            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
4539            AC_TRY_EVAL(java_cmd)
4540            if test $? = 0; then
4541              AC_MSG_RESULT([yes])
4542            else
4543              cat saxontest.java >&5
4544              AC_MSG_RESULT([no])
4545              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
4546            fi
4547        else
4548          AC_MSG_RESULT([no])
4549          cat saxontest.java >&5
4550          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
4551        fi
4552elif test "x$enable_saxon" = "xyes"; then
4553    AC_MSG_RESULT([internal])
4554    SYSTEM_SAXON=NO
4555    BUILD_TYPE="$BUILD_TYPE SAXON"
4556else
4557    AC_MSG_RESULT([none (disabled)])
4558    SYSTEM_SAXON=NO
4559    DISABLE_SAXON=YES
4560fi
4561AC_SUBST(SYSTEM_SAXON)
4562AC_SUBST(SAXON_JAR)
4563AC_SUBST(DISABLE_SAXON)
4564
4565
4566dnl ===================================================================
4567dnl Check for rhino
4568dnl ===================================================================
4569ENABLE_JAVASCRIPT=
4570AC_MSG_CHECKING([whether to enable support for JavaScript])
4571if test "x$enable_javascript" = "xyes"; then
4572   BUILD_TYPE="$BUILD_TYPE RHINO"
4573   AC_MSG_RESULT([yes])
4574   ENABLE_JAVASCRIPT=YES
4575else
4576   AC_MSG_RESULT([no])
4577   ENABLE_JAVASCRIPT=NO
4578fi
4579AC_SUBST(ENABLE_JAVASCRIPT)
4580
4581
4582dnl ===================================================================
4583dnl Check for CoinMP
4584dnl ===================================================================
4585ENABLE_COINMP=
4586SYSTEM_COINMP=NO
4587COINMP_CFLAGS=
4588COINMP_LIBS=
4589AC_MSG_CHECKING([whether to enable support for CoinMP])
4590if test "x$enable_coinmp" = "xyes"; then
4591    BUILD_TYPE="$BUILD_TYPE COINMP"
4592    AC_MSG_RESULT([yes])
4593    ENABLE_COINMP=YES
4594
4595    dnl Check whether to use system or internal CoinMP
4596    AC_MSG_CHECKING([which coinmp to use])
4597    if test "x$with_system_coinmp" = "xyes" -o -n "$with_system_libs"; then
4598        AC_MSG_RESULT([system])
4599    PKG_CHECK_MODULES([COINMP], [coinmp])
4600        SYSTEM_COINMP=YES
4601        # some systems need this. Like Ubuntu....
4602        AC_CHECK_LIB(m, floor)
4603        AC_CHECK_LIB(dl, dlopen)
4604    else
4605        AC_MSG_RESULT([internal])
4606        SYSTEM_COINMP=NO
4607        BUILD_TYPE="$BUILD_TYPE COINMP"
4608    fi
4609else
4610    AC_MSG_RESULT([no])
4611    ENABLE_COINMP=NO
4612fi
4613AC_SUBST(ENABLE_COINMP)
4614AC_SUBST(SYSTEM_COINMP)
4615AC_SUBST(COINMP_CFLAGS)
4616AC_SUBST(COINMP_LIBS)
4617
4618
4619dnl ===================================================================
4620dnl Check for system curl
4621dnl ===================================================================
4622if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
4623   with_system_curl=yes
4624fi
4625AC_MSG_CHECKING([which curl to use])
4626if test -n "$with_system_curl" -o -n "$with_system_libs" && \
4627    test "$with_system_curl" != "no"; then
4628   AC_MSG_RESULT([external])
4629   SYSTEM_CURL=YES
4630
4631   AC_PATH_PROG( CURLCONFIG, curl-config)
4632   if test -z "$CURLCONFIG"; then
4633      AC_MSG_ERROR([install curl to run this script])
4634   fi
4635
4636   # check curl version
4637   AC_MSG_CHECKING([whether curl is >= 7.13.1])
4638   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
4639    "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
4640    "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
4641      AC_MSG_ERROR([no, you need at least curl 7.13,1])
4642   else
4643      AC_MSG_RESULT([yes])
4644   fi
4645
4646   # Does curl use OpenSSL as its SSL implementation? Needed for ucb/source/ucp/webdav.
4647   AC_MSG_CHECKING([whether curl uses OpenSSL as its SSL backend])
4648   if $CURLCONFIG --ssl-backends | $GREP -q 'OpenSSL'; then
4649      AC_MSG_RESULT([yes])
4650   else
4651      AC_MSG_ERROR([no, cannot use system curl whose SSL backend isn't OpenSSL])
4652   fi
4653
4654   CURL_LIBS=`$CURLCONFIG --libs`
4655   CURL_CFLAGS=`$CURLCONFIG --cflags`
4656else
4657   AC_MSG_RESULT([internal])
4658   SYSTEM_CURL=NO
4659   BUILD_TYPE="$BUILD_TYPE CURL"
4660fi
4661AC_SUBST(SYSTEM_CURL)
4662AC_SUBST(CURL_CFLAGS)
4663AC_SUBST(CURL_LIBS)
4664
4665dnl ===================================================================
4666dnl Check for system mdds
4667dnl ===================================================================
4668AC_MSG_CHECKING([which mdds to use])
4669if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
4670    test "$with_system_mdds" != "no"; then
4671    AC_MSG_RESULT([external])
4672    SYSTEM_MDDS=YES
4673    AC_LANG_PUSH([C++])
4674    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
4675        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
4676    AC_LANG_POP([C++])
4677else
4678   AC_MSG_RESULT([internal])
4679   BUILD_TYPE="$BUILD_TYPE MDDS"
4680   SYSTEM_MDDS=NO
4681fi
4682AC_SUBST(SYSTEM_MDDS)
4683
4684dnl ===================================================================
4685dnl Check for system boost
4686dnl ===================================================================
4687AC_MSG_CHECKING([which boost to use])
4688if test -n "$with_system_boost" -o -n "$with_system_headers" && \
4689    test "$with_system_boost" != "no"; then
4690   AC_MSG_RESULT([external])
4691   SYSTEM_BOOST=YES
4692   AC_LANG_PUSH([C++])
4693   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
4694       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
4695   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
4696       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
4697   AC_CHECK_HEADER(boost/function.hpp, [],
4698       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
4699
4700   save_CXXFLAGS=$CXXFLAGS
4701   CXXFLAGS="$CXXFLAGS -fno-exceptions"
4702   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
4703   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
4704]], [[]])],[ac_cv_cxx_boost_no_exceptons_broken=no],[ac_cv_cxx_boost_no_exceptons_broken=yes])
4705
4706   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
4707    AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
4708   else
4709    AC_MSG_RESULT([yes])
4710   fi
4711   CXXFLAGS=$save_CXXFLAGS
4712   AC_LANG_POP([C++])
4713else
4714   AC_MSG_RESULT([internal])
4715   BUILD_TYPE="$BUILD_TYPE BOOST"
4716   SYSTEM_BOOST=NO
4717fi
4718AC_SUBST(SYSTEM_BOOST)
4719
4720dnl ===================================================================
4721dnl Check for system vigra
4722dnl ===================================================================
4723AC_MSG_CHECKING([which vigra to use])
4724if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
4725    test "$with_system_vigra" != "no"; then
4726   AC_MSG_RESULT([external])
4727   SYSTEM_VIGRA=YES
4728   AC_LANG_PUSH([C++])
4729   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
4730       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
4731   AC_LANG_POP([C++])
4732else
4733   AC_MSG_RESULT([internal])
4734   BUILD_TYPE="$BUILD_TYPE VIGRA"
4735   SYSTEM_VIGRA=NO
4736fi
4737AC_SUBST(SYSTEM_VIGRA)
4738
4739dnl ===================================================================
4740dnl Check for system odbc
4741dnl ===================================================================
4742AC_MSG_CHECKING([which odbc headers to use])
4743if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
4744    test "$with_system_odbc_headers" != "no"; then
4745   AC_MSG_RESULT([external])
4746   SYSTEM_ODBC_HEADERS=YES
4747
4748   AC_CHECK_HEADER(sqlext.h, [],
4749      [AC_MSG_ERROR(odbc not found. install odbc)], [])
4750else
4751   AC_MSG_RESULT([internal])
4752   SYSTEM_ODBC_HEADERS=NO
4753   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
4754fi
4755AC_SUBST(SYSTEM_ODBC_HEADERS)
4756
4757AC_MSG_CHECKING([whether to build XML Security support])
4758if test "$enable_nss_module" = "no"; then
4759   AC_MSG_RESULT([no, since NSS disabled but needed])
4760else
4761   AC_MSG_RESULT([yes])
4762fi
4763
4764AC_MSG_CHECKING([whether to build LDAP configuration backend])
4765if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
4766   if test "$with_openldap" = "yes"; then
4767      AC_MSG_RESULT([yes])
4768      WITH_LDAP=YES
4769   else
4770      WITH_LDAP=NO
4771   fi
4772else
4773   AC_MSG_RESULT([no])
4774   WITH_LDAP=NO
4775fi
4776
4777if test "$WITH_LDAP" = "YES"; then
4778   dnl ===================================================================
4779   dnl Test whether we want to use the OpenLDAP LDAP SDK
4780   dnl ===================================================================
4781   AC_MSG_CHECKING([which LDAP SDK to use])
4782   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
4783       AC_MSG_RESULT([OpenLDAP])
4784       WITH_OPENLDAP=YES
4785       AC_CHECK_HEADERS(ldap.h, [],
4786           [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
4787       AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
4788           [AC_MSG_ERROR(openldap lib not found or functional)], [])
4789       # rumours say that OpenLDAP doesn't have that function. I looked and
4790       # it has it. Test for it to be sure
4791         AC_CHECK_LIB(ldap, ldap_set_option, [],
4792                [AC_MSG_ERROR(openldap lib not found or functional)], [])
4793   fi
4794fi
4795AC_SUBST(WITH_LDAP)
4796AC_SUBST(WITH_OPENLDAP)
4797
4798AC_MSG_CHECKING([whether to build the internal NSS module])
4799if test "$enable_nss_module" != "no"; then
4800   ENABLE_NSS_MODULE="YES"
4801   BUILD_TYPE="$BUILD_TYPE NSS"
4802   AC_MSG_RESULT([yes])
4803   if test "$_os" = "WINNT"; then
4804      AC_MSG_CHECKING([for Mozilla build tooling])
4805      if test -z "$MOZILLABUILD" ; then
4806AC_MSG_ERROR([
4807Mozilla build tooling not found!
4808  It is required for NSS that is needed for AOO's security facilities.
4809  Either disable NSS using the option --disable-nss-module
4810  or use the --with-mozilla-build option after installing the tool obtained
4811  from https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/])
4812      else
4813         if test \( "$WITH_MINGWIN" = "yes" \) ; then
4814            if test ! -d "$MOZILLABUILD" ; then
4815AC_MSG_ERROR([Mozilla build tooling incomplete!])
4816            else
4817               AC_MSG_RESULT([ok])
4818            fi
4819         else
4820            if test ! -d "$MOZILLABUILD/msys" ; then
4821AC_MSG_ERROR([Mozilla build tooling incomplete!])
4822            else
4823               AC_MSG_RESULT([ok])
4824            fi
4825         fi
4826      fi
4827   fi
4828else
4829   ENABLE_NSS_MODULE="NO"
4830   AC_MSG_RESULT([no])
4831fi
4832
4833AC_SUBST(ENABLE_NSS_MODULE)
4834AC_SUBST(MOZILLABUILD)
4835AC_SUBST(MOZ_INC)
4836
4837dnl ===================================================================
4838dnl Check for system sane
4839dnl ===================================================================
4840AC_MSG_CHECKING([which sane header to use])
4841if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
4842    test "$with_system_sane_header" != "no"; then
4843   AC_MSG_RESULT([external])
4844   SYSTEM_SANE_HEADER=YES
4845   AC_CHECK_HEADER(sane/sane.h, [],
4846      [AC_MSG_ERROR(sane not found. install sane)], [])
4847else
4848   AC_MSG_RESULT([internal])
4849   SYSTEM_SANE_HEADER=NO
4850   BUILD_TYPE="$BUILD_TYPE SANE"
4851fi
4852AC_SUBST(SYSTEM_SANE_HEADER)
4853
4854dnl ===================================================================
4855dnl Check for system icu
4856dnl ===================================================================
4857AC_MSG_CHECKING([which icu to use])
4858if test -n "$with_system_icu" -o -n "$with_system_libs" && \
4859    test "$with_system_icu" != "no"; then
4860   AC_MSG_RESULT([external])
4861   SYSTEM_ICU=YES
4862   AC_LANG_PUSH([C++])
4863   AC_MSG_CHECKING([for unicode/rbbi.h])
4864   AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
4865   AC_LANG_POP([C++])
4866   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
4867   if test -z "$SYSTEM_GENBRK"; then
4868      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
4869   fi
4870   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
4871   if test -z "$SYSTEM_GENCCODE"; then
4872      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
4873   fi
4874   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
4875   if test -z "$SYSTEM_GENCMN"; then
4876      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
4877   fi
4878
4879   AC_PATH_PROG( ICUCONFIG, icu-config)
4880   AC_MSG_CHECKING([ICU version])
4881   if test "$_os" = "OS2"; then
4882      ICU_MAJOR=4
4883   else
4884      ICU_VERSION=`$ICUCONFIG --version`
4885      ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
4886      ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
4887      ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
4888   fi
4889
4890   if test "$ICU_MAJOR" -ge "4"; then
4891      AC_MSG_RESULT([OK])
4892   else
4893      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
4894   fi
4895
4896else
4897    AC_MSG_RESULT([internal])
4898    SYSTEM_ICU=NO
4899    BUILD_TYPE="$BUILD_TYPE ICU"
4900fi
4901AC_SUBST(SYSTEM_ICU)
4902AC_SUBST(SYSTEM_GENBRK)
4903AC_SUBST(SYSTEM_GENCCODE)
4904AC_SUBST(SYSTEM_GENCMN)
4905AC_SUBST(ICU_MAJOR)
4906AC_SUBST(ICU_MINOR)
4907AC_SUBST(ICU_MICRO)
4908
4909dnl ===================================================================
4910dnl Graphite
4911dnl ===================================================================
4912
4913ENABLE_GRAPHITE="FALSE"
4914AC_MSG_CHECKING([whether to enable graphite support])
4915if test "x$enable_graphite" = "xyes" -a \( "$_os" = "WINNT" -o "$_os" = "Linux" -o "$_os" = "FreeBSD" \) ; then
4916    AC_MSG_RESULT([yes])
4917    ENABLE_GRAPHITE="TRUE"
4918    AC_MSG_CHECKING([which graphite to use])
4919    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
4920        test "$with_system_graphite" != "no"; then
4921        AC_MSG_RESULT([external])
4922        SYSTEM_GRAPHITE=YES
4923        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
4924    else
4925        AC_MSG_RESULT([internal])
4926        SYSTEM_GRAPHITE=NO
4927        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
4928    fi
4929else
4930   AC_MSG_RESULT([no])
4931   ENABLE_GRAPHITE="FALSE"
4932fi
4933AC_SUBST(ENABLE_GRAPHITE)
4934AC_SUBST(SYSTEM_GRAPHITE)
4935AC_SUBST(GRAPHITE_LIBS)
4936AC_SUBST(GRAPHITE_CFLAGS)
4937
4938
4939dnl ===================================================================
4940dnl Checks for libraries.
4941dnl ===================================================================
4942dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
4943dnl See if we have the AppKit framework for building with Quartz graphics.
4944
4945if test  "$_os" = "Darwin"; then
4946   if test "x$with_x" = "xyes"; then
4947      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
4948   else
4949      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
4950      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
4951         AC_MSG_RESULT([yes])
4952         x_includes="no_x_includes"
4953         x_libraries="no_x_libraries"
4954         dnl disable some things used on other Unix versions but not on the aqua build
4955         enable_gtk=no
4956         enable_cups=no
4957         ENABLE_CUPS=""
4958         AC_SUBST(ENABLE_CUPS)
4959      else
4960         AC_MSG_ERROR([No AppKit.framewrok found])
4961      fi
4962   fi
4963fi
4964
4965dnl ***************************************
4966dnl testing for X libraries and includes...
4967dnl ***************************************
4968if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
4969   echo "Do Nothing for _os = Darwin"
4970   dnl Mac OS X using Aqua graphics. Don't check for X11.
4971   :
4972elif test "$_os" = "OS2" ; then
4973   echo "Do Nothing for _os = OS2. Don't check for X11."
4974   dnl OS/2 uses native graphics. Don't check for X11.
4975   :
4976elif test "$_os" != "WINNT" ; then
4977   AC_PATH_X
4978   AC_PATH_XTRA
4979   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
4980
4981   if test "x$x_includes" = "x"; then
4982     x_includes="default_x_includes"
4983   fi
4984   if test "x$x_libraries" = "x"; then
4985     x_libraries="default_x_libraries"
4986   fi
4987   dnl The variables $x_libraries and $x_includes are set.
4988   if test -z "$x_libraries"; then
4989      AC_MSG_ERROR([No X libraries found]) # Exit
4990   fi
4991   if test -z "$x_includes"; then
4992      AC_MSG_ERROR([No X includes found]) # Exit
4993   fi
4994   CFLAGS=$X_CFLAGS
4995   LDFLAGS="$X_LDFLAGS $X_LIBS"
4996   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
4997   dnl Check if the XauDisposeAuth symbol is provided by libXau.
4998   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
4999else
5000   x_includes="no_x_includes"
5001   x_libraries="no_x_libraries"
5002fi
5003if test -z "$x_includes"; then
5004   x_includes="no_x_includes"
5005fi
5006if test -z "$x_libraries"; then
5007   x_libraries="no_x_libraries"
5008fi
5009if test "$x_includes" = "default_x_includes"; then
5010   XINC="/usr/include"
5011else
5012   XINC="$x_includes"
5013fi
5014AC_SUBST(XINC)
5015if test "$x_libraries" = "default_x_libraries"; then
5016   XLIB=`$PKG_CONFIG --variable=libdir x11`
5017   if test "x$XLIB" = x; then
5018         XLIB="/usr/lib"
5019   fi
5020else
5021   XLIB="$x_libraries"
5022fi
5023AC_SUBST(XLIB)
5024AC_SUBST(XAU_LIBS)
5025
5026dnl ===================================================================
5027dnl Check if fontconfig/fontconfig.h is available
5028dnl ===================================================================
5029if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
5030    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
5031                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
5032    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
5033    AC_RUN_IFELSE([AC_LANG_SOURCE([[
5034#include <fontconfig/fontconfig.h>
5035
5036int main(int argc, char **argv) {
5037    if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
5038    else return 1;
5039}
5040]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])],[])
5041fi
5042
5043dnl ===================================================================
5044dnl Check for system Xrender
5045dnl ===================================================================
5046AC_MSG_CHECKING([whether to link to Xrender])
5047if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
5048   AC_MSG_RESULT([yes])
5049   XRENDER_LINK=YES
5050   with_system_xrender_headers=yes
5051else
5052   AC_MSG_RESULT([no, dynamically open it])
5053   XRENDER_LINK=NO
5054fi
5055AC_MSG_CHECKING([which Xrender headers to use])
5056if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
5057    test "$with_system_xrender_headers" != "no"; then
5058   AC_MSG_RESULT([external])
5059   SYSTEM_XRENDER_HEADERS=YES
5060   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
5061      [AC_MSG_ERROR(Xrender not found. install X)], [])
5062else
5063   AC_MSG_RESULT([internal])
5064   SYSTEM_XRENDER_HEADERS=NO
5065   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
5066fi
5067if test "$XRENDER_LINK" = "YES"; then
5068   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
5069      [AC_MSG_ERROR(libXrender not found or functional)], [])
5070fi
5071AC_SUBST(SYSTEM_XRENDER_HEADERS)
5072AC_SUBST(XRENDER_LINK)
5073
5074dnl ===================================================================
5075dnl Check for XRandr
5076dnl ===================================================================
5077AC_MSG_CHECKING([whether to enable RandR support])
5078if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5079   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5080      XRANDR_DLOPEN="TRUE"
5081      AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5082   else
5083      XRANDR_DLOPEN="FALSE"
5084      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5085      if test "$ENABLE_RANDR" != "TRUE"; then
5086         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5087                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5088         XRANDR_CFLAGS=" "
5089         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5090              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5091         XRANDR_LIBS="-lXrandr "
5092         ENABLE_RANDR="TRUE"
5093         AC_MSG_RESULT([enabling RandR support])
5094      fi
5095   fi
5096else
5097   ENABLE_RANDR=""
5098   AC_MSG_RESULT([no])
5099fi
5100AC_SUBST(XRANDR_DLOPEN)
5101AC_SUBST(XRANDR_CFLAGS)
5102AC_SUBST(XRANDR_LIBS)
5103AC_SUBST(ENABLE_RANDR)
5104
5105dnl ===================================================================
5106dnl Check for system nss
5107dnl ===================================================================
5108AC_MSG_CHECKING([which libnss to use])
5109if test -n "$with_system_nss" -o -n "$with_system_libs" && test "$with_system_nss" != "no"; then
5110    AC_MSG_RESULT([external])
5111    PKG_CHECK_MODULES( NSS, nss )
5112    SYSTEM_NSS=YES
5113else
5114    AC_MSG_RESULT([internal])
5115    SYSTEM_NSS=NO
5116    BUILD_TYPE="$BUILD_TYPE NSS"
5117fi
5118AC_SUBST(SYSTEM_NSS)
5119AC_SUBST(NSS_CFLAGS)
5120AC_SUBST(NSS_LIBS)
5121
5122dnl ===================================================================
5123dnl Check for system openssl
5124dnl ===================================================================
5125AC_MSG_CHECKING([which libssl to use])
5126if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5127        test "$with_system_openssl" != "no"; then
5128    AC_MSG_RESULT([external])
5129    if test "$_os" = "FreeBSD"; then
5130        OPENSSL_CFLAGS=
5131        OPENSSL_LIBS="-lssl -lcrypto"
5132    else
5133        PKG_CHECK_MODULES( OPENSSL, openssl )
5134    fi
5135    SYSTEM_OPENSSL=YES
5136else
5137    AC_MSG_RESULT([internal])
5138    SYSTEM_OPENSSL=NO
5139    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5140fi
5141AC_SUBST(SYSTEM_OPENSSL)
5142AC_SUBST(OPENSSL_CFLAGS)
5143AC_SUBST(OPENSSL_LIBS)
5144
5145dnl ===================================================================
5146dnl Check for system redland
5147dnl ===================================================================
5148AC_MSG_CHECKING([which redland library to use])
5149if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5150    test "$with_system_redland" != "no"; then
5151    AC_MSG_RESULT([external])
5152    SYSTEM_REDLAND=YES
5153   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5154   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5155else
5156    AC_MSG_RESULT([internal])
5157    BUILD_TYPE="$BUILD_TYPE REDLAND"
5158    SYSTEM_REDLAND=NO
5159fi
5160AC_SUBST(SYSTEM_REDLAND)
5161AC_SUBST(REDLAND_CFLAGS)
5162AC_SUBST(REDLAND_LIBS)
5163
5164dnl ===================================================================
5165dnl Check for hunspell
5166dnl ===================================================================
5167AC_MSG_CHECKING([whether to build the Spell Checking component])
5168ENABLE_HUNSPELL=
5169
5170if test "x$enable_hunspell" != "xno" ; then
5171    AC_MSG_CHECKING([which libhunspell to use])
5172    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5173        test "$with_system_hunspell" != "no"; then
5174        AC_MSG_RESULT([external])
5175        SYSTEM_HUNSPELL=YES
5176        AC_LANG_PUSH([C++])
5177        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5178        if test "$HUNSPELL_PC" != "TRUE"; then
5179            AC_CHECK_HEADER(hunspell.hxx, [],
5180            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5181                [AC_MSG_ERROR(hunspell headers not found.)], [])
5182             ], [])
5183            AC_CHECK_LIB(hunspell, main, [],
5184            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5185            HUNSPELL_LIBS=-lhunspell
5186        fi
5187        AC_LANG_POP([C++])
5188    else
5189        AC_MSG_RESULT([internal])
5190        SYSTEM_HUNSPELL=NO
5191        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5192    fi
5193    ENABLE_HUNSPELL=YES
5194    AC_SUBST(SYSTEM_HUNSPELL)
5195    AC_SUBST(HUNSPELL_CFLAGS)
5196    AC_SUBST(HUNSPELL_LIBS)
5197else
5198    AC_MSG_RESULT([no])
5199fi
5200AC_SUBST(ENABLE_HUNSPELL)
5201
5202dnl ===================================================================
5203dnl Checking for libhyphen
5204dnl ===================================================================
5205AC_MSG_CHECKING([whether to build the Hyphenator component])
5206ENABLE_HYPHEN=
5207
5208if test "x$enable_hyphen" != "xno" ; then
5209    AC_MSG_CHECKING([which libhyphen to use])
5210    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5211        test "$with_system_hyphen" != "no"; then
5212        AC_MSG_RESULT([external])
5213        SYSTEM_HYPH=YES
5214        AC_CHECK_HEADER(hyphen.h, [],
5215        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5216        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5217        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5218        [#include <hyphen.h>])
5219        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5220            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5221        if test -z "$HYPHEN_LIB"; then
5222        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5223            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5224        fi
5225        if test -z "$HYPHEN_LIB"; then
5226        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5227            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5228        fi
5229    else
5230        AC_MSG_RESULT([internal])
5231        SYSTEM_HYPH=NO
5232        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5233    fi
5234    ENABLE_HYPHEN=YES
5235    AC_SUBST(SYSTEM_HYPH)
5236    AC_SUBST(HYPHEN_LIB)
5237else
5238    AC_MSG_RESULT([no])
5239fi
5240AC_SUBST(ENABLE_HYPHEN)
5241
5242
5243#dnl ===================================================================
5244#dnl Check whether we are allowed to bundle dictionaries and whether
5245#dnl hunspell is available.
5246#dnl ===================================================================
5247ENABLE_BUNDLED_DICTIONARIES=
5248if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5249   ENABLE_BUNDLED_DICTIONARIES=YES
5250fi
5251AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5252
5253
5254
5255dnl ===================================================================
5256dnl Checking for mythes
5257dnl ===================================================================
5258AC_MSG_CHECKING([which mythes to use])
5259if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5260   test "$with_system_mythes" != "no"; then
5261    AC_MSG_RESULT([external])
5262    SYSTEM_MYTHES=YES
5263    AC_LANG_PUSH([C++])
5264    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5265    if test "$MYTHES_PKGCONFIG" = "no"; then
5266        AC_CHECK_HEADER(mythes.hxx, [],
5267            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5268        AC_CHECK_LIB(mythes-1.2, main, [],
5269            [ MYTHES_FOUND=no], [])
5270    if test "$MYTHES_FOUND" = "no"; then
5271            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5272                [ MYTHES_FOUND=no], [])
5273    fi
5274    if test "$MYTHES_FOUND" = "no"; then
5275        AC_MSG_ERROR([mythes library not found!.])
5276    fi
5277    fi
5278    AC_LANG_POP([C++])
5279else
5280    AC_MSG_RESULT([internal])
5281    SYSTEM_MYTHES=NO
5282    BUILD_TYPE="$BUILD_TYPE MYTHES"
5283fi
5284AC_SUBST(SYSTEM_MYTHES)
5285AC_SUBST(MYTHES_CFLAGS)
5286AC_SUBST(MYTHES_LIBS)
5287
5288
5289dnl ===================================================================
5290dnl Checking for libtextcat
5291dnl ===================================================================
5292AC_MSG_CHECKING([which libtextcat to use])
5293if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5294    AC_MSG_RESULT([external])
5295    SYSTEM_LIBTEXTCAT=YES
5296    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5297       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5298    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5299        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5300else
5301    AC_MSG_RESULT([internal])
5302    SYSTEM_LIBTEXTCAT=NO
5303    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5304fi
5305AC_SUBST(SYSTEM_LIBTEXTCAT)
5306
5307AC_MSG_CHECKING([which libtextcat data directory to use])
5308if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5309    if test "$with_system_libtextcat_data" = "yes"; then
5310        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5311    else
5312        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5313    fi
5314    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5315else
5316    AC_MSG_RESULT([internal])
5317    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5318fi
5319AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5320
5321dnl ***************************************
5322dnl testing libc version for Linux...
5323dnl ***************************************
5324if test "$_os" = "Linux"; then
5325   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5326   exec 6>/dev/null # no output
5327   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5328   exec 6>&1 # output on again
5329   if test "$HAVE_LIBC"; then
5330      AC_MSG_RESULT([yes])
5331   else
5332      AC_MSG_ERROR([no, upgrade libc])
5333   fi
5334fi
5335
5336if test "$_os" != "WNT"; then
5337  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5338  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5339  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5340    SYSTEM_LIBC=YES
5341  fi
5342else
5343  HAVE_GETOPT=NO
5344  HAVE_READDIR_R=NO
5345  SYSTEM_LIBC=YES
5346fi
5347AC_SUBST(HAVE_GETOPT)
5348AC_SUBST(HAVE_READDIR_R)
5349AC_SUBST(SYSTEM_LIBC)
5350
5351dnl =========================================
5352dnl Check for the Microsoft Platform SDK.
5353dnl =========================================
5354dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5355dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5356if test \( "$_os" = "WINNT" \) ; then
5357    AC_MSG_CHECKING([for PSDK files])
5358    if test -z "$with_psdk_home"; then
5359        # This first line will detect a February 2003 Microsoft Platform SDK
5360        PSDK_HOME=`$OOWINTOOL --psdk-home`
5361        # But there might be also an April 2005 PSDK, unfortunately MS changed
5362        # the registry entry. (we prefer the old version!?)
5363        if test -z "$PSDK_HOME"; then
5364          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5365        fi
5366            # normalize if found
5367            if test -n "$PSDK_HOME"; then
5368              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5369              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5370           fi
5371    else
5372           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5373    fi
5374        # Remove a possible trailing backslash
5375        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5376    # Problem with current PSDK (iz 49865)
5377    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5378        AC_MSG_ERROR([
5379
5380Some modules do not build correctly with MS Platform SDK - April 2005
5381Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5382Remove/rename/backup that file and restart configure. Details about this
5383problem can be found in issue 49856.])
5384    fi
5385# Windows SDK has different headers
5386    if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5387         -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5388         -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5389        HAVE_PSDK_H="yes"
5390    else
5391        HAVE_PSDK_H="no"
5392    fi
5393    if test -f "$PSDK_HOME/lib/unicows.lib"; then
5394        HAVE_PSDK_LIB="yes"
5395    else
5396        HAVE_PSDK_LIB="no"
5397    fi
5398    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5399        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5400are installed or use --with-psdk-home .])
5401    fi
5402    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5403         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5404         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5405         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5406        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5407    fi
5408    AC_MSG_RESULT([SDK files found ...)])
5409dnl Check if this is the right SDK.
5410    if echo $PSDK_HOME | $GREP "v6.1" >/dev/null 2>/dev/null; then
5411        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5412        WINDOWS_VISTA_PSDK=TRUE
5413    elif echo $PSDK_HOME | $GREP "v6.0" >/dev/null 2>/dev/null; then
5414        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5415        WINDOWS_VISTA_PSDK=TRUE
5416    elif echo $PSDK_HOME | $GREP "v7.0" >/dev/null 2>/dev/null; then
5417        AC_MSG_RESULT([Found Windows SDK 7.0 ($PSDK_HOME)])
5418        WINDOWS_VISTA_PSDK=TRUE
5419    else
5420        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5421    fi
5422fi
5423AC_SUBST(PSDK_HOME)
5424AC_SUBST(WINDOWS_VISTA_PSDK)
5425
5426dnl =========================================
5427dnl Check for the Microsoft DirectX SDK.
5428dnl =========================================
5429if test \( "$_os" = "WINNT" \) ; then
5430    AC_MSG_CHECKING([for DirectX SDK files])
5431    if test -z "$with_directx_home"; then
5432        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5433        if test -n "$DXSDK_DIR"; then
5434            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5435            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5436        fi
5437        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5438        # the "DirectX SDK files not found" error later
5439    else
5440    DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5441    fi
5442    # Remove a possible trailing backslash
5443    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5444
5445    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5446        HAVE_DIRECTDRAW_H="yes"
5447    else
5448        HAVE_DIRECTDRAW_H="no"
5449    fi
5450    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5451        HAVE_DIRECTXSDK_H="yes"
5452    else
5453        HAVE_DIRECTXSDK_H="no"
5454    fi
5455
5456    # MS changed the location of the libraries with dec 2004 directx sdk
5457    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5458        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5459    else
5460        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5461    fi
5462    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5463        HAVE_DIRECTDRAW_LIB="yes"
5464    else
5465        HAVE_DIRECTDRAW_LIB="no"
5466    fi
5467    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5468        HAVE_DIRECTXSDK_LIB="yes"
5469    else
5470        HAVE_DIRECTXSDK_LIB="no"
5471    fi
5472
5473    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5474       ENABLE_DIRECT_DRAW="TRUE"
5475    fi
5476    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5477       HAVE_DIRECTXSDK="yes"
5478    else
5479       HAVE_DIRECTXSDK="no"
5480    fi
5481
5482    if test -n "$ENABLE_DIRECTX"; then
5483        if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5484            AC_MSG_RESULT([found])
5485        else
5486            AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5487        fi
5488    else
5489        DIRECTXSDK_HOME=""
5490        AC_MSG_RESULT([disabled])
5491    fi
5492fi
5493AC_SUBST(ENABLE_DIRECT_DRAW)
5494AC_SUBST(DIRECTXSDK_HOME)
5495AC_SUBST(DIRECTXSDK_LIB)
5496
5497
5498dnl ============================================
5499dnl Check for ATL and MFC
5500dnl ============================================
5501if test \( "$_os" = "WINNT" \) ; then
5502    AC_MSG_CHECKING([for ATL and MFC])
5503    if test "$DISABLE_ATL" = "TRUE"; then
5504        AC_MSG_RESULT([ATL is disabled, nothing to check])
5505    else
5506        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
5507        if test -z "$with_atl_include_dir"; then
5508            ATL_INCLUDE=$COMPATH/atlmfc/include
5509        else
5510            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
5511        fi
5512        if test -z "$with_atl_lib_dir"; then
5513            ATL_LIB=$COMPATH/atlmfc/lib
5514        ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
5515        else
5516            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
5517            ATL_LIB_X64=$ATL_LIB/../amd64
5518        fi
5519        if test -z "$with_mfc_include_dir"; then
5520            MFC_INCLUDE=$COMPATH/atlmfc/include
5521        else
5522            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
5523        fi
5524        if test -z "$with_mfc_lib_dir"; then
5525            MFC_LIB=$COMPATH/atlmfc/lib
5526        else
5527            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
5528        fi
5529
5530        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
5531        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
5532        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
5533        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
5534        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
5535
5536        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
5537        if test -f "$ATL_INCLUDE/atlbase.h"; then
5538            HAVE_ATL_H="yes"
5539        else
5540            HAVE_ATL_H="no"
5541        fi
5542        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
5543
5544        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
5545        if test -f "$MFC_INCLUDE/afx.h"; then
5546            HAVE_MFC_H="yes"
5547        else
5548            HAVE_MFC_H="no"
5549        fi
5550        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
5551
5552        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
5553        if test -f "$ATL_LIB/atls.lib"; then
5554            HAVE_ATL_LIB="yes"
5555            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
5556            if test -f "$ATL_LIB/atlthunk.lib"; then
5557                HAVE_ATLTHUNK="YES"
5558            else
5559                HAVE_ATLTHUNK="NO"
5560            fi
5561            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
5562        else
5563            HAVE_ATL_LIB="no"
5564        fi
5565        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
5566
5567        dnl TODO check also MFC libraries, they seem to have different names
5568        dnl mfc42.lib mfc90.lib
5569        if test -d "$MFC_LIB"; then
5570            HAVE_MFC_LIB="yes"
5571        else
5572            HAVE_MFC_LIB="no"
5573        fi
5574
5575        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
5576            ATL_INCLUDE=
5577            ATL_LIB=
5578            ATL_LIB_X64=
5579            MFC_INCLUDE=
5580            MFC_LIB=
5581            HAVE_ATL_LIB=
5582            dnl TODO shouldn't this be an error?
5583            DISABLE_ACTIVEX="TRUE"
5584            DISABLE_ATL="TRUE"
5585            AC_MSG_RESULT([ATL/MFC disabled])
5586        else
5587            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
5588            ATL_LIB=`cygpath -dm "$ATL_LIB"`
5589            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
5590            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
5591            MFC_LIB=`cygpath -dm "$MFC_LIB"`
5592            AC_MSG_RESULT([ATL/MFC enabled])
5593        fi
5594    fi
5595fi
5596AC_SUBST(ATL_INCLUDE)
5597AC_SUBST(ATL_LIB)
5598AC_SUBST(ATL_LIB_X64)
5599AC_SUBST(HAVE_ATLTHUNK)
5600AC_SUBST(MFC_INCLUDE)
5601AC_SUBST(MFC_LIB)
5602
5603
5604dnl ============================================
5605dnl Check for Nullsoft Scriptable Install System
5606dnl ============================================
5607NSIS_PATH=""
5608if test "$_os" = "WINNT" ; then
5609    AC_MSG_CHECKING([for NSIS])
5610    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5611    if test -n "$NSIS_PATH"; then
5612        NSIS_PATH=`dirname "$NSIS_PATH"`
5613    fi
5614    if test -n "$with_nsis_path"; then
5615        with_nsis_path=`cygpath -u "$with_nsis_path"`
5616    fi
5617    if test -e "$with_nsis_path/nsis.exe"; then
5618        NSIS_PATH="$with_nsis_path"
5619    fi
5620    nsistest=`$OOWINTOOL --nsis-dir`;
5621    if test -x "$nsistest/nsis.exe"; then
5622        NSIS_PATH="$nsistest"
5623    fi
5624    if test -z "$NSIS_PATH"; then
5625        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5626        echo "NSIS not found, no self contained installer will be build." >> warn
5627    else
5628        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5629        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5630        AC_MSG_RESULT([found ($NSIS_PATH)])
5631        AC_MSG_CHECKING([whether NSIS version is >= 3.*])
5632        nsis_version_string=`"$NSIS_PATH/makensis.exe" /VERSION | $SED -e s/^v//i`
5633        nsis_version_major=`echo $nsis_version_string | cut -d. -f1`
5634        nsis_version_minor=`echo $nsis_version_string | cut -d. -f2`
5635        if test "$nsis_version_major" -ge "3"; then
5636            AC_MSG_RESULT([found NSIS $nsis_version_major.$nsis_version_minor >= 3.*])
5637            AC_MSG_CHECKING([whether NSIS was compiled with Unicode support])
5638            if echo `"$NSIS_PATH/makensis.exe" /HDRINFO` | $EGREP  "\bNSIS_UNICODE_MAKENSIS\b" 2>&1 >/dev/null; then
5639                AC_MSG_RESULT([NSIS version compiled with Unicode support.])
5640            else
5641                NSIS_PATH=""
5642                AC_MSG_WARN([NSIS version compiled without Unicode support, no self contained installer will be build.])
5643            fi
5644        else
5645            NSIS_PATH=""
5646            AC_MSG_WARN([NSIS version found is < 3.*, no self contained installer will be build.])
5647        fi
5648    fi
5649fi
5650AC_SUBST(NSIS_PATH)
5651
5652dnl ***************************************
5653dnl testing bison and flex exist
5654dnl ***************************************
5655AC_PATH_PROG(BISON, bison)
5656if test -z "$BISON"; then
5657   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5658else
5659   AC_MSG_CHECKING([the bison version])
5660   _bison_version=`$BISON --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5661    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5662    # Accept newer than 1.875 or older(equal) than 1.75
5663    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5664       if test "$_bison_version" = "1.875" ; then
5665          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5666          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5667       else
5668          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5669       fi
5670    else
5671       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5672    fi
5673fi
5674AC_PATH_PROG(FLEX, flex)
5675if test -z "$FLEX"; then
5676   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5677fi
5678dnl ***************************************
5679dnl testing that patch exists
5680dnl ***************************************
5681AC_PATH_PROG(PATCH, patch)
5682if test -z "$PATCH"; then
5683   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5684fi
5685
5686dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5687if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5688   if test -z "$with_gnu_patch"; then
5689      GNUPATCH=$PATCH
5690   else
5691      if test -x "$with_gnu_patch"; then
5692          GNUPATCH=$with_gnu_patch
5693      else
5694         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5695      fi
5696   fi
5697
5698   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5699   if $GNUPATCH --version | $GREP "Free Software Foundation" >/dev/null 2>/dev/null; then
5700       AC_MSG_RESULT([yes])
5701   else
5702      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5703   fi
5704fi
5705
5706dnl We also need to check for --with-gnu-cp
5707
5708if test -z "$with_gnu_cp"; then
5709   # check the place where the GNU stuff is hidden on Solaris...
5710   if test -x /usr/gnu/bin/cp; then
5711      GNUCP=/usr/gnu/bin/cp
5712   else
5713      AC_PATH_PROGS(GNUCP, gnucp cp)
5714   fi
5715   if test -z $GNUCP; then
5716      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5717   fi
5718else
5719   if test -x "$with_gnu_cp"; then
5720      GNUCP=$with_gnu_cp
5721   else
5722      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5723   fi
5724fi
5725
5726AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5727if $GNUCP --version 2>/dev/null | $GREP "coreutils" >/dev/null 2>/dev/null; then
5728   AC_MSG_RESULT([yes])
5729else
5730   AC_MSG_RESULT([no])
5731   GNUCP=''
5732fi
5733
5734if test -z "$GNUCP"; then
5735   if test "$_os" = "SunOS"; then
5736      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5737   else
5738      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5739   fi
5740fi
5741
5742AC_SUBST(GNUPATCH)
5743AC_SUBST(GNUCP)
5744
5745dnl ***************************************
5746dnl testing bash tools path on Windows
5747dnl ***************************************
5748if test "$_os" = "WINNT"; then
5749    CYGWIN_PATH=""
5750    AC_PATH_PROG(CYGWIN_PATH, bash)
5751    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5752fi
5753if test -z "$CYGWIN_PATH"; then
5754   CYGWIN_PATH="NO_CYGWIN"
5755fi
5756AC_SUBST(CYGWIN_PATH)
5757
5758dnl ***************************************
5759dnl testing ml.exe assembler path
5760dnl ***************************************
5761if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5762  AC_MSG_CHECKING([ml.exe assembler path])
5763  if test -n "$with_asm_home"; then
5764    with_asm_home=`cygpath -u "$with_asm_home"`
5765  fi
5766  if test ! -x "$with_asm_home/ml.exe"; then
5767    AC_PATH_PROG(ML_EXE, ml.exe)
5768    if test -z "$ML_EXE"; then
5769      if test -x "$with_cl_home/bin/ml.exe"; then
5770        with_asm_home=$with_cl_home/bin
5771        AC_MSG_RESULT([found ($with_asm_home)])
5772      else
5773        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5774      fi
5775    else
5776       with_asm_home="ASM_IN_PATH"
5777    fi
5778  fi
5779  AC_MSG_RESULT([$ASM_HOME])
5780else
5781  with_asm_home="NO_ASM_HOME"
5782fi
5783ASM_HOME="$with_asm_home"
5784AC_SUBST(ASM_HOME)
5785
5786dnl ***************************************
5787dnl testing nasm.exe assembler path
5788dnl ***************************************
5789if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes" -a "$SYSTEM_OPENSSL" = "NO"; then
5790  AC_MSG_CHECKING([nasm.exe assembler path])
5791  if test -n "$with_nasm_home"; then
5792    with_nasm_home=`cygpath -u "$with_nasm_home"`
5793  fi
5794  if test ! -x "$with_nasm_home/nasm.exe"; then
5795    AC_PATH_PROG(NASM_EXE, nasm.exe)
5796    if test -z "$NASM_EXE"; then
5797      with_nasm_home="NO_NASM_HOME"
5798      AC_MSG_ERROR([NASM is required to build on Windows, please install or use --with-nasm-home],,)
5799    else
5800      with_nasm_home="NASM_IN_PATH"
5801    fi
5802  fi
5803  AC_MSG_RESULT([$NASM_HOME])
5804else
5805  with_nasm_home="NO_NASM_HOME"
5806fi
5807NASM_HOME="$with_nasm_home"
5808AC_SUBST(NASM_HOME)
5809
5810dnl ===================================================================
5811dnl testing handle deprecated unzip switch
5812dnl ===================================================================
5813if test -z "$with_zip_home"; then
5814    with_zip_home="$with_unzip_home"
5815fi
5816dnl ===================================================================
5817dnl Zip will be found where you tell me to find it
5818dnl ===================================================================
5819if test -n "$with_zip_home" ; then
5820    if test "$_os" = "WINNT"; then
5821        with_zip_home=`cygpath -u "$with_zip_home"`
5822    fi
5823    ZIP="$with_zip_home/zip"
5824    UNZIP="$with_zip_home/unzip"
5825    ZIP_HOME="$with_zip_home"
5826else
5827    AC_PATH_PROG(ZIP, zip)
5828    AC_PATH_PROG(UNZIP, unzip)
5829    ZIP_HOME=`dirname "$ZIP"`
5830fi
5831dnl ===================================================================
5832dnl Zip must be available or else it is an error, all platforms
5833dnl ===================================================================
5834if test -z "$ZIP" -o -z "$UNZIP"; then
5835    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5836fi
5837if "$ZIP" -FS < /dev/null 2>&1 | $EGREP "no such option: S" > /dev/null; then
5838    AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
5839fi
5840
5841dnl ===================================================================
5842dnl Zip must be a specific type for different build types.
5843dnl ===================================================================
5844if test "$_os" = "WINNT"; then
5845    if test -n "`$ZIP -h | $GREP -i WinNT`" ; then
5846AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5847    fi
5848fi
5849AC_SUBST(ZIP_HOME)
5850
5851dnl ===================================================================
5852dnl Windows builds need dbghelp.dll in external/dbghelp/
5853dnl ===================================================================
5854if test "$_os" = "WINNT"; then
5855   AC_MSG_CHECKING([for dbghelp.dll])
5856   if test -x ./external/dbghelp/dbghelp.dll; then
5857      AC_MSG_RESULT([found and executable])
5858   else
5859      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5860Get it from the Microsoft site and put it into external/dbghelp.
5861(Note: Microsoft seems to enjoy changing the exact location of this file. You
5862may have to search Microsoft's website.) Last time it was seen at:
5863<https://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5864   fi
5865fi
5866
5867dnl ===================================================================
5868dnl Windows builds need vcredist_x*.exe in external/vcredist/
5869dnl ===================================================================
5870WITH_VC_REDIST=""
5871
5872if test "$_os" = "WINNT"; then
5873   AC_MSG_CHECKING([for vcredist_x86.exe])
5874   if test -x ./external/vcredist/vcredist_x86.exe; then
5875      AC_MSG_RESULT([found and executable])
5876   else
5877      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
5878Get it from the Microsoft site and put it into external/vcredist. You can try
5879to download it from https://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5880   fi
5881   AC_MSG_CHECKING([for vcredist_x64.exe])
5882   if test -x ./external/vcredist/vcredist_x64.exe; then
5883      AC_MSG_RESULT([found and executable])
5884   else
5885      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
5886Get it from the Microsoft site and put it into external/vcredist. You can try
5887to download it from https://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5888   fi
5889   WITH_VC_REDIST=YES
5890   AC_SUBST(WITH_VC_REDIST)
5891fi
5892
5893dnl ===================================================================
5894dnl Windows builds - use oowintool to copy CRT dlls and manifest
5895dnl ===================================================================
5896if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5897       if $OOWINTOOL --msvc-copy-dlls ./external/msvcp ; then
5898          :
5899       else
5900          AC_MSG_ERROR([oowintool failed to copy CRT])
5901       fi
5902fi
5903
5904dnl ===================================================================
5905dnl Windows builds need gdiplus.dll in external/gdiplus/
5906dnl ===================================================================
5907if test "$_os" = "WINNT"; then
5908   AC_MSG_CHECKING([for gdiplus.dll])
5909   if test -x ./external/gdiplus/gdiplus.dll; then
5910      AC_MSG_RESULT([found and executable])
5911   else
5912      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5913Get it from the Microsoft site and put it into external/gdiplus.
5914You may have to search Microsoft's website. Last time it was seen at:
5915<https://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5916   fi
5917fi
5918
5919dnl ===================================================================
5920dnl Windows builds need msvcr100.dll in external/msvcp100/
5921dnl ===================================================================
5922if test "$_os" = "WINNT"; then
5923   AC_MSG_CHECKING([for msvcr100.dll])
5924   if test -x ./external/msvcp100/msvcr100.dll; then
5925      AC_MSG_RESULT([found and executable])
5926   else
5927      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
5928Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
5929from the Microsoft site and put it into external/msvcp100.
5930You may have to search Microsoft's website. Last time it was seen at:
5931<https://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
5932   fi
5933fi
5934
5935dnl ===================================================================
5936dnl Test which vclplugs have to be built.
5937dnl ===================================================================
5938AC_MSG_CHECKING([which VCLplugs shall be built])
5939ENABLE_GTK=""
5940if test "x$enable_gtk" = "xyes"; then
5941    ENABLE_GTK="TRUE"
5942    R="gtk"
5943fi
5944AC_SUBST(ENABLE_GTK)
5945
5946ENABLE_KDE=""
5947if test "x$enable_kde" = "xyes"; then
5948    ENABLE_KDE="TRUE"
5949    R="$R kde"
5950fi
5951AC_SUBST(ENABLE_KDE)
5952
5953ENABLE_KDE4=""
5954if test "x$enable_kde4" = "xyes"; then
5955    ENABLE_KDE4="TRUE"
5956    R="$R kde4"
5957fi
5958AC_SUBST(ENABLE_KDE4)
5959
5960if test -z "$R"; then
5961    AC_MSG_RESULT([none])
5962else
5963    AC_MSG_RESULT([$R])
5964fi
5965
5966dnl ===================================================================
5967dnl GCONF check
5968dnl ===================================================================
5969
5970ENABLE_GCONF=""
5971AC_MSG_CHECKING([whether to enable GConf support])
5972if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5973    ENABLE_GCONF="TRUE"
5974    AC_MSG_RESULT([yes])
5975    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5976else
5977    AC_MSG_RESULT([no])
5978fi
5979AC_SUBST(ENABLE_GCONF)
5980
5981dnl ===================================================================
5982dnl Gnome VFS check
5983dnl ===================================================================
5984
5985ENABLE_GNOMEVFS=""
5986AC_MSG_CHECKING([whether to enable GNOME VFS support])
5987if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5988    ENABLE_GNOMEVFS="TRUE"
5989    AC_MSG_RESULT([yes])
5990    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5991    if test "$ENABLE_GCONF" != "TRUE"; then
5992        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5993    fi
5994else
5995    AC_MSG_RESULT([no])
5996fi
5997AC_SUBST(ENABLE_GNOMEVFS)
5998
5999dnl ===================================================================
6000dnl Check whether the gtk 2.0 libraries are available.
6001dnl ===================================================================
6002
6003GTK_CFLAGS=""
6004GTK_LIBS=""
6005ENABLE_SYSTRAY_GTK=""
6006ENABLE_DBUS=""
6007if test  "$test_gtk" = "yes"; then
6008
6009   if test "$ENABLE_GTK" = "TRUE" ; then
6010      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]))
6011      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]))
6012      BUILD_TYPE="$BUILD_TYPE GTK"
6013
6014      if test "x$enable_systray" = "xyes"; then
6015         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
6016                           [ENABLE_SYSTRAY_GTK="TRUE"
6017                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
6018                           [ENABLE_SYSTRAY_GTK=""])
6019      fi
6020
6021      AC_MSG_CHECKING([whether to enable DBUS support])
6022      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
6023          ENABLE_DBUS="TRUE"
6024          AC_MSG_RESULT([yes])
6025          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
6026      else
6027          AC_MSG_RESULT([no])
6028      fi
6029
6030      AC_MSG_CHECKING([whether to enable GIO support])
6031      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
6032          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
6033             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
6034          fi
6035          ENABLE_GIO="TRUE"
6036          AC_MSG_RESULT([yes])
6037          PKG_CHECK_MODULES( GIO, gio-2.0 )
6038      else
6039          AC_MSG_RESULT([no])
6040      fi
6041
6042   fi
6043
6044fi
6045AC_SUBST(ENABLE_GIO)
6046AC_SUBST(ENABLE_DBUS)
6047AC_SUBST(ENABLE_SYSTRAY_GTK)
6048AC_SUBST(GTK_CFLAGS)
6049AC_SUBST(GTK_LIBS)
6050AC_SUBST(GTHREAD_CFLAGS)
6051AC_SUBST(GTHREAD_LIBS)
6052
6053dnl ===================================================================
6054dnl Check whether the GStreamer libraries are available.
6055dnl ===================================================================
6056
6057GSTREAMER_CFLAGS=""
6058GSTREAMER_LIBS=""
6059ENABLE_GSTREAMER=""
6060
6061if test "$test_gstreamer" = "yes"; then
6062    AC_MSG_CHECKING([whether to build the GStreamer media backend])
6063    if test "x$enable_gstreamer" != "xno" ; then
6064        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]))
6065        ENABLE_GSTREAMER="TRUE"
6066        AC_MSG_RESULT([yes])
6067    else
6068        AC_MSG_RESULT([no])
6069    fi
6070fi
6071AC_SUBST(ENABLE_GSTREAMER)
6072AC_SUBST(GSTREAMER_CFLAGS)
6073AC_SUBST(GSTREAMER_LIBS)
6074
6075dnl ===================================================================
6076dnl Check the ARM target
6077dnl ===================================================================
6078
6079if echo "$build_cpu" | $GREP -q arm; then
6080    # default value
6081    ARM_TARGET=ARMV4T
6082    AC_MSG_CHECKING([which ARM processor optimization to use])
6083    if test "$with_arm_target" -lt "6"; then
6084    ARM_TARGET=ARMV4T
6085    elif test "$with_arm_target" = "6"; then
6086    ARM_TARGET=ARMV6
6087    elif test "$with_arm_target" -gt "6"; then
6088    ARM_TARGET=ARMV7
6089    fi
6090    AC_MSG_RESULT([$ARM_TARGET])
6091    AC_SUBST(ARM_TARGET)
6092fi
6093
6094dnl ===================================================================
6095dnl Check whether the Cairo libraries are available.
6096dnl ===================================================================
6097
6098ENABLE_CAIRO=""
6099BUILD_PIXMAN=""
6100SYSTEM_CAIRO=""
6101
6102if test  "$test_cairo" = "yes"; then
6103
6104    AC_MSG_CHECKING([whether to use cairo])
6105    if test "x$enable_cairo" != "xno" ; then
6106        ENABLE_CAIRO="TRUE"
6107    AC_MSG_RESULT([yes])
6108        AC_MSG_CHECKING([which cairo to use])
6109        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6110           test "$with_system_cairo" != "no"; then
6111           AC_MSG_RESULT([external])
6112           SYSTEM_CAIRO=YES
6113
6114           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6115       if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6116          AC_MSG_ERROR([Cairo library requires fontconfig.])
6117       fi
6118           if test "$with_system_xrender_headers" = "yes"; then
6119              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6120              AC_RUN_IFELSE([AC_LANG_SOURCE([[
6121#include <X11/extensions/Xrender.h>
6122
6123int main(int argc, char **argv) {
6124#ifdef PictStandardA8
6125      return 0;
6126#else
6127      return 1;
6128#endif
6129}
6130               ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])],[])
6131           fi
6132        else
6133           BUILD_TYPE="$BUILD_TYPE CAIRO"
6134       dnl === compiler fails on pixman with 64bit architectures...===
6135       if test "$build_cpu" != "x86_64"; then
6136          BUILD_PIXMAN=YES
6137       fi
6138           AC_MSG_RESULT([internal])
6139        fi
6140    else
6141       AC_MSG_RESULT([no])
6142    fi
6143fi
6144
6145AC_SUBST(ENABLE_CAIRO)
6146AC_SUBST(BUILD_PIXMAN)
6147AC_SUBST(SYSTEM_CAIRO)
6148AC_SUBST(CAIRO_CFLAGS)
6149AC_SUBST(CAIRO_LIBS)
6150
6151ENABLE_CAIRO_CANVAS="FALSE"
6152if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6153   ENABLE_CAIRO_CANVAS="TRUE"
6154fi
6155AC_SUBST(ENABLE_CAIRO_CANVAS)
6156
6157dnl ===================================================================
6158dnl Check whether the OpenGL libraries are available
6159dnl ===================================================================
6160
6161AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6162ENABLE_OPENGL=
6163
6164if test "x$enable_opengl" != "xno" ; then
6165   AC_MSG_RESULT([yes])
6166   AC_CHECK_HEADER(GL/gl.h, [],
6167                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6168   AC_CHECK_LIB(GL, main, [],
6169     [AC_MSG_ERROR(libGL not installed or functional)], [])
6170   AC_CHECK_LIB(GLU, main, [],
6171     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6172   ENABLE_OPENGL=TRUE
6173else
6174   AC_MSG_RESULT([no])
6175fi
6176
6177AC_SUBST(ENABLE_OPENGL)
6178
6179
6180AC_MSG_CHECKING([whether to build the PDF Import extension])
6181if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6182  AC_MSG_RESULT([yes])
6183  ENABLE_PDFIMPORT=YES
6184
6185  dnl ===================================================================
6186  dnl Check for system poppler
6187  dnl ===================================================================
6188  AC_MSG_CHECKING([whether to use system pdf backend])
6189  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6190       test "$with_system_poppler" != "no"; then
6191      AC_MSG_RESULT([external])
6192      SYSTEM_POPPLER=YES
6193      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6194  else
6195      AC_MSG_RESULT([no])
6196      SYSTEM_POPPLER=NO
6197      ENABLE_PDFIMPORT=NO
6198  fi
6199else
6200   AC_MSG_RESULT([no])
6201   ENABLE_PDFIMPORT=NO
6202fi
6203AC_SUBST(ENABLE_PDFIMPORT)
6204AC_SUBST(SYSTEM_POPPLER)
6205AC_SUBST(POPPLER_CFLAGS)
6206AC_SUBST(POPPLER_LIBS)
6207
6208AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6209if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test "$WITH_JAVA" != "no"; then
6210  AC_MSG_RESULT([yes])
6211  AC_MSG_CHECKING([for swext module])
6212  if test -d ./swext; then
6213   AC_MSG_RESULT([OK])
6214  else
6215   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6216  fi
6217  ENABLE_MEDIAWIKI=YES
6218  BUILD_TYPE="$BUILD_TYPE SWEXT"
6219else
6220  AC_MSG_RESULT([no])
6221  ENABLE_MEDIAWIKI=NO
6222fi
6223AC_SUBST(ENABLE_MEDIAWIKI)
6224
6225if test "$ENABLE_MEDIAWIKI" = "YES"; then
6226  AC_MSG_CHECKING([which Servlet API Jar to use])
6227  if test -n "$with_system_servlet_api"; then
6228    AC_MSG_RESULT([external])
6229    SYSTEM_SERVLETAPI=YES
6230      if test -z "$SERVLETAPI_JAR"; then
6231    SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6232      fi
6233      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6234             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6235  else
6236    AC_MSG_RESULT([internal])
6237    SYSTEM_SERVLETAPI=NO
6238    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6239  fi
6240fi
6241AC_SUBST(SYSTEM_SERVLETAPI)
6242AC_SUBST(SERVLETAPI_JAR)
6243
6244AC_MSG_CHECKING([whether to build the Report Builder extension])
6245if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6246  AC_MSG_RESULT([yes])
6247  ENABLE_REPORTBUILDER=YES
6248  SYSTEM_JFREEREPORT=YES
6249  AC_MSG_CHECKING([for reportbuilder module])
6250  if test -d ./reportbuilder; then
6251    AC_MSG_RESULT([OK])
6252  else
6253    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6254  fi
6255  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6256  AC_MSG_RESULT([external])
6257  if test -z $SAC_JAR; then
6258         SAC_JAR=/usr/share/java/sac.jar
6259  fi
6260  AC_CHECK_FILE($SAC_JAR, [],
6261         [AC_MSG_ERROR(sac.jar not found.)], [])
6262
6263  if test -z $LIBXML_JAR; then
6264    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6265      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6266      [
6267        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6268          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6269          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6270        )
6271      ]
6272    )
6273  else
6274    AC_CHECK_FILE($LIBXML_JAR, [],
6275         [AC_MSG_ERROR(libxml.jar not found.)], [])
6276  fi
6277
6278  if test -z $FLUTE_JAR; then
6279    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6280      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6281      [
6282        AC_CHECK_FILE(/usr/share/java/flute.jar,
6283          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6284          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6285        )
6286      ]
6287    )
6288  else
6289    AC_CHECK_FILE($FLUTE_JAR, [],
6290         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6291  fi
6292
6293  if test -z $JFREEREPORT_JAR; then
6294    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6295      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6296      [
6297        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6298          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6299          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6300        )
6301      ]
6302    )
6303  else
6304    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6305         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6306  fi
6307
6308  if test -z $LIBLAYOUT_JAR; then
6309    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6310      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6311      [
6312        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6313          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6314          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6315        )
6316      ]
6317    )
6318  else
6319    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6320         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6321  fi
6322
6323  if test -z $LIBLOADER_JAR; then
6324    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6325      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6326      [
6327        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6328          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6329          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6330        )
6331      ]
6332    )
6333  else
6334    AC_CHECK_FILE($LIBLOADER_JAR, [],
6335         [AC_MSG_ERROR(libloader.jar not found.)], [])
6336  fi
6337
6338  if test -z $LIBFORMULA_JAR; then
6339    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6340      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6341      [
6342        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6343          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6344          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6345        )
6346      ]
6347    )
6348  else
6349    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6350         [AC_MSG_ERROR(libformula.jar not found.)], [])
6351  fi
6352
6353  if test -z $LIBREPOSITORY_JAR; then
6354    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6355      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6356      [
6357        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6358          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6359          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6360        )
6361      ]
6362    )
6363  else
6364    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6365         [AC_MSG_ERROR(librepository.jar not found.)], [])
6366  fi
6367
6368  if test -z $LIBFONTS_JAR; then
6369    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6370      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6371      [
6372        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6373          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6374          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6375        )
6376      ]
6377    )
6378  else
6379    AC_CHECK_FILE($LIBFONTS_JAR, [],
6380         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6381  fi
6382
6383  if test -z $LIBSERIALIZER_JAR; then
6384    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6385      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6386      [
6387        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6388          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6389          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6390        )
6391      ]
6392    )
6393  else
6394    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6395         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6396  fi
6397
6398
6399  if test -z $LIBBASE_JAR; then
6400    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6401      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6402      [
6403        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6404          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6405          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6406        )
6407      ]
6408    )
6409  else
6410    AC_CHECK_FILE($LIBBASE_JAR, [],
6411         [AC_MSG_ERROR(libbase.jar not found.)], [])
6412  fi
6413  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6414else
6415  AC_MSG_RESULT([no])
6416  ENABLE_REPORTBUILDER=NO
6417fi
6418AC_SUBST(ENABLE_REPORTBUILDER)
6419AC_SUBST(SYSTEM_JFREEREPORT)
6420AC_SUBST(SAC_JAR)
6421AC_SUBST(LIBXML_JAR)
6422AC_SUBST(FLUTE_JAR)
6423AC_SUBST(JFREEREPORT_JAR)
6424AC_SUBST(LIBBASE_JAR)
6425AC_SUBST(LIBLAYOUT_JAR)
6426AC_SUBST(LIBLOADER_JAR)
6427AC_SUBST(LIBFORMULA_JAR)
6428AC_SUBST(LIBREPOSITORY_JAR)
6429AC_SUBST(LIBFONTS_JAR)
6430AC_SUBST(LIBSERIALIZER_JAR)
6431
6432# this has to be here because both the Wiki Publisher and the Report
6433# Builder use commons-logging, while the non-optional PostgreSQL
6434# connector uses commons-lang.
6435AC_MSG_CHECKING([which Apache commons-* libs to use])
6436if test "$with_system_apache_commons" = "yes"; then
6437  SYSTEM_APACHE_COMMONS=YES
6438  AC_MSG_RESULT([external])
6439
6440  if test -z $COMMONS_LANG_JAR; then
6441    AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
6442      [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
6443      [
6444        AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6445          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6446          [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6447        )
6448      ]
6449    )
6450  else
6451    AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6452         [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6453  fi
6454  AC_MSG_CHECKING([whether commons-lang is version 3.x])
6455  export COMMONS_LANG_JAR
6456  if $PERL -e 'use Archive::Zip;
6457      my $file = "$ENV{'COMMONS_LANG_JAR'}";
6458      my $zip = Archive::Zip->new( $file );
6459      my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
6460      if ( $mf =~ m/Specification-Version: 3.*/ ) {
6461          exit 0;
6462      } else {
6463          exit 1;
6464      }'; then
6465      AC_MSG_RESULT([yes])
6466  else
6467      AC_MSG_ERROR([no, you need Apache Commons Lang 3.x])
6468  fi
6469
6470  if test "$ENABLE_MEDIAWIKI" = "YES"; then
6471    if test -z $COMMONS_CODEC_JAR; then
6472      AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
6473        [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
6474        [
6475          AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6476            [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6477            [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6478          )
6479        ]
6480      )
6481    else
6482      AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6483           [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6484    fi
6485
6486    if test -z $COMMONS_HTTPCLIENT_JAR; then
6487      AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6488        [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6489        [
6490          AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6491            [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6492            [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6493          )
6494        ]
6495      )
6496    else
6497      AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6498           [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6499    fi
6500  fi
6501  if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6502    if test -z $COMMONS_LOGGING_JAR; then
6503      AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
6504        [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
6505        [
6506          AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6507            [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6508            [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6509          )
6510        ]
6511      )
6512    else
6513      AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6514           [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6515    fi
6516  fi
6517else
6518  AC_MSG_RESULT([internal])
6519  SYSTEM_APACHE_COMMONS=NO
6520  BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6521fi
6522AC_SUBST(SYSTEM_APACHE_COMMONS)
6523AC_SUBST(COMMONS_CODEC_JAR)
6524AC_SUBST(COMMONS_LANG_JAR)
6525AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6526AC_SUBST(COMMONS_LOGGING_JAR)
6527
6528dnl ===================================================================
6529dnl Check whether the Qt and KDE libraries are available.
6530dnl ===================================================================
6531
6532KDE_CFLAGS=""
6533KDE_LIBS=""
6534MOC="moc"
6535if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6536    dnl Search paths for Qt and KDE
6537    if test "$build_cpu" != "x86_64" ; then
6538        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"
6539        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"
6540    else
6541        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"
6542        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"
6543    fi
6544    if test -n "$QTDIR" ; then
6545        qt_incdirs="$QTDIR/include $qt_incdirs"
6546        if test "$build_cpu" != "x86_64" ; then
6547            qt_libdirs="$QTDIR/lib $qt_libdirs"
6548        else
6549            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6550        fi
6551    fi
6552    if test "$build_cpu" != "x86_64" ; then
6553        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"
6554        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"
6555    else
6556        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"
6557        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"
6558    fi
6559    if test -n "$KDEDIR" ; then
6560        kde_incdirs="$KDEDIR/include $kde_incdirs"
6561        if test "$build_cpu" != "x86_64" ; then
6562            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6563        else
6564            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6565        fi
6566    fi
6567
6568    dnl What to test
6569    qt_test_include="qstyle.h"
6570    qt_test_library="libqt-mt.so"
6571    kde_test_include="ksharedptr.h"
6572    kde_test_library="libkdeui.so"
6573
6574    dnl Check for Qt headers
6575    AC_MSG_CHECKING([for Qt headers])
6576    qt_incdir="no"
6577    for kde_check in $qt_incdirs ; do
6578        if test -r "$kde_check/$qt_test_include" ; then
6579            qt_incdir="$kde_check"
6580            break
6581        fi
6582    done
6583    AC_MSG_RESULT([$qt_incdir])
6584    if test "x$qt_incdir" = "xno" ; then
6585        AC_MSG_ERROR([Qt headers not found. Please specify the root of
6586your Qt installation by exporting QTDIR before running "configure".])
6587    fi
6588
6589    dnl Check for Qt libraries
6590    AC_MSG_CHECKING([for Qt libraries])
6591    qt_libdir="no"
6592    for qt_check in $qt_libdirs ; do
6593        if test -r "$qt_check/$qt_test_library" ; then
6594            qt_libdir="$qt_check"
6595            break
6596        fi
6597    done
6598    AC_MSG_RESULT([$qt_libdir])
6599    if test "x$qt_libdir" = "xno" ; then
6600        AC_MSG_ERROR([Qt libraries not found. Please specify the root of
6601your Qt installation by exporting QTDIR before running "configure".])
6602    fi
6603
6604    dnl Check for Meta Object Compiler
6605    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6606    if test "$MOC" = "no" ; then
6607        AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify
6608the root of your Qt installation by exporting QTDIR before running "configure".])
6609    fi
6610
6611    dnl Check for KDE headers
6612    AC_MSG_CHECKING([for KDE headers])
6613    kde_incdir="no"
6614    for kde_check in $kde_incdirs ; do
6615        if test -r "$kde_check/$kde_test_include" ; then
6616            kde_incdir="$kde_check"
6617            break
6618        fi
6619    done
6620    AC_MSG_RESULT([$kde_incdir])
6621    if test "x$kde_incdir" = "xno" ; then
6622        AC_MSG_ERROR([KDE headers not found. Please specify the root of
6623your KDE installation by exporting KDEDIR before running "configure".])
6624    fi
6625
6626    dnl Check for KDE libraries
6627    AC_MSG_CHECKING([for KDE libraries])
6628    kde_libdir="no"
6629    for kde_check in $kde_libdirs ; do
6630        if test -r "$kde_check/$kde_test_library" ; then
6631            kde_libdir="$kde_check"
6632            break
6633        fi
6634    done
6635    AC_MSG_RESULT([$kde_libdir])
6636    if test "x$kde_libdir" = "xno" ; then
6637        AC_MSG_ERROR([KDE libraries not found. Please specify the root of
6638your KDE installation by exporting KDEDIR before running "configure".])
6639    fi
6640
6641    dnl Set the variables
6642    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6643    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6644fi
6645AC_SUBST(KDE_CFLAGS)
6646AC_SUBST(KDE_LIBS)
6647AC_SUBST(MOC)
6648
6649dnl ===================================================================
6650dnl KDE4 Integration
6651dnl ===================================================================
6652
6653KDE4_CFLAGS=""
6654KDE4_LIBS=""
6655MOC4="moc"
6656if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6657   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6658   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6659
6660   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6661   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6662
6663   if test "$build_cpu" = "x86_64" ; then
6664      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6665      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6666   fi
6667
6668   if test -n "$KDE4DIR" ; then
6669      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6670      if test "$build_cpu" != "x86_64" ; then
6671         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6672      else
6673         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6674      fi
6675   fi
6676
6677   qt_test_include="Qt/qobject.h"
6678   qt_test_library="libQtCore.so"
6679   kde_test_include="ksharedptr.h"
6680   kde_test_library="libkdeui.so"
6681
6682   AC_MSG_CHECKING([for Qt4 headers])
6683   qt_header_dir="no"
6684   for inc_dir in $qt_incdirs ; do
6685      if test -r "$inc_dir/$qt_test_include" ; then
6686         qt_header_dir="$inc_dir"
6687         break
6688      fi
6689   done
6690
6691   AC_MSG_RESULT([$qt_header_dir])
6692   if test "x$qt_header_dir" = "xno" ; then
6693      AC_MSG_ERROR([Qt4 headers not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6694   fi
6695
6696   AC_MSG_CHECKING([for Qt4 libraries])
6697   qt_lib_dir="no"
6698   for lib_dir in $qt_libdirs ; do
6699      if test -r "$lib_dir/$qt_test_library" ; then
6700         qt_lib_dir="$lib_dir"
6701         break
6702      fi
6703   done
6704
6705   AC_MSG_RESULT([$qt_lib_dir])
6706
6707   if test "x$qt_lib_dir" = "xno" ; then
6708      AC_MSG_ERROR([Qt4 libraries not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6709   fi
6710
6711   dnl Check for Meta Object Compiler
6712   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6713   MOC4="$MOCQT4"
6714   if test "$MOC4" = "no" ; then
6715      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6716      if test "$MOC4" = "no" ; then
6717         AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6718      fi
6719   fi
6720
6721   dnl Check for KDE4 headers
6722   AC_MSG_CHECKING([for KDE4 headers])
6723   kde_incdir="no"
6724   for kde_check in $kde_incdirs ; do
6725      if test -r "$kde_check/$kde_test_include" ; then
6726         kde_incdir="$kde_check"
6727         break
6728      fi
6729   done
6730   AC_MSG_RESULT([$kde_incdir])
6731   if test "x$kde_incdir" = "xno" ; then
6732      AC_MSG_ERROR([KDE4 headers not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6733   fi
6734
6735   dnl Check for KDE4 libraries
6736   AC_MSG_CHECKING([for KDE4 libraries])
6737   kde_libdir="no"
6738   for kde_check in $kde_libdirs ; do
6739      if test -r "$kde_check/$kde_test_library" ; then
6740         kde_libdir="$kde_check"
6741         break
6742      fi
6743   done
6744
6745   AC_MSG_RESULT([$kde_libdir])
6746   if test "x$kde_libdir" = "xno" ; then
6747      AC_MSG_ERROR([KDE4 libraries not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6748   fi
6749
6750   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6751   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6752fi
6753AC_SUBST(KDE4_CFLAGS)
6754AC_SUBST(KDE4_LIBS)
6755AC_SUBST(MOC4)
6756
6757dnl ===================================================================
6758dnl Test for the enabling the lockdown pieces
6759dnl ===================================================================
6760AC_MSG_CHECKING([whether to enable the lockdown pieces])
6761ENABLE_LOCKDOWN=""
6762if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6763  ENABLE_LOCKDOWN=YES
6764  AC_MSG_RESULT([yes])
6765else
6766  AC_MSG_RESULT([no])
6767fi
6768AC_SUBST(ENABLE_LOCKDOWN)
6769
6770dnl ===================================================================
6771dnl Test whether to include Evolution 2 support
6772dnl ===================================================================
6773AC_MSG_CHECKING([whether to enable evolution 2 support])
6774if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6775   AC_MSG_RESULT([yes])
6776   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6777   ENABLE_EVOAB2="TRUE"
6778else
6779   ENABLE_EVOAB2=""
6780   AC_MSG_RESULT([no])
6781fi
6782AC_SUBST(ENABLE_EVOAB2)
6783AC_SUBST(GOBJECT_CFLAGS)
6784AC_SUBST(GOBJECT_LIBS)
6785
6786dnl ===================================================================
6787dnl Test whether to include MathMLDTD
6788dnl ===================================================================
6789AC_MSG_CHECKING([whether to include MathMLDTD])
6790if test -n "$enable_mathmldtd"; then
6791  if test "$enable_mathmldtd" = "no"; then
6792    AC_MSG_RESULT([no])
6793    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6794  else
6795    AC_MSG_RESULT([yes])
6796    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6797  fi
6798else
6799  AC_MSG_RESULT([no])
6800  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6801fi
6802
6803dnl ===================================================================
6804dnl Test whether to include category-B fonts
6805dnl ===================================================================
6806WITH_CATB_FONTS=
6807AC_MSG_CHECKING([whether to include category B fonts])
6808if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
6809   AC_MSG_RESULT([yes])
6810   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
6811   WITH_CATB_FONTS=YES
6812   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
6813else
6814   AC_MSG_RESULT([no])
6815   WITH_CATB_FONTS=NO
6816fi
6817
6818dnl ===================================================================
6819dnl Test whether to include category-A fonts
6820dnl ===================================================================
6821WITH_CATA_FONTS=
6822AC_MSG_CHECKING([whether to include category A fonts])
6823if test "x$with_fonts" != "xno" ; then
6824  AC_MSG_RESULT([yes])
6825  WITH_CATA_FONTS=YES
6826  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
6827else
6828  AC_MSG_RESULT([no])
6829  WITH_CATA_FONTS=NO
6830  WITH_CATB_FONTS=NO
6831fi
6832
6833WITH_FONTS=NO
6834AC_MSG_CHECKING([whether any fonts are included])
6835if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
6836  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6837  WITH_FONTS=YES
6838  AC_MSG_RESULT([yes])
6839else
6840  AC_MSG_RESULT([no])
6841fi
6842
6843AC_SUBST(WITH_CATA_FONTS)
6844AC_SUBST(WITH_CATB_FONTS)
6845AC_SUBST(WITH_FONTS)
6846
6847dnl ===================================================================
6848dnl Test whether to include ppds
6849dnl ===================================================================
6850AC_MSG_CHECKING([whether to include PPDs])
6851if test "$with_ppds" != "no"; then
6852  AC_MSG_RESULT([yes])
6853else
6854  AC_MSG_RESULT([no])
6855  WITHOUT_PPDS=YES
6856  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6857fi
6858AC_SUBST(WITHOUT_PPDS)
6859
6860dnl ===================================================================
6861dnl Test whether to include afms
6862dnl ===================================================================
6863AC_MSG_CHECKING([whether to include AFMs])
6864if test "$with_afms" != "no"; then
6865  AC_MSG_RESULT([yes])
6866  BUILD_TYPE="$BUILD_TYPE AFMS"
6867else
6868  AC_MSG_RESULT([no])
6869  WITHOUT_AFMS=YES
6870  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6871fi
6872AC_SUBST(WITHOUT_AFMS)
6873
6874AC_SUBST(SCPDEFS)
6875
6876AC_MSG_CHECKING([whether and how to use Xinerama])
6877if test "$_os" = "Darwin"; then
6878   USE_XINERAMA=YES
6879   XINERAMA_LINK=dynamic
6880   AC_MSG_RESULT([yes])
6881elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6882   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6883      # we have both versions, let the user decide but use the dynamic one
6884      # per default
6885      USE_XINERAMA=YES
6886      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6887         XINERAMA_LINK=dynamic
6888      else
6889         XINERAMA_LINK=static
6890      fi
6891   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6892      # we have only the dynamic version
6893      USE_XINERAMA=YES
6894      XINERAMA_LINK=dynamic
6895   elif test -e "$XLIB/libXinerama.a"; then
6896      # static version
6897      if echo $build_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6898         USE_XINERAMA=YES
6899         XINERAMA_LINK=static
6900      else
6901         USE_XINERAMA=NO
6902         XINERAMA_LINK=none
6903      fi
6904   else
6905      # no Xinerama
6906      USE_XINERAMA=NO
6907      XINERAMA_LINK=none
6908   fi
6909   if test "$USE_XINERAMA" = "YES"; then
6910      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6911      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6912          [AC_MSG_ERROR(Xinerama header not found.)], [])
6913      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6914      if test "$_os" = "FreeBSD"; then
6915          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6916      fi
6917      if test "$_os" = "Linux"; then
6918          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6919      fi
6920      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6921          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6922   else
6923      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6924   fi
6925else
6926   AC_MSG_RESULT([no])
6927fi
6928AC_SUBST(USE_XINERAMA)
6929AC_SUBST(XINERAMA_LINK)
6930
6931dnl ===================================================================
6932dnl always rely on the system version of gdk-pixbuf
6933dnl ===================================================================
6934
6935SYSTEM_GDKPIXBUF=YES
6936AC_SUBST(SYSTEM_GDKPIXBUF)
6937
6938dnl ===================================================================
6939dnl always rely on the system version of glib
6940dnl ===================================================================
6941
6942SYSTEM_GLIB=YES
6943AC_SUBST(SYSTEM_GLIB)
6944
6945dnl ===================================================================
6946dnl always rely on the system version of gettext
6947dnl ===================================================================
6948
6949SYSTEM_GETTEXT=YES
6950AC_SUBST(SYSTEM_GETTEXT)
6951
6952if test "$_os" = "FreeBSD"; then
6953    LIBINTL_PREFIX=
6954    for dir in $CPPFLAGS; do
6955      if dir=`expr -- $dir : '-I\(.*\)'`; then
6956        if test -f "$dir/libintl.h" ; then
6957          LIBINTL_PREFIX=`dirname $dir`
6958        fi
6959      fi
6960    done
6961    AC_SUBST(LIBINTL_PREFIX)
6962fi
6963
6964dnl ===================================================================
6965dnl always rely on the system version of pango
6966dnl ===================================================================
6967
6968SYSTEM_PANGO=YES
6969AC_SUBST(SYSTEM_PANGO)
6970
6971dnl ===================================================================
6972dnl Test whether to build libpng or rely on the system version
6973dnl ===================================================================
6974AC_MSG_CHECKING([whether to build own version of libpng])
6975
6976case "$_os" in
6977    WINNT*) # Windows
6978        SYSTEM_LIBPNG=NO
6979        AC_MSG_RESULT([yes])
6980        ;;
6981    Darwin*)
6982        SYSTEM_LIBPNG=NO
6983        AC_MSG_RESULT([yes])
6984        ;;
6985   *)
6986   SYSTEM_LIBPNG=YES
6987   AC_MSG_RESULT([no])
6988   ;;
6989esac
6990AC_SUBST(SYSTEM_LIBPNG)
6991
6992dnl ===================================================================
6993dnl Test whether to build libjpeg or rely on the system version
6994dnl ===================================================================
6995dnl FIXME: this is currently because we have jpeg-6b for our filters
6996dnl        and jpeg-8 as dependency for librsvg
6997dnl        this should be unified into using only one version for both
6998
6999AC_MSG_CHECKING([whether to build own version of libjpeg])
7000
7001if test "$SYSTEM_JPEG" = "YES"; then
7002SYSTEM_LIBJPEG=YES
7003else
7004case "$_os" in
7005    WINNT*) # Windows
7006        SYSTEM_LIBJPEG=NO
7007        ;;
7008    Darwin*)
7009        SYSTEM_LIBJPEG=NO
7010        ;;
7011   *)
7012        SYSTEM_LIBJPEG=YES
7013        ;;
7014esac
7015fi
7016
7017if test "$SYSTEM_LIBJPEG" = "YES"; then
7018   AC_MSG_RESULT([no])
7019else
7020   AC_MSG_RESULT([yes])
7021fi
7022AC_SUBST(SYSTEM_LIBJPEG)
7023
7024dnl ===================================================================
7025dnl Test whether rat scan was requested and whether apache-rat is available
7026dnl ===================================================================
7027RAT_JAR=
7028AC_MSG_CHECKING([whether to trigger rat scan])
7029if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
7030    AC_MSG_RESULT([no])
7031else
7032    if test "$WITH_JAVA" = "no"; then
7033        AC_MSG_ERROR([no, java disabled, enable with --with-java])
7034    elif test "$enable_saxon" = "no"; then
7035        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
7036    elif test "$with_rat_scan" = "yes"; then
7037        AC_MSG_RESULT([yes, use pre-built library])
7038        RAT_JAR_HOME="BUILD"
7039        BUILD_TYPE="$BUILD_TYPE RAT"
7040    else
7041        AC_MSG_RESULT([yes, use pre-installed library])
7042        AC_MSG_CHECKING([whether apache-rat is available])
7043        if test -d "$with_rat_scan"; then
7044            RAT_JAR_HOME=$with_rat_scan
7045        else
7046            AC_MSG_ERROR([$with_rat_scan is not a directory])
7047        fi
7048    fi
7049fi
7050AC_SUBST(RAT_JAR_HOME)
7051
7052
7053dnl ===================================================================
7054dnl Test for the presence of Ant and that it works
7055dnl ===================================================================
7056
7057if test "$SOLAR_JAVA" != ""; then
7058ANT_HOME=; export ANT_HOME
7059WITH_ANT_HOME=; export WITH_ANT_HOME
7060if test -z "$with_ant_home"; then
7061   if test "$_os" = "OS2"; then
7062     AC_PATH_PROGS(ANT, ant.cmd)
7063   else
7064     AC_PATH_PROGS(ANT, [apache-ant ant ant.sh ant.bat ant.cmd])
7065   fi
7066else
7067   if test "$_os" = "WINNT"; then
7068      with_ant_home=`cygpath -u "$with_ant_home"`
7069   fi
7070   if test "$_os" = "OS2"; then
7071     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
7072   else
7073     AC_PATH_PROGS(ANT, [apache-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
7074   fi
7075   WITH_ANT_HOME=$with_ant_home
7076   ANT_HOME=$with_ant_home
7077fi
7078
7079if test -z "$ANT"; then
7080  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
7081else
7082  # resolve relative or absolute symlink
7083  while test -h "$ANT"; do
7084     a_cwd=`pwd`
7085     a_basename=`basename "$ANT"`
7086     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7087     cd "`dirname "$ANT"`"
7088     cd "`dirname "$a_script"`"
7089     ANT="`pwd`"/"`basename "$a_script"`"
7090     cd "$a_cwd"
7091  done
7092
7093  if test "$_os" = "OS2"; then
7094    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7095    export ANT_HOME
7096  fi
7097
7098  AC_MSG_CHECKING([if $ANT works])
7099cat > conftest.java << EOF
7100    public class conftest {
7101    int testmethod(int a, int b) {
7102            return a + b;
7103    }
7104    }
7105EOF
7106
7107cat > conftest.xml << EOF
7108    <project name="conftest" default="conftest">
7109    <target name="conftest">
7110            <javac srcdir="." includes="conftest.java">
7111        </javac>
7112    </target>
7113    </project>
7114EOF
7115  oldJAVA_HOME=$JAVA_HOME
7116  if test "$JAVACISGCJ" = "yes"; then
7117    JAVA_HOME=; export JAVA_HOME
7118    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7119  else
7120    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7121  fi
7122  AC_TRY_EVAL(ant_cmd)
7123  if test $? = 0 && test -f ./conftest.class ; then
7124    AC_MSG_RESULT([Ant works])
7125    if test -z "$WITH_ANT_HOME"; then
7126        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7127        if test -z "$ANT_HOME"; then
7128            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7129        fi
7130    else
7131        ANT_HOME="$WITH_ANT_HOME"
7132    fi
7133  else
7134    echo "configure: Ant test failed" >&5
7135    cat conftest.java >&5
7136    cat conftest.xml >&5
7137    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7138    ANT_HOME=""
7139    echo "Ant does not work - Some Java projects will not build!" >>warn
7140  fi
7141  JAVA_HOME=$oldJAVA_HOME
7142  rm -f conftest* core core.* *.core
7143fi
7144if test -z "$ANT_HOME"; then
7145   ANT_HOME="NO_ANT_HOME"
7146fi
7147AC_SUBST(ANT_HOME)
7148
7149dnl Checking for ant.jar
7150if test "$ANT_HOME" != "NO_ANT_HOME"; then
7151   AC_MSG_CHECKING([Ant lib directory])
7152   if test -f $ANT_HOME/lib/ant.jar; then
7153    ANT_LIB="$ANT_HOME/lib"
7154   else
7155      if test -f $ANT_HOME/ant.jar; then
7156         ANT_LIB="$ANT_HOME"
7157      else
7158          if test -f /usr/share/java/ant.jar; then
7159              ANT_LIB=/usr/share/java
7160          else
7161             if test -f /usr/share/ant-core/lib/ant.jar; then
7162                 ANT_LIB=/usr/share/ant-core/lib
7163             else
7164                if test -f $ANT_HOME/lib/ant/ant.jar; then
7165                    ANT_LIB="$ANT_HOME/lib/ant"
7166                else
7167                   if test -f /usr/share/lib/ant/ant.jar; then
7168                       ANT_LIB=/usr/share/lib/ant
7169                   else
7170                       AC_MSG_ERROR([Ant libraries not found!])
7171                   fi
7172                fi
7173             fi
7174          fi
7175      fi
7176   fi
7177   AC_MSG_RESULT([Ant lib directory found.])
7178fi
7179AC_SUBST(ANT_LIB)
7180fi
7181
7182ant_minver=1.9.1
7183# update for more extensions...
7184if test "$ENABLE_MEDIAWIKI" = "YES"; then
7185  ant_minver=1.9.1
7186fi
7187ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7188
7189AC_MSG_CHECKING([whether ant is >= $ant_minver])
7190ant_version=`$ANT -version | $AWK '{ print $4; }'`
7191ant_version_major=`echo $ant_version | cut -d. -f1`
7192ant_version_minor=`echo $ant_version | cut -d. -f2`
7193echo "configure: ant_version $ant_version " >&5
7194echo "configure: ant_version_major $ant_version_major " >&5
7195echo "configure: ant_version_minor $ant_version_minor " >&5
7196if test "$ant_version_major" -ge "2"; then
7197   AC_MSG_RESULT([yes, $ant_version])
7198elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7199   AC_MSG_RESULT([yes, $ant_version])
7200else
7201   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7202fi
7203
7204if test "$ENABLE_MEDIAWIKI" = "YES"; then
7205AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7206rm -rf confdir
7207mkdir confdir
7208cat > conftest.java << EOF
7209    public class conftest {
7210        int testmethod(int a, int b) {
7211            return a + b;
7212        }
7213    }
7214EOF
7215
7216cat > conftest.xml << EOF
7217    <project name="conftest" default="conftest">
7218        <target name="conftest" depends="copytest">
7219            <javac srcdir="." includes="conftest.java">
7220            </javac>
7221        </target>
7222        <target name="copytest">
7223             <copy todir="confdir">
7224                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7225                 <filterset/>
7226                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7227             </copy>
7228        </target>
7229    </project>
7230EOF
7231  if test "$JAVACISGCJ" = "yes"; then
7232    JAVA_HOME=; export JAVA_HOME
7233    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7234  else
7235    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7236  fi
7237  AC_TRY_EVAL(ant_cmd)
7238  if test $? = 0 && test -f ./conftest.class ; then
7239    AC_MSG_RESULT([yes])
7240    rm -rf confdir
7241  else
7242    echo "configure: Ant test failed" >&5
7243    cat conftest.java >&5
7244    cat conftest.xml >&5
7245    rm -rf confdir
7246    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7247  fi
7248fi
7249rm -f conftest* core core.* *.core
7250
7251OOO_JUNIT_JAR=
7252JUNIT_NEEDS_HAMCREST=
7253if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7254    AC_MSG_CHECKING([for JUnit])
7255    if test "$with_junit" = "yes"; then
7256        if test -e /usr/share/java/junit4.jar; then
7257           OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7258        else
7259           if test -e /usr/local/share/java/classes/junit4.jar; then
7260              OOO_JUNIT_JAR=/usr/local/share/java/classes/junit4.jar
7261           else
7262              if test -e /usr/share/lib/java/junit.jar; then
7263                 OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7264              else
7265                 if test -e /usr/share/local/lib/java/junit.jar; then
7266                    OOO_JUNIT_JAR=/usr/share/local/lib/java/junit.jar
7267                 else
7268                    if test -e /usr/share/java/junit.jar; then
7269                       OOO_JUNIT_JAR=/usr/share/java/junit.jar
7270                    else
7271                       if test -e /usr/local/share/java/classes/junit.jar; then
7272                          OOO_JUNIT_JAR=/usr/local/share/java/classes/junit.jar
7273                       fi
7274                    fi
7275                 fi
7276              fi
7277           fi
7278        fi
7279    else
7280        OOO_JUNIT_JAR=$with_junit
7281    fi
7282    if test -e "$OOO_JUNIT_JAR"; then
7283        AC_MSG_RESULT([yes])
7284    else
7285        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7286locations (/usr/share/java or /usr/local/share/java/classes), specify its pathname via
7287--with-junit=..., or disable it via --without-junit.])
7288    fi
7289    if test "$_os" = "WINNT"; then
7290        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7291    fi
7292    AC_MSG_CHECKING([whether JUnit is version 4.x])
7293    export OOO_JUNIT_JAR
7294    if $PERL -e 'use Archive::Zip;
7295        my $file = "$ENV{'OOO_JUNIT_JAR'}";
7296        my $zip = Archive::Zip->new( $file );
7297        my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7298        if ( $mf =~ m/Implementation-Version: 4.12*/ ) {
7299            exit 0;
7300        } elsif ( $mf =~ m/Implementation-Version: 4.11*/ ) {
7301            exit 0;
7302        } elsif ( $mf =~ m/Bundle-Version: 4.12*/ ) {
7303            exit 0;
7304        } elsif ( $mf =~ m/Bundle-Version: 4.11*/ ) {
7305            exit 0;
7306        } else {
7307            exit 1;
7308        }'; then
7309        AC_MSG_RESULT([yes, but Hamcrest Core is mandatory with this JUnit version (>= 4.11)])
7310        JUNIT_NEEDS_HAMCREST=yes
7311    elif $PERL -e 'use Archive::Zip;
7312        my $file = "$ENV{'OOO_JUNIT_JAR'}";
7313        my $zip = Archive::Zip->new( $file );
7314        my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7315        if ( $mf =~ m/Implementation-Version: 4.*/ ) {
7316            exit 0;
7317        } elsif ( $mf =~ m/Bundle-Version: 4.*/ ) {
7318        } else {
7319            exit 1;
7320        }'; then
7321        AC_MSG_RESULT([yes])
7322    else
7323        AC_MSG_ERROR([no, your JUnit version is too old, you need JUnit 4.x])
7324    fi
7325fi
7326AC_SUBST(OOO_JUNIT_JAR)
7327
7328HAMCREST_CORE_JAR=
7329if test "$SOLAR_JAVA" != "" && test "$with_hamcrest_core" != "no"; then
7330    AC_MSG_CHECKING([for hamcrest-core])
7331    if test "$with_hamcrest_core" = "yes"; then
7332        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest-core-1.3.jar; then
7333            HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core-1.3.jar
7334        fi
7335        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest-core-1.3.jar; then
7336            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest-core-1.3.jar
7337        fi
7338        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/lib/java/hamcrest-core.jar; then
7339            HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest-core.jar
7340        fi
7341        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/lib/java/hamcrest-core.jar; then
7342            HAMCREST_CORE_JAR=/usr/local/share/lib/java/hamcrest-core.jar
7343        fi
7344        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest-core.jar; then
7345            HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core.jar
7346        fi
7347        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest-core.jar; then
7348            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest-core.jar
7349        fi
7350        # Sometimes the "-core-" part is missing...
7351        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest1.3.jar; then
7352            HAMCREST_CORE_JAR=/usr/share/java/hamcrest1.3.jar
7353        fi
7354        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest1.3.jar; then
7355            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest1.3.jar
7356        fi
7357        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/lib/java/hamcrest.jar; then
7358            HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest.jar
7359        fi
7360        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/lib/java/hamcrest.jar; then
7361            HAMCREST_CORE_JAR=/usr/local/share/lib/java/hamcrest.jar
7362        fi
7363        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest.jar; then
7364            HAMCREST_CORE_JAR=/usr/share/java/hamcrest.jar
7365        fi
7366        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest.jar; then
7367            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest.jar
7368        fi
7369    else
7370        HAMCREST_CORE_JAR=$with_hamcrest_core
7371    fi
7372    if test -e "$HAMCREST_CORE_JAR"; then
7373        AC_MSG_RESULT([yes])
7374        if test "$_os" = "WINNT"; then
7375            HAMCREST_CORE_JAR=`cygpath -m "$HAMCREST_CORE_JAR"`
7376        fi
7377    else
7378        if test "$JUNIT_NEEDS_HAMCREST" = "yes"; then
7379            AC_MSG_ERROR([cannot find hamcrest-core jar; please install one in the
7380default locations (/usr/share/java or /usr/local/share/java/classes), specify its
7381pathname via --with-hamcrest-core=..., or disable
7382it via --without-hamcrest-core or --without-junit])
7383        else
7384            AC_MSG_RESULT([no, skipping])
7385        fi
7386    fi
7387else
7388    if test "$JUNIT_NEEDS_HAMCREST" = "yes"; then
7389        AC_MSG_ERROR([JUnit needs Hamcrest but Hamcrest disabled.])
7390    fi
7391fi
7392AC_SUBST(HAMCREST_CORE_JAR)
7393
7394AC_MSG_CHECKING([which languages to be built])
7395WITH_LANG="$with_lang"
7396if test -z "$WITH_LANG"; then
7397   AC_MSG_RESULT([en-US])
7398else
7399   AC_MSG_RESULT([$WITH_LANG])
7400   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7401   BUILD_TYPE="$BUILD_TYPE L10N"
7402fi
7403AC_SUBST(WITH_LANG)
7404
7405AC_MSG_CHECKING([which languages have poor help localizations])
7406WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7407if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7408   AC_MSG_RESULT([none])
7409else
7410   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7411fi
7412AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7413
7414AC_MSG_CHECKING([which dictionaries to include])
7415if test -z "$with_dict"; then
7416   WITH_DICT=,ALL,
7417   AC_MSG_RESULT([ALL])
7418else
7419   WITH_DICT=","$with_dict","
7420   AC_MSG_RESULT([$with_dict])
7421fi
7422AC_SUBST(WITH_DICT)
7423
7424AC_MSG_CHECKING([for additional 'intro' bitmaps])
7425INTRO_BITMAPS=
7426if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7427   INTRO_BITMAPS=
7428   AC_MSG_RESULT([none])
7429else
7430   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7431      case "$bitmap" in
7432         *.png) ;;
7433         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .png files!]) ;;
7434      esac
7435      if test -n "$bitmap" ; then
7436         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7437      fi
7438   done
7439   AC_MSG_RESULT([$INTRO_BITMAPS])
7440fi
7441AC_SUBST(INTRO_BITMAPS)
7442
7443AC_MSG_CHECKING([for additional 'about' bitmaps])
7444ABOUT_BITMAPS=
7445if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7446   ABOUT_BITMAPS=
7447   AC_MSG_RESULT([none])
7448else
7449   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7450      case "$bitmap" in
7451         *.png) ;;
7452         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .png files!]) ;;
7453      esac
7454      if test -n "$bitmap" ; then
7455         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7456      fi
7457   done
7458   AC_MSG_RESULT([$ABOUT_BITMAPS])
7459fi
7460AC_SUBST(ABOUT_BITMAPS)
7461
7462OOO_VENDOR=
7463AC_MSG_CHECKING([for vendor])
7464if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7465   AC_MSG_RESULT([not set])
7466else
7467   OOO_VENDOR="$with_vendor"
7468   AC_MSG_RESULT([$OOO_VENDOR])
7469fi
7470AC_SUBST(OOO_VENDOR)
7471
7472UNIXWRAPPERNAME=
7473AC_MSG_CHECKING([for UNIX wrapper name])
7474if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no" -o "$with_unix_wrapper" = "yes" ; then
7475   AC_MSG_RESULT([not set])
7476else
7477   UNIXWRAPPERNAME="$with_unix_wrapper"
7478   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7479fi
7480AC_SUBST(UNIXWRAPPERNAME)
7481
7482AC_MSG_CHECKING([whether to statically link to Gtk])
7483if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7484   ENABLE_STATIC_GTK="TRUE"
7485   AC_MSG_RESULT([yes])
7486else
7487   ENABLE_STATIC_GTK="FALSE"
7488   AC_MSG_RESULT([no])
7489fi
7490AC_SUBST(ENABLE_STATIC_GTK)
7491
7492AC_MSG_CHECKING([whether to use layout dialogs])
7493if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7494   ENABLE_LAYOUT="TRUE"
7495   AC_MSG_RESULT([yes])
7496else
7497   ENABLE_LAYOUT="FALSE"
7498   AC_MSG_RESULT([no])
7499fi
7500AC_SUBST(ENABLE_LAYOUT)
7501
7502# ===================================================================
7503# De- or increase default verbosity of build process
7504# ===================================================================
7505AC_MSG_CHECKING([build verbosity])
7506if test -n "$enable_verbose"; then
7507   if test "$enable_verbose" = "yes"; then
7508      VERBOSE="TRUE"
7509      AC_MSG_RESULT([high])
7510   fi
7511   if test "$enable_verbose" = "no"; then
7512      VERBOSE="FALSE"
7513      AC_MSG_RESULT([low])
7514   fi
7515else
7516   AC_MSG_RESULT([not set])
7517fi
7518AC_SUBST(VERBOSE)
7519
7520dnl ===================================================================
7521dnl Hook up AOOs nodep environmental variable to automake's equivalent
7522dnl --enable-dependency-tracking configure option
7523dnl ===================================================================
7524AC_MSG_CHECKING([whether to enable dependency tracking])
7525if test "$enable_dependency_tracking" = "no"; then
7526    nodep=TRUE
7527    AC_MSG_RESULT([no])
7528else
7529    AC_MSG_RESULT([yes])
7530fi
7531AC_SUBST(nodep)
7532
7533dnl ===================================================================
7534dnl Setting up the environment.
7535dnl ===================================================================
7536echo "********************************************************************"
7537echo "*                                                                  *"
7538echo "*   Setting up the build environment variables.                    *"
7539echo "*                                                                  *"
7540echo "********************************************************************"
7541
7542if test -z "$COMPATH"; then
7543   AC_MSG_ERROR([No compiler found.])
7544fi
7545AC_SUBST(COMPATH)
7546AC_SUBST(CC_PATH)
7547
7548AC_MSG_CHECKING([solver path])
7549if test -z "$with_local_solver"; then
7550   LOCAL_SOLVER="DEFAULT"
7551   AC_MSG_RESULT([default])
7552else
7553   LOCAL_SOLVER=$with_local_solver
7554   AC_MSG_RESULT([$with_local_solver])
7555fi
7556AC_SUBST(LOCAL_SOLVER)
7557
7558AC_SUBST(BUILD_TYPE)
7559AC_SUBST(ADDITIONAL_REPOSITORIES)
7560
7561# make sure config.guess is +x; we execute config.guess, so it has to be so;
7562chmod +x ./config.guess
7563
7564# Create files from their *.in templates.
7565AC_CONFIG_FILES([set_soenv Makefile])
7566
7567AC_MSG_NOTICE([writing config.status])
7568AC_OUTPUT
7569
7570dnl Executing the set_soenv script to setup the environment variables.
7571chmod a+x set_soenv
7572if test -z "$enable_check_only"; then
7573   './set_soenv'
7574else
7575   echo
7576   echo Test Complete
7577   echo No environment file will be generated
7578   echo
7579   num_warnings=`wc -l warn`
7580   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7581   if test $_num -gt 0; then
7582      echo The following warning\(s\) were generated by configure
7583      echo ----------------------------------------------------
7584      echo
7585      cat warn
7586      echo
7587   else
7588      echo There were no warnings
7589   fi
7590   echo
7591fi
7592
7593
7594