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