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