xref: /trunk/main/configure.ac (revision 33efb51f76a78baf5a276c335781687d66cf274a)
1dnl * *************************************************************
2dnl *
3dnl *  Licensed to the Apache Software Foundation (ASF) under one
4dnl *  or more contributor license agreements.  See the NOTICE file
5dnl *  distributed with this work for additional information
6dnl *  regarding copyright ownership.  The ASF licenses this file
7dnl *  to you under the Apache License, Version 2.0 (the
8dnl *  "License"); you may not use this file except in compliance
9dnl *  with the License.  You may obtain a copy of the License at
10dnl *
11dnl *    http://www.apache.org/licenses/LICENSE-2.0
12dnl *
13dnl *  Unless required by applicable law or agreed to in writing,
14dnl *  software distributed under the License is distributed on an
15dnl *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16dnl *  KIND, either express or implied.  See the License for the
17dnl *  specific language governing permissions and limitations
18dnl *  under the License.
19dnl *
20dnl * *************************************************************
21AC_REVISION( $Revision$ )
22dnl macOS needs autoconf 2.72 (2.71 mis-detects the toolchain there);
23dnl other platforms remain on the older 2.71 floor.
24m4_define([AOO_REQUIRED_AUTOCONF],
25  [m4_if(m4_esyscmd_s([uname]), [Darwin], [2.72], [2.71])])
26AC_PREREQ(AOO_REQUIRED_AUTOCONF)
27AC_INIT
28echo "$@" >config.parms
29AC_ARG_WITH(dmake-path,
30[  --with-dmake-path=<PATH TO EXECUTABLE>   Specify the location of dmake ],
31[  DMAKE_PATH="$withval"
32])
33AC_ARG_WITH(dmake-url,
34[  --with-dmake-url=<URL>   Specify the location of downloadable dmake source code. For example:
35                          https://github.com/jimjag/dmake/archive/v4.13.1/dmake-4.13.1.tar.gz
36                          Note that dmake is under GPL license.],
37[  DMAKE_URL="$withval"
38])
39AC_ARG_WITH(packager-list,
40[  --with-packager-list=<PATH TO PACK LIST>   Specify a file to drive the packaging process.
41                          The file must follow the format explained in
42                          instsetoo_native/util/pack.lst
43],,)
44AC_ARG_WITH(gnu-patch,
45[  --with-gnu-patch        Specify location of GNU patch on Solaris or FreeBSD
46],,)
47AC_ARG_WITH(gnu-cp,
48[  --with-gnu-cp           Specify location of GNU cp on Solaris
49],,)
50AC_ARG_WITH(gperf,
51[  --with-gperf           Specify location of gperf on Solaris or FreeBSD
52],,)
53AC_ARG_ENABLE(graphite,
54[  --enable-graphite       Enables the compilation of Graphite smart font rendering
55],,)
56AC_ARG_WITH(system-graphite,
57[  --with-system-graphite    use graphite library already installed on system
58],,)
59AC_ARG_WITH(system-apache-commons,
60[  --with-system-apache-commons    use apache-commons jar files already installed on system
61],,)
62AC_ARG_ENABLE(online-update,
63[  --disable-online-update Disables the Online Update feature.
64],,enable_online_update=yes)
65AC_ARG_ENABLE(unit-tests,
66[  --disable-unit-tests    Disables default unit tests (eg. unit tests using Google test, ...).
67],,enable_unit_tests=yes)
68AC_ARG_ENABLE(ldap,
69[  --disable-ldap          Disables the use of LDAP backend via OpenLDAP
70],,)
71AC_ARG_ENABLE(fetch-external,
72[  --disable-fetch-external Disables fetching external tarballs from web sources.
73],,)
74AC_ARG_WITH(external-tar,
75[  --with-external-tar=<TARFILE PATH>   Specify path to tarfiles manually ],
76[ TARFILE_LOCATION="$withval"
77])
78AC_ARG_WITH(openldap,
79[  --with-openldap         Enables the use of the OpenLDAP
80],,)
81AC_ARG_ENABLE(lockdown,
82[  --enable-lockdown       Enables the gconf integration work in AOO
83],,)
84AC_ARG_ENABLE(vba,
85[  --disable-vba           disables the vba compatibility feature
86],,)
87AC_ARG_WITH(vba-package-format,
88[  --with-vba-package-format   specify package format for vba compatibility api.
89                          Specifying "builtin" means the api component and
90                          associated type library are part of the installation set.
91                          Specifying "extn" creates an uno extension that is
92                          part of the installation set ( located in the program
93                          directory ) that MUST be optionly registered using
94                          either the unopkg executeable or the extension manager
95                          gui.
96
97                          Note: "builtin" is the default, "extn" can cause
98                          problems.
99                          Usage: --with-vba-package-format="builtin" or
100                                 --with-vba-package-format="extn"
101],,)
102AC_ARG_ENABLE(pch,
103[  --enable-pch            EXPERIMENTAL: Enables precompiled header support for C++.
104],,)
105AC_ARG_WITH(fonts,
106[  --without-fonts         AOO includes some third-party fonts to provide a reliable
107                          basis for help content, templates, samples, etc.
108                          When these fonts are already known to be available on the
109                          system then you should use this option.
110],,)
111AC_ARG_WITH(ppds,
112[  --without-ppds          Removes Postscript Printer definition files from
113                          Apache OpenOffice installation set, for people building
114                          for specific distributions where PPDs are known to be
115                          already available (every recent distro with CUPS
116                          backend)
117],,)
118AC_ARG_WITH(afms,
119[  --without-afms          Removes bitmap font files from Apache Openoffice
120                          installation set, for people building for specific
121                          distributions where AFM files or TrueType Fonts
122                          are known to be available.
123],,)
124AC_ARG_ENABLE(epm,
125[  --disable-epm           AOO includes self-packaging code, that requires EPM.
126],,enable_epm="yes")
127AC_ARG_WITH(epm,
128[  --with-epm         Decides which EPM to use. Default is to use
129              the one installed on the system if one is there. When
130              either this is not there or you say =internal
131              EPM will be built.
132],,)
133AC_ARG_WITH(epm-url,
134[  --with-epm-url=<URL>    Specify the location of downloadable epm source code. For example:
135                            https://github.com/jimjag/epm/archive/v5.0.0/epm-5.0.0.tar.gz
136                          Version 5.0.0 or later is required.
137],[  EPM_URL="$withval"
138])
139AC_ARG_WITH(package-format,
140[  --with-package-format   specify package format(s) for AOO installsets.
141                          Default is "normal" one of the OS/Distribution.
142
143                          Usage: --with-package-format="foo bar"
144],,)
145AC_ARG_ENABLE(odk,
146[  --disable-odk           AOO includes an ODK, office development kit
147                          which some packagers may want to build without
148],,enable_odk="yes")
149AC_ARG_ENABLE(mathmldtd,
150[  --disable-mathmldtd     disable mathmldtd
151                          (useful for distributions that want to avoid packaging
152                          it)
153],,enable_mathmldtd="yes")
154AC_ARG_ENABLE(evolution2,
155[  --enable-evolution2     Allows the built-in evolution 2 addressbook
156                          connectivity build to be enabled.
157],,)
158AC_ARG_WITH(system-stdlibs,
159[  --with-system-stdlibs   use libstdc++/libgcc_s already on system
160],,)
161AC_ARG_ENABLE(cups,
162[  --disable-cups          disable CUPS support (for printing on UNIX)
163],,enable_cups=yes)
164AC_ARG_ENABLE(fontconfig,
165[  --disable-fontconfig    disable support for the fontconfig library
166],,enable_fontconfig=yes)
167AC_ARG_ENABLE(directx,
168[  --disable-directx       Remove DirectX implementation for the new XCanvas
169                          interface. The DirectX support requires more stuff
170                          installed on Windows to compile.
171                          (DirectX SDK, GDI+ libs)
172],,enable_directx=yes)
173AC_ARG_ENABLE(activex,
174[  --disable-activex       Disable the use of ActiveX for Windows build.
175                          This switch is mandatory when using VC++ 2005/2008 Express.
176                          Alternatively you can use the Windows Driver Kit (WDK) and
177                          configure with the following switches:
178                          --with-atl-include-dir=$WDK_HOME\inc\atl71
179                          --with-atl-lib-dir=$WDK_HOME\lib\ATL\i386
180                          --with-mfc-include-dir=$WDK_HOME\inc\mfc42
181                          --with-mfc-lib-dir=$WDK_HOME\lib\Mfc\i386
182],,)
183
184AC_ARG_ENABLE(atl,
185[  --disable-atl          Disable the use of ATL for Windows build.
186                          This switch is mandatory when using VC++ 2005/2008 Express.
187                          Alternatively you can use the Windows Driver Kit (WDK) and
188                          configure with the following switches:
189                          --with-atl-include-dir=$WDK_HOME\inc\atl71
190                          --with-atl-lib-dir=$WDK_HOME\lib\ATL\i386
191                          --with-mfc-include-dir=$WDK_HOME\inc\mfc42
192                          --with-mfc-lib-dir=$WDK_HOME\lib\Mfc\i386
193],,)
194
195AC_ARG_WITH(atl-include-dir,
196[  --with-atl-include-dir      Path to ATL include directory for Windows build.
197                          This switch is mandatory when using VC++ 2008 Express
198                          and configuring with ATL/ActiveX enabled.
199                          You can use the Windows Driver Kit (WDK) and
200                          configure with the following switch:
201                          --with-atl-include-dir=$WDK_HOME\inc\atl71
202],,)
203
204AC_ARG_WITH(atl-lib-dir,
205[  --with-atl-lib-dir          Path to ATL libraries directory for Windows build.
206                          This switch is mandatory when using VC++ 2008 Express
207                          and configuring with ATL/ActiveX enabled.
208                          You can use the Windows Driver Kit (WDK) and
209                          configure with the following switch:
210                          --with-atl-lib-dir=$WDK_HOME\lib\ATL\i386
211],,)
212
213AC_ARG_WITH(mfc-include-dir,
214[  --with-mfc-include-dir       Path to MFC include directory for Windows build.
215                          This switch is mandatory when using VC++ 2008 Express
216                          and configuring with ATL/ActiveX enabled.
217                          You can use the Windows Driver Kit (WDK) and
218                          configure with the following switch:
219                          --with-mfc-include-dir=$WDK_HOME\inc\mfc42
220],,)
221
222AC_ARG_WITH(mfc-lib-dir,
223[  --with-mfc-lib-dir          Path to MFC libraries directory for Windows build.
224                          This switch is mandatory when using VC++ 2008 Express
225                          and configuring with ATL/ActiveX enabled.
226                          You can use the Windows Driver Kit (WDK) and
227                          configure with the following switch:
228                          --with-mfc-lib-dir=$WDK_HOME\lib\Mfc\i386
229],,)
230
231
232AC_ARG_ENABLE(symbols,
233[  --enable-symbols        Include debugging symbols in output.
234                          WARNING - a complete build needs 8 Gb of space and
235                          takes much longer. (enables -g compiler flag)
236
237                          --enable-symbols=SMALL sets the gcc -g1 setting
238                          which is smaller.
239
240                          Enabling symbols disables the stripping of the solver
241                          (--disable-strip-solver).
242],,)
243AC_ARG_ENABLE(strip-solver,
244[  --disable-strip-solver  Disable the stripping of the solver.
245                          By default the solver is stripped unless a build with
246                          debugging symbols (--enable-symbols) is requested.
247
248                          This switch allows to override this setting.
249],,)
250AC_ARG_ENABLE(werror,
251[  --enable-werror         Turn warnings to errors. (Has no effect in modules
252                          where the treating of warnings as errors is disabled
253                          explicitly)
254],,)
255AC_ARG_ENABLE(debug,
256[  --enable-debug          Include debugging symbols from --enable-symbols
257                          plus extra debugging code. Extra large build!
258                          (enables -g compiler flag and dmake debug=true)
259],,)
260AC_ARG_ENABLE(dbgutil,
261[  --enable-dbgutil        Include additional debugging utilities, such as
262                          assertions, object counting, etc. Larger build.
263                          Independent from --enable-debug
264],,)
265AC_ARG_ENABLE(crashdump,
266[  --enable-crashdump      Enable the crashdump feature code.
267],,)
268AC_ARG_ENABLE(cl-standard,
269[  --enable-cl-standard    For Microsoft C/C++ compiler users, use non-optimizing
270                          standard compiler. ( This just disables optimization
271                          options and therefore removes a lot of warnings when
272                          using the cheaper standard compiler. )
273],,)
274AC_ARG_ENABLE(win64,
275[  --enable-win64          Enable building 64 bit OpenOffice on 64 bit Windows, (as
276                          opposed to 32 bit OpenOffice that is usually built there).
277                          This is a temporary option during the transition,
278                          as 64 bit OpenOffice doesn't fully build on Windows yet.
279],,enable_win64=no)
280AC_ARG_ENABLE(win-x64-shellext,
281[  --enable-win-x64-shellext    Enable the build/usage of Windows 64bit shell extensions.
282                          These extensions are used for the system integration on
283              Windows 64bit systems. For example supporting the search
284              in ODF files with the standard Windows search feature.
285],,)
286AC_ARG_ENABLE(gtk,
287[  --disable-gtk           Determines whether to use Gtk+ vclplug on platforms
288                          where Gtk+ is available.
289],,enable_gtk=yes)
290AC_ARG_ENABLE(gstreamer,
291[  --enable-gstreamer      Determines whether to use the GStreamer media
292                          backend on platforms where GStreamer is available.
293],,enable_gstreamer=no)
294AC_ARG_ENABLE(systray,
295[  --disable-systray       Determines whether to build the systray quickstarter.
296],,enable_systray=yes)
297AC_ARG_ENABLE(cairo,
298[  --enable-cairo          Determines whether to use Cairo library on
299                          platforms where Cairo is available.
300],,enable_cairo=no)
301AC_ARG_WITH(system-cairo,
302[  --with-system-cairo      Use Cairo libraries already on system
303],,)
304AC_ARG_ENABLE(cairo-canvas,
305[  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
306                          platforms where Cairo is available.
307],,enable_cairo_canvas=yes)
308AC_ARG_ENABLE(opengl,
309[  --enable-opengl         Determines whether to build the OpenGL 3D slide
310                          transitions component
311],,enable_opengl=no)
312AC_ARG_ENABLE(dbus,
313[  --enable-dbus           Determines whether to enable presentation mode
314                          screensaver control under GNOME via DBUS
315],,enable_dbus=no)
316AC_ARG_ENABLE(gconf,
317[  --disable-gconf         Determines whether to use the GConf support
318],,enable_gconf=yes)
319AC_ARG_ENABLE(gnome-vfs,
320[  --disable-gnome-vfs     Determines whether to use the Gnome Virtual Filing
321                          System on platforms where that VFS is available
322],,enable_gnome_vfs=no)
323AC_ARG_ENABLE(gio,
324[  --enable-gio            Determines whether to use the GIO support
325],,enable_gio=yes)
326AC_ARG_ENABLE(static-gtk,
327[  --enable-static-gtk     Modules that are linked against gtk libraries use
328                          the static libraries instead of the dynamic ones.
329                          (enables -Bstatic linker flag for gtk libraries)
330],,)
331AC_ARG_ENABLE(layout,
332[  --enable-layout         Enable the compilation and use of layout dialogs
333],,)
334AC_ARG_ENABLE(nss-module,
335[  --disable-nss-module    Whether to use the NSS module that is used for xml-security
336],,enable_nss_module=yes)
337AC_ARG_ENABLE(kde,
338[  --enable-kde            Determines whether to use Qt/KDE vclplug on platforms
339                          where Qt and KDE are available.
340],,)
341AC_ARG_ENABLE(kde4,
342[  --enable-kde4            Determines whether to use Qt4/KDE4 vclplug on platforms
343                          where Qt4 and KDE4 are available. May be used with --enable-kde
344                          if you want to support both KDE3 and KDE4.
345],,)
346AC_ARG_ENABLE(rpath,
347[  --disable-rpath         Disable the use of relative paths in shared libraries
348],,)
349AC_ARG_ENABLE(pam,
350[  --disable-pam           Disable pam support.
351],,)
352AC_ARG_ENABLE(pam-link,
353[  --enable-pam-link       link with libpam instead of dynamically open it
354],,)
355AC_ARG_ENABLE(crypt-link,
356[  --disable-crypt-link    disable linking with libcrypt instead of dynamically
357                          open it (needed for ancient GNU/Linux distributions
358                          without crypt()/libcrypt)
359],,enable_crypt_link=yes)
360AC_ARG_ENABLE(xrender-link,
361[  --enable-xrender-link   link with libXrender instead of dynamically open it
362],,)
363AC_ARG_ENABLE(randr,
364[  --disable-randr         disable RandR support in the vcl project
365],,enable_randr=yes)
366AC_ARG_ENABLE(randr-link,
367[  --disable-randr-link    disable linking with libXrandr, instead dynamically
368                           open it at runtime
369],,enable_randr_link=yes)
370AC_ARG_WITH(bundled-extension-blobs,
371[  --with-bundled-extension-blobs Whitespace separated list of files in the tarball directory
372                          that are to be bundled as-is for installation as extensions
373                          at the first program start. Make sure to only bundle extensions
374                          which can be installed without requiring a license dialog
375                          and comply with their distribution requirements by updating the
376                          files LICENSE_aggregated and NOTICE_aggregated accordingly
377],,)
378#AC_ARG_WITH(bundled-prereg-extensions,
379#[  --with-bundled-prereg-extensions Whitespace separated list of files in the tarball directory that
380#                          are to be bundled as pre-registered extensions. Make sure to only bundle
381#                          extensions which can be installed without requiring a license dialog
382#],,)
383AC_ARG_ENABLE(bundled-dictionaries,
384[  --enable-bundled-dictionaries  Download dictionaries (spelling, hyphenation, thesaurus)
385                           according to main/extensions.lst and bundle them. Make sure to
386                           comply with their distribution requirements and update the
387                           files LICENSE_aggregated and NOTICE_aggregated accordingly
388],,enable_bundled_dictionaries=no)
389
390# Remove the following switches when not in release mode.
391AC_ARG_WITH(system-dicts,
392[  --with-system-dicts    Use dictionaries from system paths- Specify
393                         them via --with-{dict,hyph,thes}-path=/path
394                        if you want to override the default ones
395],,)
396AC_ARG_WITH(external-dict-dir,
397[  --with-external-dict-dir Specify external dictionary dir
398],,)
399AC_ARG_WITH(external-hyph-dir,
400[  --with-external-hyph-dir Specify external hyphenation pattern dir
401],,)
402AC_ARG_WITH(external-thes-dir,
403[  --with-external-thes-dir Specify external thesaurus dir
404],,)
405# End of remove.
406
407
408AC_ARG_WITH(system-libs,
409[  --with-system-libs      Use libs already on system -- enables all
410                          --with-system-* flags except
411                          odbc/sane/xrender-header(s)
412],,)
413AC_ARG_WITH(system-headers,
414[  --with-system-headers   Use headers already on system -- enables all
415                          --with-system-* flags for external packages
416                          whose headers are the only entities used i.e.
417                          boost/vigra/odbc/sane/xrender-header(s)
418],,)
419AC_ARG_WITH(system-jars,
420[  --without-system-jars   When building with --with-system-libs, also the
421                          needed jars are expected on the system. Use this to
422                          disable that.
423                          (except for the db case where --with-system-db
424                          *has to* imply using the db.jar from there, too)
425],,)
426AC_ARG_WITH(system-zlib,
427[  --with-system-zlib      Use zlib already on system
428],,)
429AC_ARG_WITH(system-nss,
430[  --with-system-nss       Use NSS already on system
431],,)
432AC_ARG_WITH(system-openssl,
433[  --with-system-openssl   Use OpenSSL already on system
434],,)
435AC_ARG_WITH(system-jpeg,
436[  --with-system-jpeg      Use jpeg already on system
437],,)
438AC_ARG_WITH(system-expat,
439[  --with-system-expat     Use expat already on system
440],,)
441AC_ARG_WITH(system-libxml,
442[  --with-system-libxml    Use libxml already on system
443],,)
444AC_ARG_WITH(static-system-libs,
445[  --with-static-system-libs=LIST
446                          Comma-separated list of system libraries to link
447                          statically, each NAME or NAME:DIR, e.g.
448                          "libxml,libxslt,curl,libiconv:/usr/local".
449                          Supported: libxml, libxslt, curl, libiconv.
450                          NAME alone uses the prefix the matching
451                          --with-system-NAME resolved; libiconv has no such
452                          option, so it always needs the :DIR form. Without
453                          this the archive is used only when the prefix
454                          happens to have no dylib, so a dylib appearing
455                          there silently switches the build to dynamic
456                          linking.
457],,)
458AC_ARG_WITH(system-python,
459[  --with-system-python    Use python already on system
460],,)
461AC_ARG_WITH(system-icu,
462[  --with-system-icu       Use icu already on system
463],,)
464AC_ARG_WITH(system-poppler,
465[  --with-system-poppler   Use poppler already on system
466],,)
467AC_ARG_WITH(system-lucene,
468[  --with-system-lucene    Use lucene already on system
469],,)
470AC_ARG_WITH(lucene-core-jar,
471[  --with-lucene-core-jar=JARFILE   Specify path to jarfile manually ],
472[ LUCENE_CORE_JAR="$withval"
473])
474AC_ARG_WITH(lucene-analyzers-jar,
475[  --with-lucene-analyzers-jar=JARFILE   Specify path to jarfile manually ],
476[ LUCENE_ANALYZERS_JAR="$withval"
477])
478AC_ARG_ENABLE(mysql-connector,
479[  --enable-mysql-connector     enables the build of the MySQL Connector/OOo extension.
480                                This requires access to the MySQL Connector/C (aka libmysql) to be given, too, with
481                                either the --with-system-mysql or --with-libmysql-path option.
482],,)
483AC_ARG_WITH(system-mysql,
484[  --with-system-mysql          Use MySQL libraries already on system, for building the MySQL Connector/OOo extension.
485                                Requires MYSQLCONFIG to point to the mysql_config executable.
486],,)
487AC_ARG_WITH(libmysql-path,
488[  --with-libmysql-path         Use Connector/C (libmysql) installation for building the MySQL Connector/OOo extension.
489
490                                Usage: --with-libmysql-path=<absolute path to your Connector/C installation>
491],,)
492AC_ARG_WITH(system-mysql-cppconn,
493[  --with-system-mysql-cppconn  Use MySQL C++ Connector libraries already on system
494],,)
495AC_ARG_WITH(system-hsqldb,
496[  --with-system-hsqldb    Use hsqldb already on system
497],,)
498AC_ARG_WITH(hsqldb-jar,
499[  --with-hsqldb-jar=JARFILE   Specify path to jarfile manually ],
500[ HSQLDB_JAR="$withval"
501])
502AC_ARG_WITH(system-beanshell,
503[  --with-system-beanshell Use beanshell already on system (default)
504],,)
505AC_ARG_ENABLE(beanshell,
506[  --enable-beanshell     Enable the use of beanshell.
507],,)
508AC_ARG_WITH(beanshell-jar,
509[  --with-beanshell-jar=JARFILE   Specify path to jarfile manually ],
510[ BSH_JAR="$withval"
511])
512AC_ARG_ENABLE(pdfimport,
513[  --enable-pdfimport          enables the build of the PDF Import extension
514],,)
515AC_ARG_ENABLE(wiki-publisher,
516[  --enable-wiki-publisher      enables the build of the Wiki Publisher extension
517],,)
518AC_ARG_WITH(commons-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    else
2023       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.])
2024       BUILD_DMAKE=YES
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(DMAKE_PATH)
2058AC_SUBST(IS_SYSTEM_DMAKE)
2059
2060
2061dnl ===================================================================
2062dnl Search all the common names for GNU or BSD tar
2063dnl ===================================================================
2064AC_MSG_CHECKING([for GNU or compatible BSD tar])
2065for a in $GNUTAR gtar gnutar bsdtar tar; do
2066      $a --version 2> /dev/null | $EGREP "GNU|libarchive" 2>&1 > /dev/null
2067      if test $? -eq 0; then
2068           GNUTAR=$a
2069           break
2070      fi
2071done
2072AC_MSG_RESULT($GNUTAR)
2073if test -z "$GNUTAR"; then
2074    AC_MSG_ERROR([not found. install GNU tar.])
2075fi
2076
2077AC_SUBST(GNUTAR)
2078
2079dnl ===================================================================
2080dnl Search for xz, needed to unpack .tar.xz external dependency tarballs
2081dnl ===================================================================
2082AC_MSG_CHECKING([for xz])
2083for a in $XZ xz; do
2084      $a --version 2> /dev/null > /dev/null
2085      if test $? -eq 0; then
2086           XZ=$a
2087           break
2088      fi
2089done
2090if test -z "$XZ"; then
2091    AC_MSG_RESULT([not found])
2092    AC_MSG_WARN([xz not found - building with a .tar.xz external dependency will fail. Install xz-utils.])
2093    echo "xz not found - building with a .tar.xz external dependency will fail. Install xz-utils." >> warn
2094else
2095    AC_MSG_RESULT($XZ)
2096fi
2097AC_SUBST(XZ)
2098
2099dnl ===================================================================
2100dnl  Test the solaris compiler version
2101dnl ===================================================================
2102if test "$_os" = "SunOS"; then
2103   if test "$CC" = "cc"; then
2104      AC_PATH_PROGS(_cc, cc)
2105      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2106      AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2107      dnl cc -V outputs to standard error!!!!
2108      _sunstudio_string=`$CC -V 2>&1 | $GREP '^cc' | sed -e 's/.* C //'`
2109      _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2110      _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2111      if test "$_sunstudio_major" != "5"; then
2112         AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2113      else
2114         _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" }'`
2115         if test "$_sunstudio_minor" = "false"; then
2116            AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2117         else
2118            dnl compiler will do
2119            AC_MSG_RESULT([checked])
2120         fi
2121      fi
2122   fi
2123fi
2124
2125if test "$GCC" = "yes"; then
2126   AC_MSG_CHECKING( for --hash-style=both linker support )
2127   hash_style_ldflags_save=$LDFLAGS
2128   LDFLAGS="$LDFLAGS -Wl,--hash-style=both"
2129   AC_LINK_IFELSE([AC_LANG_PROGRAM([
2130   #include <stdio.h>
2131   ],[
2132    printf ("hello world\n");
2133   ])], HAVE_LD_HASH_STYLE=TRUE, HAVE_LD_HASH_STYLE=FALSE)
2134   if test "z$HAVE_LD_HASH_STYLE" = "zTRUE"; then
2135     AC_MSG_RESULT( found )
2136   else
2137     AC_MSG_RESULT( not found )
2138   fi
2139   LDFLAGS=$hash_style_ldflags_save
2140fi
2141AC_SUBST(HAVE_LD_HASH_STYLE)
2142
2143dnl ===================================================================
2144dnl  Test the Compaq compiler for OSF1
2145dnl ===================================================================
2146if test "$_os" = "OSF1"; then
2147   if test "$CC" = "cc"; then
2148      AC_PATH_PROGS(_cc, cc)
2149      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2150      AC_MSG_WARN([******* $_cc , $COMPATH])
2151      AC_MSG_CHECKING([the Compaq C compiler version])
2152      dnl cc -V outputs to standard error!!!!
2153      _compaqc_version=`$CC -V 2>&1 | $AWK '{ print $3 }'`
2154      _compaqc_major=`echo $_compaqc_version | $AWK -F. '{ print $1 }'`
2155      if test "$_compaqc_major" != "T6"; then
2156         AC_MSG_ERROR([found version "$_compaqc_version", use version 6 of the Compaq C compiler])
2157      else
2158         dnl compiler will do
2159         AC_MSG_RESULT([checked])
2160      fi
2161   fi
2162fi
2163
2164dnl ===================================================================
2165dnl Check whether there's a Perl version available.
2166dnl ===================================================================
2167if test -z "$with_perl_home"; then
2168   AC_PATH_PROG(PERL, perl)
2169else
2170   if test "$_os" = "WINNT"; then
2171      with_perl_home=`cygpath -u "$with_perl_home"`
2172   fi
2173   _perl_path="$with_perl_home/bin/perl"
2174   if test -x "$_perl_path"; then
2175      PERL=$_perl_path
2176   else
2177      AC_MSG_ERROR([$_perl_path not found])
2178   fi
2179fi
2180
2181dnl ===================================================================
2182dnl Testing for Perl version 5 or greater.
2183dnl $] is the perl version variable, it is returned as an integer
2184dnl ===================================================================
2185if test "$PERL"; then
2186   AC_MSG_CHECKING([the Perl version])
2187   ${PERL} -e "exit($]);"
2188   _perl_version=$?
2189   if test "$_perl_version" -lt 5; then
2190      AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2191   fi
2192   AC_MSG_RESULT([checked (perl $_perl_version)])
2193else
2194   AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2195fi
2196AC_SUBST(PERL)
2197
2198dnl ===================================================================
2199dnl Testing for required Perl modules
2200dnl The list of required Perl modules is documented here:
2201dnl     https://wiki.openoffice.org/wiki/Documentation/Building_Guide_AOO#General_Build_Requirements
2202dnl ===================================================================
2203AC_MSG_CHECKING([for required Perl modules])
2204if `$PERL -e 'use Archive::Zip;
2205              use LWP::UserAgent;
2206              use XML::Parser;
2207              use Digest::SHA;
2208              use Digest::MD5;
2209              use LWP::Protocol::https;'>/dev/null 2>&1`; then
2210    AC_MSG_RESULT([all modules found])
2211else
2212    # Find out which modules are missing.
2213    missing_perl_modules=
2214    if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
2215       missing_perl_modules=Archive::Zip
2216    fi
2217    if ! `$PERL -e 'use LWP::UserAgent;'>/dev/null 2>&1`; then
2218       missing_perl_modules="$missing_perl_modules LWP::UserAgent"
2219    fi
2220    if ! `$PERL -e 'use XML::Parser;'>/dev/null 2>&1`; then
2221       missing_perl_modules="$missing_perl_modules XML::Parser"
2222    fi
2223    if ! `$PERL -e 'use Digest::SHA;'>/dev/null 2>&1`; then
2224       missing_perl_modules="$missing_perl_modules Digest::SHA"
2225    fi
2226    if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
2227       missing_perl_modules="$missing_perl_modules Digest::MD5"
2228    fi
2229    if ! `$PERL -e 'use LWP::Protocol::https;'>/dev/null 2>&1`; then
2230       missing_perl_modules="$missing_perl_modules LWP::Protocol::https"
2231    fi
2232    AC_MSG_ERROR([
2233    The missing Perl modules are: $missing_perl_modules
2234    Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
2235fi
2236
2237dnl ===================================================================
2238dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2239dnl ===================================================================
2240if test "$_os" = "WINNT"; then
2241    if test "$WITH_MINGWIN" != "yes"; then
2242        AC_MSG_CHECKING([for friendly registry keys])
2243        # VS.Net 2003, VS.Net 2005
2244        if test -z "$with_cl_home"; then
2245            vctest=`$OOWINTOOL --msvc-productdir`;
2246            if test -x "$vctest/bin/cl.exe"; then
2247                with_cl_home=$vctest;
2248            fi
2249        else
2250            with_cl_home=`cygpath -u "$with_cl_home"`
2251        fi
2252        AC_MSG_RESULT([done])
2253
2254        dnl ===========================================================
2255        dnl  Which MSVC layout is --with-cl-home pointing at?
2256        dnl ===========================================================
2257        dnl  VS2008 (VC9) keeps cl.exe in VC/bin and its debug-info server
2258        dnl  (mspdb80.dll) somewhere else entirely -- Common7/IDE, or the
2259        dnl  Windows SDK's own bin.  From VS2015 on the toolset is versioned,
2260        dnl  self-contained and reached as
2261        dnl      VC/Tools/MSVC/<toolset>/bin/Host<host>/<target>/cl.exe
2262        dnl  with its headers in <toolset>/include, its import libraries in
2263        dnl  <toolset>/lib/<target>, and mspdb140.dll next to cl.exe.
2264        dnl  Detecting the layout here lets the mspdb hunt and the VC/bin
2265        dnl  logic below stay exactly as they were for VC9.
2266        MSVC_MODERN=
2267        if test -d "$with_cl_home/bin/Hostx86" -o -d "$with_cl_home/bin/Hostx64"; then
2268            MSVC_MODERN="TRUE"
2269        fi
2270
2271        dnl ===========================================================
2272        dnl  Check for mspdb71.dll/mspdb80.dll
2273        dnl ===========================================================
2274        dnl  VC9 and older only: a modern toolset ships its mspdb*.dll in the
2275        dnl  same directory as cl.exe, which the compile actions already have
2276        dnl  on PATH.
2277        if test -z "$MSVC_MODERN"; then
2278        dnl  .NET 2003/5/8 Compiler
2279        if test -n "$with_mspdb_path";then
2280            with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2281        fi
2282        if test -e "$with_mspdb_path/mspdb71.dll" -o -e "$with_mspdb_path/mspdb80.dll"; then
2283            MSPDB_PATH="$with_mspdb_path"
2284        fi
2285        dnl .NET 2003 case
2286        if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb71.dll"; then
2287            MSPDB_PATH="$with_cl_home/../Common7/IDE"
2288        fi
2289        dnl .NET 2005/2008 case
2290        if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2291            MSPDB_PATH="$with_cl_home/../Common7/IDE"
2292        fi
2293        dnl Windows SDK 6.0 case
2294        if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2295            MSPDB_PATH="$with_cl_home/bin"
2296        fi
2297
2298        if test -z "$MSPDB_PATH";then
2299            dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2300            AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2301            AC_PATH_PROG(MSPDB_PATH, mspdb71.dll)
2302            MSPDB_PATH=`dirname "$MSPDB_PATH"`
2303        fi
2304
2305        if test -z "$MSPDB_PATH"; then
2306            AC_MSG_ERROR([You need a mspdb71.dll/mspdb80.dll, make sure it's in the path or use --with-mspdb-path])
2307        fi
2308        MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2309        MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2310        dnl The path needs to be added before cl is called
2311        PATH="$MSPDB_PATH:$PATH"
2312        fi
2313
2314        AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2315        dnl  A modern toolset splits bin/ by HOST and then by TARGET, so the
2316        dnl  cross compiler is a directory rather than VC9's "bin/amd64"
2317        dnl  suffix.  Prefer a Hostx64 tree when one exists: the x64-hosted
2318        dnl  compiler is not confined to a 2GB address space, which matters
2319        dnl  on the larger translation units in this tree.
2320        if test -n "$MSVC_MODERN"; then
2321          if test -d "$with_cl_home/bin/Hostx64"; then
2322            cl_host="Hostx64"
2323          else
2324            cl_host="Hostx86"
2325          fi
2326          case "$build_cpu" in
2327            i?86)
2328              cl_subdirectory="bin/$cl_host/x86"
2329              ;;
2330            x86_64)
2331              if test "$BUILD_WIN64" = "TRUE" ; then
2332                cl_subdirectory="bin/$cl_host/x64"
2333              else
2334                cl_subdirectory="bin/$cl_host/x86"
2335              fi
2336              ;;
2337            *)
2338              AC_MSG_ERROR([Unknown/unsupported Windows CPU $build_cpu.])
2339              ;;
2340          esac
2341        else
2342        case "$build_cpu" in
2343          i?86)
2344            cl_subdirectory="bin"
2345            ;;
2346          x86_64)
2347            if test "$BUILD_WIN64" = "TRUE" ; then
2348              cl_subdirectory="bin/amd64"
2349            else
2350              cl_subdirectory="bin"
2351            fi
2352            ;;
2353          *)
2354            AC_MSG_ERROR([Unknown/unsupported Windows CPU $build_cpu.])
2355            ;;
2356        esac
2357        fi
2358        if test -x "$with_cl_home/$cl_subdirectory/cl.exe"; then
2359            CC="$with_cl_home/$cl_subdirectory/cl.exe"
2360            COMPATH="$with_cl_home"
2361            # This gives us a posix path with 8.3 filename restrictions
2362            CC=`cygpath -d "$CC"`
2363            CC=`cygpath -u "$CC"`
2364            COMPATH=`cygpath -d "$COMPATH"`
2365            COMPATH=`cygpath -u "$COMPATH"`
2366            # Remove /cl.exe from CC case insensitive
2367            AC_MSG_RESULT([found ($CC)])
2368            dnl  VC9 spells it VC/Include, a modern toolset spells it
2369            dnl  <toolset>/include.  NTFS is case-insensitive so either
2370            dnl  name resolves, but only one of the two directories exists.
2371            if test -n "$MSVC_MODERN"; then
2372                export INCLUDE=`cygpath -d "$COMPATH/include"`
2373            else
2374                export INCLUDE=`cygpath -d "$COMPATH/Include"`
2375            fi
2376            dnl  Check which Microsoft C/C++ compiler is found
2377            AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2378dnl      The following find microsoft, matches nn.nn.nnnn then pulls numbers out.
2379            CCTXTVER=`$CC 2>&1 | head -n1`
2380            CCNUMVER=`echo $CCTXTVER | $AWK "/Microsoft/ && /..\\...\\...../ {
2381                            x = match( \\\$0, /..\\...\\...../ )
2382                            CCversion = substr( \\\$0, RSTART, RLENGTH)
2383                            tokencount = split (CCversion,vertoken,\".\")
2384                            for ( i = 1 ; i <= tokencount ; i++ ) {
2385                                printf (\"%04d\",vertoken[[i]] )
2386                            }
2387                            }"`
2388            AC_MSG_RESULT([found Compiler version $CCNUMVER in "$CCTXTVER"])
2389            dnl  COMEX names the compiler generation the rest of the build
2390            dnl  switches on: it selects solenv/inc/wntmsci<COMEX>.mk, the
2391            dnl  CVER define, and the wntmsci<COMEX> output tree.  14 is the
2392            dnl  UCRT generation -- VS2015 (cl 19.00) and everything since,
2393            dnl  which share one CRT and one SDK layout.  There is
2394            dnl  deliberately no value per Visual Studio release: nothing in
2395            dnl  this tree distinguishes VS2017 from VS2022.
2396            if test "$CCNUMVER" -ge "001900000000"; then
2397                COMEX=14
2398                MSVSVER=2015
2399                AC_MSG_RESULT([found a UCRT-generation compiler (VS2015 or newer).])
2400                if test -z "$MSVC_MODERN"; then
2401                    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])
2402                fi
2403            elif test "$CCNUMVER" -ge "001500000000"; then
2404                COMEX=12
2405                MSVSVER=2008
2406                AC_MSG_RESULT([found .NET 2008 / VS 9.0.])
2407                if test -n "$MSVC_MODERN"; then
2408                    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.])
2409                fi
2410            else
2411                AC_MSG_ERROR([Compiler too old. Use Microsoft C/C++ .NET 2008, or a VS2015-or-newer toolset.])
2412            fi
2413        else
2414            AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home.])
2415        fi
2416    else
2417        AC_MSG_CHECKING([the Mingwin32 C++ Compiler])
2418        if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then
2419            AC_MSG_RESULT([found.])
2420            if $CC -dumpspecs | $GREP -q "mno-cygwin"; then
2421                USE_MINGW="cygwin"
2422            else
2423                USE_MINGW="pure-mingw"
2424            fi
2425        else
2426            AC_MSG_ERROR([Mingwin32 C++ Compiler not found.])
2427        fi
2428    fi
2429fi
2430AC_SUBST(COMEX)
2431AC_SUBST(MSPDB_PATH)
2432AC_SUBST(MSVC_MODERN)
2433AC_SUBST(USE_MINGW)
2434
2435dnl ===================================================================
2436dnl  The CLI/.NET language binding, and whether it can be built at all
2437dnl ===================================================================
2438dnl  cli_ure, the .NET language binding.  It was written in Managed
2439dnl  Extensions for C++ -- __gc, S"...", __pin -- which needs /clr:oldSyntax,
2440dnl  and that switch was removed after VS2015; it is now C++/CLI and builds
2441dnl  with either compiler generation.
2442dnl
2443dnl  It is still optional, because it wants a .NET SDK: csc.exe to compile the
2444dnl  C# half and mscoree.lib to link the C++ half.  --disable-cli is for a
2445dnl  Windows box that has a compiler but no SDK.
2446dnl
2447dnl  One variable rather than a test in each consumer: the module makefiles,
2448dnl  the SDK's file lists and its checker all need the same answer, and they
2449dnl  should not each rediscover it.
2450AC_ARG_ENABLE(cli,
2451[  --disable-cli           Do not build the CLI (.NET) language binding.  It
2452                          needs a .NET SDK -- csc.exe and mscoree.lib -- which
2453                          a Windows machine need not have.
2454],,)
2455DISABLE_CLI=
2456if test "$_os" != "WINNT" -o "$enable_cli" = "no" ; then
2457    DISABLE_CLI="TRUE"
2458fi
2459if test "$_os" = "WINNT" ; then
2460    AC_MSG_CHECKING([whether to build the CLI language binding])
2461    if test -z "$DISABLE_CLI" ; then
2462        AC_MSG_RESULT([yes])
2463    else
2464        AC_MSG_RESULT([no, --disable-cli])
2465    fi
2466fi
2467AC_SUBST(DISABLE_CLI)
2468
2469dnl ===================================================================
2470dnl  A host Python, for building the bundled one on Windows
2471dnl ===================================================================
2472dnl  Python 3's PCbuild runs generator scripts under an ALREADY EXISTING
2473dnl  Python.  Its find_python.bat probes only "py -3.10" and "py -3.9"
2474dnl  and then falls back to downloading a private copy through nuget,
2475dnl  which an offline build cannot do.  HOST_PYTHON is the environment
2476dnl  variable that batch file checks before any of that, so naming one
2477dnl  here keeps the build off the network.
2478dnl  AOO_CHECK_HOST_PYTHON(candidate)
2479dnl
2480dnl  Sets HOST_PYTHON to the Windows form of $1 when it is a NATIVE Windows
2481dnl  Python 3.9 or newer, and leaves it empty otherwise.
2482dnl
2483dnl  os.name is the whole point of the test.  A cygwin Python passes the
2484dnl  version check and is still the wrong tool: it reads the native paths
2485dnl  PCbuild hands it -- C:\foo\bar -- as RELATIVE, and prepends its own
2486dnl  working directory, so deepfreeze.py dies on a path with a drive letter
2487dnl  in the middle of it.
2488AC_DEFUN([AOO_CHECK_HOST_PYTHON], [
2489    _pycand="$1"
2490    dnl  cygwin's which reports the name without the .exe that Windows needs
2491    if test -f "$_pycand.exe"; then
2492        _pycand="$_pycand.exe"
2493    fi
2494    if "$_pycand" -Ec "import os, sys; assert os.name == 'nt'; assert sys.version_info[[:2]] >= (3, 9)" >/dev/null 2>&1; then
2495        HOST_PYTHON=`cygpath -m "$_pycand"`
2496    fi
2497])
2498
2499HOST_PYTHON=
2500if test \( "$_os" = "WINNT" \) -a \( -n "$MSVC_MODERN" \) -a \( "$SYSTEM_PYTHON" != "YES" \) ; then
2501    AC_MSG_CHECKING([for a host Python to build the bundled Python with])
2502    if test -n "$with_host_python"; then
2503        AOO_CHECK_HOST_PYTHON([$with_host_python])
2504        if test -z "$HOST_PYTHON"; then
2505            AC_MSG_ERROR([--with-host-python=$with_host_python is not a native Windows Python 3.9 or newer])
2506        fi
2507    else
2508        dnl  which -a, not which: cygwin's own python comes first on PATH and
2509        dnl  is not usable here, so the search has to see past it.
2510        for _pypath in `which -a python3 python py 2>/dev/null`; do
2511            AOO_CHECK_HOST_PYTHON([$_pypath])
2512            if test -n "$HOST_PYTHON"; then
2513                break
2514            fi
2515        done
2516    fi
2517    if test -z "$HOST_PYTHON"; then
2518        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>])
2519    fi
2520    AC_MSG_RESULT([$HOST_PYTHON])
2521fi
2522AC_SUBST(HOST_PYTHON)
2523
2524dnl ===================================================================
2525dnl  The Windows 10 SDK, for a UCRT-generation toolset
2526dnl ===================================================================
2527dnl  This sits here, immediately after the compiler, rather than next to
2528dnl  the Platform SDK check far below, because the SDK now supplies
2529dnl  midl.exe and the Windows Installer tools -- and the .NET/midl hunt
2530dnl  is only a few lines further down.
2531if test \( "$_os" = "WINNT" \) -a \( -n "$MSVC_MODERN" \) ; then
2532    dnl =====================================================================
2533    dnl  A UCRT-generation toolset is paired with the Windows 10/11 SDK,
2534    dnl  whose layout is genuinely different rather than merely renamed.
2535    dnl  Platform SDK v7.0 has one Include/ and one Lib/; the Windows 10 SDK
2536    dnl  has FOUR include trees (ucrt, um, shared, winrt) and TWO lib trees
2537    dnl  (ucrt, um) per installed version, each under a version directory.
2538    dnl  So the single PSDK_HOME/Include and PSDK_HOME/Lib that set_soenv.in
2539    dnl  builds by concatenation become a version plus a fixed set of
2540    dnl  subdirectories -- and that version is what has to be found here.
2541    AC_MSG_CHECKING([for the Windows 10 SDK])
2542    dnl  Every candidate is judged by ONE rule: does it have Include/<ver>/um?
2543    dnl  That is the only cheap thing that separates a Windows 10 SDK from the
2544    dnl  old Platform SDK, which also has an Include/ and a Lib/ -- so a test
2545    dnl  for those two accepts v7.0 and then fails the version scan below with
2546    dnl  a message naming the right directory and the wrong reason.
2547    dnl
2548    dnl  In order: what the user said, what the old option said, what the
2549    dnl  registry says (oowintool knows only pre-Windows-8 keys, so this is
2550    dnl  usually the Platform SDK and usually rejected here), then the two
2551    dnl  documented install roots.
2552    windows_sdk_seen=
2553    WINDOWS_SDK_HOME=
2554    for windows_sdk_try in \
2555        "$with_windows_sdk_home" \
2556        "$with_psdk_home" \
2557        "`$OOWINTOOL --psdk-home 2>/dev/null`" \
2558        "/cygdrive/c/Program Files (x86)/Windows Kits/10" \
2559        "/cygdrive/c/Program Files/Windows Kits/10" ; do
2560        test -z "$windows_sdk_try" && continue
2561        windows_sdk_try=`cygpath -u "$windows_sdk_try" 2>/dev/null || echo "$windows_sdk_try"`
2562        windows_sdk_try=`echo "$windows_sdk_try" | $SED 's:/$::'`
2563        windows_sdk_seen="$windows_sdk_seen
2564        $windows_sdk_try"
2565        if test -n "`ls -d \"$windows_sdk_try\"/Include/*/um 2>/dev/null`"; then
2566            WINDOWS_SDK_HOME="$windows_sdk_try"
2567            break
2568        fi
2569    done
2570    if test -z "$WINDOWS_SDK_HOME"; then
2571        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
2572
2573Use --with-windows-sdk-home to name one explicitly.])
2574    fi
2575    if test -n "$with_psdk_home" -a "$WINDOWS_SDK_HOME" != "`cygpath -u \"$with_psdk_home\" 2>/dev/null`"; then
2576        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.])
2577    fi
2578
2579    dnl  Pick the newest COMPLETE version.  Completeness matters more than it
2580    dnl  sounds: bin/ routinely holds several versions while Include/ and
2581    dnl  Lib/ hold one or two, so selecting on bin/ alone can pick a version
2582    dnl  that has no headers at all.  Compare component by component as
2583    dnl  integers -- a plain string compare sorts 10.0.9xxxx above
2584    dnl  10.0.19041.
2585    if test -n "$with_windows_sdk_version"; then
2586        WINDOWS_SDK_VERSION="$with_windows_sdk_version"
2587    else
2588        windows_sdk_candidates=
2589        for sdkver in `ls "$WINDOWS_SDK_HOME/Include" 2>/dev/null`; do
2590            if test -d "$WINDOWS_SDK_HOME/Include/$sdkver/um" -a -d "$WINDOWS_SDK_HOME/Lib/$sdkver/um"; then
2591                windows_sdk_candidates="$windows_sdk_candidates $sdkver"
2592            fi
2593        done
2594        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 }'`
2595    fi
2596    if test -z "$WINDOWS_SDK_VERSION"; then
2597        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.])
2598    fi
2599    AC_MSG_RESULT([$WINDOWS_SDK_VERSION in $WINDOWS_SDK_HOME])
2600
2601    dnl  PSDK_HOME stays the SDK root, so everything downstream that only
2602    dnl  wants a base directory keeps working.  What changes is that the
2603    dnl  include and lib paths are built from the version as well; that
2604    dnl  happens in set_soenv.in.
2605    PSDK_HOME="$WINDOWS_SDK_HOME"
2606
2607    windows_sdk_um="$WINDOWS_SDK_HOME/Include/$WINDOWS_SDK_VERSION/um"
2608    if test ! -f "$windows_sdk_um/adoint.h" -o ! -f "$windows_sdk_um/sqlucode.h" -o ! -f "$windows_sdk_um/usp10.h"; then
2609        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.])
2610    fi
2611    windows_sdk_lib="$WINDOWS_SDK_HOME/Lib/$WINDOWS_SDK_VERSION"
2612    if test ! -f "$windows_sdk_lib/ucrt/x86/ucrt.lib" -a ! -f "$windows_sdk_lib/ucrt/x64/ucrt.lib"; then
2613        AC_MSG_ERROR([$windows_sdk_lib has no ucrt import library for either architecture.])
2614    fi
2615
2616    dnl  The Windows Installer tools moved into bin/<version>/<arch>.  They
2617    dnl  run on the build machine, so x86 is the right choice whatever is
2618    dnl  being built.
2619    WINDOWS_SDK_BINDIR="$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_VERSION/x86"
2620    for sdktool in msiinfo msidb uuidgen msitran; do
2621        if test ! -x "$WINDOWS_SDK_BINDIR/$sdktool.exe"; then
2622            AC_MSG_ERROR([$sdktool.exe is missing from $WINDOWS_SDK_BINDIR. Install the "MSI Tools" SDK component.])
2623        fi
2624    done
2625    WINDOWS_VISTA_PSDK=TRUE
2626fi
2627AC_SUBST(WINDOWS_SDK_HOME)
2628AC_SUBST(WINDOWS_SDK_VERSION)
2629AC_SUBST(WINDOWS_SDK_BINDIR)
2630
2631dnl ===================================================================
2632dnl  MSBuild, for dependencies that ship Visual Studio project files
2633dnl ===================================================================
2634dnl  vcbuild.exe built .vcproj files and shipped with VS2005 and VS2008
2635dnl  only; VS2010 replaced it with MSBuild and changed the project format
2636dnl  to .vcxproj at the same time, so this is not a renamed binary but a
2637dnl  different tool reading different files.  CoinMP is the one bundled
2638dnl  dependency that needs it.
2639dnl
2640dnl  MSBuild lives beside the toolset rather than inside it, and is not on
2641dnl  PATH in a BuildTools installation, so it is looked for relative to
2642dnl  --with-cl-home: <VS>/VC/Tools/MSVC/<ver> puts the VS root four levels
2643dnl  up.  Only searched for a UCRT-generation toolset -- VC9 uses vcbuild
2644dnl  and must not be given an MSBuild it would not know what to do with.
2645MSBUILD_PATH=
2646if test "$_os" = "WINNT" -a -n "$MSVC_MODERN"; then
2647    AC_MSG_CHECKING([for MSBuild])
2648    if test -n "$with_msbuild_path"; then
2649        MSBUILD_PATH=`cygpath -u "$with_msbuild_path"`
2650    else
2651        for msbuild_try in \
2652            "$with_cl_home/../../../../MSBuild/Current/Bin" \
2653            "$with_cl_home/../../../../MSBuild/15.0/Bin" ; do
2654            if test -x "$msbuild_try/MSBuild.exe"; then
2655                MSBUILD_PATH="$msbuild_try"
2656                break
2657            fi
2658        done
2659        if test -z "$MSBUILD_PATH"; then
2660            AC_PATH_PROG(MSBUILD_EXE, MSBuild.exe)
2661            if test -n "$MSBUILD_EXE"; then
2662                MSBUILD_PATH=`dirname "$MSBUILD_EXE"`
2663            fi
2664        fi
2665    fi
2666    if test -z "$MSBUILD_PATH" -o ! -x "$MSBUILD_PATH/MSBuild.exe"; then
2667        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.])
2668    fi
2669    dnl  Convert to a posix path with 8.3 names, as the other tool paths are
2670    MSBUILD_PATH=`cygpath -d "$MSBUILD_PATH"`
2671    MSBUILD_PATH=`cygpath -u "$MSBUILD_PATH"`
2672    AC_MSG_RESULT([$MSBUILD_PATH])
2673fi
2674AC_SUBST(MSBUILD_PATH)
2675
2676dnl  The PlatformToolset MSBuild should retarget a project to.  CoinMP's
2677dnl  MSBuild projects are v10, i.e. they name toolset v100 (VS2010), which is
2678dnl  not installed -- so the toolset has to be passed on the command line or
2679dnl  the build fails with "the build tools for v100 cannot be found".
2680dnl
2681dnl  It is derived from the toolset directory name rather than from cl's
2682dnl  version, because that name IS the toolset version and needs no parsing
2683dnl  of the four-part number configure builds elsewhere: 14.29.30133 is v142,
2684dnl  14.16.x is v141, 14.0x is v140, 14.3x is v143.
2685VCTOOLSET=
2686if test "$_os" = "WINNT" -a -n "$MSVC_MODERN"; then
2687    AC_MSG_CHECKING([which MSBuild PlatformToolset to use])
2688    vctoolset_ver=`basename "$with_cl_home"`
2689    vctoolset_major=`echo "$vctoolset_ver" | cut -d. -f1`
2690    vctoolset_minor=`echo "$vctoolset_ver" | cut -d. -f2`
2691    if test -n "$vctoolset_major" -a -n "$vctoolset_minor"; then
2692        VCTOOLSET="v$vctoolset_major`expr $vctoolset_minor / 10`"
2693    fi
2694    if test -z "$VCTOOLSET"; then
2695        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])
2696    fi
2697    AC_MSG_RESULT([$VCTOOLSET])
2698fi
2699AC_SUBST(VCTOOLSET)
2700
2701dnl Compiler detection, logic from setsoenv.in
2702case "$build_os" in
2703    *cygwin*)
2704        if test "$WITH_MINGWIN" = "yes"; then
2705            COM="GCC";
2706        else
2707            COM="MSC";
2708        fi;;
2709    os2*)
2710        COM="GCC";;
2711    netbsd | kfreebsd* | freebsd* | linux* | darwin* )
2712        if $CC --version 2>&1 | $GREP clang > /dev/null ; then
2713            COM="CLANG";
2714        else
2715            COM="GCC";
2716        fi;;
2717    solaris*)
2718        case "$CC" in
2719            *gcc*)  COM="GCC";;
2720            *)  COM="C52";;
2721        esac;;
2722    osf | aix*)
2723        COM="CXX";;
2724    *) AC_MSG_ERROR([Unable to decipher compiler for $build_os]);;
2725esac
2726AC_SUBST(COM)
2727
2728dnl  Decode the compiler version. Logic from main/solenv/inc/tg_compv.mk.
2729case $COM in
2730    GCC)
2731        CCVER=`${CC} -dumpfullversion -dumpversion 2>&1`;
2732        CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2733        if test "${CCNUMVER}" -ge 000300000001; then
2734            COMID="gcc3";
2735            COMNAME="gcc3";
2736        elif test "${CCNUMVER}" -ge 000300000001; then
2737            COMID="GCC";
2738            COMNAME="gcc2";
2739        else
2740            AC_MSG_ERROR([gcc too old]);
2741        fi
2742        ;;
2743    CLANG)
2744        CCVER=`${CC} --version 2>&1 | head -n1 | sed -e"s/.*version //" -e"s/ .*//"`;
2745        CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2746        # The version in tg_compv.mk for darwin does not look correct
2747        # CCNUMVER = `echo ${CCVER} | sed -e"s/\.//";
2748        case "$build_os" in
2749            darwin*) # Mac OS X
2750                COMID="s5abi";
2751                COMNAME="s5abi";
2752                ;;
2753            *)
2754                COMID="gcc3";
2755                COMNAME="gcc3";
2756                ;;
2757        esac
2758        ;;
2759    MSC)
2760        CCVER=`${CC} 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
2761        CCNUMVER=`${CC} 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2762        if test "${CCNUMVER}" -ge 001200000000; then
2763            COMID="MSC";
2764            case "$build_cpu" in
2765              i?86)
2766                COMNAME="msci";
2767                ;;
2768              x86_64)
2769                if test "$BUILD_WIN64" = "TRUE" ; then
2770                  COMNAME="mscx";
2771                else
2772                  COMNAME="msci";
2773                fi
2774                ;;
2775              *)
2776                AC_MSG_ERROR([Unknown/unsupported Windows CPU $build_cpu.])
2777                ;;
2778            esac
2779        else
2780            AC_MSG_ERROR([MSC compiler too old]);
2781        fi
2782        ;;
2783    C55 | C54 | C52 | C40 | sunpro)
2784        CCVER=`${CC} -V 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
2785        CCNUMVER=`${CC} -V 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2786        if test "${CCNUMVER}" -ge 00050002; then
2787            COMID="C52";
2788            COMNAME="sunpro5";
2789        else
2790            AC_MSG_ERROR([Sun compiler too old]);
2791        fi
2792        ;;
2793    *)
2794        AC_MSG_ERROR([Unable to detect compiler version]);;
2795esac
2796AC_SUBST(CCVER)
2797AC_SUBST(CCNUMVER)
2798AC_SUBST(COMID)
2799AC_SUBST(COMNAME)
2800
2801if test "$_os" = "FreeBSD"; then
2802    FBSD_GCC_RPATH=
2803    if test "$COM" = "GCC"; then
2804        rpath=`$CC --print-file-name libstdc++.so`
2805        rpath=`realpath $rpath`
2806        rpath=`dirname $rpath`
2807    if test "$rpath" != "/usr/lib" ; then
2808            FBSD_GCC_RPATH="-Wl,-rpath=$rpath"
2809    fi
2810    fi
2811    AC_SUBST(FBSD_GCC_RPATH)
2812fi
2813
2814if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "GNU"; then
2815    AC_MSG_CHECKING( for --undefined-version linker support )
2816    undefined_version_ldflags_save=$LDFLAGS
2817    LDFLAGS="$LDFLAGS -Wl,--undefined-version"
2818    AC_LINK_IFELSE([AC_LANG_PROGRAM([
2819    #include <stdio.h>
2820    ],[
2821     printf ("hello world\n");
2822    ])], HAVE_LD_UNDEFINED_VERSION=TRUE, HAVE_LD_UNDEFINED_VERSION=FALSE)
2823    if test "z$HAVE_LD_UNDEFINED_VERSION" = "zTRUE"; then
2824        AC_MSG_RESULT( found )
2825    else
2826        AC_MSG_RESULT( not found )
2827    fi
2828    LDFLAGS=$undefined_version_ldflags_save
2829    AC_SUBST(HAVE_LD_UNDEFINED_VERSION)
2830fi
2831
2832dnl ===================================================================
2833dnl  .NET needs special treatment
2834dnl ===================================================================
2835if test "$_os" = "WINNT"; then
2836if test "$WITH_MINGWIN" = "yes" || test "$COMEX" -ge "10"; then
2837    dnl Check midl.exe
2838    AC_PATH_PROG(MIDL_PATH, midl.exe)
2839    if test -n "$MIDL_PATH";then
2840        MIDL_PATH=`dirname "$MIDL_PATH"`
2841    fi
2842    if test -n "$with_midl_path";then
2843        with_midl_path=`cygpath -u "$with_midl_path"`
2844    fi
2845    if test -x "$with_midl_path/midl.exe"; then
2846        MIDL_PATH="$with_midl_path"
2847    fi
2848    if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
2849        MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
2850    fi
2851    if test -z "$MIDL_PATH" ; then
2852      vstest=`$OOWINTOOL --msvs-productdir`;
2853      if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
2854          MIDL_PATH="$vstest/Common7/Tools/Bin"
2855      fi
2856    fi
2857    if test -z "$MIDL_PATH" ; then
2858        psdktest=`$OOWINTOOL --psdk-home`
2859        if test -x "$psdktest/Bin/midl.exe" ; then
2860            MIDL_PATH="$psdktest/Bin"
2861        fi
2862    fi
2863    dnl  On the Windows 10 SDK midl.exe sits with the other SDK tools in
2864    dnl  bin/<version>/<arch>.  This is preferred over what the searches above
2865    dnl  turn up -- an AC_PATH_PROG hit from an ambient vcvars environment is
2866    dnl  exactly the kind of midl/headers mismatch that surfaces much later as
2867    dnl  output the compiler cannot parse -- but NOT over --with-midl-path,
2868    dnl  which is the user saying which one they mean.
2869    if test -z "$with_midl_path" \
2870         -a -n "$WINDOWS_SDK_BINDIR" -a -x "$WINDOWS_SDK_BINDIR/midl.exe" ; then
2871        MIDL_PATH="$WINDOWS_SDK_BINDIR"
2872    fi
2873    if test ! -x "$MIDL_PATH/midl.exe"; then
2874        AC_MSG_ERROR([midl.exe not found. Make sure it's in the path or use --with-midl-path])
2875    fi
2876    # Convert to posix path with 8.3 filename restrictions ( No spaces )
2877    MIDL_PATH=`cygpath -d "$MIDL_PATH"`
2878    MIDL_PATH=`cygpath -u "$MIDL_PATH"`
2879
2880    dnl Check csc.exe
2881    AC_PATH_PROG(CSC_PATH, csc.exe)
2882    if test -n "$CSC_PATH";then
2883        CSC_PATH=`dirname "$CSC_PATH"`
2884    fi
2885    if test -n "$with_csc_path";then
2886        with_csc_path=`cygpath -u "$with_csc_path"`
2887    fi
2888    if test -x "$with_csc_path/csc.exe"; then
2889        CSC_PATH="$with_csc_path"
2890    else
2891       csctest=`$OOWINTOOL --csc-compilerdir`;
2892       if test -x "$csctest/csc.exe"; then
2893          CSC_PATH="$csctest"
2894       fi
2895    fi
2896    dnl  Which CLR the C# half must target is decided by the C++ half, and a
2897    dnl  UCRT-generation compiler settles it: /clr has not emitted CLR 2
2898    dnl  assemblies since VS2010.  Mixing the two does not fail at build time,
2899    dnl  it fails when the process loads them --
2900    dnl
2901    dnl    System.BadImageFormatException: ... The assembly was created by a
2902    dnl    runtime that is newer than the currently loaded runtime
2903    dnl
2904    dnl  oowintool goes looking for the v2 csc on purpose, which is right for
2905    dnl  VC9 and wrong here, so take the newest compiler beside it instead.
2906    dnl  This overrides an explicit --with-csc-path, because the constraint is
2907    dnl  the compiler's and not a preference; hence the warning.
2908    if test -n "$MSVC_MODERN" -a -z "$DISABLE_CLI"; then
2909        AC_MSG_CHECKING([for a csc.exe matching the C++ compiler's CLR])
2910        case "$CSC_PATH" in
2911        *[[Vv]]1.*|*[[Vv]]2.*|*[[Vv]]3.*)
2912            _csc_root=`dirname "$CSC_PATH"`
2913            _csc_new=
2914            for _c in `ls -d "$_csc_root"/[[Vv]]4* 2>/dev/null | sort -r`; do
2915                if test -x "$_c/csc.exe"; then
2916                    _csc_new="$_c"
2917                    break
2918                fi
2919            done
2920            if test -n "$_csc_new"; then
2921                if test -n "$with_csc_path"; then
2922                    AC_MSG_WARN([--with-csc-path points at a CLR 2 compiler; using $_csc_new instead, because this C++ compiler emits CLR 4 assemblies])
2923                fi
2924                CSC_PATH="$_csc_new"
2925                AC_MSG_RESULT([$CSC_PATH])
2926            else
2927                AC_MSG_RESULT([none found])
2928                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.])
2929            fi
2930            ;;
2931        *)
2932            AC_MSG_RESULT([$CSC_PATH])
2933            ;;
2934        esac
2935    fi
2936    if test ! -x "$CSC_PATH/csc.exe" -a -z "$DISABLE_CLI"; then
2937        AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path, or configure --disable-cli])
2938    fi
2939    # Convert to posix path with 8.3 filename restrictions ( No spaces )
2940    CSC_PATH=`cygpath -d "$CSC_PATH"`
2941    CSC_PATH=`cygpath -u "$CSC_PATH"`
2942
2943    dnl Check mscoree.lib / .NET Frameworks dir
2944    dnl For VS2003/2005 $with_frame_home has to point to the directory with lib/mscoree.lib.
2945       AC_MSG_CHECKING(.NET Framework)
2946        if test -n "$with_frame_home"; then
2947        with_frame_home=`cygpath -u "$with_frame_home"`
2948        fi
2949        if test -f "$with_frame_home/lib/mscoree.lib"; then
2950            FRAME_HOME="$with_frame_home"
2951        fi
2952        if test -z "$FRAME_HOME" -a -e "$with_cl_home/../SDK/v1.1/lib/mscoree.lib"; then
2953            FRAME_HOME="$with_cl_home/../SDK/v1.1"
2954        fi
2955        if test -z "$FRAME_HOME" ; then
2956          frametest=`$OOWINTOOL --dotnetsdk-dir`
2957          if test -f "$frametest/lib/mscoree.lib"; then
2958             FRAME_HOME="$frametest"
2959          else
2960             frametest=`$OOWINTOOL --psdk-home`
2961             if test -f "$frametest/lib/mscoree.lib"; then
2962                FRAME_HOME="$frametest"
2963             fi
2964          fi
2965        fi
2966        if test ! -f "$FRAME_HOME/lib/mscoree.lib" -a -z "$DISABLE_CLI"; then
2967        AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-frame-home, or configure --disable-cli])
2968        fi
2969        AC_MSG_RESULT(found)
2970    # Convert to posix path with 8.3 filename restrictions ( No spaces )
2971    FRAME_HOME=`cygpath -d "$FRAME_HOME"`
2972    FRAME_HOME=`cygpath -u "$FRAME_HOME"`
2973fi
2974AC_SUBST(MIDL_PATH)
2975AC_SUBST(CSC_PATH)
2976AC_SUBST(FRAME_HOME)
2977fi
2978
2979dnl ===================================================================
2980dnl Check if stdc headers are available excluding Windows.
2981dnl ===================================================================
2982if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2983   m4_warn([obsolete],
2984[The preprocessor macro 'STDC_HEADERS' is obsolete.
2985  Except in unusual embedded environments, you can safely include all
2986  C89 headers unconditionally.])dnl
2987# Autoupdate added the next two lines to ensure that your configure
2988# script's behavior did not change.  They are probably safe to remove.
2989AC_CHECK_INCLUDES_DEFAULT
2990AC_PROG_EGREP
2991
2992fi
2993
2994dnl ===================================================================
2995dnl Find pre-processors.
2996dnl ===================================================================
2997if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2998   AC_PROG_CXXCPP
2999
3000dnl Check whether there's a C pre-processor.
3001dnl ===================================================================
3002dnl When using SunStudio compiler, there is a bug with the cc
3003dnl preprocessor, so use CC preprocessor as the cc preprocessor
3004dnl See Issuezilla #445.
3005dnl ===================================================================
3006   if test "$_os" = "SunOS"; then
3007      CPP=$CXXCPP
3008   else
3009      AC_PROG_CPP
3010   fi
3011fi
3012
3013AC_CHECK_SIZEOF(long)
3014SIZEOF_LONG=$ac_cv_sizeof_long
3015AC_SUBST(SIZEOF_LONG)
3016AC_C_BIGENDIAN
3017WORDS_BIGENDIAN=$ac_cv_c_bigendian
3018AC_SUBST(WORDS_BIGENDIAN)
3019
3020dnl Check for large file support
3021AC_SYS_LARGEFILE
3022if test -n "$ac_cv_sys_file_offset_bits"; then
3023   LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
3024fi
3025if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
3026   LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
3027fi
3028AC_SUBST(LFS_CFLAGS)
3029
3030dnl ===================================================================
3031dnl Check if valgrind.h is available
3032dnl ===================================================================
3033if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
3034   dnl Test $prefix (currently only testing for /usr and /usr/local)
3035   dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
3036   VALGRIND_CFLAGS=""
3037   prev_cppflags=$CPPFLAGS
3038   if test -z "$VALGRIND_CFLAGS"; then
3039      CPPFLAGS="-I/usr/include/valgrind"
3040      AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
3041   fi
3042   if test -z "$VALGRIND_CFLAGS"; then
3043      CPPFLAGS="-I/usr/local/include/valgrind"
3044      AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
3045   fi
3046   if test -n "$VALGRIND_CFLAGS"; then
3047      CPPFLAGS=$VALGRIND_CFLAGS
3048      AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
3049   fi
3050   CPPFLAGS=$prev_cppflags
3051fi
3052AC_SUBST([VALGRIND_CFLAGS])
3053
3054dnl ===================================================================
3055dnl Check if cups/cups.h is available
3056dnl ===================================================================
3057if test "$test_cups" = "yes" -a "$ENABLE_CUPS" = "TRUE" ; then
3058    AC_CHECK_HEADER(cups/cups.h, [],
3059                    [AC_MSG_ERROR([cups/cups.h could not be found. libcupsys2-dev or cups???-devel missing?])], [])
3060fi
3061
3062dnl ===================================================================
3063dnl Check if PAM/pam_appl.h is available on Linux or FreeBSD
3064dnl ===================================================================
3065if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "GNU"; then
3066  AC_MSG_CHECKING([whether to enable pam support])
3067  if test -z "$enable_pam" || test "$enable_pam" != "no"; then
3068    AC_MSG_RESULT([yes])
3069    PAM=YES
3070    AC_CHECK_HEADER(security/pam_appl.h, [],
3071                    [AC_MSG_ERROR([pam_appl.h could not be found. libpam-dev or pam-devel missing?])], [])
3072    AC_MSG_CHECKING([whether to link to libpam])
3073    if test -n "$enable_pam_link" -a "$enable_pam_link" != "no"; then
3074      AC_MSG_RESULT([yes])
3075      PAM_LINK=YES
3076      AC_CHECK_LIB(pam, pam_start, [],
3077          [AC_MSG_ERROR(libpam not found or functional)], [])
3078    else
3079      AC_MSG_RESULT([no, dynamically open it])
3080      PAM_LINK=NO
3081    fi
3082  else
3083    AC_MSG_RESULT([no])
3084    PAM=NO
3085    PAM_LINK=NO
3086    dnl check getspnam_r for needed args (4 or 5)
3087    AX_FUNC_WHICH_GETSPNAM_R
3088  fi
3089fi
3090AC_SUBST(PAM)
3091AC_SUBST(NEW_SHADOW_API)
3092AC_SUBST(PAM_LINK)
3093
3094if test "$_os" = "Linux"; then
3095    AC_MSG_CHECKING([whether to link to libcrypt])
3096    if test -n "$enable_crypt_link" -a "$enable_crypt_link" != "no"; then
3097        AC_MSG_RESULT([yes])
3098        CRYPT_LINK=YES
3099        AC_CHECK_LIB(crypt, crypt, [],
3100            [AC_MSG_ERROR(libcrypt not found or functional)], [])
3101    else
3102        AC_MSG_RESULT([no, dynamically open it])
3103        CRYPT_LINK=NO
3104    fi
3105fi
3106AC_SUBST(CRYPT_LINK)
3107
3108dnl ===================================================================
3109dnl Testing for c++ compiler and version...
3110dnl ===================================================================
3111if test -n "$with_gcc_home"; then
3112   if test -z "$CXX"; then
3113      CXX="$with_gcc_home/bin/g++"
3114   fi
3115fi
3116
3117if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
3118   if test -e "$CC"; then
3119      CXX="$CC"
3120   fi
3121fi
3122
3123dnl Autoconf 2.53 can do this test for cl.exe, 2.13 can't!
3124if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
3125   AC_PROG_CXX
3126fi
3127
3128dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
3129if test "$GXX" = "yes"; then
3130   AC_MSG_CHECKING([the GNU C++ compiler version])
3131
3132   _gpp_version=`$CXX -dumpversion`
3133   _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
3134
3135   AC_MSG_RESULT([checked (g++ $_gpp_version)])
3136
3137   if test "$_gpp_majmin" = "304"; then
3138      AC_MSG_CHECKING([whether $CXX has the enum bug])
3139AC_RUN_IFELSE([AC_LANG_SOURCE([[
3140extern "C" void abort (void);
3141extern "C" void exit (int status);
3142
3143enum E { E0, E1, E2, E3, E4, E5 };
3144
3145void
3146test (enum E e)
3147{
3148  if (e == E2 || e == E3 || e == E1)
3149  exit (1);
3150}
3151
3152int
3153main (void)
3154{
3155  test (E4);
3156  test (E5);
3157  test (E0);
3158  return 0;
3159}
3160]])],[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])],[])
3161   fi
3162fi
3163
3164dnl ===================================================================
3165dnl Set the mingw runtime library include directories
3166dnl ===================================================================
3167if test "$WITH_MINGWIN" = "yes"; then
3168   AC_MSG_CHECKING([for mingwin runtime include path])
3169   cat >conftest.$ac_ext <<_ACEOF
3170#include <stddef.h>
3171#include <bits/c++config.h>
3172_ACEOF
3173   _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`
3174   rm conftest.$ac_ext
3175   if test -n "$_mingw_lib_include_path"; then
3176      _temp=""
3177      for a in $_mingw_lib_include_path
3178         do
3179            a=`cygpath -d "$a"`
3180            _temp="$_temp "`cygpath -u "$a"`
3181         done
3182      _mingw_lib_include_path=$_temp
3183   fi
3184   if test -z "$_mingw_lib_include_path"; then
3185      _mingw_lib_include_path="NO_LIB_INCLUDE"
3186      AC_MSG_RESULT([no mingwin runtime includes])
3187   else
3188      AC_MSG_RESULT([$_mingw_lib_include_path])
3189   fi
3190  MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
3191  AC_SUBST(MINGW_LIB_INCLUDE_PATH)
3192dnl mingw gcc 4.4.0 needs backward in include path to use hash_set/hash_map
3193   AC_MSG_CHECKING([for mingwin c++ backward include path])
3194   cat >conftest.$ac_ext <<_ACEOF
3195#include <hash_set>
3196_ACEOF
3197   _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`
3198   rm conftest.$ac_ext
3199   if test -n "$_mingw_backward_include_path"; then
3200      _mingw_backward_include_path=`cygpath -d $_mingw_backward_include_path`
3201      _mingw_backward_include_path=`cygpath -u $_mingw_backward_include_path`
3202      AC_MSG_RESULT([$_mingw_backward_include_path])
3203   else
3204      _mingw_backward_include_path="NO_BACKWARD_INCLUDE"
3205      AC_MSG_RESULT([no mingwin c++ backward includes])
3206   fi
3207  MINGW_BACKWARD_INCLUDE_PATH="$_mingw_backward_include_path"
3208  AC_SUBST(MINGW_BACKWARD_INCLUDE_PATH)
3209  mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
3210  MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
3211  AC_MSG_CHECKING([whether to use dynamic libgcc])
3212  if test -e "$MINGW_CLIB_DIR/libgcc_s.a"; then
3213    AC_MSG_CHECKING([dynamic libgcc name])
3214    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'`
3215    MINGW_GCCDLL=`cd $COMPATH/bin && ls $MINGW_GCCDLL_pattern 2>/dev/null`
3216    if test -n "$MINGW_GCCDLL"; then
3217        MINGW_SHARED_GCCLIB=YES
3218        AC_MSG_RESULT([use $MINGW_GCCDLL])
3219    else
3220        AC_MSG_RESULT([no])
3221    fi
3222  else
3223    AC_MSG_RESULT([no])
3224  fi
3225  if test -e "$MINGW_CLIB_DIR/libgcc_eh.a"; then
3226      MINGW_GCCLIB_EH=YES
3227  fi
3228  AC_MSG_CHECKING([whether to use dynamic libstdc++])
3229  MINGW_SHARED_LIBSTDCPP=
3230  if test -e "$MINGW_CLIB_DIR/libstdc++_s.a" ; then
3231    MINGW_SHARED_LIBSTDCPP=stdc++_s
3232  fi
3233  if test -e "$MINGW_CLIB_DIR/libstdc++.dll.a" ; then
3234    MINGW_SHARED_LIBSTDCPP=stdc++.dll
3235  fi
3236  if test -n "$MINGW_SHARED_LIBSTDCPP" ; then
3237    AC_MSG_CHECKING([dynamic libstdc++ name])
3238    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'`
3239    MINGW_GXXDLL=`cd $COMPATH/bin && ls $MINGW_GXXDLL_pattern 2>/dev/null`
3240    if test -n "$MINGW_GXXDLL"; then
3241        MINGW_SHARED_LIBSTDCPP=-l$MINGW_SHARED_LIBSTDCPP
3242        MINGW_SHARED_GXXLIB=YES
3243        AC_MSG_RESULT([use $MINGW_GXXDLL])
3244    else
3245        MINGW_SHARED_LIBSTDCPP=
3246        AC_MSG_RESULT([no])
3247    fi
3248  else
3249    AC_MSG_RESULT([no])
3250  fi
3251  MINGW_CLIB_DIR=`cygpath $MINGW_CLIB_DIR`
3252  AC_SUBST(MINGW_CLIB_DIR)
3253  AC_SUBST(MINGW_SHARED_GCCLIB)
3254  AC_SUBST(MINGW_GCCLIB_EH)
3255  AC_SUBST(MINGW_SHARED_GXXLIB)
3256  AC_SUBST(MINGW_SHARED_LIBSTDCPP)
3257  AC_SUBST(MINGW_GCCDLL)
3258  AC_SUBST(MINGW_GXXDLL)
3259fi
3260
3261dnl ===================================================================
3262dnl Extra checking for the SUN OS compiler
3263dnl ===================================================================
3264if test "$_os" = "SunOS"; then
3265   dnl SunStudio C++ compiler packaged with SunStudio C compiler
3266   if test "$CC" = "cc"; then
3267   AC_MSG_CHECKING([SunStudio C++ Compiler])
3268      if test "$CXX" != "CC"; then
3269         AC_MSG_WARN([SunStudio C++ was not found])
3270         echo "SunStudio C++ was not found" >> warn
3271      else
3272         AC_MSG_RESULT([checked])
3273      fi
3274   fi
3275fi
3276dnl ===================================================================
3277dnl Extra checking for the OSF compiler
3278dnl ===================================================================
3279if test "$_os" = "OSF1"; then
3280   AC_MSG_CHECKING([Compaq C++ compiler version])
3281   dnl cxx -V outputs to standard error!!!!
3282   _compaqcxx_version=`$CXX -V 2>&1 | $AWK '{ print $3 }'`
3283   _compaqcxx_major=`echo $_compaqcxx_version | $AWK -F. '{ print $1 }'`
3284   if test "$_compaqcxx_major" != "V6"; then
3285      AC_MSG_WARN([found version "$_compaqc_version", use version 6 of the Compaq C++ compiler])
3286      echo "found version $_compaqc_version, use version 6 of the Compaq C++ compiler" >> warn
3287   else
3288      dnl compiler will do
3289      AC_MSG_RESULT([checked])
3290   fi
3291fi
3292
3293dnl *************************************************************
3294dnl Testing for exception handling - dwarf2 or sjlj exceptions...
3295dnl *************************************************************
3296AC_MSG_CHECKING([exception type])
3297AC_LANG_PUSH([C++])
3298if test "$WITH_MINGWIN" = "yes"; then
3299  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
3300
3301extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
3302
3303    ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
3304  ])
3305fi
3306
3307AC_MSG_RESULT($exceptions_type)
3308AC_LANG_POP([C++])
3309EXCEPTIONS="$exceptions_type"
3310AC_SUBST(EXCEPTIONS)
3311
3312dnl ===================================================================
3313dnl Checks for what the default STL should be
3314dnl ===================================================================
3315   AC_MSG_CHECKING([what the default STL should be])
3316   DEFAULT_TO_STLPORT="no"
3317if test "$WITH_STLPORT" != "no"; then
3318   AC_MSG_ERROR([Option --with-stlport is no longer available.])
3319else
3320   USE_SYSTEM_STL="YES"
3321fi
3322
3323AC_SUBST(USE_SYSTEM_STL)
3324
3325dnl ===================================================================
3326dnl visibility feature
3327dnl ===================================================================
3328if test "$GCC" = "yes"; then
3329   AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
3330   save_CFLAGS=$CFLAGS
3331   CFLAGS="$CFLAGS -fvisibility=hidden"
3332   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
3333   CFLAGS=$save_CFLAGS
3334   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3335      AC_MSG_RESULT([yes])
3336   else
3337      AC_MSG_RESULT([no])
3338   fi
3339fi
3340
3341# ===================================================================
3342# use --ccache-skip?
3343# ===================================================================
3344dnl used to escape compiler options for ccache that otherwise prevent
3345dnl caching of the results (like "-x objective-c++" for Mac)
3346AC_MSG_CHECKING([whether we are allowed and able to use --ccache-skip])
3347if test "$_os" != "Darwin" ; then
3348   AC_MSG_RESULT([only used on Mac currently, skipping])
3349elif test "$enable_ccache_skip" = "no" ; then
3350   AC_MSG_RESULT([no - disabled explicitly])
3351elif test "$enable_ccache_skip" = "yes" ; then
3352   AC_MSG_RESULT([yes - enabled explicitly, skipping checks])
3353   AC_SUBST([USE_CCACHE], [YES])
3354elif test "$enable_ccache_skip" = "auto" ; then
3355   # checking for ccache presence/version
3356   AC_MSG_RESULT([probing...])
3357   AC_PATH_PROG([CCACHE],[ccache],[not_found])
3358   if test "$CCACHE" = "not_found" ; then
3359      AC_MSG_NOTICE([not enabling --ccache-skip (ccache not found)])
3360   else
3361      # check ccache version
3362      AC_MSG_CHECKING([whether version of ccache is suitable])
3363      CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3364      if test "$CCACHE_VERSION" = "2.4_OOo"; then
3365         AC_MSG_RESULT([yes])
3366         AC_MSG_CHECKING([whether ccache is actually used for the build])
3367         AC_LANG_PUSH([C++])
3368         save_CXXFLAGS=$CXXFLAGS
3369         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
3370         dnl an empty program will do, we're checking the compiler flags
3371         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3372            [use_ccache=yes], [use_ccache=no])
3373         if test $use_ccache = yes ; then
3374            AC_MSG_RESULT([yes, will enable --ccache-skip])
3375            AC_SUBST([USE_CCACHE], [YES])
3376         else
3377            AC_MSG_RESULT([no, will not enable --ccache-skip])
3378         fi
3379         CXXFLAGS=$save_CXXFLAGS
3380         AC_LANG_POP([C++])
3381      else
3382         AC_MSG_RESULT([no])
3383         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. See description for --enable-ccache-skip])
3384      fi
3385   fi
3386else
3387   AC_MSG_ERROR([invalid option to --enable-ccache-skip. Valid values are "auto", "yes" and "no"])
3388fi
3389
3390dnl ===================================================================
3391dnl system stl sanity tests
3392dnl ===================================================================
3393if false ; then # TODO: update TR1 compliant STLs
3394if test "$USE_SYSTEM_STL" = "YES"; then
3395   AC_MSG_CHECKING([system stl sanity])
3396   AC_LANG_PUSH([C++])
3397
3398   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3399      AC_MSG_CHECKING([if STL headers are visibility safe])
3400      AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
3401      AC_MSG_RESULT([$stlvisok])
3402      if test "$stlvisok" = "no"; then
3403         AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
3404         echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
3405         unset HAVE_GCC_VISIBILITY_FEATURE
3406      fi
3407   fi
3408
3409   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3410      sharedlink_ldflags_save=$LDFLAGS
3411      LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
3412
3413      AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
3414      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sstream>
3415using namespace std;
3416]], [[istringstream strm( "test" ); return 0;]])],[$EGREP -q  unresolvable conftest.err;
3417      if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no])
3418      AC_MSG_RESULT([$gccvisok])
3419      if test "$gccvisok" = "no"; then
3420         AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility])
3421         echo "Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility" >> warn
3422         unset HAVE_GCC_VISIBILITY_FEATURE
3423      fi
3424
3425      LDFLAGS=$sharedlink_ldflags_save
3426   fi
3427
3428   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
3429      AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
3430      cat >visibility.cxx <<_ACEOF
3431#pragma GCC visibility push(hidden)
3432struct __attribute__ ((visibility ("default"))) TestStruct {
3433  static void Init();
3434};
3435__attribute__ ((visibility ("default"))) void TestFunc() {
3436  TestStruct::Init();
3437}
3438_ACEOF
3439      if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
3440         gccvisbroken=yes
3441      else
3442         case "$build_cpu" in
3443            i?86|x86_64)
3444               if $EGREP -q '@PLT' visibility.s; then
3445                  gccvisbroken=no
3446               else
3447                  gccvisbroken=yes
3448               fi
3449               ;;
3450            *)
3451               gccvisbroken=no
3452               ;;
3453         esac
3454      fi
3455      rm -f visibility.s visibility.cxx
3456
3457      AC_MSG_RESULT([$gccvisbroken])
3458      if test "$gccvisbroken" = "yes"; then
3459         AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
3460         echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
3461         unset HAVE_GCC_VISIBILITY_FEATURE
3462      fi
3463   fi
3464
3465   AC_LANG_POP([C++])
3466fi
3467fi # endof TODO: update TR1 compliant STLs
3468
3469AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
3470
3471dnl ===================================================================
3472dnl allocator
3473dnl ===================================================================
3474AC_MSG_CHECKING([which memory allocator to use])
3475if test "$with_alloc" = "system"; then
3476    AC_MSG_RESULT([system])
3477    ALLOC="SYS_ALLOC";
3478    AC_CHECK_FUNCS([malloc realloc calloc free])
3479fi
3480if test "$with_alloc" = "tcmalloc"; then
3481    AC_MSG_RESULT(tcmalloc)
3482    if ! echo $build_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
3483        AC_MSG_ERROR([tcmalloc only available/usable on ix86])
3484    fi
3485    AC_CHECK_LIB(tcmalloc, malloc, [],
3486        [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
3487    ALLOC="TCMALLOC";
3488fi
3489if test "$with_alloc" = "jemalloc"; then
3490  if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
3491    AC_MSG_RESULT(jemalloc)
3492    save_CFLAGS=$CFLAGS
3493    CFLAGS="$CFLAGS -pthread"
3494    AC_CHECK_LIB(jemalloc, malloc, [],
3495        [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
3496    ALLOC="JEMALLOC";
3497    CFLAGS=$save_CFLAGS
3498  else
3499    AC_MSG_RESULT([system])
3500    ALLOC="SYS_ALLOC";
3501    AC_CHECK_FUNCS([malloc realloc calloc free])
3502  fi
3503fi
3504if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
3505   AC_MSG_RESULT([internal])
3506fi
3507AC_SUBST(ALLOC)
3508
3509dnl ===================================================================
3510dnl Custom build version
3511dnl ===================================================================
3512
3513AC_MSG_CHECKING([whether to add custom build version])
3514if test "z$with_build_version" != "z"; then
3515   BUILD_VER_STRING=$with_build_version
3516   AC_MSG_RESULT([yes, $BUILD_VER_STRING])
3517else
3518   BUILD_VER_STRING=
3519   AC_MSG_RESULT([no])
3520fi
3521AC_SUBST(BUILD_VER_STRING)
3522
3523dnl ===================================================================
3524dnl Java support enable
3525dnl ===================================================================
3526AC_MSG_CHECKING([whether to build with Java support])
3527if test "$WITH_JAVA" != "no"; then
3528   AC_MSG_RESULT([yes])
3529   SOLAR_JAVA="TRUE"
3530else
3531   AC_MSG_RESULT([no])
3532   SOLAR_JAVA=""
3533
3534   AC_MSG_WARN([building without java will mean some features will not be available])
3535   echo "building without java will mean some features will not be available" >>warn
3536fi
3537AC_SUBST(SOLAR_JAVA)
3538
3539if test "$_os" = "Linux" && test "$build_cpu" = "powerpc"; then
3540   # IBMs JDK needs this...
3541   JITC_PROCESSOR_TYPE=6
3542   export JITC_PROCESSOR_TYPE
3543fi
3544
3545if test "$_os" = "WINNT"; then
3546   if test -z "$with_jdk_home"; then
3547      AC_MSG_CHECKING([for JDK home])
3548      _jdk_home=`$OOWINTOOL --jdk-home`
3549      AC_MSG_RESULT([$_jdk_home])
3550      if test -d "$_jdk_home"; then
3551          with_jdk_home="$_jdk_home"
3552      else
3553          AC_MSG_WARN([$_jdk_home is not a JDK home directory, ignoring it])
3554      fi
3555   else
3556      with_jdk_home=`cygpath -u "$with_jdk_home"`
3557   fi
3558fi
3559
3560dnl on macOS there is no reliable way to derive JAVA_HOME from the path
3561dnl of the java/javac binaries (the /usr/bin/java* wrappers are no longer
3562dnl symlinks into a JDK, they are dispatcher stubs that shell out to
3563dnl /usr/libexec/java_home), so ask the system tool directly.
3564if test "$_os" = "Darwin"; then
3565   if test -z "$with_jdk_home"; then
3566      AC_MSG_CHECKING([for JDK home])
3567      _jdk_home=`/usr/libexec/java_home 2>/dev/null`
3568      AC_MSG_RESULT([$_jdk_home])
3569      if test -d "$_jdk_home"; then
3570          with_jdk_home="$_jdk_home"
3571      else
3572          AC_MSG_WARN([/usr/libexec/java_home did not return a JDK home directory, ignoring it])
3573      fi
3574   fi
3575fi
3576
3577dnl ===================================================================
3578dnl Checks for java
3579dnl ===================================================================
3580if test "$SOLAR_JAVA" != ""; then
3581   JAVA_HOME=; export JAVA_HOME
3582   if test -z "$with_jdk_home"; then
3583      AC_PATH_PROG(JAVAINTERPRETER, $WITH_JAVA)
3584   else
3585      _java_path="$with_jdk_home/bin/$WITH_JAVA"
3586      dnl Check if there is a java interpreter at all.
3587      if test -x "$_java_path"; then
3588         JAVAINTERPRETER=$_java_path
3589      else
3590         AC_MSG_ERROR([$_java_path not found, please use --with-jdk-home])
3591      fi
3592   fi
3593   if test "$_os" = "WINNT"; then
3594      if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
3595          JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3596      fi
3597      JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3598      JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3599   elif test "$_os" = "Darwin"; then
3600         JAVAIFLAGS=""
3601   fi
3602fi
3603
3604dnl ===================================================================
3605dnl Checks for JDK.
3606dnl ===================================================================
3607if test "$SOLAR_JAVA" != ""; then
3608   _gij_longver=0
3609   AC_MSG_CHECKING([the installed JDK])
3610   if test -n "$JAVAINTERPRETER"; then
3611      dnl java -version sends output to stderr!
3612      if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
3613         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3614#        dnl Kaffe specific tests
3615#        KAFFE_VER=`$JAVAINTERPRETER -version 2>&1 | $EGREP "  Version:" | $SED -r "s/.*  Version: ([[0-9\.]]*).*/\1/"`
3616#        if test -z "$KAFFE_VER"; then
3617#          AC_MSG_ERROR([looks like Kaffe but version detection failed])
3618#        fi
3619#        _kaffe_ver=`echo "$KAFFE_VER" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3620#        if test "$_kaffe_ver" -lt 10100; then
3621#           AC_MSG_ERROR([Kaffe is too old ($KAFFE_VER - $_kaffe_ver), you need at least 1.1.0])
3622#        fi
3623#        JDK=kaffe
3624#
3625#        dnl TODO: define some project exclusion variables
3626#
3627#        AC_MSG_RESULT([checked (Kaffe $KAFFE_VER)])
3628#        AC_MSG_WARN([EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile])
3629#        echo "EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile" >>warn
3630#        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3631      elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
3632        JDK=gcj
3633        AC_MSG_RESULT([checked (gcj)])
3634        _gij_version=`$JAVAINTERPRETER --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
3635        _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3636
3637      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | $GREP -c "BEA"` -gt 0; then
3638         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3639#        JDK=bea
3640#
3641#        dnl BEA JDK specific tests
3642#        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3643#        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3644#
3645#        if test "$_jdk_ver" -lt 10500; then
3646#          AC_MSG_ERROR([JDK is too old, you need at least BEA JDK 1.5.0])
3647#        fi
3648#
3649#        AC_MSG_RESULT([checked (BEA JDK $_jdk)])
3650#
3651#        if test "$with_jdk_home" = ""; then
3652#             AC_MSG_ERROR([In order to successfully build Apache OpenOffice using the BEA JDK,
3653#you must use the "--with-jdk-home" configure option explicitly])
3654#        fi
3655#
3656#        AC_MSG_WARN([A bug in certain BEA JREs can prevent you from successfully compiling some modules])
3657#        echo "A bug in certain BEA JREs can prevent you from successfully compiling some modules" >>warn
3658#
3659#        JAVA_HOME=$with_jdk_home
3660#
3661      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | $GREP -c "IBM"` -gt 0; then
3662        JDK=ibm
3663
3664        dnl IBM JDK specific tests
3665        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3666        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3667
3668        if test "$_jdk_ver" -lt 10500; then
3669             AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
3670        fi
3671
3672        AC_MSG_RESULT([checked (IBM JDK $_jdk)])
3673
3674        if test "$with_jdk_home" = ""; then
3675             AC_MSG_ERROR([In order to successfully build Apache OpenOffice using the IBM JDK,
3676you must use the "--with-jdk-home" configure option explicitly])
3677        fi
3678
3679        JAVA_HOME=$with_jdk_home
3680
3681      else
3682        JDK=sun
3683
3684        dnl SUN JDK specific tests
3685        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3686        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3687
3688        if test "$_jdk_ver" -lt 10500; then
3689             AC_MSG_ERROR([JDK is too old, you need at least 1.5])
3690        fi
3691        AC_MSG_RESULT([checked (JDK $_jdk)])
3692        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3693        if test "$_os" = "WINNT"; then
3694          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3695        fi
3696        if test "$_os" = "OS2"; then
3697          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3698        fi
3699      fi
3700   else
3701      AC_MSG_ERROR([JAVA not found. You need at least jdk-1.5, or gcj-4])
3702   fi
3703else
3704   dnl Java disabled
3705   JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
3706fi
3707
3708dnl ===================================================================
3709dnl Checks for javac
3710dnl ===================================================================
3711if test "$SOLAR_JAVA" != ""; then
3712    if test "$JDK" = "gcj"; then
3713        javacompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
3714    else
3715        javacompiler="javac"
3716    fi
3717    if test "$_os" = "WNT" -o "$_os" = "OS2"; then
3718      if test x`echo "$javacompiler" | $GREP -i '\.exe$'` = x; then
3719          javacompiler="${javacompiler}.exe"
3720      fi
3721    fi
3722    if test -z "$with_jdk_home"; then
3723        AC_PATH_PROG(JAVACOMPILER, $javacompiler)
3724    else
3725        _javac_path="$with_jdk_home/bin/$javacompiler"
3726        dnl Check if there is a java compiler at all.
3727        if test -x "$_javac_path"; then
3728            JAVACOMPILER=$_javac_path
3729        fi
3730    fi
3731    if test -z "$JAVACOMPILER"; then
3732      AC_MSG_ERROR([$javacompiler not found, please use --with-jdk-home])
3733    fi
3734    if test "$_os" = "WINNT"; then
3735       if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
3736          JAVACOMPILER="${JAVACOMPILER}.exe"
3737       fi
3738       JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
3739       JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
3740    fi
3741    if test "$_os" = "OS2"; then
3742       if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
3743          JAVACOMPILER="${JAVACOMPILER}.exe"
3744       fi
3745    fi
3746
3747    if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
3748        AC_MSG_CHECKING([re-checking JDK])
3749        JDK=gcj
3750        AC_MSG_RESULT([checked (ecj)])
3751        #TODO: what's to do here? some switch to do 1.5 compiling?
3752        JAVAFLAGS="-source 1.5 -target 1.5"
3753        _gij_longver="40200"
3754    fi
3755fi
3756
3757JAVACISGCJ=""
3758dnl ===================================================================
3759dnl Checks that javac is gcj
3760dnl ===================================================================
3761if test "$SOLAR_JAVA" != ""; then
3762    if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
3763        JAVACISGCJ="yes"
3764    fi
3765fi
3766AC_SUBST(JAVACISGCJ)
3767
3768dnl ===================================================================
3769dnl Checks for javadoc
3770dnl ===================================================================
3771if test "$SOLAR_JAVA" != ""; then
3772    if test -z "$with_jdk_home"; then
3773        AC_PATH_PROG(JAVADOC, javadoc)
3774    else
3775        _javadoc_path="$with_jdk_home/bin/javadoc"
3776        if test "$_os" = "WNT" -o "$_os" = "OS2"; then
3777          if test x`echo "$_javadoc_path" | $GREP -i '\.exe$'` = x; then
3778              _javadoc_path="${_javadoc_path}.exe"
3779          fi
3780        fi
3781        dnl Check if there is a javadoc at all.
3782        if test -x "$_javadoc_path"; then
3783            JAVADOC=$_javadoc_path
3784        else
3785            AC_PATH_PROG(JAVADOC, javadoc)
3786        fi
3787    fi
3788    if test -z "$JAVADOC"; then
3789      AC_MSG_ERROR([$_javadoc_path not found, please use --with-jdk-home])
3790    fi
3791    if test "$_os" = "WINNT"; then
3792        if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
3793            JAVADOC="${JAVADOC}.exe"
3794        fi
3795        JAVADOC=`cygpath -d "$JAVADOC"`
3796        JAVADOC=`cygpath -u "$JAVADOC"`
3797    fi
3798    if test "$_os" = "OS2"; then
3799        if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
3800            JAVADOC="${JAVADOC}.exe"
3801        fi
3802    fi
3803fi
3804
3805if test "$SOLAR_JAVA" != ""; then
3806    dnl first check if we have been asked to autodetect JAVA_HOME with a recent gij
3807    if test "$JDK" = "gcj" -a -z "$JAVA_HOME"; then
3808      if test "x$with_jdk_home" = "x" -a "$_gij_longver" -ge "40200"; then
3809        cat > findhome.java <<_ACEOF
3810[import java.io.File;
3811
3812class findhome
3813{
3814    public static void main(String args[])
3815    {
3816        String jrelocation = System.getProperty("java.home");
3817        File jre = new File(jrelocation);
3818        System.out.println(jre.getParent());
3819    }
3820}]
3821_ACEOF
3822        AC_MSG_CHECKING([if javac works])
3823        javac_cmd="$JAVACOMPILER findhome.java 1>&2"
3824        AC_TRY_EVAL(javac_cmd)
3825        if test $? = 0 && test -f ./findhome.class ; then
3826          AC_MSG_RESULT([javac works])
3827        else
3828          echo "configure: javac test failed" >&5
3829          cat findhome.java >&5
3830          AC_MSG_ERROR([javac does not work - java projects will not build!])
3831        fi
3832
3833        AC_MSG_CHECKING([if gij knows its java.home])
3834        JAVA_HOME=`$JAVAINTERPRETER findhome`
3835        if test $? = 0 && test "$JAVA_HOME" != "" ; then
3836          AC_MSG_RESULT([$JAVA_HOME])
3837        else
3838          echo "configure: java test failed" >&5
3839          cat findhome.java >&5
3840          AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
3841        fi
3842      else
3843        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
3844      fi
3845    fi
3846
3847    dnl second sanity check JAVA_HOME if possible
3848    if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
3849      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
3850      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
3851         javac_link_f=`readlink -f "$JAVACOMPILER" 2>/dev/null`
3852         if test $? == 0 && test "$JAVACOMPILER" != "$javac_link_f"; then
3853          # try to recover first by looking whether we have a alternatives
3854          # system as in Debian or newer SuSEs where following /usr/bin/javac
3855          # over /etc/alternatives/javac leads to the right bindir where we
3856          # just need to strip a bit away to get a valid JAVA_HOME
3857          # Solaris 11 is even worse, because target is relative, so use -f
3858            JAVA_HOME="$javac_link_f"
3859         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
3860          # Darwin readlink(1) is so primitive it doesn't even support -f
3861          # maybe only one level of symlink (e.g. on Mac)
3862            JAVA_HOME=`readlink $JAVACOMPILER`
3863         else
3864          # else warn
3865          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
3866          AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
3867          echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
3868          echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
3869          fi
3870         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
3871         if test "$JAVA_HOME" != "/usr"; then
3872            if test "$_os" = "Darwin"; then
3873               dnl Leopard returns a non-suitable path with readlink - points to "Current" only
3874               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
3875               dnl Tiger already returns a JDK path..
3876               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
3877            else
3878               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
3879            fi
3880         fi
3881      fi
3882      # now check if $JAVA_HOME is really valid
3883      if test "$_os" = "Darwin"; then
3884         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
3885            JAVA_HOME_OK="NO"
3886         fi
3887      elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
3888         JAVA_HOME_OK="NO"
3889      fi
3890      if test "$JAVA_HOME_OK" = "NO"; then
3891         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
3892         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
3893         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
3894         echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
3895         echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
3896         echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
3897#         if test "$JDK" = "gcj"; then
3898#             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
3899#         fi
3900      fi
3901    fi
3902fi
3903
3904AWTLIB=
3905if test "$SOLAR_JAVA" != ""; then
3906   AC_MSG_CHECKING([for jawt lib name])
3907   if test "$JDK" = "gcj"; then
3908      save_CFLAGS=$CFLAGS
3909      save_LDFLAGS=$LDFLAGS
3910      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3911      LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
3912      exec 6>/dev/null # no output
3913      AC_CHECK_HEADER(jni.h, [],
3914                    [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
3915      AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
3916      exec 6>&1 # output on again
3917      CFLAGS=$save_CFLAGS
3918      LDFLAGS=$save_LDFLAGS
3919   fi
3920   # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
3921   # A workaround is to link also against libpmawt.so
3922   if test "$JDK" = "ibm" ; then
3923      save_CFLAGS=$CFLAGS
3924      save_LDFLAGS=$LDFLAGS
3925      save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
3926      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3927      if test "$_os" = "Darwin"; then
3928         dnl jni_md.h lives in a platform-specific subdirectory on macOS,
3929         dnl matching the layout set up for the real build in set_soenv.in
3930         CFLAGS="$CFLAGS -I$JAVA_HOME/include/darwin"
3931      fi
3932      LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
3933      LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
3934      export LD_LIBRARY_PATH
3935      exec 6>/dev/null # no output
3936      AC_CHECK_HEADER(jni.h, [],
3937                    [AC_MSG_ERROR([jni.h could not be found.])], [])
3938      AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
3939      if test -z "$AWTLIB"; then
3940         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
3941         AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
3942      fi
3943      exec 6>&1 # output on again
3944      CFLAGS=$save_CFLAGS
3945      LDFLAGS=$save_LDFLAGS
3946      LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
3947   fi
3948   if test -z "$AWTLIB"; then
3949      AWTLIB=-ljawt
3950   fi
3951   AC_MSG_RESULT([$AWTLIB])
3952   AC_SUBST(AWTLIB)
3953fi
3954
3955dnl ===================================================================
3956dnl Check for optional gcj for AOT
3957dnl ===================================================================
3958if test "$SOLAR_JAVA" != ""; then
3959  AC_MSG_CHECKING([whether to enable gcj aot compilation])
3960  if test -n "$enable_gcjaot" && test "$enable_gcjaot" != "no"; then
3961     AC_MSG_RESULT([yes])
3962     if test `echo $WITH_JAVA | $GREP -c "gij"` -eq 0; then
3963        gcjaot="gcj"
3964     else
3965        gcjaot=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g"`
3966     fi
3967     AC_MSG_RESULT([$gcjaot])
3968     if test -n "$with_jdk_home"; then
3969        _javac_path="$with_jdk_home/bin/$gcjaot"
3970        dnl Check if there is a gcj at all.
3971        if test -x "$_javac_path"; then
3972           JAVAAOTCOMPILER=$_javac_path
3973        fi
3974     fi
3975     if test -z "$JAVAAOTCOMPILER"; then
3976        AC_PATH_PROG(JAVAAOTCOMPILER, $gcjaot)
3977     fi
3978     if test -z "$JAVAAOTCOMPILER"; then
3979        AC_MSG_WARN([$gcjaot not found, please use --with-jdk-home])
3980     fi
3981  else
3982     AC_MSG_RESULT([no])
3983  fi
3984fi
3985
3986AC_SUBST(JAVA_HOME)
3987AC_SUBST(JDK)
3988AC_SUBST(JAVAFLAGS)
3989AC_SUBST(JAVAINTERPRETER)
3990AC_SUBST(JAVAIFLAGS)
3991AC_SUBST(JAVACOMPILER)
3992AC_SUBST(JAVAAOTCOMPILER)
3993AC_SUBST(JAVADOC)
3994
3995dnl ===================================================================
3996dnl Checks for specific files.
3997dnl ===================================================================
3998
3999dnl ===================================================================
4000dnl Checks for programs.
4001dnl ===================================================================
4002
4003dnl EPM is not needed for Windows, or when every requested package format is
4004dnl handled directly by the simple packager (installer/simplepackage.pm)
4005dnl rather than by EPM: "archive"/"installed" on any platform, and Darwin's
4006dnl "dmg" - including the empty default, which resolves to "dmg" on Darwin
4007dnl below. simplepackage.pm never invokes EPM for any of these three, so
4008dnl requiring EPM to be present for e.g. a plain "dmg" or "archive dmg"
4009dnl build serves no purpose.
4010need_epm_for_packaging=yes
4011if test "$_os" = "WINNT"; then
4012   need_epm_for_packaging=no
4013elif test "$with_package_format" = "archive" -o "$with_package_format" = "installed"; then
4014   need_epm_for_packaging=no
4015elif test "$_os" = "Darwin"; then
4016   need_epm_for_packaging=no
4017   for pkgformat_word in $with_package_format; do
4018      case "$pkgformat_word" in
4019         archive|installed|dmg) ;;
4020         *) need_epm_for_packaging=yes ;;
4021      esac
4022   done
4023fi
4024
4025AC_MSG_CHECKING([whether to enable EPM for packing])
4026if test "$enable_epm" = "yes"; then
4027   AC_MSG_RESULT([yes])
4028   dnl ================================================================================
4029   dnl Check for epm - not needed for Windows, or when the requested package
4030   dnl format(s) are all handled without it (see need_epm_for_packaging above)
4031   dnl ================================================================================
4032   if test "$need_epm_for_packaging" = "yes"; then
4033      if test -n "$with_epm"; then
4034          EPM=$with_epm
4035      else
4036         AC_PATH_PROG(EPM, epm, no)
4037      fi
4038
4039      # Override system epm and --with-epm if --with-epm-url is used.
4040      if test -n "$with_epm_url" ; then
4041         # At this moment we can not verify the URL or the content that we want to download.
4042         EPM_URL=$with_epm_url
4043         AC_MSG_RESULT([epm will be downloaded and compiled in bootstrap])
4044         EPM=
4045         echo "EPM will be built."
4046         BUILD_EPM=YES
4047         BUILD_TYPE="$BUILD_TYPE EPM"
4048      else
4049         if test "$EPM" = "no" ; then
4050             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.])
4051          else
4052             # Gentoo has some epm which is something different...
4053            AC_MSG_CHECKING([whether the found EPM is the right EPM])
4054            if $EPM --version | $GREP "ESP Package Manager" >/dev/null 2>/dev/null; then
4055               AC_MSG_RESULT([yes])
4056            else
4057                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.])
4058            fi
4059            AC_MSG_CHECKING([EPM version])
4060            EPM_VERSION=`$EPM --version | $GREP 'ESP Package Manager' | cut -d' ' -f5 | $SED -e s/v//`
4061             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -ge "5"; then
4062               AC_MSG_RESULT([OK, >= 5.0])
4063               BUILD_EPM=NO
4064             else
4065               AC_MSG_ERROR([too old. EPM >= 5.0.0 is required.])
4066             fi
4067        fi
4068      fi
4069   fi
4070
4071   # test which package format to use
4072   AC_MSG_CHECKING([which package format to use])
4073
4074   # defaults
4075   case "$_os" in
4076    OS2)
4077        PKGFORMAT=native
4078        ;;
4079    Darwin)
4080        PKGFORMAT=dmg
4081        ;;
4082    SunOS)
4083        PKGFORMAT=pkg
4084        ;;
4085    Linux)
4086      # if building on Debian, default should be deb...
4087      if test -e /etc/debian_version; then
4088         PKGFORMAT=deb
4089      else
4090         PKGFORMAT=rpm
4091      fi
4092        ;;
4093    AIX)
4094        PKGFORMAT=aix
4095        ;;
4096    *BSD)
4097        PKGFORMAT=bsd
4098        ;;
4099    OSF1)
4100        PKGFORMAT=setld
4101        ;;
4102    WINNT)
4103        PKGFORMAT=msi
4104        ;;
4105    # we never should get here since we check the architecture/os at the beginning,
4106    # but go sure...
4107    *)
4108        AC_MSG_ERROR([unknown system])
4109   esac
4110   if test -n "$with_package_format"; then
4111    for i in $with_package_format; do
4112        case "$i" in
4113            aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4114            ;;
4115        *)
4116            AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4117aix - AIX software distribution
4118bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4119depot or swinstall - HP-UX software distribution
4120deb - Debian software distribution
4121inst or tardist - IRIX software distribution
4122osx - MacOS X software distribution
4123pkg - Solaris software distribution
4124rpm - RedHat software distribution
4125setld - Tru64 (setld) software distribution
4126native - "Native" software distribution for the platform
4127portable - Portable software distribution
4128AOO additionally supports:
4129archive - .tar.gz or .zip
4130dmg - Mac OS X .dmg
4131installed - installation tree
4132msi - Windows .msi
4133            ])
4134            ;;
4135        esac
4136    done
4137    PKGFORMAT="$with_package_format"
4138   fi
4139   AC_MSG_RESULT([$PKGFORMAT])
4140   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
4141      AC_MSG_CHECKING([for rpm])
4142      for a in "$RPM" rpmbuild rpm; do
4143         $a --usage >/dev/null 2> /dev/null
4144         if test $? -eq 0; then
4145            RPM=$a
4146            break
4147         else
4148            $a --version >/dev/null 2> /dev/null
4149            if test $? -eq 0; then
4150               RPM=$a
4151               break
4152            fi
4153         fi
4154       done
4155       if test -z "$RPM" ; then
4156          AC_MSG_ERROR([not found])
4157       elif "$RPM" --usage 2>&1 | $EGREP -- -bb >/dev/null; then
4158          RPM_PATH=`which $RPM`
4159          AC_MSG_RESULT([$RPM_PATH])
4160       else
4161          AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
4162       fi
4163   fi
4164   if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
4165      AC_PATH_PROG(DPKG, dpkg, no)
4166      if test "$DPKG" = "no"; then
4167         AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
4168      fi
4169      AC_PATH_PROG(FAKEROOT, fakeroot, no)
4170      if test "$FAKEROOT" = "no"; then
4171         AC_MSG_ERROR([fakeroot needed for deb creation. Install fakeroot.])
4172      fi
4173   fi
4174   if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
4175      if test "$_os" = "Darwin"; then
4176         AC_MSG_CHECKING([for PackageMaker availability])
4177         if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
4178            AC_MSG_ERROR([not installed. Apple's PackageMaker does not exist on
4179current Xcode; the "osx" EPM format is obsolete on this platform - use "dmg"
4180instead, or see MACOS_PACKAGING_EPM_REVIEW.md for a modern product-PKG path.])
4181         else
4182            AC_MSG_RESULT([ok])
4183         fi
4184      else
4185         AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
4186       fi
4187   fi
4188   if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
4189      AC_PATH_PROG(PKGMK, pkgmk, no)
4190      if test "$PKGMK" = "no"; then
4191         AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
4192      fi
4193   fi
4194   AC_SUBST(RPM)
4195   AC_SUBST(DPKG)
4196   AC_SUBST(FAKEROOT)
4197   AC_SUBST(PKGMK)
4198else
4199   AC_MSG_RESULT([no])
4200   BUILD_EPM=NO
4201   EPM=NO
4202   if test "$_os" = "Darwin" -a "$need_epm_for_packaging" = "no"; then
4203      dnl simplepackage.pm builds archive/installed/dmg without EPM, so
4204      dnl --disable-epm should not discard a requested "dmg" (or Darwin's
4205      dnl "dmg" default) the way it must for a format that does need EPM.
4206      PKGFORMAT=dmg
4207      test -z "$with_package_format" || PKGFORMAT="$with_package_format"
4208   else
4209      PKGFORMAT=native
4210   fi
4211fi
4212AC_SUBST(BUILD_EPM)
4213AC_SUBST(EPM_URL)
4214AC_SUBST(EPM)
4215AC_SUBST(PKGFORMAT)
4216
4217dnl ===================================================================
4218dnl Check for gperf
4219dnl ===================================================================
4220AC_PATH_PROG(GPERF, gperf)
4221if test -z "$with_gperf"; then
4222    AC_PATH_PROG(GPERF, gperf)
4223    if test -z "$GPERF"; then
4224       AC_MSG_ERROR([gperf not found but needed. Install it and/or specify --with-gperf=/path/to/it.])
4225    fi
4226else
4227  if test -x "$with_gperf"; then
4228    GPERF=$with_gperf
4229  else
4230    AC_MSG_ERROR([--with-gperf did not point to an executable])
4231  fi
4232fi
4233AC_MSG_CHECKING([gperf version])
4234if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
4235    AC_MSG_RESULT([OK])
4236   GPERF=$GPERF
4237else
4238    AC_MSG_ERROR([too old, you need at least 3.0.0])
4239fi
4240AC_SUBST(GPERF)
4241
4242dnl ===================================================================
4243dnl Check for building ODK
4244dnl ===================================================================
4245AC_MSG_CHECKING([whether to build the ODK])
4246if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
4247   AC_MSG_RESULT([yes])
4248   if test "$WITH_JAVA" != "no"; then
4249   AC_MSG_CHECKING([for external/unowinreg/unowinreg.dll])
4250   if ! test -f "./external/unowinreg/unowinreg.dll"; then
4251      HAVE_UNOWINREG_DLL=no
4252   else
4253      HAVE_UNOWINREG_DLL=yes
4254   fi
4255   if test "$HAVE_UNOWINREG_DLL" = "yes"; then
4256      AC_MSG_RESULT([found])
4257      BUILD_UNOWINREG=NO
4258   else
4259      if test "$_os" = "WINNT"; then
4260         AC_MSG_RESULT([not found, will be built])
4261      else
4262         AC_MSG_WARN([not found, will be cross-built using mingw32])
4263      fi
4264      BUILD_UNOWINREG=YES
4265   fi
4266   if test "$_os" != "WINNT" && test "$BUILD_UNOWINREG" = "YES"; then
4267      if test -z "$WITH_MINGWIN" || test "$WITH_MINGWIN" = "0"; then
4268         AC_MSG_ERROR([for rebuilding unowinreg.dll you need the mingw32 C++ compiler.
4269         Specify mingw32 g++ executable name with --with-mingwin.
4270         Or use prebuilt one from https://tools.openoffice.org/unowinreg_prebuild/680/ and
4271         put it into external/unowinreg using your browser or a command equivalent to:
4272         wget -O external/unowinreg/unowinreg.dll https://www.openoffice.org/tools/unowinreg_prebuild/680/unowinreg.dll])
4273      fi
4274      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
4275         if ! test -x "$WITH_MINGWIN"; then MINGWCXX=false; else MINGWCXX=`basename $WITH_MINGWIN`; fi
4276      else
4277         AC_CHECK_TOOL(MINGWCXX, $WITH_MINGWIN, false)
4278      fi
4279      if test "$MINGWCXX" = "false"; then
4280         AC_MSG_ERROR(specified MinGW32 C++ cross-compiler not found. Install it or correct name.)
4281      fi
4282      AC_MSG_CHECKING(whether we are using the MinGW32 cross C++ compiler)
4283      if ! echo "`$MINGWCXX -dumpmachine`" | $GREP -q mingw32; then
4284         AC_MSG_ERROR(no)
4285      else
4286         AC_MSG_RESULT(yes)
4287      fi
4288      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
4289         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
4290      else
4291         AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`, false)
4292      fi
4293      if test "$MINGWSTRIP" = "false"; then
4294         AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
4295      fi
4296      AC_LANG_PUSH([C++])
4297      save_CXX=$CXX
4298      save_CXXCPP=$CXXCPP
4299      CXX=$MINGWCXX
4300      CXXCPP="$MINGWCXX -E"
4301      save_CXXFLAGS=$CXXFLAGS
4302      save_CPPFLAGS=$CPPFLAGS
4303      CXXFLAGS="$CXXFLAGS -I$JAVA_HOME/include"
4304      CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include"
4305      # LIBS contains -lcrypt etc due to the AC_CHECK_LIBS which obviously
4306      # do not make sense here (and 'd make the check fail)
4307      save_LIBS=$LIBS
4308      LIBS=""
4309      AC_CHECK_LIB([kernel32],[main],[],[],[])ac_cv_lib_kernel32=ac_cv_lib_kernel32_main
4310
4311      AC_CHECK_LIB([advapi32],[main],[],[],[])ac_cv_lib_advapi32=ac_cv_lib_advapi32_main
4312
4313      AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR([windows.h missing])])
4314      CXXFLAGS=$save_CXXFLAGS
4315      CPPFLAGS=$save_CPPFLAGS
4316      CXX=$save_CXX
4317      CXXCPP=$save_CXXCPP
4318      LIBS=$save_LIBS
4319      AC_LANG_POP([C++])
4320      fi
4321   fi
4322   BUILD_TYPE="$BUILD_TYPE ODK"
4323else
4324   AC_MSG_RESULT([no])
4325   BUILD_UNOWINREG=NO
4326fi
4327AC_SUBST(BUILD_UNOWINREG)
4328AC_SUBST(MINGWCXX)
4329AC_SUBST(MINGWSTRIP)
4330
4331dnl ===================================================================
4332dnl Check for system stdlibs
4333dnl ===================================================================
4334AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
4335if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
4336   test "$with_system_stdlibs" != "no"; then
4337   AC_MSG_RESULT([no])
4338   SYSTEM_STDLIBS=YES
4339else
4340   AC_MSG_RESULT([yes])
4341   SYSTEM_STDLIBS=NO
4342fi
4343AC_SUBST(SYSTEM_STDLIBS)
4344
4345dnl ===================================================================
4346dnl Check for system zlib
4347dnl ===================================================================
4348if test "$_os" = "Darwin" && test "$with_system_zlib" != "no"; then
4349   with_system_zlib=yes
4350fi
4351AC_MSG_CHECKING([which zlib to use])
4352if test -n "$with_system_zlib" -o -n "$with_system_libs" && \
4353    test "$with_system_zlib" != "no"; then
4354    AC_MSG_RESULT([external])
4355    SYSTEM_ZLIB=YES
4356    AC_CHECK_HEADER(zlib.h, [],
4357        [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
4358    AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
4359        [AC_MSG_ERROR(zlib not found or functional)], [])
4360else
4361    AC_MSG_RESULT([internal])
4362    SYSTEM_ZLIB=NO
4363    BUILD_TYPE="$BUILD_TYPE ZLIB"
4364fi
4365AC_SUBST(SYSTEM_ZLIB)
4366
4367dnl ===================================================================
4368dnl Check for system jpeg
4369dnl ===================================================================
4370AC_MSG_CHECKING([which jpeg to use])
4371if test -n "$with_system_jpeg" -o -n "$with_system_libs" && \
4372    test "$with_system_jpeg" != "no"; then
4373    AC_MSG_RESULT([external])
4374    SYSTEM_JPEG=YES
4375    AC_CHECK_HEADER(jpeglib.h, [],
4376        [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
4377    AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
4378    [AC_MSG_CHECKING(jpeg library not found or functional)], [])
4379else
4380    AC_MSG_RESULT([internal])
4381    SYSTEM_JPEG=NO
4382    BUILD_TYPE="$BUILD_TYPE JPEG"
4383fi
4384AC_SUBST(SYSTEM_JPEG)
4385
4386dnl ===================================================================
4387dnl Check for system expat
4388dnl ===================================================================
4389AC_MSG_CHECKING([which expat to use])
4390if test -n "$with_system_expat" -o -n "$with_system_libs" && \
4391    test "$with_system_expat" != "no"; then
4392    AC_MSG_RESULT([external])
4393    SYSTEM_EXPAT=YES
4394    AC_CHECK_HEADER(expat.h, [],
4395        [AC_MSG_ERROR(expat.h not found. install expat)], [])
4396    AC_CHECK_LIB(expat, XML_ParserCreate, [],
4397    [AC_MSG_RESULT(expat library not found or functional.)], [])
4398else
4399    AC_MSG_RESULT([internal])
4400    SYSTEM_EXPAT=NO
4401    BUILD_TYPE="$BUILD_TYPE EXPAT"
4402fi
4403AC_SUBST(SYSTEM_EXPAT)
4404
4405dnl ===================================================================
4406dnl Check whether freetype is available
4407dnl ===================================================================
4408if test  "$test_freetype" = "yes"; then
4409   AC_MSG_CHECKING([whether freetype is available])
4410    PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
4411fi
4412AC_SUBST(FREETYPE_CFLAGS)
4413AC_SUBST(FREETYPE_LIBS)
4414
4415dnl ===================================================================
4416dnl Check whether freetype2 supports emboldening
4417dnl ===================================================================
4418if test  "$test_freetype" = "yes"; then
4419    save_CPPFLAGS="$CPPFLAGS"
4420    save_LDFLAGS="$LDFLAGS"
4421    save_LIBS="$LIBS"
4422    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
4423    LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
4424    AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
4425                 [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
4426    LDFLAGS="$save_LDFLAGS"
4427    CPPFLAGS="$save_CPPFLAGS"
4428    LIBS="$save_LIBS"
4429fi
4430AC_SUBST(USE_FT_EMBOLDEN)
4431
4432if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
4433   test "$with_system_libxslt" != "no"; then
4434    if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
4435      test "$with_system_libxml" = "no"; then
4436      # somehow AC_MSG_WARN won't work...
4437       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
4438       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
4439       with_system_libxml=yes
4440    fi
4441fi
4442if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
4443   test "$with_system_libxml" != "no"; then
4444    if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
4445      test "$with_system_libxslt" = "no"; then
4446      # somehow AC_MSG_WARN won't work...
4447       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
4448       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
4449       with_system_libxslt=yes
4450    fi
4451fi
4452
4453dnl ===================================================================
4454dnl Check for system libxslt
4455dnl ===================================================================
4456AC_MSG_CHECKING([which libxslt to use])
4457if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
4458       "$_os" = "Darwin" && \
4459   test "$with_system_libxslt" != "no"; then
4460   AC_MSG_RESULT([external])
4461   SYSTEM_LIBXSLT=YES
4462
4463    if test "$_os" != "Darwin"; then
4464        PKG_CHECK_MODULES(LIBXSLT, libxslt)
4465    else
4466        dnl See the matching libxml check below for why this pins
4467        dnl xslt-config to the directory given to --with-system-libxslt
4468        dnl instead of resolving a bare "xslt-config" off PATH.
4469        if test "$with_system_libxslt" != "yes" -a -n "$with_system_libxslt"; then
4470            XSLT_CONFIG="$with_system_libxslt/bin/xslt-config"
4471            if test ! -x "$XSLT_CONFIG"; then
4472                AC_MSG_ERROR([--with-system-libxslt=$with_system_libxslt given, but $XSLT_CONFIG not found or not executable])
4473            fi
4474        else
4475            AC_PATH_PROG(XSLT_CONFIG, xslt-config, [])
4476            if test -z "$XSLT_CONFIG"; then
4477                AC_MSG_ERROR([xslt-config not found on PATH])
4478            fi
4479        fi
4480        LIBXSLT_CFLAGS=`$XSLT_CONFIG --cflags`
4481        LIBXSLT_LIBS=`$XSLT_CONFIG --libs`
4482        LIBXSLT_PREFIX=`$XSLT_CONFIG --prefix`
4483    fi
4484
4485   dnl Check for xsltproc
4486   AC_PATH_PROG(XSLTPROC, xsltproc, no)
4487   if test "$XSLTPROC" = "no"; then
4488      AC_MSG_ERROR([xsltproc is required])
4489   fi
4490else
4491   AC_MSG_RESULT([internal])
4492   SYSTEM_LIBXSLT=NO
4493   BUILD_TYPE="$BUILD_TYPE LIBXSLT"
4494fi
4495AC_SUBST(SYSTEM_LIBXSLT)
4496AC_SUBST(LIBXSLT_CFLAGS)
4497AC_SUBST(LIBXSLT_LIBS)
4498AC_SUBST(LIBXSLT_PREFIX)
4499
4500
4501dnl ===================================================================
4502dnl Check for system libxml
4503dnl ===================================================================
4504AC_MSG_CHECKING([which libxml to use])
4505if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
4506            "$_os" = "Darwin" && \
4507    test "$with_system_libxml" != "no"; then
4508    AC_MSG_RESULT([external])
4509    SYSTEM_LIBXML=YES
4510    BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
4511
4512    if test "$_os" != "Darwin"; then
4513        PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
4514    else
4515        dnl A bare "xml2-config" resolves off whatever happens to be
4516        dnl first on PATH, which is ambiguous when several package
4517        dnl managers each ship their own libxml2 (MacPorts, Homebrew,
4518        dnl a hand-built static copy, ...). When --with-system-libxml
4519        dnl is given an actual directory (not just a bare "yes"), pin
4520        dnl xml2-config to that prefix explicitly so the intended copy
4521        dnl can't be shadowed by PATH order.
4522        if test "$with_system_libxml" != "yes" -a -n "$with_system_libxml"; then
4523            XML2_CONFIG="$with_system_libxml/bin/xml2-config"
4524            if test ! -x "$XML2_CONFIG"; then
4525                AC_MSG_ERROR([--with-system-libxml=$with_system_libxml given, but $XML2_CONFIG not found or not executable])
4526            fi
4527        else
4528            AC_PATH_PROG(XML2_CONFIG, xml2-config, [])
4529            if test -z "$XML2_CONFIG"; then
4530                AC_MSG_ERROR([xml2-config not found on PATH])
4531            fi
4532        fi
4533        LIBXML_CFLAGS=`$XML2_CONFIG --cflags`
4534        LIBXML_LIBS=`$XML2_CONFIG --libs`
4535        LIBXML_PREFIX=`$XML2_CONFIG --prefix`
4536    fi
4537else
4538    AC_MSG_RESULT([internal])
4539    SYSTEM_LIBXML=NO
4540    BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
4541fi
4542AC_SUBST(SYSTEM_LIBXML)
4543AC_SUBST(SYSTEM_LIBXML_STATIC)
4544AC_SUBST(LIBXML_CFLAGS)
4545AC_SUBST(LIBXML_LIBS)
4546AC_SUBST(LIBXML_PREFIX)
4547
4548
4549dnl ===================================================================
4550dnl Checks for a MacOS platform SDK compatible with deployment target
4551dnl ===================================================================
4552if test  "$_os" = "Darwin"; then
4553   sdk_target=$with_macosx_target
4554   AC_MSG_CHECKING([checking SDK compatibility with OSX $sdk_target])
4555
4556   sdk_major=`echo $sdk_target | cut -d"." -f1`
4557   sdk_minor=`echo $sdk_target | cut -d"." -f2`
4558   test -z "$sdk_minor" && sdk_minor=0
4559
4560   dnl Minimum supported macOS deployment target is 11.0 (Big Sur). This is
4561   dnl also the hard floor for Apple Silicon (arm64), so enforce it for every
4562   dnl architecture.
4563   if test "$sdk_major" -lt "11" ; then
4564      AC_MSG_ERROR([macOS deployment target < 11.0 is no longer supported; use --with-macosx-target=11.0 or later])
4565   else
4566      MACOSX_DEPLOYMENT_TARGET=$sdk_target
4567      sdk_path=$with_macosx_sdk
4568      if test -z "$sdk_path"; then
4569          dnl --macosx-sdk not used (or blank): We look for the SDK.
4570          dnl Prefer xcodebuild when full Xcode is installed, but fall back
4571          dnl to xcrun so that Command Line Tools-only setups also work
4572          dnl (xcodebuild is unavailable without the full Xcode app).
4573          sdk_found=`xcodebuild -showsdks 2>/dev/null | $EGREP "sdk macosx(1[1-9]|[2-9][0-9])" | sed -e "s/.*sdk //" | tail -n1`
4574          if test -n "$sdk_found"; then
4575             AC_MSG_RESULT([yes, by using SDK $sdk_found])
4576             sdk_path=`xcodebuild -version -sdk ${sdk_found} Path`
4577          else
4578             sdk_path=`xcrun --sdk macosx --show-sdk-path 2>/dev/null`
4579             if test -z "$sdk_path"; then
4580                AC_MSG_ERROR([No SDK with OSX $sdk_target compatibility found])
4581             fi
4582             AC_MSG_RESULT([yes, by using SDK at $sdk_path])
4583          fi
4584      elif test ! -d "$sdk_path"; then
4585          dnl --macosx-sdk=<version> given (not a path): resolve it. Prefer
4586          dnl xcodebuild, but fall back to xcrun so Command Line Tools-only
4587          dnl setups (no full Xcode) also work.
4588          sdk_found=`xcodebuild -showsdks 2>/dev/null | $EGREP "sdk macosx${sdk_path}" | sed -e "s/.*sdk //" | tail -n1`
4589          if test -n "$sdk_found"; then
4590             AC_MSG_RESULT([SDK $sdk_found])
4591             sdk_path=`xcodebuild -version -sdk ${sdk_found} Path`
4592          else
4593             sdk_xcrun=`xcrun --sdk macosx${sdk_path} --show-sdk-path 2>/dev/null`
4594             if test -z "$sdk_xcrun"; then
4595                AC_MSG_ERROR([SDK macosx${sdk_path} not found])
4596             fi
4597             AC_MSG_RESULT([SDK at $sdk_xcrun])
4598             sdk_path=$sdk_xcrun
4599          fi
4600      fi
4601      AC_MSG_CHECKING([for $sdk_path])
4602      if test -d "$sdk_path"; then
4603         AC_MSG_RESULT([yes])
4604      else
4605         AC_MSG_ERROR([not found!])
4606      fi
4607
4608      MACOSX_SDK_PATH=$sdk_path
4609      SDKROOT=$sdk_path
4610      export SDKROOT
4611   fi
4612
4613fi
4614dnl Code signing during packaging: solenv/bin/modules/installer/simplepackage.pm
4615dnl reads these from the environment (via set_soenv), so a bare "yes" is an error.
4616MACOSX_CODESIGNING_IDENTITY=
4617MACOSX_CODESIGNING_KEYCHAIN=
4618MACOSX_NOTARY_PROFILE=
4619if test "$with_macosx_codesigning_identity" = "yes"; then
4620   AC_MSG_ERROR([--with-macosx-codesigning-identity needs a codesign identity, or "-" for ad-hoc])
4621fi
4622if test -n "$with_macosx_codesigning_identity" -a "$with_macosx_codesigning_identity" != "no"; then
4623   MACOSX_CODESIGNING_IDENTITY=$with_macosx_codesigning_identity
4624fi
4625if test -n "$with_macosx_codesigning_keychain" -a "$with_macosx_codesigning_keychain" != "no" -a "$with_macosx_codesigning_keychain" != "yes"; then
4626   MACOSX_CODESIGNING_KEYCHAIN=$with_macosx_codesigning_keychain
4627fi
4628if test "$with_macosx_notary_profile" = "yes"; then
4629   AC_MSG_ERROR([--with-macosx-notary-profile needs a notarytool keychain profile name])
4630fi
4631if test -n "$with_macosx_notary_profile" -a "$with_macosx_notary_profile" != "no"; then
4632   if test "$MACOSX_CODESIGNING_IDENTITY" = "" -o "$MACOSX_CODESIGNING_IDENTITY" = "-"; then
4633      AC_MSG_ERROR([--with-macosx-notary-profile needs --with-macosx-codesigning-identity set to a real Developer ID identity, not ad-hoc])
4634   fi
4635   MACOSX_NOTARY_PROFILE=$with_macosx_notary_profile
4636fi
4637AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4638AC_SUBST(MACOSX_SDK_PATH)
4639AC_SUBST(SDKROOT)
4640AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
4641AC_SUBST(MACOSX_CODESIGNING_KEYCHAIN)
4642AC_SUBST(MACOSX_NOTARY_PROFILE)
4643
4644
4645dnl ===================================================================
4646dnl Check for system python
4647dnl ===================================================================
4648AC_MSG_CHECKING([which python to use])
4649if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
4650   with_system_python=yes
4651
4652   dnl Recent macOS releases no longer ship a usable Python under /usr/bin,
4653   dnl and even when python3 exists there it may be Apple's old CLT stub
4654   dnl (< 3.11). Probe the locations where a system/user Python is typically
4655   dnl found - the python.org framework build, Homebrew (Apple Silicon and
4656   dnl Intel), and whatever python3 is first on PATH (MacPorts/pyenv/etc.) -
4657   dnl and pick the first candidate that actually satisfies the 3.11 floor.
4658   dnl hex version of Python 3.11.0 = 51118080
4659   _python=""
4660   for _python_candidate in \
4661       "/Library/Frameworks/Python.framework/Versions/Current/bin/python3" \
4662       "/Library/Frameworks/Python.framework/Versions/Current/bin/python" \
4663       "/opt/homebrew/bin/python3" \
4664       "/usr/local/bin/python3" \
4665       `command -v python3 2>/dev/null` \
4666       "/usr/bin/python3" \
4667       "/usr/bin/python" ; do
4668       if test -x "$_python_candidate"; then
4669           _python_candidate_hexversion=`$_python_candidate -c "import sys; print(sys.hexversion)" 2>/dev/null`
4670           if test -n "$_python_candidate_hexversion" && \
4671              test "$_python_candidate_hexversion" -ge 51118080 2>/dev/null; then
4672               _python="$_python_candidate"
4673               break
4674           fi
4675       fi
4676   done
4677   if test -z "$_python"; then
4678       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])
4679   fi
4680
4681   _python_version=`$_python -c "import sys; print(sys.version);" | head -c 4`
4682   AC_MSG_RESULT([compiling against system python ($_python, version $_python_version)])
4683
4684   dnl Hand the interpreter we just validated to the build, so that the build
4685   dnl steps that run Python scripts use it instead of whatever "python3"
4686   dnl happens to be first on PATH.
4687   PYTHON_BIN="$_python"
4688
4689   _python_ver=`$_python -c "import sysconfig; print(sysconfig.get_config_var('VERSION'));"`
4690
4691   dnl Locate the headers. Prefer the framework/SDK locations, but fall back
4692   dnl to whatever include dir the interpreter itself reports (this is what
4693   dnl makes Homebrew and other non-framework installs work).
4694   if test -d "/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
4695        PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4696   elif test -d "$MACOSX_SDK_PATH/usr/include/python$_python_ver"; then
4697       PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/python$_python_ver"
4698   elif test -d "$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
4699       PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4700   else
4701       _python_inc=`$_python -c "import sysconfig; print(sysconfig.get_path('include'));"`
4702       PYTHON_CFLAGS="-I$_python_inc"
4703   fi
4704
4705   dnl A framework build links against the Python framework; any other
4706   dnl install (Homebrew, etc.) links against libpython in its LIBDIR.
4707   case "$_python" in
4708       /Library/Frameworks/Python.framework/*|*/System/Library/Frameworks/Python.framework/*)
4709           PYTHON_LIBS="-framework Python"
4710           ;;
4711       *)
4712           dnl Use sysconfig, not distutils.sysconfig: distutils was removed in
4713           dnl Python 3.12 and the interpreter we pick here may well be newer
4714           dnl than the 3.11 floor.
4715           _python_libdir=`$_python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'));"`
4716           PYTHON_LIBS="-L$_python_libdir -lpython$_python_ver"
4717           ;;
4718   esac
4719elif test -n "$with_system_python" -o -n "$with_system_libs" && \
4720    test "$with_system_python" != "no"; then
4721   with_system_python=yes
4722   AC_MSG_RESULT([external])
4723   AM_PATH_PYTHON([3.11])
4724
4725   dnl Hand the interpreter AM_PATH_PYTHON just validated to the build, so that
4726   dnl the build steps that run Python scripts use it instead of whatever
4727   dnl "python3" happens to be first on PATH.
4728   PYTHON_BIN="$PYTHON"
4729
4730   python_include=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'));"`
4731   python_version=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_var('VERSION'));"`
4732   # Python 3.8 and later distinguish building Python modules from linking to the
4733   # libpython, so embedders must use the "-embed" pkg-config module:
4734   # (https://bugs.python.org/issue36721)
4735   # AM_PATH_PYTHON above already enforces a 3.11 floor, so "-embed" is always
4736   # the right variant here. (The old "$python_version" -lt "3.8" test was a
4737   # numeric comparison on a string like "3.11" and could never work.)
4738   PKG_CHECK_MODULES(PYTHON, python-$python_version-embed, PYTHON_PC="TRUE", PYTHON_PC="" )
4739   if test "$PYTHON_PC" != "TRUE"; then
4740       PYTHON_CFLAGS="-I$python_include"
4741       PYTHON_LIBS="-lpython$python_version"
4742   fi
4743fi
4744if test "$with_system_python" = "yes" ; then
4745   SYSTEM_PYTHON=YES
4746   dnl check if the headers really work:
4747   save_CPPFLAGS="$CPPFLAGS"
4748   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4749   AC_CHECK_HEADER(Python.h, [],
4750       [AC_MSG_ERROR(Python headers not found)], [])
4751   CPPFLAGS="$save_CPPFLAGS"
4752else
4753   SYSTEM_PYTHON=NO
4754   BUILD_TYPE="$BUILD_TYPE PYTHON"
4755   AC_MSG_RESULT([internal])
4756   # Embedded python dies without Home set
4757   if test "z$HOME" = "z"; then
4758      export HOME="";
4759   fi
4760   dnl The internal Python tarball is a .tgz (see main/external_deps.lst), so
4761   dnl gzip is all that is needed to unpack it. The old bzip2 requirement was
4762   dnl for the Python 2.x .tar.bz2 and no longer applies.
4763fi
4764AC_SUBST(SYSTEM_PYTHON)
4765AC_SUBST(PYTHON_BIN)
4766AC_SUBST(PYTHON_CFLAGS)
4767AC_SUBST(PYTHON_LIBS)
4768HOME=`echo $HOME | sed 's:\\\\:/:g'`
4769AC_SUBST(HOME)
4770
4771dnl ===================================================================
4772dnl Check for system lucene
4773dnl ===================================================================
4774AC_MSG_CHECKING([which lucene to use])
4775if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4776       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4777        AC_MSG_RESULT([external])
4778        SYSTEM_LUCENE=YES
4779        if test -z $LUCENE_CORE_JAR; then
4780          AC_CHECK_FILE(/usr/share/java/lucene-core-2.9.4.jar,
4781            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.9.4.jar ],
4782            [
4783              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4784                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4785                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4786                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4787                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4788                  )
4789                ]
4790              )
4791            ]
4792          )
4793        else
4794          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4795               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
4796        fi
4797
4798        if test -z $LUCENE_ANALYZERS_JAR; then
4799          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
4800            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
4801            [
4802              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
4803                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
4804                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
4805              )
4806            ]
4807          )
4808        else
4809          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4810               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
4811        fi
4812        AC_MSG_CHECKING([whether lucene is version 2.x])
4813        export LUCENE_CORE_JAR
4814        if $PERL -e 'use Archive::Zip;
4815            my $file = "$ENV{'LUCENE_CORE_JAR'}";
4816            my $zip = Archive::Zip->new( $file );
4817            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4818            if ( $mf =~ m/Specification-Version: 2.*/ ) {
4819                exit 0;
4820            } else {
4821                exit 1;
4822            }'; then
4823            AC_MSG_RESULT([yes])
4824         else
4825            AC_MSG_RESULT([no])
4826            AC_MSG_CHECKING([whether lucene is version 3.x])
4827
4828            if $PERL -e 'use Archive::Zip;
4829                my $file = "$ENV{'LUCENE_CORE_JAR'}";
4830                my $zip = Archive::Zip->new( $file );
4831                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4832                if ( $mf =~ m/Specification-Version: 3.*/ ) {
4833                    exit 0;
4834                } else {
4835                    exit 1;
4836                }'; then
4837                AC_MSG_RESULT([yes])
4838             else
4839                AC_MSG_ERROR([no, you need lucene 2 or 3])
4840             fi
4841         fi
4842
4843else
4844    AC_MSG_RESULT([internal])
4845    SYSTEM_LUCENE=NO
4846    BUILD_TYPE="$BUILD_TYPE LUCENE"
4847fi
4848AC_SUBST(SYSTEM_LUCENE)
4849AC_SUBST(LUCENE_CORE_JAR)
4850AC_SUBST(LUCENE_ANALYZERS_JAR)
4851
4852AC_MSG_CHECKING([whether to build the MySQL Connector extension])
4853if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
4854  AC_MSG_RESULT([yes])
4855  ENABLE_MYSQLC=YES
4856  AC_MSG_CHECKING([for mysqlc module])
4857  if test -d mysqlc; then
4858   AC_MSG_RESULT([OK])
4859  else
4860   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4861  fi
4862  BUILD_TYPE="$BUILD_TYPE MYSQLC"
4863else
4864  AC_MSG_RESULT([no])
4865  ENABLE_MYSQLC=NO
4866fi
4867AC_SUBST(ENABLE_MYSQLC)
4868
4869if test "$ENABLE_MYSQLC" = "YES"; then
4870dnl ===================================================================
4871dnl Check for system MySQL
4872dnl ===================================================================
4873AC_MSG_CHECKING([for mysql pre-requisites])
4874if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
4875       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
4876    AC_MSG_RESULT([external MySQL])
4877    SYSTEM_MYSQL=YES
4878    AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4879    AC_MSG_CHECKING([MySQL version])
4880    if test -z "$MYSQLCONFIG" -o ! -x "$MYSQLCONFIG" ; then
4881        AC_MSG_ERROR([can not find/execute mysql_config]);
4882    fi
4883    MYSQL_VERSION=`$MYSQLCONFIG --version`
4884    MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4885    if test "$MYSQL_MAJOR" -ge "5"; then
4886        AC_MSG_RESULT([OK])
4887    else
4888        AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4889    fi
4890    AC_MSG_CHECKING([for MySQL Client library])
4891    MYSQL_INC=`$MYSQLCONFIG --include`
4892    MYSQL_LIB=`$MYSQLCONFIG --libs`
4893    MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4894    AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4895else
4896    SYSTEM_MYSQL=NO
4897    if test -n "$with_libmysql_path"; then
4898        AC_MSG_RESULT([external Connector/C (libmysql)])
4899        LIBMYSQL=libmysql.so
4900        if test "$_os" = "Darwin"; then
4901            LIBMYSQL=libmysql.dylib
4902        elif test "$_os" = "WINNT"; then
4903            LIBMYSQL=libmysql.dll
4904        fi
4905        AC_MSG_CHECKING([for $LIBMYSQL])
4906        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4907            AC_MSG_RESULT([found.])
4908            LIBMYSQL_PATH=$with_libmysql_path
4909        else
4910            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4911        fi
4912    else
4913        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4914    fi
4915fi
4916AC_SUBST(SYSTEM_MYSQL)
4917AC_SUBST(MYSQL_INC)
4918AC_SUBST(MYSQL_LIB)
4919AC_SUBST(MYSQL_DEFINES)
4920AC_SUBST(LIBMYSQL_PATH)
4921
4922AC_LANG_PUSH([C++])
4923dnl ===================================================================
4924dnl Check for system MySQL C++ Connector
4925dnl ===================================================================
4926# FIXME!
4927# who thought this too-generic cppconn dir was a good idea?
4928AC_MSG_CHECKING([MySQL Connector/C++])
4929if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4930        test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4931    AC_MSG_RESULT([external])
4932    SYSTEM_MYSQL_CPPCONN=YES
4933        AC_LANG_PUSH([C++])
4934    AC_CHECK_HEADER(mysql_driver.h, [],
4935                    [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4936    AC_CHECK_LIB(mysqlcppconn, main, [],
4937                    [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4938   AC_MSG_CHECKING([version])
4939      AC_RUN_IFELSE([AC_LANG_SOURCE([[
4940#include <mysql_driver.h>
4941
4942int main(int argc, char **argv) {
4943    sql::Driver *driver;
4944    driver = get_driver_instance();
4945    if (driver->getMajorVersion() > 1 || \
4946       (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4947       (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4948        return 0;
4949      else
4950        return 1;
4951}
4952      ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
4953        AC_LANG_POP([C++])
4954
4955else
4956    AC_MSG_RESULT([no])
4957    SYSTEM_MYSQL_CPPCONN=
4958fi
4959AC_LANG_POP([C++])
4960AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4961fi
4962
4963dnl ===================================================================
4964dnl Check for system hsqldb
4965dnl ===================================================================
4966AC_MSG_CHECKING([which hsqldb to use])
4967if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4968       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4969        AC_MSG_RESULT([external])
4970        SYSTEM_HSQLDB=YES
4971        if test -z $HSQLDB_JAR; then
4972               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4973        fi
4974        AC_CHECK_FILE($HSQLDB_JAR, [],
4975               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4976        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4977        export HSQLDB_JAR
4978        if $PERL -e 'use Archive::Zip;
4979            my $file = "$ENV{'HSQLDB_JAR'}";
4980            my $zip = Archive::Zip->new( $file );
4981            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4982            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4983               push @l, split(/\n/, $mf);
4984               foreach my $line (@l) {
4985                  if ($line =~ m/Specification-Version:/) {
4986                      ($t, $version) = split (/:/,$line);
4987                      $version =~ s/^\s//;
4988                      ($a, $b, $c, $d) = split (/\./,$version);
4989                      if ($c == "0" && $d > "8")  {
4990                          exit 0;
4991                      } else {
4992                          exit 1;
4993                      }
4994                  }
4995               }
4996            } else {
4997                exit 1;
4998            }'; then
4999            AC_MSG_RESULT([yes])
5000         else
5001            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
5002         fi
5003else
5004    AC_MSG_RESULT([internal])
5005    SYSTEM_HSQLDB=NO
5006    BUILD_TYPE="$BUILD_TYPE HSQLDB"
5007fi
5008AC_SUBST(SYSTEM_HSQLDB)
5009AC_SUBST(HSQLDB_JAR)
5010
5011dnl ===================================================================
5012dnl Check for system beanshell
5013dnl ===================================================================
5014ENABLE_BEANSHELL=YES
5015AC_MSG_CHECKING([which beanshell to use])
5016if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
5017       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
5018        AC_MSG_RESULT([external])
5019        SYSTEM_BSH=YES
5020        if test -z $BSH_JAR; then
5021               BSH_JAR=/usr/share/java/bsh.jar
5022        fi
5023        AC_CHECK_FILE($BSH_JAR, [],
5024               [AC_MSG_ERROR(bsh.jar not found.)], [])
5025elif test "x$enable_beanshell" = "xyes"; then
5026    AC_MSG_RESULT([internal])
5027    SYSTEM_BSH=NO
5028    BUILD_TYPE="$BUILD_TYPE BSH"
5029else
5030    AC_MSG_RESULT([none (disabled)])
5031    SYSTEM_BSH=NO
5032    ENABLE_BEANSHELL=NO
5033fi
5034AC_SUBST(SYSTEM_BSH)
5035AC_SUBST(BSH_JAR)
5036AC_SUBST(ENABLE_BEANSHELL)
5037
5038
5039dnl ===================================================================
5040dnl Check for saxon. It can come from two different places:
5041dnl - pre-installed on the system. This is checked when the --with-system-saxon
5042dnl   option is given to configure.
5043dnl   The exact place can be specified with the --with-saxon-jar=<path> option.
5044dnl - From the saxon tar ball in ext_sources/. This is used when --enable-saxon
5045dnl   is given to configure but not any of --with-system-saxon or --with-saxon-jar.
5046dnl ===================================================================
5047DISABLE_SAXON=
5048AC_MSG_CHECKING([which saxon to use])
5049if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
5050       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
5051        AC_MSG_RESULT([external])
5052        SYSTEM_SAXON=YES
5053        if test -z $SAXON_JAR; then
5054          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5055            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5056            [
5057              AC_CHECK_FILE(/usr/share/java/saxon.jar,
5058                [ SAXON_JAR=/usr/share/java/saxon.jar ],
5059                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
5060                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
5061                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
5062                  )
5063                ]
5064              )
5065            ]
5066          )
5067        else
5068          AC_CHECK_FILE($SAXON_JAR, [],
5069               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
5070        fi
5071        if test -n "$SERIALIZER_JAR"; then
5072          AC_CHECK_FILE($SERIALIZER_JAR, [],
5073               [AC_MSG_ERROR(serializer.jar not found.)], [])
5074          AC_SUBST(SERIALIZER_JAR)
5075        fi
5076
5077dnl Saxon comes in two practically available versions, the out-of-date saxonb which
5078dnl supports the java extensions that AOO uses, and the up-to-date saxon he
5079dnl "home edition" version, which is crippled to not support those java extensions.
5080dnl And as an aside the he one also needs to be tweaked to include
5081dnl a META-INF/services to broadcast that it supports the jaxp transform factory
5082
5083        AC_MSG_CHECKING([if saxon works])
5084        cat > saxontest.java <<_ACEOF
5085[import javax.xml.transform.TransformerFactory;
5086import javax.xml.transform.Transformer;
5087import javax.xml.transform.stream.StreamSource;
5088import java.io.*;
5089
5090import net.sf.saxon.FeatureKeys;
5091
5092class saxontest {
5093    public static void main(String[] args) {
5094      System.setProperty("javax.xml.transform.TransformerFactory",
5095        "net.sf.saxon.TransformerFactoryImpl");
5096      try {
5097        TransformerFactory tfactory = TransformerFactory.newInstance();
5098    // some external saxons (Debian, Ubuntu, ...) have this disabled
5099    // per default
5100    tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
5101        System.out.println("TransformerFactory is" +
5102          tfactory.getClass().getName());
5103        Transformer transformer = tfactory.newTransformer(
5104          new StreamSource(new File(args[0])));
5105      } catch(Exception e){
5106        e.printStackTrace(System.err);
5107        System.exit(-1);
5108      }
5109      System.exit(0);
5110    }
5111}
5112]
5113_ACEOF
5114        cat > saxontest.xsl<<_ACEOF
5115[<?xml version="1.0" encoding="UTF-8"?>
5116<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5117 <xsl:template match="/">
5118  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
5119 </xsl:template>
5120</xsl:stylesheet>
5121]
5122_ACEOF
5123        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
5124        AC_TRY_EVAL(javac_cmd)
5125        if test $? = 0 && test -f ./saxontest.class ; then
5126            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
5127            AC_TRY_EVAL(java_cmd)
5128            if test $? = 0; then
5129              AC_MSG_RESULT([yes])
5130            else
5131              cat saxontest.java >&5
5132              AC_MSG_RESULT([no])
5133              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
5134            fi
5135        else
5136          AC_MSG_RESULT([no])
5137          cat saxontest.java >&5
5138          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
5139        fi
5140elif test "x$enable_saxon" = "xyes"; then
5141    AC_MSG_RESULT([internal])
5142    SYSTEM_SAXON=NO
5143    BUILD_TYPE="$BUILD_TYPE SAXON"
5144else
5145    AC_MSG_RESULT([none (disabled)])
5146    SYSTEM_SAXON=NO
5147    DISABLE_SAXON=YES
5148fi
5149AC_SUBST(SYSTEM_SAXON)
5150AC_SUBST(SAXON_JAR)
5151AC_SUBST(DISABLE_SAXON)
5152
5153
5154dnl ===================================================================
5155dnl Check for rhino
5156dnl ===================================================================
5157ENABLE_JAVASCRIPT=
5158AC_MSG_CHECKING([whether to enable support for JavaScript])
5159if test "x$enable_javascript" = "xyes"; then
5160   BUILD_TYPE="$BUILD_TYPE RHINO"
5161   AC_MSG_RESULT([yes])
5162   ENABLE_JAVASCRIPT=YES
5163else
5164   AC_MSG_RESULT([no])
5165   ENABLE_JAVASCRIPT=NO
5166fi
5167AC_SUBST(ENABLE_JAVASCRIPT)
5168
5169
5170dnl ===================================================================
5171dnl Check for CoinMP
5172dnl ===================================================================
5173ENABLE_COINMP=
5174SYSTEM_COINMP=NO
5175COINMP_CFLAGS=
5176COINMP_LIBS=
5177AC_MSG_CHECKING([whether to enable support for CoinMP])
5178if test "x$enable_coinmp" = "xyes"; then
5179    BUILD_TYPE="$BUILD_TYPE COINMP"
5180    AC_MSG_RESULT([yes])
5181    ENABLE_COINMP=YES
5182
5183    dnl Check whether to use system or internal CoinMP
5184    AC_MSG_CHECKING([which coinmp to use])
5185    if test "x$with_system_coinmp" = "xyes" -o -n "$with_system_libs"; then
5186        AC_MSG_RESULT([system])
5187    PKG_CHECK_MODULES([COINMP], [coinmp])
5188        SYSTEM_COINMP=YES
5189        # some systems need this. Like Ubuntu....
5190        AC_CHECK_LIB(m, floor)
5191        AC_CHECK_LIB(dl, dlopen)
5192    else
5193        AC_MSG_RESULT([internal])
5194        SYSTEM_COINMP=NO
5195        BUILD_TYPE="$BUILD_TYPE COINMP"
5196    fi
5197else
5198    AC_MSG_RESULT([no])
5199    ENABLE_COINMP=NO
5200fi
5201AC_SUBST(ENABLE_COINMP)
5202AC_SUBST(SYSTEM_COINMP)
5203AC_SUBST(COINMP_CFLAGS)
5204AC_SUBST(COINMP_LIBS)
5205
5206
5207dnl ===================================================================
5208dnl Check for system curl
5209dnl ===================================================================
5210dnl Darwin always treats curl as external (see the "-o \"$_os\" = \"Darwin\""
5211dnl clause below), regardless of whether --with-system-curl was actually
5212dnl given a directory -- capture the as-given value first, before it gets
5213dnl forced to a bare "yes", so a real --with-system-curl=DIR isn't lost.
5214with_system_curl_dir="$with_system_curl"
5215if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
5216   with_system_curl=yes
5217fi
5218AC_MSG_CHECKING([which curl to use])
5219if test -n "$with_system_curl" -o -n "$with_system_libs" && \
5220    test "$with_system_curl" != "no"; then
5221   AC_MSG_RESULT([external])
5222   SYSTEM_CURL=YES
5223
5224   dnl See the matching libxml check above for why this pins
5225   dnl curl-config to the directory given to --with-system-curl instead
5226   dnl of resolving a bare "curl-config" off PATH.
5227   if test "$with_system_curl_dir" != "yes" -a -n "$with_system_curl_dir"; then
5228      CURLCONFIG="$with_system_curl_dir/bin/curl-config"
5229      if test ! -x "$CURLCONFIG"; then
5230         AC_MSG_ERROR([--with-system-curl=$with_system_curl_dir given, but $CURLCONFIG not found or not executable])
5231      fi
5232   else
5233      AC_PATH_PROG( CURLCONFIG, curl-config)
5234      if test -z "$CURLCONFIG"; then
5235         AC_MSG_ERROR([install curl to run this script])
5236      fi
5237   fi
5238
5239   # check curl version
5240   AC_MSG_CHECKING([whether curl is >= 7.13.1])
5241   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
5242    "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
5243    "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
5244      AC_MSG_ERROR([no, you need at least curl 7.13,1])
5245   else
5246      AC_MSG_RESULT([yes])
5247   fi
5248
5249   # Does curl use OpenSSL as its SSL implementation? Needed for ucb/source/ucp/webdav.
5250   AC_MSG_CHECKING([whether curl uses OpenSSL as its SSL backend])
5251   if $CURLCONFIG --ssl-backends | $GREP -q 'OpenSSL'; then
5252      AC_MSG_RESULT([yes])
5253   else
5254      AC_MSG_ERROR([no, cannot use system curl whose SSL backend isn't OpenSSL])
5255   fi
5256
5257   CURL_LIBS=`$CURLCONFIG --libs`
5258   CURL_CFLAGS=`$CURLCONFIG --cflags`
5259   CURL_PREFIX=`$CURLCONFIG --prefix`
5260else
5261   AC_MSG_RESULT([internal])
5262   SYSTEM_CURL=NO
5263   BUILD_TYPE="$BUILD_TYPE CURL"
5264fi
5265AC_SUBST(SYSTEM_CURL)
5266AC_SUBST(CURL_CFLAGS)
5267AC_SUBST(CURL_LIBS)
5268AC_SUBST(CURL_PREFIX)
5269
5270dnl ===================================================================
5271dnl Pin selected system libraries to their static archives
5272dnl ===================================================================
5273dnl Runs after the libxml/libxslt/curl checks above, which is where the
5274dnl *_PREFIX and *_LIBS values it rewrites are established.
5275dnl
5276dnl Without this the static-vs-dynamic choice is implicit: "-lfoo" lets the
5277dnl linker take a dylib over an archive, and the libxml2 link in
5278dnl forms/util and xmlsecurity/util explicitly prefers a dylib when the
5279dnl prefix has one. Either way a dylib appearing at the prefix silently
5280dnl turns a release build dynamic, and these dylibs carry absolute install
5281dnl names that do not exist on an end user's machine.
5282STATIC_SYSTEM_LIBS=
5283STATIC_SYSTEM_LIBXML=NO
5284STATIC_SYSTEM_LIBXSLT=NO
5285STATIC_SYSTEM_CURL=NO
5286if test -n "$with_static_system_libs" -a "$with_static_system_libs" != "no"; then
5287   if test "$with_static_system_libs" = "yes"; then
5288      AC_MSG_ERROR([--with-static-system-libs needs a list, e.g. --with-static-system-libs=libxml,libxslt,curl])
5289   fi
5290   for _ssentry in `echo "$with_static_system_libs" | $SED -e 's/,/ /g'`; do
5291      dnl Each entry is NAME or NAME:DIR. The explicit DIR is what makes
5292      dnl libiconv usable here: it has no --with-system-libiconv, so
5293      dnl configure has no prefix of its own to fall back on.
5294      _sslib=`echo "$_ssentry" | $SED -e 's/:.*//'`
5295      _ssgiven=
5296      case "$_ssentry" in
5297      *:*) _ssgiven=`echo "$_ssentry" | $SED -e 's/^[[^:]]*://'` ;;
5298      esac
5299      AC_MSG_CHECKING([for a static system $_sslib])
5300      case "$_sslib" in
5301      libxml)
5302         _ssenabled="$SYSTEM_LIBXML"; _ssprefix="$LIBXML_PREFIX"; _ssopt="--with-system-libxml"
5303         _ssarchives="libxml2.a"; _sslflags="-lxml2"
5304         ;;
5305      libxslt)
5306         _ssenabled="$SYSTEM_LIBXSLT"; _ssprefix="$LIBXSLT_PREFIX"; _ssopt="--with-system-libxslt"
5307         _ssarchives="libxslt.a libexslt.a"; _sslflags="-lxslt -lexslt"
5308         ;;
5309      curl)
5310         _ssenabled="$SYSTEM_CURL"; _ssprefix="$CURL_PREFIX"; _ssopt="--with-system-curl"
5311         _ssarchives="libcurl.a"; _sslflags="-lcurl"
5312         ;;
5313      libiconv)
5314         dnl The bundled XML libs are built --without-iconv, so this only
5315         dnl covers a *system* libxml2/libxslt/curl whose own build enabled
5316         dnl iconv and whose *-config therefore reports -liconv. There is no
5317         dnl --with-system-libiconv to take a prefix from, hence libiconv:DIR.
5318         _ssenabled=YES; _ssprefix="$_ssgiven"; _ssopt=
5319         _ssarchives="libiconv.a"; _sslflags="-liconv"
5320         ;;
5321      *)
5322         AC_MSG_ERROR([unsupported library "$_sslib" in --with-static-system-libs; supported: libxml, libxslt, curl, libiconv])
5323         ;;
5324      esac
5325      test -n "$_ssgiven" && _ssprefix="$_ssgiven"
5326      if test "$_ssenabled" != "YES"; then
5327         AC_MSG_ERROR([--with-static-system-libs=$_sslib requires $_ssopt])
5328      fi
5329      if test -z "$_ssprefix"; then
5330         if test -n "$_ssopt"; then
5331            AC_MSG_ERROR([--with-static-system-libs=$_sslib needs a prefix; give $_ssopt=DIR (macOS only)])
5332         else
5333            AC_MSG_ERROR([--with-static-system-libs=$_sslib needs a prefix; write $_sslib:DIR, e.g. $_sslib:/usr/local])
5334         fi
5335      fi
5336      for _ssa in $_ssarchives; do
5337         if test ! -f "$_ssprefix/lib/$_ssa"; then
5338            AC_MSG_ERROR([--with-static-system-libs=$_sslib given, but $_ssprefix/lib/$_ssa not found])
5339         fi
5340      done
5341      dnl Replace each "-lfoo" with the archive's absolute path so the
5342      dnl linker cannot pick a dylib sitting beside it. Matching on a
5343      dnl trailing space (the value gets one appended, then trimmed) keeps
5344      dnl this to portable BRE -- $SED is whatever sed AC_PATH_PROGS found,
5345      dnl which is not required to be GNU, and \| alternation silently
5346      dnl matches nothing under the BSD sed macOS ships.
5347      for _ssl in $_sslflags; do
5348         _ssa="lib`echo "$_ssl" | $SED -e 's/^-l//'`.a"
5349         case "$_sslib" in
5350         libxml)   LIBXML_LIBS=`echo "$LIBXML_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` ;;
5351         libxslt)  LIBXSLT_LIBS=`echo "$LIBXSLT_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` ;;
5352         curl)     CURL_LIBS=`echo "$CURL_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` ;;
5353         libiconv)
5354            dnl iconv is a transitive dep, so -liconv turns up in whichever
5355            dnl of these *-config reported it -- rewrite all of them.
5356            LIBXML_LIBS=`echo "$LIBXML_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'`
5357            LIBXSLT_LIBS=`echo "$LIBXSLT_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'`
5358            CURL_LIBS=`echo "$CURL_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'`
5359            ;;
5360         esac
5361      done
5362      case "$_sslib" in
5363      libxml)   STATIC_SYSTEM_LIBXML=YES ;;
5364      libxslt)  STATIC_SYSTEM_LIBXSLT=YES ;;
5365      curl)     STATIC_SYSTEM_CURL=YES ;;
5366      esac
5367      STATIC_SYSTEM_LIBS="$STATIC_SYSTEM_LIBS $_sslib"
5368      AC_MSG_RESULT([$_ssprefix/lib])
5369   done
5370   STATIC_SYSTEM_LIBS=`echo $STATIC_SYSTEM_LIBS`
5371fi
5372AC_SUBST(STATIC_SYSTEM_LIBS)
5373AC_SUBST(STATIC_SYSTEM_LIBXML)
5374AC_SUBST(STATIC_SYSTEM_LIBXSLT)
5375AC_SUBST(STATIC_SYSTEM_CURL)
5376
5377dnl ===================================================================
5378dnl Check for system mdds
5379dnl ===================================================================
5380AC_MSG_CHECKING([which mdds to use])
5381if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
5382    test "$with_system_mdds" != "no"; then
5383    AC_MSG_RESULT([external])
5384    SYSTEM_MDDS=YES
5385    AC_LANG_PUSH([C++])
5386    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
5387        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
5388    AC_LANG_POP([C++])
5389else
5390   AC_MSG_RESULT([internal])
5391   BUILD_TYPE="$BUILD_TYPE MDDS"
5392   SYSTEM_MDDS=NO
5393fi
5394AC_SUBST(SYSTEM_MDDS)
5395
5396dnl ===================================================================
5397dnl Check for system boost
5398dnl ===================================================================
5399AC_MSG_CHECKING([which boost to use])
5400if test -n "$with_system_boost" -o -n "$with_system_headers" && \
5401    test "$with_system_boost" != "no"; then
5402   AC_MSG_RESULT([external])
5403   SYSTEM_BOOST=YES
5404   AC_LANG_PUSH([C++])
5405   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
5406       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
5407   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
5408       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
5409   AC_CHECK_HEADER(boost/function.hpp, [],
5410       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
5411
5412   save_CXXFLAGS=$CXXFLAGS
5413   CXXFLAGS="$CXXFLAGS -fno-exceptions"
5414   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
5415   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
5416]], [[]])],[ac_cv_cxx_boost_no_exceptons_broken=no],[ac_cv_cxx_boost_no_exceptons_broken=yes])
5417
5418   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
5419    AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
5420   else
5421    AC_MSG_RESULT([yes])
5422   fi
5423   CXXFLAGS=$save_CXXFLAGS
5424   AC_LANG_POP([C++])
5425else
5426   AC_MSG_RESULT([internal])
5427   BUILD_TYPE="$BUILD_TYPE BOOST"
5428   SYSTEM_BOOST=NO
5429fi
5430AC_SUBST(SYSTEM_BOOST)
5431
5432dnl ===================================================================
5433dnl Check for system vigra
5434dnl ===================================================================
5435AC_MSG_CHECKING([which vigra to use])
5436if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
5437    test "$with_system_vigra" != "no"; then
5438   AC_MSG_RESULT([external])
5439   SYSTEM_VIGRA=YES
5440   AC_LANG_PUSH([C++])
5441   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
5442       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
5443   AC_LANG_POP([C++])
5444else
5445   AC_MSG_RESULT([internal])
5446   BUILD_TYPE="$BUILD_TYPE VIGRA"
5447   SYSTEM_VIGRA=NO
5448fi
5449AC_SUBST(SYSTEM_VIGRA)
5450
5451dnl ===================================================================
5452dnl Check for system odbc
5453dnl ===================================================================
5454AC_MSG_CHECKING([which odbc headers to use])
5455if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
5456    test "$with_system_odbc_headers" != "no"; then
5457   AC_MSG_RESULT([external])
5458   SYSTEM_ODBC_HEADERS=YES
5459
5460   AC_CHECK_HEADER(sqlext.h, [],
5461      [AC_MSG_ERROR(odbc not found. install odbc)], [])
5462else
5463   AC_MSG_RESULT([internal])
5464   SYSTEM_ODBC_HEADERS=NO
5465   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
5466fi
5467AC_SUBST(SYSTEM_ODBC_HEADERS)
5468
5469AC_MSG_CHECKING([whether to build XML Security support])
5470if test "$enable_nss_module" = "no"; then
5471   AC_MSG_RESULT([no, since NSS disabled but needed])
5472else
5473   AC_MSG_RESULT([yes])
5474fi
5475
5476AC_MSG_CHECKING([whether to build LDAP configuration backend])
5477if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
5478   if test "$with_openldap" = "yes"; then
5479      AC_MSG_RESULT([yes])
5480      WITH_LDAP=YES
5481   else
5482      WITH_LDAP=NO
5483   fi
5484else
5485   AC_MSG_RESULT([no])
5486   WITH_LDAP=NO
5487fi
5488
5489if test "$WITH_LDAP" = "YES"; then
5490   dnl ===================================================================
5491   dnl Test whether we want to use the OpenLDAP LDAP SDK
5492   dnl ===================================================================
5493   AC_MSG_CHECKING([which LDAP SDK to use])
5494   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
5495       AC_MSG_RESULT([OpenLDAP])
5496       WITH_OPENLDAP=YES
5497       AC_CHECK_HEADERS(ldap.h, [],
5498           [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
5499       AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
5500           [AC_MSG_ERROR(openldap lib not found or functional)], [])
5501       # rumours say that OpenLDAP doesn't have that function. I looked and
5502       # it has it. Test for it to be sure
5503         AC_CHECK_LIB(ldap, ldap_set_option, [],
5504                [AC_MSG_ERROR(openldap lib not found or functional)], [])
5505   fi
5506fi
5507AC_SUBST(WITH_LDAP)
5508AC_SUBST(WITH_OPENLDAP)
5509
5510AC_MSG_CHECKING([whether to build the internal NSS module])
5511if test "$enable_nss_module" != "no"; then
5512   ENABLE_NSS_MODULE="YES"
5513   BUILD_TYPE="$BUILD_TYPE NSS"
5514   AC_MSG_RESULT([yes])
5515   if test "$_os" = "WINNT"; then
5516      AC_MSG_CHECKING([for Mozilla build tooling])
5517      if test -z "$MOZILLABUILD" ; then
5518AC_MSG_ERROR([
5519Mozilla build tooling not found!
5520  It is required for NSS that is needed for AOO's security facilities.
5521  Either disable NSS using the option --disable-nss-module
5522  or use the --with-mozilla-build option after installing the tool obtained
5523  from https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/])
5524      else
5525         if test \( "$WITH_MINGWIN" = "yes" \) ; then
5526            if test ! -d "$MOZILLABUILD" ; then
5527AC_MSG_ERROR([Mozilla build tooling incomplete!])
5528            else
5529               AC_MSG_RESULT([ok])
5530            fi
5531         else
5532            if test ! -d "$MOZILLABUILD/msys" ; then
5533AC_MSG_ERROR([Mozilla build tooling incomplete!])
5534            else
5535               AC_MSG_RESULT([ok])
5536            fi
5537         fi
5538      fi
5539   fi
5540else
5541   ENABLE_NSS_MODULE="NO"
5542   AC_MSG_RESULT([no])
5543fi
5544
5545AC_SUBST(ENABLE_NSS_MODULE)
5546AC_SUBST(MOZILLABUILD)
5547AC_SUBST(MOZ_INC)
5548
5549dnl ===================================================================
5550dnl Check for system sane
5551dnl ===================================================================
5552AC_MSG_CHECKING([which sane header to use])
5553if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
5554    test "$with_system_sane_header" != "no"; then
5555   AC_MSG_RESULT([external])
5556   SYSTEM_SANE_HEADER=YES
5557   AC_CHECK_HEADER(sane/sane.h, [],
5558      [AC_MSG_ERROR(sane not found. install sane)], [])
5559else
5560   AC_MSG_RESULT([internal])
5561   SYSTEM_SANE_HEADER=NO
5562   BUILD_TYPE="$BUILD_TYPE SANE"
5563fi
5564AC_SUBST(SYSTEM_SANE_HEADER)
5565
5566dnl ===================================================================
5567dnl Check for system icu
5568dnl ===================================================================
5569AC_MSG_CHECKING([which icu to use])
5570if test -n "$with_system_icu" -o -n "$with_system_libs" && \
5571    test "$with_system_icu" != "no"; then
5572   AC_MSG_RESULT([external])
5573   SYSTEM_ICU=YES
5574   AC_LANG_PUSH([C++])
5575   AC_MSG_CHECKING([for unicode/rbbi.h])
5576   AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
5577   AC_LANG_POP([C++])
5578   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
5579   if test -z "$SYSTEM_GENBRK"; then
5580      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
5581   fi
5582   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
5583   if test -z "$SYSTEM_GENCCODE"; then
5584      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
5585   fi
5586   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
5587   if test -z "$SYSTEM_GENCMN"; then
5588      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
5589   fi
5590
5591   AC_PATH_PROG( ICUCONFIG, icu-config)
5592   AC_MSG_CHECKING([ICU version])
5593   if test "$_os" = "OS2"; then
5594      ICU_MAJOR=4
5595   else
5596      ICU_VERSION=`$ICUCONFIG --version`
5597      ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
5598      ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
5599      ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
5600      ICU_CFLAGS=`$ICUCONFIG --cppflags`
5601   fi
5602
5603   if test "$ICU_MAJOR" -ge "4"; then
5604      AC_MSG_RESULT([OK])
5605   else
5606      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
5607   fi
5608
5609else
5610    AC_MSG_RESULT([internal])
5611    SYSTEM_ICU=NO
5612    BUILD_TYPE="$BUILD_TYPE ICU"
5613fi
5614AC_SUBST(SYSTEM_ICU)
5615AC_SUBST(SYSTEM_GENBRK)
5616AC_SUBST(SYSTEM_GENCCODE)
5617AC_SUBST(SYSTEM_GENCMN)
5618AC_SUBST(ICU_MAJOR)
5619AC_SUBST(ICU_MINOR)
5620AC_SUBST(ICU_MICRO)
5621AC_SUBST(ICU_CFLAGS)
5622
5623dnl ===================================================================
5624dnl Graphite
5625dnl ===================================================================
5626
5627ENABLE_GRAPHITE="FALSE"
5628AC_MSG_CHECKING([whether to enable graphite support])
5629if test "x$enable_graphite" = "xyes" -a \( "$_os" = "WINNT" -o "$_os" = "Linux" -o "$_os" = "FreeBSD" \) ; then
5630    AC_MSG_RESULT([yes])
5631    ENABLE_GRAPHITE="TRUE"
5632    AC_MSG_CHECKING([which graphite to use])
5633    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
5634        test "$with_system_graphite" != "no"; then
5635        AC_MSG_RESULT([external])
5636        SYSTEM_GRAPHITE=YES
5637        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
5638    else
5639        AC_MSG_RESULT([internal])
5640        SYSTEM_GRAPHITE=NO
5641        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
5642    fi
5643else
5644   AC_MSG_RESULT([no])
5645   ENABLE_GRAPHITE="FALSE"
5646fi
5647AC_SUBST(ENABLE_GRAPHITE)
5648AC_SUBST(SYSTEM_GRAPHITE)
5649AC_SUBST(GRAPHITE_LIBS)
5650AC_SUBST(GRAPHITE_CFLAGS)
5651
5652
5653dnl ===================================================================
5654dnl Checks for libraries.
5655dnl ===================================================================
5656dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
5657dnl See if we have the AppKit framework for building with Quartz graphics.
5658
5659if test  "$_os" = "Darwin"; then
5660   if test "x$with_x" = "xyes"; then
5661      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
5662   else
5663      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
5664      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
5665         AC_MSG_RESULT([yes])
5666         x_includes="no_x_includes"
5667         x_libraries="no_x_libraries"
5668         dnl disable some things used on other Unix versions but not on the aqua build
5669         enable_gtk=no
5670         enable_cups=no
5671         ENABLE_CUPS=""
5672         AC_SUBST(ENABLE_CUPS)
5673      else
5674         AC_MSG_ERROR([No AppKit.framewrok found])
5675      fi
5676   fi
5677fi
5678
5679dnl ***************************************
5680dnl testing for X libraries and includes...
5681dnl ***************************************
5682if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
5683   echo "Do Nothing for _os = Darwin"
5684   dnl Mac OS X using Aqua graphics. Don't check for X11.
5685   :
5686elif test "$_os" = "OS2" ; then
5687   echo "Do Nothing for _os = OS2. Don't check for X11."
5688   dnl OS/2 uses native graphics. Don't check for X11.
5689   :
5690elif test "$_os" != "WINNT" ; then
5691   AC_PATH_X
5692   AC_PATH_XTRA
5693   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
5694
5695   if test "x$x_includes" = "x"; then
5696     x_includes="default_x_includes"
5697   fi
5698   if test "x$x_libraries" = "x"; then
5699     x_libraries="default_x_libraries"
5700   fi
5701   dnl The variables $x_libraries and $x_includes are set.
5702   if test -z "$x_libraries"; then
5703      AC_MSG_ERROR([No X libraries found]) # Exit
5704   fi
5705   if test -z "$x_includes"; then
5706      AC_MSG_ERROR([No X includes found]) # Exit
5707   fi
5708   CFLAGS=$X_CFLAGS
5709   LDFLAGS="$X_LDFLAGS $X_LIBS"
5710   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
5711   dnl Check if the XauDisposeAuth symbol is provided by libXau.
5712   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
5713else
5714   x_includes="no_x_includes"
5715   x_libraries="no_x_libraries"
5716fi
5717if test -z "$x_includes"; then
5718   x_includes="no_x_includes"
5719fi
5720if test -z "$x_libraries"; then
5721   x_libraries="no_x_libraries"
5722fi
5723if test "$x_includes" = "default_x_includes"; then
5724   XINC="/usr/include"
5725else
5726   XINC="$x_includes"
5727fi
5728AC_SUBST(XINC)
5729if test "$x_libraries" = "default_x_libraries"; then
5730   XLIB=`$PKG_CONFIG --variable=libdir x11`
5731   if test "x$XLIB" = x; then
5732         XLIB="/usr/lib"
5733   fi
5734else
5735   XLIB="$x_libraries"
5736fi
5737AC_SUBST(XLIB)
5738AC_SUBST(XAU_LIBS)
5739
5740dnl ===================================================================
5741dnl Check if fontconfig/fontconfig.h is available
5742dnl ===================================================================
5743if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
5744    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
5745                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
5746    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
5747    AC_RUN_IFELSE([AC_LANG_SOURCE([[
5748#include <fontconfig/fontconfig.h>
5749
5750int main(int argc, char **argv) {
5751    if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
5752    else return 1;
5753}
5754]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])],[])
5755fi
5756
5757dnl ===================================================================
5758dnl Check for system Xrender
5759dnl ===================================================================
5760AC_MSG_CHECKING([whether to link to Xrender])
5761if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
5762   AC_MSG_RESULT([yes])
5763   XRENDER_LINK=YES
5764   with_system_xrender_headers=yes
5765else
5766   AC_MSG_RESULT([no, dynamically open it])
5767   XRENDER_LINK=NO
5768fi
5769AC_MSG_CHECKING([which Xrender headers to use])
5770if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
5771    test "$with_system_xrender_headers" != "no"; then
5772   AC_MSG_RESULT([external])
5773   SYSTEM_XRENDER_HEADERS=YES
5774   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
5775      [AC_MSG_ERROR(Xrender not found. install X)], [])
5776else
5777   AC_MSG_RESULT([internal])
5778   SYSTEM_XRENDER_HEADERS=NO
5779   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
5780fi
5781if test "$XRENDER_LINK" = "YES"; then
5782   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
5783      [AC_MSG_ERROR(libXrender not found or functional)], [])
5784fi
5785AC_SUBST(SYSTEM_XRENDER_HEADERS)
5786AC_SUBST(XRENDER_LINK)
5787
5788dnl ===================================================================
5789dnl Check for XRandr
5790dnl ===================================================================
5791AC_MSG_CHECKING([whether to enable RandR support])
5792if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5793   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5794      XRANDR_DLOPEN="TRUE"
5795      AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5796   else
5797      XRANDR_DLOPEN="FALSE"
5798      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5799      if test "$ENABLE_RANDR" != "TRUE"; then
5800         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5801                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5802         XRANDR_CFLAGS=" "
5803         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5804              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5805         XRANDR_LIBS="-lXrandr "
5806         ENABLE_RANDR="TRUE"
5807         AC_MSG_RESULT([enabling RandR support])
5808      fi
5809   fi
5810else
5811   ENABLE_RANDR=""
5812   AC_MSG_RESULT([no])
5813fi
5814AC_SUBST(XRANDR_DLOPEN)
5815AC_SUBST(XRANDR_CFLAGS)
5816AC_SUBST(XRANDR_LIBS)
5817AC_SUBST(ENABLE_RANDR)
5818
5819dnl ===================================================================
5820dnl Check for system nss
5821dnl ===================================================================
5822AC_MSG_CHECKING([which libnss to use])
5823if test -n "$with_system_nss" -o -n "$with_system_libs" && test "$with_system_nss" != "no"; then
5824    AC_MSG_RESULT([external])
5825    PKG_CHECK_MODULES( NSS, nss )
5826    SYSTEM_NSS=YES
5827else
5828    AC_MSG_RESULT([internal])
5829    SYSTEM_NSS=NO
5830    BUILD_TYPE="$BUILD_TYPE NSS"
5831fi
5832AC_SUBST(SYSTEM_NSS)
5833AC_SUBST(NSS_CFLAGS)
5834AC_SUBST(NSS_LIBS)
5835
5836dnl ===================================================================
5837dnl Check for system openssl
5838dnl ===================================================================
5839AC_MSG_CHECKING([which libssl to use])
5840if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5841        test "$with_system_openssl" != "no"; then
5842    AC_MSG_RESULT([external])
5843    if test "$_os" = "FreeBSD"; then
5844        OPENSSL_CFLAGS=
5845        OPENSSL_LIBS="-lssl -lcrypto"
5846    else
5847        PKG_CHECK_MODULES( OPENSSL, openssl )
5848    fi
5849    SYSTEM_OPENSSL=YES
5850else
5851    AC_MSG_RESULT([internal])
5852    SYSTEM_OPENSSL=NO
5853    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5854fi
5855AC_SUBST(SYSTEM_OPENSSL)
5856AC_SUBST(OPENSSL_CFLAGS)
5857AC_SUBST(OPENSSL_LIBS)
5858
5859dnl ===================================================================
5860dnl Check for system redland
5861dnl ===================================================================
5862AC_MSG_CHECKING([which redland library to use])
5863if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5864    test "$with_system_redland" != "no"; then
5865    AC_MSG_RESULT([external])
5866    SYSTEM_REDLAND=YES
5867   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5868   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5869else
5870    AC_MSG_RESULT([internal])
5871    BUILD_TYPE="$BUILD_TYPE REDLAND"
5872    SYSTEM_REDLAND=NO
5873fi
5874AC_SUBST(SYSTEM_REDLAND)
5875AC_SUBST(REDLAND_CFLAGS)
5876AC_SUBST(REDLAND_LIBS)
5877
5878dnl ===================================================================
5879dnl Check for hunspell
5880dnl ===================================================================
5881AC_MSG_CHECKING([whether to build the Spell Checking component])
5882ENABLE_HUNSPELL=
5883
5884if test "x$enable_hunspell" != "xno" ; then
5885    AC_MSG_CHECKING([which libhunspell to use])
5886    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5887        test "$with_system_hunspell" != "no"; then
5888        AC_MSG_RESULT([external])
5889        SYSTEM_HUNSPELL=YES
5890        AC_LANG_PUSH([C++])
5891        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5892        if test "$HUNSPELL_PC" != "TRUE"; then
5893            AC_CHECK_HEADER(hunspell.hxx, [],
5894            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5895                [AC_MSG_ERROR(hunspell headers not found.)], [])
5896             ], [])
5897            AC_CHECK_LIB(hunspell, main, [],
5898            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5899            HUNSPELL_LIBS=-lhunspell
5900        fi
5901        AC_LANG_POP([C++])
5902    else
5903        AC_MSG_RESULT([internal])
5904        SYSTEM_HUNSPELL=NO
5905        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5906    fi
5907    ENABLE_HUNSPELL=YES
5908    AC_SUBST(SYSTEM_HUNSPELL)
5909    AC_SUBST(HUNSPELL_CFLAGS)
5910    AC_SUBST(HUNSPELL_LIBS)
5911else
5912    AC_MSG_RESULT([no])
5913fi
5914AC_SUBST(ENABLE_HUNSPELL)
5915
5916dnl ===================================================================
5917dnl Checking for libhyphen
5918dnl ===================================================================
5919AC_MSG_CHECKING([whether to build the Hyphenator component])
5920ENABLE_HYPHEN=
5921
5922if test "x$enable_hyphen" != "xno" ; then
5923    AC_MSG_CHECKING([which libhyphen to use])
5924    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5925        test "$with_system_hyphen" != "no"; then
5926        AC_MSG_RESULT([external])
5927        SYSTEM_HYPH=YES
5928        AC_CHECK_HEADER(hyphen.h, [],
5929        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5930        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5931        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5932        [#include <hyphen.h>])
5933        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5934            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5935        if test -z "$HYPHEN_LIB"; then
5936        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5937            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5938        fi
5939        if test -z "$HYPHEN_LIB"; then
5940        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5941            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5942        fi
5943    else
5944        AC_MSG_RESULT([internal])
5945        SYSTEM_HYPH=NO
5946        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5947    fi
5948    ENABLE_HYPHEN=YES
5949    AC_SUBST(SYSTEM_HYPH)
5950    AC_SUBST(HYPHEN_LIB)
5951else
5952    AC_MSG_RESULT([no])
5953fi
5954AC_SUBST(ENABLE_HYPHEN)
5955
5956
5957#dnl ===================================================================
5958#dnl Check whether we are allowed to bundle dictionaries and whether
5959#dnl hunspell is available.
5960#dnl ===================================================================
5961ENABLE_BUNDLED_DICTIONARIES=
5962if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5963   ENABLE_BUNDLED_DICTIONARIES=YES
5964fi
5965AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5966
5967
5968
5969dnl ===================================================================
5970dnl Checking for mythes
5971dnl ===================================================================
5972AC_MSG_CHECKING([which mythes to use])
5973if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5974   test "$with_system_mythes" != "no"; then
5975    AC_MSG_RESULT([external])
5976    SYSTEM_MYTHES=YES
5977    AC_LANG_PUSH([C++])
5978    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5979    if test "$MYTHES_PKGCONFIG" = "no"; then
5980        AC_CHECK_HEADER(mythes.hxx, [],
5981            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5982        AC_CHECK_LIB(mythes-1.2, main, [],
5983            [ MYTHES_FOUND=no], [])
5984    if test "$MYTHES_FOUND" = "no"; then
5985            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5986                [ MYTHES_FOUND=no], [])
5987    fi
5988    if test "$MYTHES_FOUND" = "no"; then
5989        AC_MSG_ERROR([mythes library not found!.])
5990    fi
5991    fi
5992    AC_LANG_POP([C++])
5993else
5994    AC_MSG_RESULT([internal])
5995    SYSTEM_MYTHES=NO
5996    BUILD_TYPE="$BUILD_TYPE MYTHES"
5997fi
5998AC_SUBST(SYSTEM_MYTHES)
5999AC_SUBST(MYTHES_CFLAGS)
6000AC_SUBST(MYTHES_LIBS)
6001
6002
6003dnl ===================================================================
6004dnl Checking for libtextcat
6005dnl ===================================================================
6006AC_MSG_CHECKING([which libtextcat to use])
6007if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
6008    AC_MSG_RESULT([external])
6009    SYSTEM_LIBTEXTCAT=YES
6010    AC_CHECK_HEADER(libtextcat/textcat.h, [],
6011       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
6012    AC_CHECK_LIB(textcat, special_textcat_Init, ,
6013        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
6014else
6015    AC_MSG_RESULT([internal])
6016    SYSTEM_LIBTEXTCAT=NO
6017    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
6018fi
6019AC_SUBST(SYSTEM_LIBTEXTCAT)
6020
6021AC_MSG_CHECKING([which libtextcat data directory to use])
6022if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
6023    if test "$with_system_libtextcat_data" = "yes"; then
6024        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
6025    else
6026        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
6027    fi
6028    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
6029else
6030    AC_MSG_RESULT([internal])
6031    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
6032fi
6033AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
6034
6035dnl ***************************************
6036dnl testing libc version for Linux...
6037dnl ***************************************
6038if test "$_os" = "Linux"; then
6039   AC_MSG_CHECKING([whether libc is >= 2.1.1])
6040   exec 6>/dev/null # no output
6041   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
6042   exec 6>&1 # output on again
6043   if test "$HAVE_LIBC"; then
6044      AC_MSG_RESULT([yes])
6045   else
6046      AC_MSG_ERROR([no, upgrade libc])
6047   fi
6048fi
6049
6050if test "$_os" != "WNT"; then
6051  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
6052  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
6053  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
6054    SYSTEM_LIBC=YES
6055  fi
6056else
6057  HAVE_GETOPT=NO
6058  HAVE_READDIR_R=NO
6059  SYSTEM_LIBC=YES
6060fi
6061AC_SUBST(HAVE_GETOPT)
6062AC_SUBST(HAVE_READDIR_R)
6063AC_SUBST(SYSTEM_LIBC)
6064
6065dnl =========================================
6066dnl Check for the Microsoft Platform SDK.
6067dnl =========================================
6068dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
6069dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
6070if test \( "$_os" = "WINNT" \) -a \( -z "$MSVC_MODERN" \) ; then
6071    AC_MSG_CHECKING([for PSDK files])
6072    if test -z "$with_psdk_home"; then
6073        # This first line will detect a February 2003 Microsoft Platform SDK
6074        PSDK_HOME=`$OOWINTOOL --psdk-home`
6075        # But there might be also an April 2005 PSDK, unfortunately MS changed
6076        # the registry entry. (we prefer the old version!?)
6077        if test -z "$PSDK_HOME"; then
6078          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
6079        fi
6080            # normalize if found
6081            if test -n "$PSDK_HOME"; then
6082              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
6083              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
6084           fi
6085    else
6086           PSDK_HOME=`cygpath -u "$with_psdk_home"`
6087    fi
6088        # Remove a possible trailing backslash
6089        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
6090    # Problem with current PSDK (iz 49865)
6091    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
6092        AC_MSG_ERROR([
6093
6094Some modules do not build correctly with MS Platform SDK - April 2005
6095Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
6096Remove/rename/backup that file and restart configure. Details about this
6097problem can be found in issue 49856.])
6098    fi
6099# Windows SDK has different headers
6100    if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
6101         -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
6102         -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
6103        HAVE_PSDK_H="yes"
6104    else
6105        HAVE_PSDK_H="no"
6106    fi
6107    if test -f "$PSDK_HOME/lib/unicows.lib"; then
6108        HAVE_PSDK_LIB="yes"
6109    else
6110        HAVE_PSDK_LIB="no"
6111    fi
6112    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
6113        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
6114are installed or use --with-psdk-home .])
6115    fi
6116    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
6117         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
6118         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
6119         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
6120        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
6121    fi
6122    AC_MSG_RESULT([SDK files found ...)])
6123dnl Check if this is the right SDK.
6124    if echo $PSDK_HOME | $GREP "v6.1" >/dev/null 2>/dev/null; then
6125        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
6126        WINDOWS_VISTA_PSDK=TRUE
6127    elif echo $PSDK_HOME | $GREP "v6.0" >/dev/null 2>/dev/null; then
6128        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
6129        WINDOWS_VISTA_PSDK=TRUE
6130    elif echo $PSDK_HOME | $GREP "v7.0" >/dev/null 2>/dev/null; then
6131        AC_MSG_RESULT([Found Windows SDK 7.0 ($PSDK_HOME)])
6132        WINDOWS_VISTA_PSDK=TRUE
6133    else
6134        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
6135    fi
6136fi
6137AC_SUBST(PSDK_HOME)
6138AC_SUBST(WINDOWS_VISTA_PSDK)
6139
6140dnl =========================================
6141dnl Check for the Microsoft DirectX SDK.
6142dnl =========================================
6143if test \( "$_os" = "WINNT" \) ; then
6144    AC_MSG_CHECKING([for DirectX SDK files])
6145    if test -z "$with_directx_home"; then
6146        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
6147        if test -n "$DXSDK_DIR"; then
6148            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
6149            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
6150        fi
6151        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
6152        # the "DirectX SDK files not found" error later
6153    else
6154    DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
6155    fi
6156    # Remove a possible trailing backslash
6157    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
6158
6159    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
6160        HAVE_DIRECTDRAW_H="yes"
6161    else
6162        HAVE_DIRECTDRAW_H="no"
6163    fi
6164    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
6165        HAVE_DIRECTXSDK_H="yes"
6166    else
6167        HAVE_DIRECTXSDK_H="no"
6168    fi
6169
6170    # MS changed the location of the libraries with dec 2004 directx sdk
6171    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
6172        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
6173    else
6174        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
6175    fi
6176    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
6177        HAVE_DIRECTDRAW_LIB="yes"
6178    else
6179        HAVE_DIRECTDRAW_LIB="no"
6180    fi
6181    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
6182        HAVE_DIRECTXSDK_LIB="yes"
6183    else
6184        HAVE_DIRECTXSDK_LIB="no"
6185    fi
6186
6187    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
6188       ENABLE_DIRECT_DRAW="TRUE"
6189    fi
6190    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
6191       HAVE_DIRECTXSDK="yes"
6192    else
6193       HAVE_DIRECTXSDK="no"
6194    fi
6195
6196    if test -n "$ENABLE_DIRECTX"; then
6197        if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
6198            AC_MSG_RESULT([found])
6199        else
6200            AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
6201        fi
6202    else
6203        DIRECTXSDK_HOME=""
6204        AC_MSG_RESULT([disabled])
6205    fi
6206fi
6207AC_SUBST(ENABLE_DIRECT_DRAW)
6208AC_SUBST(DIRECTXSDK_HOME)
6209AC_SUBST(DIRECTXSDK_LIB)
6210
6211
6212dnl ============================================
6213dnl Check for ATL and MFC
6214dnl ============================================
6215if test \( "$_os" = "WINNT" \) ; then
6216    AC_MSG_CHECKING([for ATL and MFC])
6217    if test "$DISABLE_ATL" = "TRUE"; then
6218        AC_MSG_RESULT([ATL is disabled, nothing to check])
6219    else
6220        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
6221        if test -z "$with_atl_include_dir"; then
6222            ATL_INCLUDE=$COMPATH/atlmfc/include
6223        else
6224            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
6225        fi
6226        if test -z "$with_atl_lib_dir"; then
6227            ATL_LIB=$COMPATH/atlmfc/lib
6228        ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
6229        else
6230            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
6231            ATL_LIB_X64=$ATL_LIB/../amd64
6232        fi
6233        if test -z "$with_mfc_include_dir"; then
6234            MFC_INCLUDE=$COMPATH/atlmfc/include
6235        else
6236            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
6237        fi
6238        if test -z "$with_mfc_lib_dir"; then
6239            MFC_LIB=$COMPATH/atlmfc/lib
6240        else
6241            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
6242        fi
6243
6244        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
6245        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
6246        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
6247        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
6248        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
6249
6250        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
6251        if test -f "$ATL_INCLUDE/atlbase.h"; then
6252            HAVE_ATL_H="yes"
6253        else
6254            HAVE_ATL_H="no"
6255        fi
6256        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
6257
6258        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
6259        if test -f "$MFC_INCLUDE/afx.h"; then
6260            HAVE_MFC_H="yes"
6261        else
6262            HAVE_MFC_H="no"
6263        fi
6264        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
6265
6266        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
6267        if test -f "$ATL_LIB/atls.lib"; then
6268            HAVE_ATL_LIB="yes"
6269            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
6270            if test -f "$ATL_LIB/atlthunk.lib"; then
6271                HAVE_ATLTHUNK="YES"
6272            else
6273                HAVE_ATLTHUNK="NO"
6274            fi
6275            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
6276        else
6277            HAVE_ATL_LIB="no"
6278        fi
6279        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
6280
6281        dnl TODO check also MFC libraries, they seem to have different names
6282        dnl mfc42.lib mfc90.lib
6283        if test -d "$MFC_LIB"; then
6284            HAVE_MFC_LIB="yes"
6285        else
6286            HAVE_MFC_LIB="no"
6287        fi
6288
6289        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
6290            ATL_INCLUDE=
6291            ATL_LIB=
6292            ATL_LIB_X64=
6293            MFC_INCLUDE=
6294            MFC_LIB=
6295            HAVE_ATL_LIB=
6296            dnl TODO shouldn't this be an error?
6297            DISABLE_ACTIVEX="TRUE"
6298            DISABLE_ATL="TRUE"
6299            AC_MSG_RESULT([ATL/MFC disabled])
6300        else
6301            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
6302            ATL_LIB=`cygpath -dm "$ATL_LIB"`
6303            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
6304            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
6305            MFC_LIB=`cygpath -dm "$MFC_LIB"`
6306            AC_MSG_RESULT([ATL/MFC enabled])
6307        fi
6308    fi
6309fi
6310AC_SUBST(ATL_INCLUDE)
6311AC_SUBST(ATL_LIB)
6312AC_SUBST(ATL_LIB_X64)
6313AC_SUBST(HAVE_ATLTHUNK)
6314AC_SUBST(MFC_INCLUDE)
6315AC_SUBST(MFC_LIB)
6316
6317
6318dnl ============================================
6319dnl Check for Nullsoft Scriptable Install System
6320dnl ============================================
6321NSIS_PATH=""
6322if test "$_os" = "WINNT" ; then
6323    AC_MSG_CHECKING([for NSIS])
6324    AC_PATH_PROG(NSIS_PATH, nsis.exe)
6325    if test -n "$NSIS_PATH"; then
6326        NSIS_PATH=`dirname "$NSIS_PATH"`
6327    fi
6328    if test -n "$with_nsis_path"; then
6329        with_nsis_path=`cygpath -u "$with_nsis_path"`
6330    fi
6331    if test -e "$with_nsis_path/nsis.exe"; then
6332        NSIS_PATH="$with_nsis_path"
6333    fi
6334    nsistest=`$OOWINTOOL --nsis-dir`;
6335    if test -x "$nsistest/nsis.exe"; then
6336        NSIS_PATH="$nsistest"
6337    fi
6338    if test -z "$NSIS_PATH"; then
6339        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
6340        echo "NSIS not found, no self contained installer will be build." >> warn
6341    else
6342        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
6343        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
6344        AC_MSG_RESULT([found ($NSIS_PATH)])
6345        AC_MSG_CHECKING([whether NSIS version is >= 3.*])
6346        nsis_version_string=`"$NSIS_PATH/makensis.exe" /VERSION | $SED -e s/^v//i`
6347        nsis_version_major=`echo $nsis_version_string | cut -d. -f1`
6348        nsis_version_minor=`echo $nsis_version_string | cut -d. -f2`
6349        if test "$nsis_version_major" -ge "3"; then
6350            AC_MSG_RESULT([found NSIS $nsis_version_major.$nsis_version_minor >= 3.*])
6351            AC_MSG_CHECKING([whether NSIS was compiled with Unicode support])
6352            if echo `"$NSIS_PATH/makensis.exe" /HDRINFO` | $EGREP  "\bNSIS_UNICODE_MAKENSIS\b" 2>&1 >/dev/null; then
6353                AC_MSG_RESULT([NSIS version compiled with Unicode support.])
6354            else
6355                NSIS_PATH=""
6356                AC_MSG_WARN([NSIS version compiled without Unicode support, no self contained installer will be build.])
6357            fi
6358        else
6359            NSIS_PATH=""
6360            AC_MSG_WARN([NSIS version found is < 3.*, no self contained installer will be build.])
6361        fi
6362    fi
6363fi
6364AC_SUBST(NSIS_PATH)
6365
6366dnl ***************************************
6367dnl testing bison and flex exist
6368dnl ***************************************
6369AC_PATH_PROG(BISON, bison)
6370if test -z "$BISON"; then
6371   AC_MSG_ERROR([no bison found in \$PATH, install bison])
6372else
6373   AC_MSG_CHECKING([the bison version])
6374   _bison_version=`$BISON --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
6375    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
6376    # Accept newer than 1.875 or older(equal) than 1.75
6377    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
6378       if test "$_bison_version" = "1.875" ; then
6379          AC_MSG_WARN([suspect ($BISON $_bison_version)])
6380          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
6381       else
6382          AC_MSG_RESULT([checked ($BISON $_bison_version)])
6383       fi
6384    else
6385       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
6386    fi
6387fi
6388AC_PATH_PROG(FLEX, flex)
6389if test -z "$FLEX"; then
6390   AC_MSG_ERROR([no flex found in \$PATH, install flex])
6391fi
6392dnl ***************************************
6393dnl testing that patch exists
6394dnl ***************************************
6395AC_PATH_PROG(PATCH, patch)
6396if test -z "$PATCH"; then
6397   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
6398fi
6399
6400dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
6401if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
6402   if test -z "$with_gnu_patch"; then
6403      GNUPATCH=$PATCH
6404   else
6405      if test -x "$with_gnu_patch"; then
6406          GNUPATCH=$with_gnu_patch
6407      else
6408         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
6409      fi
6410   fi
6411
6412   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
6413   if $GNUPATCH --version | $GREP "Free Software Foundation" >/dev/null 2>/dev/null; then
6414       AC_MSG_RESULT([yes])
6415   else
6416      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
6417   fi
6418fi
6419
6420dnl We also need to check for --with-gnu-cp
6421
6422if test -z "$with_gnu_cp"; then
6423   # check the place where the GNU stuff is hidden on Solaris...
6424   if test -x /usr/gnu/bin/cp; then
6425      GNUCP=/usr/gnu/bin/cp
6426   else
6427      AC_PATH_PROGS(GNUCP, gnucp cp)
6428   fi
6429   if test -z $GNUCP; then
6430      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
6431   fi
6432else
6433   if test -x "$with_gnu_cp"; then
6434      GNUCP=$with_gnu_cp
6435   else
6436      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
6437   fi
6438fi
6439
6440AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
6441if $GNUCP --version 2>/dev/null | $GREP "coreutils" >/dev/null 2>/dev/null; then
6442   AC_MSG_RESULT([yes])
6443else
6444   AC_MSG_RESULT([no])
6445   GNUCP=''
6446fi
6447
6448if test -z "$GNUCP"; then
6449   if test "$_os" = "SunOS"; then
6450      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
6451   else
6452      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
6453   fi
6454fi
6455
6456AC_SUBST(GNUPATCH)
6457AC_SUBST(GNUCP)
6458
6459dnl ***************************************
6460dnl testing bash tools path on Windows
6461dnl ***************************************
6462if test "$_os" = "WINNT"; then
6463    CYGWIN_PATH=""
6464    AC_PATH_PROG(CYGWIN_PATH, bash)
6465    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
6466fi
6467if test -z "$CYGWIN_PATH"; then
6468   CYGWIN_PATH="NO_CYGWIN"
6469fi
6470AC_SUBST(CYGWIN_PATH)
6471
6472dnl ***************************************
6473dnl testing ml.exe assembler path
6474dnl ***************************************
6475if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
6476  dnl  The 64 bit assembler is a different BINARY, not just a different copy:
6477  dnl  ml.exe emits 32 bit objects and ml64.exe 64 bit ones, and the x64
6478  dnl  toolset directory ships only the latter.  Look for whichever one goes
6479  dnl  with the target being built.
6480  if test "$BUILD_WIN64" = "TRUE" ; then
6481    ASM_EXE_NAME=ml64.exe
6482  else
6483    ASM_EXE_NAME=ml.exe
6484  fi
6485  AC_MSG_CHECKING([$ASM_EXE_NAME assembler path])
6486  if test -n "$with_asm_home"; then
6487    with_asm_home=`cygpath -u "$with_asm_home"`
6488  fi
6489  if test ! -x "$with_asm_home/$ASM_EXE_NAME"; then
6490    AC_PATH_PROG(ML_EXE, $ASM_EXE_NAME)
6491    if test -z "$ML_EXE"; then
6492      if test -x "$with_cl_home/bin/$ASM_EXE_NAME"; then
6493        with_asm_home=$with_cl_home/bin
6494        AC_MSG_RESULT([found ($with_asm_home)])
6495      elif test -x "$with_cl_home/$cl_subdirectory/$ASM_EXE_NAME"; then
6496        dnl  A modern toolset keeps the assembler beside the compiler in the
6497        dnl  split bin/Host<host>/<target> tree, and the target half matters:
6498        dnl  the x86 directory has ml.exe, the x64 one has ml64.exe.  Reusing
6499        dnl  $cl_subdirectory is what keeps assembler and compiler on the same
6500        dnl  target rather than merely on the same toolset.
6501        with_asm_home=$with_cl_home/$cl_subdirectory
6502        AC_MSG_RESULT([found ($with_asm_home)])
6503      else
6504        AC_MSG_ERROR([Configure did not find $ASM_EXE_NAME assembler.])
6505      fi
6506    else
6507       with_asm_home="ASM_IN_PATH"
6508    fi
6509  fi
6510  AC_MSG_RESULT([$ASM_HOME])
6511else
6512  with_asm_home="NO_ASM_HOME"
6513fi
6514ASM_HOME="$with_asm_home"
6515AC_SUBST(ASM_HOME)
6516
6517dnl ***************************************
6518dnl testing nasm.exe assembler path
6519dnl ***************************************
6520if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes" -a "$SYSTEM_OPENSSL" = "NO"; then
6521  AC_MSG_CHECKING([nasm.exe assembler path])
6522  if test -n "$with_nasm_home"; then
6523    with_nasm_home=`cygpath -u "$with_nasm_home"`
6524  fi
6525  if test ! -x "$with_nasm_home/nasm.exe"; then
6526    AC_PATH_PROG(NASM_EXE, nasm.exe)
6527    if test -z "$NASM_EXE"; then
6528      with_nasm_home="NO_NASM_HOME"
6529      AC_MSG_ERROR([NASM is required to build on Windows, please install or use --with-nasm-home],,)
6530    else
6531      with_nasm_home="NASM_IN_PATH"
6532    fi
6533  fi
6534  AC_MSG_RESULT([$NASM_HOME])
6535else
6536  with_nasm_home="NO_NASM_HOME"
6537fi
6538NASM_HOME="$with_nasm_home"
6539AC_SUBST(NASM_HOME)
6540
6541dnl ===================================================================
6542dnl testing handle deprecated unzip switch
6543dnl ===================================================================
6544if test -z "$with_zip_home"; then
6545    with_zip_home="$with_unzip_home"
6546fi
6547dnl ===================================================================
6548dnl Zip will be found where you tell me to find it
6549dnl ===================================================================
6550if test -n "$with_zip_home" ; then
6551    if test "$_os" = "WINNT"; then
6552        with_zip_home=`cygpath -u "$with_zip_home"`
6553    fi
6554    ZIP="$with_zip_home/zip"
6555    UNZIP="$with_zip_home/unzip"
6556    ZIP_HOME="$with_zip_home"
6557else
6558    AC_PATH_PROG(ZIP, zip)
6559    AC_PATH_PROG(UNZIP, unzip)
6560    ZIP_HOME=`dirname "$ZIP"`
6561fi
6562dnl ===================================================================
6563dnl Zip must be available or else it is an error, all platforms
6564dnl ===================================================================
6565if test -z "$ZIP" -o -z "$UNZIP"; then
6566    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
6567fi
6568if "$ZIP" -FS < /dev/null 2>&1 | $EGREP "no such option: S" > /dev/null; then
6569    AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
6570fi
6571
6572dnl ===================================================================
6573dnl Zip must be a specific type for different build types.
6574dnl ===================================================================
6575if test "$_os" = "WINNT"; then
6576    if test -n "`$ZIP -h | $GREP -i WinNT`" ; then
6577AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
6578    fi
6579fi
6580AC_SUBST(ZIP_HOME)
6581
6582dnl ===================================================================
6583dnl Windows builds need dbghelp.dll in external/dbghelp/
6584dnl ===================================================================
6585if test "$_os" = "WINNT"; then
6586   AC_MSG_CHECKING([for dbghelp.dll])
6587   if test -x ./external/dbghelp/dbghelp.dll; then
6588      AC_MSG_RESULT([found and executable])
6589   else
6590      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
6591Get it from the Microsoft site and put it into external/dbghelp.
6592(Note: Microsoft seems to enjoy changing the exact location of this file. You
6593may have to search Microsoft's website.) Last time it was seen at:
6594<https://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
6595   fi
6596fi
6597
6598dnl ===================================================================
6599dnl Windows builds need vcredist_x*.exe in external/vcredist/
6600dnl ===================================================================
6601WITH_VC_REDIST=""
6602
6603if test "$_os" = "WINNT"; then
6604   AC_MSG_CHECKING([for vcredist_x86.exe])
6605   if test -x ./external/vcredist/vcredist_x86.exe; then
6606      AC_MSG_RESULT([found and executable])
6607   else
6608      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
6609Get it from the Microsoft site and put it into external/vcredist. You can try
6610to download it from https://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
6611   fi
6612   AC_MSG_CHECKING([for vcredist_x64.exe])
6613   if test -x ./external/vcredist/vcredist_x64.exe; then
6614      AC_MSG_RESULT([found and executable])
6615   else
6616      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
6617Get it from the Microsoft site and put it into external/vcredist. You can try
6618to download it from https://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
6619   fi
6620   WITH_VC_REDIST=YES
6621   AC_SUBST(WITH_VC_REDIST)
6622fi
6623
6624dnl ===================================================================
6625dnl Windows builds - use oowintool to copy CRT dlls and manifest
6626dnl ===================================================================
6627if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
6628       if $OOWINTOOL --msvc-copy-dlls ./external/msvcp ; then
6629          :
6630       else
6631          AC_MSG_ERROR([oowintool failed to copy CRT])
6632       fi
6633fi
6634
6635dnl ===================================================================
6636dnl Windows builds need gdiplus.dll in external/gdiplus/
6637dnl ===================================================================
6638if test "$_os" = "WINNT"; then
6639   AC_MSG_CHECKING([for gdiplus.dll])
6640   if test -x ./external/gdiplus/gdiplus.dll; then
6641      AC_MSG_RESULT([found and executable])
6642   else
6643      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
6644Get it from the Microsoft site and put it into external/gdiplus.
6645You may have to search Microsoft's website. Last time it was seen at:
6646<https://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
6647   fi
6648fi
6649
6650dnl ===================================================================
6651dnl Windows builds need msvcr100.dll in external/msvcp100/
6652dnl ===================================================================
6653if test "$_os" = "WINNT"; then
6654   AC_MSG_CHECKING([for msvcr100.dll])
6655   if test -x ./external/msvcp100/msvcr100.dll; then
6656      AC_MSG_RESULT([found and executable])
6657   else
6658      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
6659Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
6660from the Microsoft site and put it into external/msvcp100.
6661You may have to search Microsoft's website. Last time it was seen at:
6662<https://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
6663   fi
6664fi
6665
6666dnl ===================================================================
6667dnl Test which vclplugs have to be built.
6668dnl ===================================================================
6669AC_MSG_CHECKING([which VCLplugs shall be built])
6670ENABLE_GTK=""
6671if test "x$enable_gtk" = "xyes"; then
6672    ENABLE_GTK="TRUE"
6673    R="gtk"
6674fi
6675AC_SUBST(ENABLE_GTK)
6676
6677ENABLE_KDE=""
6678if test "x$enable_kde" = "xyes"; then
6679    ENABLE_KDE="TRUE"
6680    R="$R kde"
6681fi
6682AC_SUBST(ENABLE_KDE)
6683
6684ENABLE_KDE4=""
6685if test "x$enable_kde4" = "xyes"; then
6686    ENABLE_KDE4="TRUE"
6687    R="$R kde4"
6688fi
6689AC_SUBST(ENABLE_KDE4)
6690
6691if test -z "$R"; then
6692    AC_MSG_RESULT([none])
6693else
6694    AC_MSG_RESULT([$R])
6695fi
6696
6697dnl ===================================================================
6698dnl GCONF check
6699dnl ===================================================================
6700
6701ENABLE_GCONF=""
6702AC_MSG_CHECKING([whether to enable GConf support])
6703if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
6704    ENABLE_GCONF="TRUE"
6705    AC_MSG_RESULT([yes])
6706    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6707else
6708    AC_MSG_RESULT([no])
6709fi
6710AC_SUBST(ENABLE_GCONF)
6711
6712dnl ===================================================================
6713dnl Gnome VFS check
6714dnl ===================================================================
6715
6716ENABLE_GNOMEVFS=""
6717AC_MSG_CHECKING([whether to enable GNOME VFS support])
6718if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
6719    ENABLE_GNOMEVFS="TRUE"
6720    AC_MSG_RESULT([yes])
6721    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
6722    if test "$ENABLE_GCONF" != "TRUE"; then
6723        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
6724    fi
6725else
6726    AC_MSG_RESULT([no])
6727fi
6728AC_SUBST(ENABLE_GNOMEVFS)
6729
6730dnl ===================================================================
6731dnl Check whether the gtk 2.0 libraries are available.
6732dnl ===================================================================
6733
6734GTK_CFLAGS=""
6735GTK_LIBS=""
6736ENABLE_SYSTRAY_GTK=""
6737ENABLE_DBUS=""
6738if test  "$test_gtk" = "yes"; then
6739
6740   if test "$ENABLE_GTK" = "TRUE" ; then
6741      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]))
6742      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]))
6743      BUILD_TYPE="$BUILD_TYPE GTK"
6744
6745      if test "x$enable_systray" = "xyes"; then
6746         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
6747                           [ENABLE_SYSTRAY_GTK="TRUE"
6748                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
6749                           [ENABLE_SYSTRAY_GTK=""])
6750      fi
6751
6752      AC_MSG_CHECKING([whether to enable DBUS support])
6753      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
6754          ENABLE_DBUS="TRUE"
6755          AC_MSG_RESULT([yes])
6756          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
6757      else
6758          AC_MSG_RESULT([no])
6759      fi
6760
6761      AC_MSG_CHECKING([whether to enable GIO support])
6762      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
6763          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
6764             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
6765          fi
6766          ENABLE_GIO="TRUE"
6767          AC_MSG_RESULT([yes])
6768          PKG_CHECK_MODULES( GIO, gio-2.0 )
6769      else
6770          AC_MSG_RESULT([no])
6771      fi
6772
6773   fi
6774
6775fi
6776AC_SUBST(ENABLE_GIO)
6777AC_SUBST(ENABLE_DBUS)
6778AC_SUBST(ENABLE_SYSTRAY_GTK)
6779AC_SUBST(GTK_CFLAGS)
6780AC_SUBST(GTK_LIBS)
6781AC_SUBST(GTHREAD_CFLAGS)
6782AC_SUBST(GTHREAD_LIBS)
6783
6784dnl ===================================================================
6785dnl Check whether the GStreamer libraries are available.
6786dnl ===================================================================
6787
6788GSTREAMER_CFLAGS=""
6789GSTREAMER_LIBS=""
6790ENABLE_GSTREAMER=""
6791
6792if test "$test_gstreamer" = "yes"; then
6793    AC_MSG_CHECKING([whether to build the GStreamer media backend])
6794    if test "x$enable_gstreamer" != "xno" ; then
6795        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]))
6796        ENABLE_GSTREAMER="TRUE"
6797        AC_MSG_RESULT([yes])
6798    else
6799        AC_MSG_RESULT([no])
6800    fi
6801fi
6802AC_SUBST(ENABLE_GSTREAMER)
6803AC_SUBST(GSTREAMER_CFLAGS)
6804AC_SUBST(GSTREAMER_LIBS)
6805
6806dnl ===================================================================
6807dnl Check the ARM target
6808dnl ===================================================================
6809
6810if echo "$build_cpu" | $GREP -q arm && test "$build_cpu" != "arm64" && test "$build_cpu" != "aarch64"; then
6811    # default value
6812    ARM_TARGET=ARMV4T
6813    AC_MSG_CHECKING([which ARM processor optimization to use])
6814    if test "$with_arm_target" -lt "6"; then
6815    ARM_TARGET=ARMV4T
6816    elif test "$with_arm_target" = "6"; then
6817    ARM_TARGET=ARMV6
6818    elif test "$with_arm_target" -gt "6"; then
6819    ARM_TARGET=ARMV7
6820    fi
6821    AC_MSG_RESULT([$ARM_TARGET])
6822    AC_SUBST(ARM_TARGET)
6823fi
6824
6825dnl ===================================================================
6826dnl Check whether the Cairo libraries are available.
6827dnl ===================================================================
6828
6829ENABLE_CAIRO=""
6830BUILD_PIXMAN=""
6831SYSTEM_CAIRO=""
6832
6833if test  "$test_cairo" = "yes"; then
6834
6835    AC_MSG_CHECKING([whether to use cairo])
6836    if test "x$enable_cairo" != "xno" ; then
6837        ENABLE_CAIRO="TRUE"
6838    AC_MSG_RESULT([yes])
6839        AC_MSG_CHECKING([which cairo to use])
6840        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6841           test "$with_system_cairo" != "no"; then
6842           AC_MSG_RESULT([external])
6843           SYSTEM_CAIRO=YES
6844
6845           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6846       if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6847          AC_MSG_ERROR([Cairo library requires fontconfig.])
6848       fi
6849           if test "$with_system_xrender_headers" = "yes"; then
6850              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6851              AC_RUN_IFELSE([AC_LANG_SOURCE([[
6852#include <X11/extensions/Xrender.h>
6853
6854int main(int argc, char **argv) {
6855#ifdef PictStandardA8
6856      return 0;
6857#else
6858      return 1;
6859#endif
6860}
6861               ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])],[])
6862           fi
6863        else
6864           BUILD_TYPE="$BUILD_TYPE CAIRO"
6865       dnl === compiler fails on pixman with 64bit architectures...===
6866       if test "$build_cpu" != "x86_64"; then
6867          BUILD_PIXMAN=YES
6868       fi
6869           AC_MSG_RESULT([internal])
6870        fi
6871    else
6872       AC_MSG_RESULT([no])
6873    fi
6874fi
6875
6876AC_SUBST(ENABLE_CAIRO)
6877AC_SUBST(BUILD_PIXMAN)
6878AC_SUBST(SYSTEM_CAIRO)
6879AC_SUBST(CAIRO_CFLAGS)
6880AC_SUBST(CAIRO_LIBS)
6881
6882ENABLE_CAIRO_CANVAS="FALSE"
6883if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6884   ENABLE_CAIRO_CANVAS="TRUE"
6885fi
6886AC_SUBST(ENABLE_CAIRO_CANVAS)
6887
6888dnl ===================================================================
6889dnl Check whether the OpenGL libraries are available
6890dnl ===================================================================
6891
6892AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6893ENABLE_OPENGL=
6894
6895if test "x$enable_opengl" != "xno" ; then
6896   AC_MSG_RESULT([yes])
6897   AC_CHECK_HEADER(GL/gl.h, [],
6898                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6899   AC_CHECK_LIB(GL, main, [],
6900     [AC_MSG_ERROR(libGL not installed or functional)], [])
6901   AC_CHECK_LIB(GLU, main, [],
6902     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6903   ENABLE_OPENGL=TRUE
6904else
6905   AC_MSG_RESULT([no])
6906fi
6907
6908AC_SUBST(ENABLE_OPENGL)
6909
6910
6911AC_MSG_CHECKING([whether to build the PDF Import extension])
6912if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6913  AC_MSG_RESULT([yes])
6914  ENABLE_PDFIMPORT=YES
6915
6916  dnl ===================================================================
6917  dnl Check for system poppler
6918  dnl ===================================================================
6919  AC_MSG_CHECKING([whether to use system pdf backend])
6920  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6921       test "$with_system_poppler" != "no"; then
6922      AC_MSG_RESULT([external])
6923      SYSTEM_POPPLER=YES
6924      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6925  else
6926      AC_MSG_RESULT([no])
6927      SYSTEM_POPPLER=NO
6928      ENABLE_PDFIMPORT=NO
6929  fi
6930else
6931   AC_MSG_RESULT([no])
6932   ENABLE_PDFIMPORT=NO
6933fi
6934AC_SUBST(ENABLE_PDFIMPORT)
6935AC_SUBST(SYSTEM_POPPLER)
6936AC_SUBST(POPPLER_CFLAGS)
6937AC_SUBST(POPPLER_LIBS)
6938
6939AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6940if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test "$WITH_JAVA" != "no"; then
6941  AC_MSG_RESULT([yes])
6942  AC_MSG_CHECKING([for swext module])
6943  if test -d ./swext; then
6944   AC_MSG_RESULT([OK])
6945  else
6946   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6947  fi
6948  ENABLE_MEDIAWIKI=YES
6949  BUILD_TYPE="$BUILD_TYPE SWEXT"
6950else
6951  AC_MSG_RESULT([no])
6952  ENABLE_MEDIAWIKI=NO
6953fi
6954AC_SUBST(ENABLE_MEDIAWIKI)
6955
6956AC_MSG_CHECKING([whether to build the Report Builder extension])
6957if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6958  AC_MSG_RESULT([yes])
6959  ENABLE_REPORTBUILDER=YES
6960  SYSTEM_JFREEREPORT=YES
6961  AC_MSG_CHECKING([for reportbuilder module])
6962  if test -d ./reportbuilder; then
6963    AC_MSG_RESULT([OK])
6964  else
6965    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6966  fi
6967  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6968  AC_MSG_RESULT([external])
6969  if test -z $SAC_JAR; then
6970         SAC_JAR=/usr/share/java/sac.jar
6971  fi
6972  AC_CHECK_FILE($SAC_JAR, [],
6973         [AC_MSG_ERROR(sac.jar not found.)], [])
6974
6975  if test -z $LIBXML_JAR; then
6976    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6977      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6978      [
6979        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6980          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6981          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6982        )
6983      ]
6984    )
6985  else
6986    AC_CHECK_FILE($LIBXML_JAR, [],
6987         [AC_MSG_ERROR(libxml.jar not found.)], [])
6988  fi
6989
6990  if test -z $FLUTE_JAR; then
6991    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6992      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6993      [
6994        AC_CHECK_FILE(/usr/share/java/flute.jar,
6995          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6996          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6997        )
6998      ]
6999    )
7000  else
7001    AC_CHECK_FILE($FLUTE_JAR, [],
7002         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
7003  fi
7004
7005  if test -z $JFREEREPORT_JAR; then
7006    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
7007      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
7008      [
7009        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
7010          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
7011          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
7012        )
7013      ]
7014    )
7015  else
7016    AC_CHECK_FILE($JFREEREPORT_JAR, [],
7017         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
7018  fi
7019
7020  if test -z $LIBLAYOUT_JAR; then
7021    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
7022      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
7023      [
7024        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
7025          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
7026          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
7027        )
7028      ]
7029    )
7030  else
7031    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
7032         [AC_MSG_ERROR(liblayout.jar not found.)], [])
7033  fi
7034
7035  if test -z $LIBLOADER_JAR; then
7036    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
7037      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
7038      [
7039        AC_CHECK_FILE(/usr/share/java/libloader.jar,
7040          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
7041          [AC_MSG_ERROR(libloader.jar replacement not found.)]
7042        )
7043      ]
7044    )
7045  else
7046    AC_CHECK_FILE($LIBLOADER_JAR, [],
7047         [AC_MSG_ERROR(libloader.jar not found.)], [])
7048  fi
7049
7050  if test -z $LIBFORMULA_JAR; then
7051    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
7052      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
7053      [
7054        AC_CHECK_FILE(/usr/share/java/libformula.jar,
7055          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
7056          [AC_MSG_ERROR(libformula.jar replacement not found.)]
7057        )
7058      ]
7059    )
7060  else
7061    AC_CHECK_FILE($LIBFORMULA_JAR, [],
7062         [AC_MSG_ERROR(libformula.jar not found.)], [])
7063  fi
7064
7065  if test -z $LIBREPOSITORY_JAR; then
7066    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
7067      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
7068      [
7069        AC_CHECK_FILE(/usr/share/java/librepository.jar,
7070          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
7071          [AC_MSG_ERROR(librepository.jar replacement not found.)]
7072        )
7073      ]
7074    )
7075  else
7076    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
7077         [AC_MSG_ERROR(librepository.jar not found.)], [])
7078  fi
7079
7080  if test -z $LIBFONTS_JAR; then
7081    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
7082      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
7083      [
7084        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
7085          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
7086          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
7087        )
7088      ]
7089    )
7090  else
7091    AC_CHECK_FILE($LIBFONTS_JAR, [],
7092         [AC_MSG_ERROR(libfonts.jar not found.)], [])
7093  fi
7094
7095  if test -z $LIBSERIALIZER_JAR; then
7096    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
7097      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
7098      [
7099        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
7100          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
7101          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
7102        )
7103      ]
7104    )
7105  else
7106    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
7107         [AC_MSG_ERROR(libserializer.jar not found.)], [])
7108  fi
7109
7110
7111  if test -z $LIBBASE_JAR; then
7112    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
7113      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
7114      [
7115        AC_CHECK_FILE(/usr/share/java/libbase.jar,
7116          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
7117          [AC_MSG_ERROR(libbase.jar replacement not found.)]
7118        )
7119      ]
7120    )
7121  else
7122    AC_CHECK_FILE($LIBBASE_JAR, [],
7123         [AC_MSG_ERROR(libbase.jar not found.)], [])
7124  fi
7125  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
7126else
7127  AC_MSG_RESULT([no])
7128  ENABLE_REPORTBUILDER=NO
7129fi
7130AC_SUBST(ENABLE_REPORTBUILDER)
7131AC_SUBST(SYSTEM_JFREEREPORT)
7132AC_SUBST(SAC_JAR)
7133AC_SUBST(LIBXML_JAR)
7134AC_SUBST(FLUTE_JAR)
7135AC_SUBST(JFREEREPORT_JAR)
7136AC_SUBST(LIBBASE_JAR)
7137AC_SUBST(LIBLAYOUT_JAR)
7138AC_SUBST(LIBLOADER_JAR)
7139AC_SUBST(LIBFORMULA_JAR)
7140AC_SUBST(LIBREPOSITORY_JAR)
7141AC_SUBST(LIBFONTS_JAR)
7142AC_SUBST(LIBSERIALIZER_JAR)
7143
7144# this has to be here because the Report Builder uses commons-logging,
7145# while the non-optional PostgreSQL connector uses commons-lang.
7146AC_MSG_CHECKING([which Apache commons-* libs to use])
7147if test "$with_system_apache_commons" = "yes"; then
7148  SYSTEM_APACHE_COMMONS=YES
7149  AC_MSG_RESULT([external])
7150
7151  if test -z $COMMONS_LANG_JAR; then
7152    AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
7153      [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
7154      [
7155        AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
7156          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
7157          [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
7158        )
7159      ]
7160    )
7161  else
7162    AC_CHECK_FILE($COMMONS_LANG_JAR, [],
7163         [AC_MSG_ERROR(commons-lang.jar not found.)], [])
7164  fi
7165  AC_MSG_CHECKING([whether commons-lang is version 3.x])
7166  export COMMONS_LANG_JAR
7167  if $PERL -e 'use Archive::Zip;
7168      my $file = "$ENV{'COMMONS_LANG_JAR'}";
7169      my $zip = Archive::Zip->new( $file );
7170      my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7171      if ( $mf =~ m/Specification-Version: 3.*/ ) {
7172          exit 0;
7173      } else {
7174          exit 1;
7175      }'; then
7176      AC_MSG_RESULT([yes])
7177  else
7178      AC_MSG_ERROR([no, you need Apache Commons Lang 3.x])
7179  fi
7180
7181  if test "$ENABLE_REPORTBUILDER" = "YES"; then
7182    if test -z $COMMONS_LOGGING_JAR; then
7183      AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
7184        [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
7185        [
7186          AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
7187            [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
7188            [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
7189          )
7190        ]
7191      )
7192    else
7193      AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
7194           [AC_MSG_ERROR(commons-logging.jar not found.)], [])
7195    fi
7196  fi
7197else
7198  AC_MSG_RESULT([internal])
7199  SYSTEM_APACHE_COMMONS=NO
7200  BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
7201fi
7202AC_SUBST(SYSTEM_APACHE_COMMONS)
7203AC_SUBST(COMMONS_LANG_JAR)
7204AC_SUBST(COMMONS_LOGGING_JAR)
7205
7206dnl ===================================================================
7207dnl Check whether the Qt and KDE libraries are available.
7208dnl ===================================================================
7209
7210KDE_CFLAGS=""
7211KDE_LIBS=""
7212MOC="moc"
7213if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
7214    dnl Search paths for Qt and KDE
7215    if test "$build_cpu" != "x86_64" ; then
7216        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"
7217        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"
7218    else
7219        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"
7220        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"
7221    fi
7222    if test -n "$QTDIR" ; then
7223        qt_incdirs="$QTDIR/include $qt_incdirs"
7224        if test "$build_cpu" != "x86_64" ; then
7225            qt_libdirs="$QTDIR/lib $qt_libdirs"
7226        else
7227            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
7228        fi
7229    fi
7230    if test "$build_cpu" != "x86_64" ; then
7231        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"
7232        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"
7233    else
7234        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"
7235        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"
7236    fi
7237    if test -n "$KDEDIR" ; then
7238        kde_incdirs="$KDEDIR/include $kde_incdirs"
7239        if test "$build_cpu" != "x86_64" ; then
7240            kde_libdirs="$KDEDIR/lib $kde_libdirs"
7241        else
7242            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
7243        fi
7244    fi
7245
7246    dnl What to test
7247    qt_test_include="qstyle.h"
7248    qt_test_library="libqt-mt.so"
7249    kde_test_include="ksharedptr.h"
7250    kde_test_library="libkdeui.so"
7251
7252    dnl Check for Qt headers
7253    AC_MSG_CHECKING([for Qt headers])
7254    qt_incdir="no"
7255    for kde_check in $qt_incdirs ; do
7256        if test -r "$kde_check/$qt_test_include" ; then
7257            qt_incdir="$kde_check"
7258            break
7259        fi
7260    done
7261    AC_MSG_RESULT([$qt_incdir])
7262    if test "x$qt_incdir" = "xno" ; then
7263        AC_MSG_ERROR([Qt headers not found. Please specify the root of
7264your Qt installation by exporting QTDIR before running "configure".])
7265    fi
7266
7267    dnl Check for Qt libraries
7268    AC_MSG_CHECKING([for Qt libraries])
7269    qt_libdir="no"
7270    for qt_check in $qt_libdirs ; do
7271        if test -r "$qt_check/$qt_test_library" ; then
7272            qt_libdir="$qt_check"
7273            break
7274        fi
7275    done
7276    AC_MSG_RESULT([$qt_libdir])
7277    if test "x$qt_libdir" = "xno" ; then
7278        AC_MSG_ERROR([Qt libraries not found. Please specify the root of
7279your Qt installation by exporting QTDIR before running "configure".])
7280    fi
7281
7282    dnl Check for Meta Object Compiler
7283    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
7284    if test "$MOC" = "no" ; then
7285        AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify
7286the root of your Qt installation by exporting QTDIR before running "configure".])
7287    fi
7288
7289    dnl Check for KDE headers
7290    AC_MSG_CHECKING([for KDE headers])
7291    kde_incdir="no"
7292    for kde_check in $kde_incdirs ; do
7293        if test -r "$kde_check/$kde_test_include" ; then
7294            kde_incdir="$kde_check"
7295            break
7296        fi
7297    done
7298    AC_MSG_RESULT([$kde_incdir])
7299    if test "x$kde_incdir" = "xno" ; then
7300        AC_MSG_ERROR([KDE headers not found. Please specify the root of
7301your KDE installation by exporting KDEDIR before running "configure".])
7302    fi
7303
7304    dnl Check for KDE libraries
7305    AC_MSG_CHECKING([for KDE libraries])
7306    kde_libdir="no"
7307    for kde_check in $kde_libdirs ; do
7308        if test -r "$kde_check/$kde_test_library" ; then
7309            kde_libdir="$kde_check"
7310            break
7311        fi
7312    done
7313    AC_MSG_RESULT([$kde_libdir])
7314    if test "x$kde_libdir" = "xno" ; then
7315        AC_MSG_ERROR([KDE libraries not found. Please specify the root of
7316your KDE installation by exporting KDEDIR before running "configure".])
7317    fi
7318
7319    dnl Set the variables
7320    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7321    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
7322fi
7323AC_SUBST(KDE_CFLAGS)
7324AC_SUBST(KDE_LIBS)
7325AC_SUBST(MOC)
7326
7327dnl ===================================================================
7328dnl KDE4 Integration
7329dnl ===================================================================
7330
7331KDE4_CFLAGS=""
7332KDE4_LIBS=""
7333MOC4="moc"
7334if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
7335   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
7336   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
7337
7338   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
7339   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
7340
7341   if test "$build_cpu" = "x86_64" ; then
7342      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
7343      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
7344   fi
7345
7346   if test -n "$KDE4DIR" ; then
7347      kde_incdirs="$KDE4DIR/include $kde_incdirs"
7348      if test "$build_cpu" != "x86_64" ; then
7349         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
7350      else
7351         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
7352      fi
7353   fi
7354
7355   qt_test_include="Qt/qobject.h"
7356   qt_test_library="libQtCore.so"
7357   kde_test_include="ksharedptr.h"
7358   kde_test_library="libkdeui.so"
7359
7360   AC_MSG_CHECKING([for Qt4 headers])
7361   qt_header_dir="no"
7362   for inc_dir in $qt_incdirs ; do
7363      if test -r "$inc_dir/$qt_test_include" ; then
7364         qt_header_dir="$inc_dir"
7365         break
7366      fi
7367   done
7368
7369   AC_MSG_RESULT([$qt_header_dir])
7370   if test "x$qt_header_dir" = "xno" ; then
7371      AC_MSG_ERROR([Qt4 headers not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7372   fi
7373
7374   AC_MSG_CHECKING([for Qt4 libraries])
7375   qt_lib_dir="no"
7376   for lib_dir in $qt_libdirs ; do
7377      if test -r "$lib_dir/$qt_test_library" ; then
7378         qt_lib_dir="$lib_dir"
7379         break
7380      fi
7381   done
7382
7383   AC_MSG_RESULT([$qt_lib_dir])
7384
7385   if test "x$qt_lib_dir" = "xno" ; then
7386      AC_MSG_ERROR([Qt4 libraries not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
7387   fi
7388
7389   dnl Check for Meta Object Compiler
7390   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
7391   MOC4="$MOCQT4"
7392   if test "$MOC4" = "no" ; then
7393      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
7394      if test "$MOC4" = "no" ; then
7395         AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
7396      fi
7397   fi
7398
7399   dnl Check for KDE4 headers
7400   AC_MSG_CHECKING([for KDE4 headers])
7401   kde_incdir="no"
7402   for kde_check in $kde_incdirs ; do
7403      if test -r "$kde_check/$kde_test_include" ; then
7404         kde_incdir="$kde_check"
7405         break
7406      fi
7407   done
7408   AC_MSG_RESULT([$kde_incdir])
7409   if test "x$kde_incdir" = "xno" ; then
7410      AC_MSG_ERROR([KDE4 headers not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7411   fi
7412
7413   dnl Check for KDE4 libraries
7414   AC_MSG_CHECKING([for KDE4 libraries])
7415   kde_libdir="no"
7416   for kde_check in $kde_libdirs ; do
7417      if test -r "$kde_check/$kde_test_library" ; then
7418         kde_libdir="$kde_check"
7419         break
7420      fi
7421   done
7422
7423   AC_MSG_RESULT([$kde_libdir])
7424   if test "x$kde_libdir" = "xno" ; then
7425      AC_MSG_ERROR([KDE4 libraries not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
7426   fi
7427
7428   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
7429   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
7430fi
7431AC_SUBST(KDE4_CFLAGS)
7432AC_SUBST(KDE4_LIBS)
7433AC_SUBST(MOC4)
7434
7435dnl ===================================================================
7436dnl Test for the enabling the lockdown pieces
7437dnl ===================================================================
7438AC_MSG_CHECKING([whether to enable the lockdown pieces])
7439ENABLE_LOCKDOWN=""
7440if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
7441  ENABLE_LOCKDOWN=YES
7442  AC_MSG_RESULT([yes])
7443else
7444  AC_MSG_RESULT([no])
7445fi
7446AC_SUBST(ENABLE_LOCKDOWN)
7447
7448dnl ===================================================================
7449dnl Test whether to include Evolution 2 support
7450dnl ===================================================================
7451AC_MSG_CHECKING([whether to enable evolution 2 support])
7452if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
7453   AC_MSG_RESULT([yes])
7454   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
7455   ENABLE_EVOAB2="TRUE"
7456else
7457   ENABLE_EVOAB2=""
7458   AC_MSG_RESULT([no])
7459fi
7460AC_SUBST(ENABLE_EVOAB2)
7461AC_SUBST(GOBJECT_CFLAGS)
7462AC_SUBST(GOBJECT_LIBS)
7463
7464dnl ===================================================================
7465dnl Test whether to include MathMLDTD
7466dnl ===================================================================
7467AC_MSG_CHECKING([whether to include MathMLDTD])
7468if test -n "$enable_mathmldtd"; then
7469  if test "$enable_mathmldtd" = "no"; then
7470    AC_MSG_RESULT([no])
7471    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7472  else
7473    AC_MSG_RESULT([yes])
7474    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
7475  fi
7476else
7477  AC_MSG_RESULT([no])
7478  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
7479fi
7480
7481dnl ===================================================================
7482dnl Test whether to include category-B fonts
7483dnl ===================================================================
7484WITH_CATB_FONTS=
7485AC_MSG_CHECKING([whether to include category B fonts])
7486if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
7487   AC_MSG_RESULT([yes])
7488   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
7489   WITH_CATB_FONTS=YES
7490   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
7491else
7492   AC_MSG_RESULT([no])
7493   WITH_CATB_FONTS=NO
7494fi
7495
7496dnl ===================================================================
7497dnl Test whether to include category-A fonts
7498dnl ===================================================================
7499WITH_CATA_FONTS=
7500AC_MSG_CHECKING([whether to include category A fonts])
7501if test "x$with_fonts" != "xno" ; then
7502  AC_MSG_RESULT([yes])
7503  WITH_CATA_FONTS=YES
7504  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
7505else
7506  AC_MSG_RESULT([no])
7507  WITH_CATA_FONTS=NO
7508  WITH_CATB_FONTS=NO
7509fi
7510
7511WITH_FONTS=NO
7512AC_MSG_CHECKING([whether any fonts are included])
7513if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
7514  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
7515  WITH_FONTS=YES
7516  AC_MSG_RESULT([yes])
7517else
7518  AC_MSG_RESULT([no])
7519fi
7520
7521AC_SUBST(WITH_CATA_FONTS)
7522AC_SUBST(WITH_CATB_FONTS)
7523AC_SUBST(WITH_FONTS)
7524
7525dnl ===================================================================
7526dnl Test whether to include ppds
7527dnl ===================================================================
7528AC_MSG_CHECKING([whether to include PPDs])
7529if test "$with_ppds" != "no"; then
7530  AC_MSG_RESULT([yes])
7531else
7532  AC_MSG_RESULT([no])
7533  WITHOUT_PPDS=YES
7534  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
7535fi
7536AC_SUBST(WITHOUT_PPDS)
7537
7538dnl ===================================================================
7539dnl Test whether to include afms
7540dnl ===================================================================
7541AC_MSG_CHECKING([whether to include AFMs])
7542if test "$with_afms" != "no"; then
7543  AC_MSG_RESULT([yes])
7544  BUILD_TYPE="$BUILD_TYPE AFMS"
7545else
7546  AC_MSG_RESULT([no])
7547  WITHOUT_AFMS=YES
7548  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
7549fi
7550AC_SUBST(WITHOUT_AFMS)
7551
7552AC_SUBST(SCPDEFS)
7553
7554AC_MSG_CHECKING([whether and how to use Xinerama])
7555if test "$_os" = "Darwin"; then
7556   USE_XINERAMA=YES
7557   XINERAMA_LINK=dynamic
7558   AC_MSG_RESULT([yes])
7559elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
7560   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
7561      # we have both versions, let the user decide but use the dynamic one
7562      # per default
7563      USE_XINERAMA=YES
7564      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
7565         XINERAMA_LINK=dynamic
7566      else
7567         XINERAMA_LINK=static
7568      fi
7569   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
7570      # we have only the dynamic version
7571      USE_XINERAMA=YES
7572      XINERAMA_LINK=dynamic
7573   elif test -e "$XLIB/libXinerama.a"; then
7574      # static version
7575      if echo $build_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
7576         USE_XINERAMA=YES
7577         XINERAMA_LINK=static
7578      else
7579         USE_XINERAMA=NO
7580         XINERAMA_LINK=none
7581      fi
7582   else
7583      # no Xinerama
7584      USE_XINERAMA=NO
7585      XINERAMA_LINK=none
7586   fi
7587   if test "$USE_XINERAMA" = "YES"; then
7588      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
7589      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
7590          [AC_MSG_ERROR(Xinerama header not found.)], [])
7591      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
7592      if test "$_os" = "FreeBSD"; then
7593          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
7594      fi
7595      if test "$_os" = "Linux"; then
7596          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
7597      fi
7598      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
7599          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
7600   else
7601      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
7602   fi
7603else
7604   AC_MSG_RESULT([no])
7605fi
7606AC_SUBST(USE_XINERAMA)
7607AC_SUBST(XINERAMA_LINK)
7608
7609dnl ===================================================================
7610dnl always rely on the system version of gdk-pixbuf
7611dnl ===================================================================
7612
7613SYSTEM_GDKPIXBUF=YES
7614AC_SUBST(SYSTEM_GDKPIXBUF)
7615
7616dnl ===================================================================
7617dnl always rely on the system version of glib
7618dnl ===================================================================
7619
7620SYSTEM_GLIB=YES
7621AC_SUBST(SYSTEM_GLIB)
7622
7623dnl ===================================================================
7624dnl always rely on the system version of gettext
7625dnl ===================================================================
7626
7627SYSTEM_GETTEXT=YES
7628AC_SUBST(SYSTEM_GETTEXT)
7629
7630if test "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
7631    LIBINTL_PREFIX=
7632    for dir in $CPPFLAGS; do
7633      if dir=`expr -- $dir : '-I\(.*\)'`; then
7634        if test -f "$dir/libintl.h" ; then
7635          LIBINTL_PREFIX=`dirname $dir`
7636        fi
7637      fi
7638    done
7639    if test -z "$LIBINTL_PREFIX"; then
7640       for dir in /usr/local /opt/homebrew /opt/local /usr; do
7641          test -f "$dir/include/libintl.h" && LIBINTL_PREFIX=$dir && break
7642       done
7643    fi
7644    AC_SUBST(LIBINTL_PREFIX)
7645fi
7646
7647dnl ===================================================================
7648dnl always rely on the system version of pango
7649dnl ===================================================================
7650
7651SYSTEM_PANGO=YES
7652AC_SUBST(SYSTEM_PANGO)
7653
7654dnl ===================================================================
7655dnl Test whether to build libpng or rely on the system version
7656dnl ===================================================================
7657AC_MSG_CHECKING([whether to build own version of libpng])
7658
7659case "$_os" in
7660    WINNT*) # Windows
7661        SYSTEM_LIBPNG=NO
7662        AC_MSG_RESULT([yes])
7663        ;;
7664    Darwin*)
7665        SYSTEM_LIBPNG=NO
7666        AC_MSG_RESULT([yes])
7667        ;;
7668   *)
7669   SYSTEM_LIBPNG=YES
7670   AC_MSG_RESULT([no])
7671   ;;
7672esac
7673AC_SUBST(SYSTEM_LIBPNG)
7674
7675dnl ===================================================================
7676dnl Test whether to build libjpeg or rely on the system version
7677dnl ===================================================================
7678dnl FIXME: this is currently because we have jpeg-6b for our filters
7679dnl        and jpeg-8 as dependency for librsvg
7680dnl        this should be unified into using only one version for both
7681
7682AC_MSG_CHECKING([whether to build own version of libjpeg])
7683
7684if test "$SYSTEM_JPEG" = "YES"; then
7685SYSTEM_LIBJPEG=YES
7686else
7687case "$_os" in
7688    WINNT*) # Windows
7689        SYSTEM_LIBJPEG=NO
7690        ;;
7691    Darwin*)
7692        SYSTEM_LIBJPEG=NO
7693        ;;
7694   *)
7695        SYSTEM_LIBJPEG=YES
7696        ;;
7697esac
7698fi
7699
7700if test "$SYSTEM_LIBJPEG" = "YES"; then
7701   AC_MSG_RESULT([no])
7702else
7703   AC_MSG_RESULT([yes])
7704fi
7705AC_SUBST(SYSTEM_LIBJPEG)
7706
7707dnl ===================================================================
7708dnl Test whether rat scan was requested and whether apache-rat is available
7709dnl ===================================================================
7710RAT_JAR=
7711AC_MSG_CHECKING([whether to trigger rat scan])
7712if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
7713    AC_MSG_RESULT([no])
7714else
7715    if test "$WITH_JAVA" = "no"; then
7716        AC_MSG_ERROR([no, java disabled, enable with --with-java])
7717    elif test "$enable_saxon" = "no"; then
7718        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
7719    elif test "$with_rat_scan" = "yes"; then
7720        AC_MSG_RESULT([yes, use pre-built library])
7721        RAT_JAR_HOME="BUILD"
7722        BUILD_TYPE="$BUILD_TYPE RAT"
7723    else
7724        AC_MSG_RESULT([yes, use pre-installed library])
7725        AC_MSG_CHECKING([whether apache-rat is available])
7726        if test -d "$with_rat_scan"; then
7727            RAT_JAR_HOME=$with_rat_scan
7728        else
7729            AC_MSG_ERROR([$with_rat_scan is not a directory])
7730        fi
7731    fi
7732fi
7733AC_SUBST(RAT_JAR_HOME)
7734
7735
7736dnl ===================================================================
7737dnl Test for the presence of Ant and that it works
7738dnl ===================================================================
7739
7740if test "$SOLAR_JAVA" != ""; then
7741ANT_HOME=; export ANT_HOME
7742WITH_ANT_HOME=; export WITH_ANT_HOME
7743if test -z "$with_ant_home"; then
7744   if test "$_os" = "OS2"; then
7745     AC_PATH_PROGS(ANT, ant.cmd)
7746   else
7747     AC_PATH_PROGS(ANT, [apache-ant ant ant.sh ant.bat ant.cmd])
7748   fi
7749else
7750   if test "$_os" = "WINNT"; then
7751      with_ant_home=`cygpath -u "$with_ant_home"`
7752   fi
7753   if test "$_os" = "OS2"; then
7754     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
7755   else
7756     AC_PATH_PROGS(ANT, [apache-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
7757   fi
7758   WITH_ANT_HOME=$with_ant_home
7759   ANT_HOME=$with_ant_home
7760fi
7761
7762if test -z "$ANT"; then
7763  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
7764else
7765  # resolve relative or absolute symlink
7766  while test -h "$ANT"; do
7767     a_cwd=`pwd`
7768     a_basename=`basename "$ANT"`
7769     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7770     cd "`dirname "$ANT"`"
7771     cd "`dirname "$a_script"`"
7772     ANT="`pwd`"/"`basename "$a_script"`"
7773     cd "$a_cwd"
7774  done
7775
7776  if test "$_os" = "OS2"; then
7777    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7778    export ANT_HOME
7779  fi
7780
7781  AC_MSG_CHECKING([if $ANT works])
7782cat > conftest.java << EOF
7783    public class conftest {
7784    int testmethod(int a, int b) {
7785            return a + b;
7786    }
7787    }
7788EOF
7789
7790cat > conftest.xml << EOF
7791    <project name="conftest" default="conftest">
7792    <target name="conftest">
7793            <javac srcdir="." includes="conftest.java">
7794        </javac>
7795    </target>
7796    </project>
7797EOF
7798  oldJAVA_HOME=$JAVA_HOME
7799  if test "$JAVACISGCJ" = "yes"; then
7800    JAVA_HOME=; export JAVA_HOME
7801    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7802  else
7803    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7804  fi
7805  AC_TRY_EVAL(ant_cmd)
7806  if test $? = 0 && test -f ./conftest.class ; then
7807    AC_MSG_RESULT([Ant works])
7808    if test -z "$WITH_ANT_HOME"; then
7809        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7810        if test -z "$ANT_HOME"; then
7811            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7812        fi
7813    else
7814        ANT_HOME="$WITH_ANT_HOME"
7815    fi
7816  else
7817    echo "configure: Ant test failed" >&5
7818    cat conftest.java >&5
7819    cat conftest.xml >&5
7820    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7821    ANT_HOME=""
7822    echo "Ant does not work - Some Java projects will not build!" >>warn
7823  fi
7824  JAVA_HOME=$oldJAVA_HOME
7825  rm -f conftest* core core.* *.core
7826fi
7827if test -z "$ANT_HOME"; then
7828   ANT_HOME="NO_ANT_HOME"
7829fi
7830AC_SUBST(ANT_HOME)
7831
7832dnl Checking for ant.jar
7833if test "$ANT_HOME" != "NO_ANT_HOME"; then
7834   AC_MSG_CHECKING([Ant lib directory])
7835   if test -f $ANT_HOME/lib/ant.jar; then
7836    ANT_LIB="$ANT_HOME/lib"
7837   else
7838      if test -f $ANT_HOME/ant.jar; then
7839         ANT_LIB="$ANT_HOME"
7840      else
7841          if test -f /usr/share/java/ant.jar; then
7842              ANT_LIB=/usr/share/java
7843          else
7844             if test -f /usr/share/ant-core/lib/ant.jar; then
7845                 ANT_LIB=/usr/share/ant-core/lib
7846             else
7847                if test -f $ANT_HOME/lib/ant/ant.jar; then
7848                    ANT_LIB="$ANT_HOME/lib/ant"
7849                else
7850                   if test -f /usr/share/lib/ant/ant.jar; then
7851                       ANT_LIB=/usr/share/lib/ant
7852                   else
7853                       AC_MSG_ERROR([Ant libraries not found!])
7854                   fi
7855                fi
7856             fi
7857          fi
7858      fi
7859   fi
7860   AC_MSG_RESULT([Ant lib directory found.])
7861fi
7862AC_SUBST(ANT_LIB)
7863fi
7864
7865ant_minver=1.9.1
7866# update for more extensions...
7867if test "$ENABLE_MEDIAWIKI" = "YES"; then
7868  ant_minver=1.9.1
7869fi
7870ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7871
7872AC_MSG_CHECKING([whether ant is >= $ant_minver])
7873ant_version=`$ANT -version | $AWK '{ print $4; }'`
7874ant_version_major=`echo $ant_version | cut -d. -f1`
7875ant_version_minor=`echo $ant_version | cut -d. -f2`
7876echo "configure: ant_version $ant_version " >&5
7877echo "configure: ant_version_major $ant_version_major " >&5
7878echo "configure: ant_version_minor $ant_version_minor " >&5
7879if test "$ant_version_major" -ge "2"; then
7880   AC_MSG_RESULT([yes, $ant_version])
7881elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7882   AC_MSG_RESULT([yes, $ant_version])
7883else
7884   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7885fi
7886
7887if test "$ENABLE_MEDIAWIKI" = "YES"; then
7888AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7889rm -rf confdir
7890mkdir confdir
7891cat > conftest.java << EOF
7892    public class conftest {
7893        int testmethod(int a, int b) {
7894            return a + b;
7895        }
7896    }
7897EOF
7898
7899cat > conftest.xml << EOF
7900    <project name="conftest" default="conftest">
7901        <target name="conftest" depends="copytest">
7902            <javac srcdir="." includes="conftest.java">
7903            </javac>
7904        </target>
7905        <target name="copytest">
7906             <copy todir="confdir">
7907                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7908                 <filterset/>
7909                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7910             </copy>
7911        </target>
7912    </project>
7913EOF
7914  if test "$JAVACISGCJ" = "yes"; then
7915    JAVA_HOME=; export JAVA_HOME
7916    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7917  else
7918    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7919  fi
7920  AC_TRY_EVAL(ant_cmd)
7921  if test $? = 0 && test -f ./conftest.class ; then
7922    AC_MSG_RESULT([yes])
7923    rm -rf confdir
7924  else
7925    echo "configure: Ant test failed" >&5
7926    cat conftest.java >&5
7927    cat conftest.xml >&5
7928    rm -rf confdir
7929    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7930  fi
7931fi
7932rm -f conftest* core core.* *.core
7933
7934OOO_JUNIT_JAR=
7935JUNIT_NEEDS_HAMCREST=
7936if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7937    AC_MSG_CHECKING([for JUnit])
7938    if test "$with_junit" = "yes"; then
7939        if test -e /usr/share/java/junit4.jar; then
7940           OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7941        else
7942           if test -e /usr/local/share/java/classes/junit4.jar; then
7943              OOO_JUNIT_JAR=/usr/local/share/java/classes/junit4.jar
7944           else
7945              if test -e /usr/share/lib/java/junit.jar; then
7946                 OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7947              else
7948                 if test -e /usr/share/local/lib/java/junit.jar; then
7949                    OOO_JUNIT_JAR=/usr/share/local/lib/java/junit.jar
7950                 else
7951                    if test -e /usr/share/java/junit.jar; then
7952                       OOO_JUNIT_JAR=/usr/share/java/junit.jar
7953                    else
7954                       if test -e /usr/local/share/java/classes/junit.jar; then
7955                          OOO_JUNIT_JAR=/usr/local/share/java/classes/junit.jar
7956                       fi
7957                    fi
7958                 fi
7959              fi
7960           fi
7961        fi
7962    else
7963        OOO_JUNIT_JAR=$with_junit
7964    fi
7965    if test -e "$OOO_JUNIT_JAR"; then
7966        AC_MSG_RESULT([yes])
7967    else
7968        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7969locations (/usr/share/java or /usr/local/share/java/classes), specify its pathname via
7970--with-junit=..., or disable it via --without-junit.])
7971    fi
7972    if test "$_os" = "WINNT"; then
7973        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7974    fi
7975    AC_MSG_CHECKING([whether JUnit is version 4.x])
7976    export OOO_JUNIT_JAR
7977    if $PERL -e 'use Archive::Zip;
7978        my $file = "$ENV{'OOO_JUNIT_JAR'}";
7979        my $zip = Archive::Zip->new( $file );
7980        my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7981        if ( $mf =~ m/Implementation-Version: 4.12*/ ) {
7982            exit 0;
7983        } elsif ( $mf =~ m/Implementation-Version: 4.11*/ ) {
7984            exit 0;
7985        } elsif ( $mf =~ m/Bundle-Version: 4.12*/ ) {
7986            exit 0;
7987        } elsif ( $mf =~ m/Bundle-Version: 4.11*/ ) {
7988            exit 0;
7989        } else {
7990            exit 1;
7991        }'; then
7992        AC_MSG_RESULT([yes, but Hamcrest Core is mandatory with this JUnit version (>= 4.11)])
7993        JUNIT_NEEDS_HAMCREST=yes
7994    elif $PERL -e 'use Archive::Zip;
7995        my $file = "$ENV{'OOO_JUNIT_JAR'}";
7996        my $zip = Archive::Zip->new( $file );
7997        my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7998        if ( $mf =~ m/Implementation-Version: 4.*/ ) {
7999            exit 0;
8000        } elsif ( $mf =~ m/Bundle-Version: 4.*/ ) {
8001        } else {
8002            exit 1;
8003        }'; then
8004        AC_MSG_RESULT([yes])
8005    else
8006        AC_MSG_ERROR([no, your JUnit version is too old, you need JUnit 4.x])
8007    fi
8008fi
8009AC_SUBST(OOO_JUNIT_JAR)
8010
8011HAMCREST_CORE_JAR=
8012if test "$SOLAR_JAVA" != "" && test "$with_hamcrest_core" != "no"; then
8013    AC_MSG_CHECKING([for hamcrest-core])
8014    if test "$with_hamcrest_core" = "yes"; then
8015        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest-core-1.3.jar; then
8016            HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core-1.3.jar
8017        fi
8018        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest-core-1.3.jar; then
8019            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest-core-1.3.jar
8020        fi
8021        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/lib/java/hamcrest-core.jar; then
8022            HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest-core.jar
8023        fi
8024        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/lib/java/hamcrest-core.jar; then
8025            HAMCREST_CORE_JAR=/usr/local/share/lib/java/hamcrest-core.jar
8026        fi
8027        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest-core.jar; then
8028            HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core.jar
8029        fi
8030        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest-core.jar; then
8031            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest-core.jar
8032        fi
8033        # Sometimes the "-core-" part is missing...
8034        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest1.3.jar; then
8035            HAMCREST_CORE_JAR=/usr/share/java/hamcrest1.3.jar
8036        fi
8037        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest1.3.jar; then
8038            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest1.3.jar
8039        fi
8040        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/lib/java/hamcrest.jar; then
8041            HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest.jar
8042        fi
8043        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/lib/java/hamcrest.jar; then
8044            HAMCREST_CORE_JAR=/usr/local/share/lib/java/hamcrest.jar
8045        fi
8046        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest.jar; then
8047            HAMCREST_CORE_JAR=/usr/share/java/hamcrest.jar
8048        fi
8049        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest.jar; then
8050            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest.jar
8051        fi
8052    else
8053        HAMCREST_CORE_JAR=$with_hamcrest_core
8054    fi
8055    if test -e "$HAMCREST_CORE_JAR"; then
8056        AC_MSG_RESULT([yes])
8057        if test "$_os" = "WINNT"; then
8058            HAMCREST_CORE_JAR=`cygpath -m "$HAMCREST_CORE_JAR"`
8059        fi
8060    else
8061        if test "$JUNIT_NEEDS_HAMCREST" = "yes"; then
8062            AC_MSG_ERROR([cannot find hamcrest-core jar; please install one in the
8063default locations (/usr/share/java or /usr/local/share/java/classes), specify its
8064pathname via --with-hamcrest-core=..., or disable
8065it via --without-hamcrest-core or --without-junit])
8066        else
8067            AC_MSG_RESULT([no, skipping])
8068        fi
8069    fi
8070else
8071    if test "$JUNIT_NEEDS_HAMCREST" = "yes"; then
8072        AC_MSG_ERROR([JUnit needs Hamcrest but Hamcrest disabled.])
8073    fi
8074fi
8075AC_SUBST(HAMCREST_CORE_JAR)
8076
8077AC_MSG_CHECKING([which languages to be built])
8078WITH_LANG="$with_lang"
8079if test -z "$WITH_LANG"; then
8080   AC_MSG_RESULT([en-US])
8081else
8082   AC_MSG_RESULT([$WITH_LANG])
8083   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
8084   BUILD_TYPE="$BUILD_TYPE L10N"
8085fi
8086AC_SUBST(WITH_LANG)
8087
8088AC_MSG_CHECKING([which languages have poor help localizations])
8089WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
8090if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
8091   AC_MSG_RESULT([none])
8092else
8093   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
8094fi
8095AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
8096
8097AC_MSG_CHECKING([which dictionaries to include])
8098if test -z "$with_dict"; then
8099   WITH_DICT=,ALL,
8100   AC_MSG_RESULT([ALL])
8101else
8102   WITH_DICT=","$with_dict","
8103   AC_MSG_RESULT([$with_dict])
8104fi
8105AC_SUBST(WITH_DICT)
8106
8107AC_MSG_CHECKING([for additional 'intro' bitmaps])
8108INTRO_BITMAPS=
8109if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
8110   INTRO_BITMAPS=
8111   AC_MSG_RESULT([none])
8112else
8113   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
8114      case "$bitmap" in
8115         *.png) ;;
8116         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .png files!]) ;;
8117      esac
8118      if test -n "$bitmap" ; then
8119         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
8120      fi
8121   done
8122   AC_MSG_RESULT([$INTRO_BITMAPS])
8123fi
8124AC_SUBST(INTRO_BITMAPS)
8125
8126AC_MSG_CHECKING([for additional 'about' bitmaps])
8127ABOUT_BITMAPS=
8128if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
8129   ABOUT_BITMAPS=
8130   AC_MSG_RESULT([none])
8131else
8132   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
8133      case "$bitmap" in
8134         *.png) ;;
8135         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .png files!]) ;;
8136      esac
8137      if test -n "$bitmap" ; then
8138         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
8139      fi
8140   done
8141   AC_MSG_RESULT([$ABOUT_BITMAPS])
8142fi
8143AC_SUBST(ABOUT_BITMAPS)
8144
8145OOO_VENDOR=
8146AC_MSG_CHECKING([for vendor])
8147if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
8148   AC_MSG_RESULT([not set])
8149else
8150   OOO_VENDOR="$with_vendor"
8151   AC_MSG_RESULT([$OOO_VENDOR])
8152fi
8153AC_SUBST(OOO_VENDOR)
8154
8155UNIXWRAPPERNAME=
8156AC_MSG_CHECKING([for UNIX wrapper name])
8157if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no" -o "$with_unix_wrapper" = "yes" ; then
8158   AC_MSG_RESULT([not set])
8159else
8160   UNIXWRAPPERNAME="$with_unix_wrapper"
8161   AC_MSG_RESULT([$UNIXWRAPPERNAME])
8162fi
8163AC_SUBST(UNIXWRAPPERNAME)
8164
8165AC_MSG_CHECKING([whether to statically link to Gtk])
8166if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
8167   ENABLE_STATIC_GTK="TRUE"
8168   AC_MSG_RESULT([yes])
8169else
8170   ENABLE_STATIC_GTK="FALSE"
8171   AC_MSG_RESULT([no])
8172fi
8173AC_SUBST(ENABLE_STATIC_GTK)
8174
8175AC_MSG_CHECKING([whether to use layout dialogs])
8176if test -n "$enable_layout" && test "$enable_layout" != "no"; then
8177   ENABLE_LAYOUT="TRUE"
8178   AC_MSG_RESULT([yes])
8179else
8180   ENABLE_LAYOUT="FALSE"
8181   AC_MSG_RESULT([no])
8182fi
8183AC_SUBST(ENABLE_LAYOUT)
8184
8185# ===================================================================
8186# De- or increase default verbosity of build process
8187# ===================================================================
8188AC_MSG_CHECKING([build verbosity])
8189if test -n "$enable_verbose"; then
8190   if test "$enable_verbose" = "yes"; then
8191      VERBOSE="TRUE"
8192      AC_MSG_RESULT([high])
8193   fi
8194   if test "$enable_verbose" = "no"; then
8195      VERBOSE="FALSE"
8196      AC_MSG_RESULT([low])
8197   fi
8198else
8199   AC_MSG_RESULT([not set])
8200fi
8201AC_SUBST(VERBOSE)
8202
8203dnl ===================================================================
8204dnl Hook up AOOs nodep environmental variable to automake's equivalent
8205dnl --enable-dependency-tracking configure option
8206dnl ===================================================================
8207AC_MSG_CHECKING([whether to enable dependency tracking])
8208if test "$enable_dependency_tracking" = "no"; then
8209    nodep=TRUE
8210    AC_MSG_RESULT([no])
8211else
8212    AC_MSG_RESULT([yes])
8213fi
8214AC_SUBST(nodep)
8215
8216dnl ===================================================================
8217dnl Setting up the environment.
8218dnl ===================================================================
8219echo "********************************************************************"
8220echo "*                                                                  *"
8221echo "*   Setting up the build environment variables.                    *"
8222echo "*                                                                  *"
8223echo "********************************************************************"
8224
8225if test -z "$COMPATH"; then
8226   AC_MSG_ERROR([No compiler found.])
8227fi
8228AC_SUBST(COMPATH)
8229AC_SUBST(CC_PATH)
8230
8231AC_MSG_CHECKING([solver path])
8232if test -z "$with_local_solver"; then
8233   LOCAL_SOLVER="DEFAULT"
8234   AC_MSG_RESULT([default])
8235else
8236   LOCAL_SOLVER=$with_local_solver
8237   AC_MSG_RESULT([$with_local_solver])
8238fi
8239AC_SUBST(LOCAL_SOLVER)
8240
8241AC_SUBST(BUILD_TYPE)
8242AC_SUBST(ADDITIONAL_REPOSITORIES)
8243
8244# make sure config.guess is +x; we execute config.guess, so it has to be so;
8245chmod +x ./config.guess
8246
8247# Create files from their *.in templates.
8248AC_CONFIG_FILES([set_soenv Makefile])
8249
8250AC_MSG_NOTICE([writing config.status])
8251AC_OUTPUT
8252
8253dnl Executing the set_soenv script to setup the environment variables.
8254chmod a+x set_soenv
8255if test -z "$enable_check_only"; then
8256   './set_soenv'
8257else
8258   echo
8259   echo Test Complete
8260   echo No environment file will be generated
8261   echo
8262   num_warnings=`wc -l warn`
8263   _num=`echo $num_warnings | $AWK '{ print $1 }'`
8264   if test $_num -gt 0; then
8265      echo The following warning\(s\) were generated by configure
8266      echo ----------------------------------------------------
8267      echo
8268      cat warn
8269      echo
8270   else
8271      echo There were no warnings
8272   fi
8273   echo
8274fi
8275
8276