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