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