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