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