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