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