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