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