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