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