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