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