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