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