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