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